def __init__(self): Models.__init__(self) self.name = 'maze' self.episodic = True self.stochastic = True self.snum = 264 self.anum = 4 self.timeH = util.T_maze self.slip = 0.0 self.dim = (6,7) self.start_pos = (0,0) self.goal_pos = (0,6) self.goal = (232,240) redundants = [32, 33, 35, 37, 64, 66, 67, 70, 232, 233, 234, 235, 236, 237, 238, 239, 256, 257, 258, 260] self.eff_states = [i for i in range(self.snum) if not(i in redundants)] self.phi = (lambda x,y: util.discrete_phi(x, y, self.snum*self.anum, self.anum), self.snum*self.anum) self.map = np.asarray(["SWFOWOG","OWOOWOO","OOOOOOO","WWOOOWW","OOOOOOF","FOOOOOW"],dtype='c') self.img_map = np.ones(self.dim) for x in Maze.obstacles: self.img_map[x[0]][x[1]] = 0 self.idx2cell = {0: (0, 0), 1: (1, 0), 2: (2, 0), 3: (4, 0), 4: (5, 0), 5: (2, 1), 6: (4, 1), 7: (5, 1), 8: (0, 2), 9: (1, 2), 10: (2, 2), 11: (3, 2), 12: (4, 2), 13: (5, 2), 14: (0, 3), 15: (1, 3), 16: (2, 3), 17: (3, 3), 18: (4, 3), 19: (5, 3), 20: (2, 4), 21: (3, 4), 22: (4, 4), 23: (5, 4), 24: (0, 5), 25: (1, 5), 26: (2, 5), 27: (4, 5), 28: (5, 5), 29: (0, 6), 30: (1, 6), 31: (2, 6), 32: (4, 6)} self.cell2idx = {(1, 3): 15, (5, 4): 23, (2, 1): 5, (2, 6): 31, (1, 6): 30, (5, 1): 7, (0, 3): 14, (2, 5): 26, (4, 0): 3, (1, 2): 9, (3, 3): 17, (0, 6): 29, (4, 4): 22, (1, 5): 25, (5, 0): 4, (2, 2): 10, (4, 1): 6, (3, 2): 11, (0, 0): 0, (4, 5): 27, (5, 5): 28, (2, 3): 16, (4, 2): 12, (1, 0): 1, (5, 3): 19, (4, 6): 32, (3, 4): 21, (0, 2): 8, (2, 0): 2, (4, 3): 18, (0, 5): 24, (5, 2): 13, (2, 4): 20}
def __init__(self): Models.__init__(self) self.name = 'minimaze' self.episodic = True self.stochastic = True self.snum = 112 self.anum = 4 self.timeH = util.T_minimaze self.slip = 0.1 self.dim = (4,5) self.start_pos = (0,0) self.goal_pos = (0,4) self.goal = (96,104) self.optLength = 18 redundants = [16, 17, 19, 21, 48, 50, 51, 54, 88, 89, 90, 92, 96, 97, 98, 99, 100, 101, 102, 103] self.eff_states = [i for i in range(self.snum) if not(i in redundants)] self.phi = (lambda x,y: util.discrete_phi(x, y, self.snum*self.anum, self.anum), self.snum*self.anum) self.map = np.asarray(["SWFWG","OOOOO","WOOOW","FOWFW"],dtype='c') self.img_map = np.ones(self.dim) for x in MiniMaze.obstacles: self.img_map[x[0]][x[1]] = 0 self.idx2cell = {0: (0, 0), 1: (1, 0), 2: (3, 0), 3: (1, 1), 4: (2, 1), 5: (3, 1), 6: (0, 2), 7: (1, 2), 8: (2, 2), 9: (1, 3), 10: (2, 3), 11: (3, 3), 12: (0, 4), 13: (1, 4)} self.cell2idx = {(1, 2): 7, (0, 0): 0, (3, 3): 11, (3, 0): 2, (3, 1): 5, (2, 1): 4, (0, 2): 6, (1, 3): 9, (2, 3): 10, (1, 4): 13, (2, 2): 8, (0, 4): 12, (1, 0): 1, (1, 1): 3}
def __init__(self): Models.__init__(self) self.name = 'loop' self.episodic = False self.snum = 9 self.anum = 2 self.timeH = util.T_loop self.slip = 0.0 self.stochastic = False self.goal = (9,9) # This is not a goal. default. self.eff_states = [i for i in range(self.snum) if not(i in [])] self.phi = (lambda x,y: util.discrete_phi(x, y, self.snum*self.anum, self.anum), self.snum*self.anum)
def __init__(self, length=5): Models.__init__(self) self.name = 'chain' self.episodic = False self.snum = length self.anum = 2 self.timeH = util.T_chain self.slip = 0.1 self.stochastic = True self.map = np.asarray(["01234"],dtype='c') self.goal = (5,5) # This is not a goal. default. self.eff_states = [i for i in range(self.snum) if not(i in [])] self.phi = (lambda x,y: util.discrete_phi(x, y, self.snum*self.anum, self.anum), self.snum*self.anum) self.optLength = length*2
def __init__(self): Models.__init__(self) self.name = 'grid10' self.episodic = True self.stochastic = True self.snum = 100 self.anum = 4 self.timeH = util.T_grid10 self.slip = 0.1 self.dim = (10,10) self.start_pos = (0,0) self.goal_pos = (9,9) self.goal = (99,100) self.eff_states = range(self.snum-1) self.map = np.asarray(["SOOOOOOOOO","OOOOOOOOOO","OOOOOOOOOO","OOOOOOOOOO","OOOOOOOOOO","OOOOOOOOOO","OOOOOOOOOO","OOOOOOOOOO","OOOOOOOOOO","OOOOOOOOOG"],dtype='c') self.phi = (lambda x,y: util.discrete_phi(x, y, self.snum*self.anum, self.anum), self.snum*self.anum)
def __init__(self, choices=10): self.name = 'simple' self.snum = 2+choices self.anum = choices self.timeH = 100 self.slip_r = 0.25 self.slip = 0.0 self.stochastic = False self.stochastic_reward = True self.map = None self.eff_states = [0,1] self.goal = (5,5) # Not used self.terminal_states = [2+i for i in range(choices)] self.reward_pair = [(10.0, 0.0), (-5.0, 5.0), (4.0, 4.0), (15.0, -6.0), (5.0, 2.0), (-3.0, 5.0), (-8.0, 8.5)] self.reward_pair.extend([(10.0, 0.0)]*10) self.phi = (lambda x,y: util.discrete_phi(x, y, self.snum*self.anum, self.anum), self.snum*self.anum)
def __init__(self, optQ_given=None): Models.__init__(self) self.name = 'grid5' self.episodic = True self.stochastic = True self.snum = 25 self.anum = 4 self.timeH = util.T_grid5 self.slip = 0.1 self.dim = (5,5) self.start_pos = (0,0) self.goal_pos = (4,4) self.goal = (24,25) self.eff_states = range(self.snum-1) self.optQ_given = optQ_given self.map = np.asarray(["SOOOO","OOOOO","OOOOO","OOOOO","OOOOG"],dtype='c') self.img_map = np.ones((5,5)) self.phi = (lambda x,y: util.discrete_phi(x, y, self.snum*self.anum, self.anum), self.snum*self.anum)
def __init__(self): Models.__init__(self) self.name = 'movingmaze' self.episodic = True self.stochastic = False self.snum = 9 self.anum = 4 self.timeH = util.T_movingmaze self.slip = 0.0 self.dim = (3,3) self.start_pos = (0,0) self.goal_pos = (2,2) self.goal = (8,9) self.optLength = 4 self.phi = (lambda x,y: util.discrete_phi(x, y, self.snum*self.anum, self.anum), self.snum*self.anum) self.map = np.asarray(["SOO","WWO","OOG"],dtype='c') self.obstacles = [(1,0),(1,1)] self.eff_states = [0,1,2,5,6,7] self.changePt = 150