From e477cb2e4c0b5e70299bd50a2e505d97a25d4aec Mon Sep 17 00:00:00 2001 From: zhm-real Date: Fri, 19 Jun 2020 17:37:53 -0700 Subject: [PATCH] update --- Model-free Control/Q-learning.py | 8 ++++---- Model-free Control/Sarsa.py | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Model-free Control/Q-learning.py b/Model-free Control/Q-learning.py index acb3b78..98a7dcc 100644 --- a/Model-free Control/Q-learning.py +++ b/Model-free Control/Q-learning.py @@ -132,21 +132,21 @@ class QLEARNING: :return: simulation path """ - plt.figure(1) # path animation - tools.show_map(xI, xG, self.obs, self.lose, self.name1) # show background + plt.figure(1) # path animation + tools.show_map(xI, xG, self.obs, self.lose, self.name1) # show background x, path = xI, [] while True: u = self.u_set[policy[x]] x_next = (x[0] + u[0], x[1] + u[1]) if x_next in self.obs: - print("Collision!") # collision: simulation failed + print("Collision!") # collision: simulation failed else: x = x_next if x_next == xG: break else: - tools.plot_dots(x) # each state in optimal path + tools.plot_dots(x) # each state in optimal path path.append(x) plt.show() self.message() diff --git a/Model-free Control/Sarsa.py b/Model-free Control/Sarsa.py index e8d3308..57f1f4c 100644 --- a/Model-free Control/Sarsa.py +++ b/Model-free Control/Sarsa.py @@ -132,21 +132,21 @@ class SARSA: :return: simulation path """ - plt.figure(1) # path animation - tools.show_map(xI, xG, self.obs, self.lose, self.name1) # show background + plt.figure(1) # path animation + tools.show_map(xI, xG, self.obs, self.lose, self.name1) # show background x, path = xI, [] while True: u = self.u_set[policy[x]] x_next = (x[0] + u[0], x[1] + u[1]) if x_next in self.obs: - print("Collision!") # collision: simulation failed + print("Collision!") # collision: simulation failed else: x = x_next if x_next == xG: break else: - tools.plot_dots(x) # each state in optimal path + tools.plot_dots(x) # each state in optimal path path.append(x) plt.show() self.message()