File tree Expand file tree Collapse file tree 1 file changed +1
-5
lines changed
Expand file tree Collapse file tree 1 file changed +1
-5
lines changed Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments