def openMDPGUI(self): global w, g if self.checkSettingValues(): self.master.destroy() df = float(self.discFactor.get()) rews = list(map(lambda x: float(x.get()), self.rewValue)) probs = list(map(lambda x: float(x.get()), self.probValue)) w = GridWorld([[ GridWorld.CELL_VOID, GridWorld.CELL_VOID, GridWorld.CELL_VOID, GridWorld.CELL_EXIT ], [ GridWorld.CELL_VOID, GridWorld.CELL_WALL, GridWorld.CELL_VOID, GridWorld.CELL_PIT ], [ GridWorld.CELL_VOID, GridWorld.CELL_VOID, GridWorld.CELL_VOID, GridWorld.CELL_VOID ]]) w.setDiscountFactor(df) w.setRewards(rews[0], rews[1], rews[2]) w.setProbabilities(probs[0], probs[1], probs[2], probs[3]) g = MDPGUI(w)
def openMDPGUI(self): global w, g if self.checkSettingValues(): self.master.destroy() df = float(self.discFactor.get()) rews = list(map(lambda x: float(x.get()), self.rewValue)) probs = list(map(lambda x: float(x.get()), self.probValue)) w = GridWorld( [ [GridWorld.CELL_VOID, GridWorld.CELL_VOID, GridWorld.CELL_VOID, GridWorld.CELL_EXIT], [GridWorld.CELL_VOID, GridWorld.CELL_WALL, GridWorld.CELL_VOID, GridWorld.CELL_PIT], [GridWorld.CELL_VOID, GridWorld.CELL_VOID, GridWorld.CELL_VOID, GridWorld.CELL_VOID], ] ) w.setDiscountFactor(df) w.setRewards(rews[0], rews[1], rews[2]) w.setProbabilities(probs[0], probs[1], probs[2], probs[3]) g = MDPGUI(w)
exit() if len(sys.argv) == 1: showhelp() if sys.argv[1] == "gridworld": w = GridWorld([[GridWorld.CELL_VOID, GridWorld.CELL_VOID, GridWorld.CELL_VOID, GridWorld.CELL_EXIT], [GridWorld.CELL_VOID, GridWorld.CELL_WALL, GridWorld.CELL_VOID, GridWorld.CELL_PIT], [GridWorld.CELL_VOID, GridWorld.CELL_VOID, GridWorld.CELL_VOID, GridWorld.CELL_VOID]], discountFactor = 1 ) if len(sys.argv) < 3: mdpc = MDPChooser() elif sys.argv[2] == "1": w.setRewards(-0.04, -1, 1) w.setProbabilities(0.8, 0.1, 0.1, 0) w.setDiscountFactor(1) g = MDPGUI(w) elif sys.argv[2] == "2": w.setRewards(-0.04, -1, 1) w.setProbabilities(0.8, 0.1, 0.1, 0) w.setDiscountFactor(0.9) g = MDPGUI(w) elif sys.argv[2] == "3": w.setRewards(-0.01, -1, 1) w.setProbabilities(0.8, 0.1, 0.1, 0) w.setDiscountFactor(1) g = MDPGUI(w) elif sys.argv[2] == "4": w.setRewards(-2, -1, 1) w.setProbabilities(0.8, 0.1, 0.1, 0) w.setDiscountFactor(0.6)
if len(sys.argv) == 1: showhelp() if sys.argv[1] == "gridworld": w = GridWorld([[GridWorld.CELL_VOID, GridWorld.CELL_VOID, GridWorld.CELL_VOID, GridWorld.CELL_EXIT], [GridWorld.CELL_VOID, GridWorld.CELL_WALL, GridWorld.CELL_VOID, GridWorld.CELL_PIT], [GridWorld.CELL_VOID, GridWorld.CELL_VOID, GridWorld.CELL_VOID, GridWorld.CELL_VOID]], discountFactor=1) if len(sys.argv) < 3: mdpc = MDPChooser() elif sys.argv[2] == "1": w.setRewards(-0.04, -1, 1) w.setProbabilities(0.8, 0.1, 0.1, 0) w.setDiscountFactor(1) g = MDPGUI(w) elif sys.argv[2] == "2": w.setRewards(-0.04, -1, 1) w.setProbabilities(0.8, 0.1, 0.1, 0) w.setDiscountFactor(0.9) g = MDPGUI(w) elif sys.argv[2] == "3": w.setRewards(-0.01, -1, 1) w.setProbabilities(0.8, 0.1, 0.1, 0) w.setDiscountFactor(1) g = MDPGUI(w) elif sys.argv[2] == "4": w.setRewards(-2, -1, 1) w.setProbabilities(0.8, 0.1, 0.1, 0) w.setDiscountFactor(0.6)