From 9e3585ba3617d2af399e6a18bfd45b046f7c5e1e Mon Sep 17 00:00:00 2001 From: Alexander Schmidt Date: Tue, 3 Nov 2020 08:38:00 +0100 Subject: [PATCH] fixed final q --- src/qtable.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/qtable.py b/src/qtable.py index 0804187..5bb1c51 100755 --- a/src/qtable.py +++ b/src/qtable.py @@ -6,7 +6,7 @@ import sys from game import Game -learning_rate = 0.1 +learning_rate = 1.0 discount_factor = 1.0 states_dim = 36864 # 2^10 * 6^2 @@ -34,7 +34,6 @@ def select_option(opts, qs): opt_qid = find_option_qid(opt) opt_qid_pairs.append( [opt, opt_qid] ) opt_qsum += qs[opt_qid] - #random.shuffle(opt_qid_pairs) ran_pt = random.uniform(0.0, opt_qsum) decision_pt = 0.0 for opt_qid_pair in opt_qid_pairs: @@ -64,7 +63,7 @@ for i in range(num_episodes): + discount_factor * np.max(Q[new_state_qid, :]) - Q[state_qid, opt_qid]) state_qid = new_state_qid - Q[state_qid, opt_qid] = 0 + Q[state_qid, :] = 0 running_score[0] *= 0.99999999 running_score[0] += g.get_score() running_score[1] *= 0.99999999 -- 2.39.5