def optQ(self, discount): try: Q = np.load("optQ/grid10_"+str(int(discount*100))+"_"+str(int(self.slip*10))+".npy") except: print("No Stored Data for optQ") _,Q,_ = pi.policy_iter(self, discount, 0.001) np.save("optQ/grid10_"+str(int(discount*100))+"_"+str(int(self.slip*10))+".npy", Q) return Q
def optQ(self,discount): fname ="optQ/"+self.name+"_"+str(int(discount*100))+"_"+str(int(self.slip*10))+".npy" try: Q = np.load(fname) except: print("No Stored Data for optQ") _,Q,_ = pi.policy_iter(self, discount, 0.001) np.save(fname, Q) return Q
def optQ(self, discount, changed=False): fname = "optQ/movingmaze_changed_" if changed else "optQ/movingmaze_" try: Q = np.load(fname+str(int(discount*100))+"_"+str(int(self.slip*10))+".npy") except: print("No Stored Data for optQ") _,Q,_ = pi.policy_iter(self, discount, 0.001) np.save(fname+str(int(discount*100))+"_"+str(int(self.slip*10))+".npy", Q) return Q
def optQ(self, discount): import os dirname = os.path.join(os.path.dirname(os.path.abspath(__file__)), "optQ") fname = self.name+"_"+str(int(discount*100))+"_"+str(int(self.slip*10))+".npy" if os.path.exists(os.path.join(dirname, fname)): Q = np.load(os.path.join(dirname, fname)) else: if not(os.path.exists(dirname)): os.mkdir(dirname) print("No Stored Data for optQ") _, Q, _ = pi.policy_iter(self, discount, 0.001) np.save(os.path.join(dirname, fname), Q) return Q
def optQ(self, discount): _,Q,_ = pi.policy_iter(self, discount, 0.001) return Q