Skip to content

Commit 39d121a

Browse files
committed
cls
1 parent a7b5349 commit 39d121a

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

machine_learning/q_learning.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,17 +104,13 @@ def update(
104104
global LEARNING_RATE, DISCOUNT_FACTOR
105105
alpha = alpha if alpha is not None else LEARNING_RATE
106106
gamma = gamma if gamma is not None else DISCOUNT_FACTOR
107-
max_q_next = 0.0 if done or not next_available_actions else max(
108-
get_q_value(next_state, a) for a in next_available_actions
109107
max_q_next = (
110108
0.0
111109
if done or not next_available_actions
112110
else max(get_q_value(next_state, a) for a in next_available_actions)
113111
)
114112
old_q = get_q_value(state, action)
115-
new_q = (1 - alpha) * old_q + alpha * (
116-
reward + gamma * max_q_next
117-
)
113+
new_q = (1 - alpha) * old_q + alpha * (reward + gamma * max_q_next)
118114
q_table[state][action] = new_q
119115

120116

0 commit comments

Comments
 (0)