def __init__(self, maze_size, maze_kind, goal_fixed, maze_fixed, goal_reward, wall_reward, **kwargs): super().__init__() self.size = maze_size self.kind = maze_kind self.maze_fixed = maze_fixed self.goal_fixed = goal_fixed self.goal_reward = goal_reward self.wall_reward = wall_reward if self.maze_fixed and self.kind == "maze": file = pkg_resources.resource_filename( "rl_trickery", "envs/mazes/raw_maze_{}.npy".format(int(self.size))) array = np.load(file) self.maze = Maze("empty", 8).from_numpy(array) else: self.maze = Maze(self.kind, self.size) if self.goal_fixed: self.maze.default_goal() self.motions = VonNeumannMotion() self.observation_space = Box(low=0, high=255, shape=list(self.maze.size) + [3], dtype=np.uint8) self.action_space = Discrete(len(self.motions))
def __init__(self): super().__init__() # # Run by run env variables self.robber_start_idx = [[3, 3]] self.maze = SoloMaze() self.motions = VonNeumannMotion() self.observation_space = Box(low=0, high=len(self.maze.objects), shape=self.maze.size, dtype=np.uint8) self.action_space = Discrete(len(self.motions)) # Players lists for grouping self.players = [self.maze.objects.robber] self.robber_list = [self.maze.objects.robber]
def __init__(self): super(EightRooms, self).__init__() self.maze = Maze() self.motions = VonNeumannMotion() self.start_idx = [] for i in range(ROOMS - 7): self.start_idx.append([[3, 3, i]]) self.goal_idx = [[WIDTH - 2, WIDTH - 2, ROOMS - 1]] self.width = WIDTH self.rooms = ROOMS self.observation_space = Box(low=0, high=np.max([WIDTH, ROOMS]), shape=np.array(self.start_idx[0]).shape, dtype=np.uint8) self.action_space = Discrete(len(self.motions)) self.steps = 0
def __init__(self, maze): """ https://github.com/zuoxingdong/mazelab https://github.com/zuoxingdong/mazelab/blob/master/examples/navigation_env.ipynb """ super().__init__() self.reward = None self.stepcost = None self.maze = maze self.motions = VonNeumannMotion() self.actions = [(0, 1), (1, 0), (0, -1), (-1, 0)] # NORTH, EAST, SOUTH, WEST self.observation_space = Box(low=0, high=len(self.maze.objects), shape=self.maze.size, dtype=np.uint8) self.action_space = Discrete(len(self.motions)) # viz properties self.env_lw = 2
def __init__(self, agent_num): super().__init__() self.agent_num = agent_num self.maze = MAMaze(self.agent_num) self.gt_global_map = self.maze.to_value() self.motions = VonNeumannMotion() self.observation_space = Box(low=0, high=len(self.maze.objects), shape=self.maze.size, dtype=np.uint8) self.action_space = Discrete(len(self.motions)) self.global_map_size = 60 self.local_map_size = 11 self.global_map = np.full((self.global_map_size, self.global_map_size), -1) self.step_n = 5 self.episode_length = 5