zuoxingdong / mazelab Goto Github PK
View Code? Open in Web Editor NEWA customizable framework to create maze and gridworld environments
A customizable framework to create maze and gridworld environments
Hi,
May I check if it is possible to create an environment supporting multi-agent exploration? Thank you!
Following the jupyter notebook, I'm getting the above error when running the line:
from mazelab import BaseMaze
TypeError Traceback (most recent call last)
in
1 import numpy as np
----> 2 from mazelab import BaseMaze
3 from mazelab import Object
4 from mazelab import DeepMindColor as color
5
~/anaconda3/envs/slime/mazelab/mazelab/init.py in
3 from .object import Object
4
----> 5 from .motion import VonNeumannMotion
6 from .motion import MooreMotion
7
~/anaconda3/envs/slime/mazelab/mazelab/motion.py in
4 VonNeumannMotion = namedtuple('VonNeumannMotion',
5 ['north', 'south', 'west', 'east'],
----> 6 defaults=[[-1, 0], [1, 0], [0, -1], [0, 1]])
7
8
TypeError: namedtuple() got an unexpected keyword argument 'defaults'
It seems that negative or out of edge position will result index error in _is_valid() method, because of the passable check.
I think it should be changed to
def _is_valid(self, position):
nonnegative = position[0] >= 0 and position[1] >= 0
within_edge = position[0] < self.maze.size[0] and position[1] < self.maze.size[1]
if (nonnegative and within_edge):
passable = not self.maze.to_impassable()[position[0]][position[1]]
else:
passable = False
return nonnegative and within_edge and passable
IndexError Traceback (most recent call last)
in
35 action = agent.act(state, epsilon)
36
---> 37 _, reward, done, _ = env.step(action)
38 next_state = env.unwrapped.maze.objects.agent.positions[0]
39
//anaconda3/lib/python3.7/site-packages/gym/wrappers/time_limit.py in step(self, action)
14 def step(self, action):
15 assert self._elapsed_steps is not None, "Cannot call env.step() before calling reset()"
---> 16 observation, reward, done, info = self.env.step(action)
17 self._elapsed_steps += 1
18 if self._elapsed_steps >= self._max_episode_steps:
in step(self, action)
21 current_position = self.maze.objects.agent.positions[0]
22 new_position = [current_position[0] + motion[0], current_position[1] + motion[1]]
---> 23 valid = self._is_valid(new_position)
24 if valid:
25 self.maze.objects.agent.positions = [new_position]
in _is_valid(self, position)
44 nonnegative = position[0] >= 0 and position[1] >= 0
45 within_edge = position[0] < self.maze.size[0] and position[1] < self.maze.size[1]
---> 46 passable = not self.maze.to_impassable()[position[0]][position[1]]
47 return nonnegative and within_edge and passable
48
IndexError: index 6 is out of bounds for axis 0 with size 6
when running
from gym_maze.envs import MazeEnv
from gym_maze.envs.generators import *
maze = RandomBlockMazeGenerator(maze_size=4, obstacle_ratio=0.0)
env = MazeEnv(maze)
env.reset()
I get the following error:
Traceback (most recent call last):
WARN: gym.spaces.Box autodetected dtype as <class 'numpy.float32'>. Please provide explicit dtype. File "C:/Users/Yitzhak/Projects/gym-maze/example_1.py", line 5, in <module>
env.reset()
File "C:\Users\Yitzhak\Anaconda3\lib\site-packages\gym\core.py", line 71, in reset
raise NotImplementedError
NotImplementedError
Support metadata: reward_range
, spec
etc
Thanks for releasing this project. Could you add License?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.