fix(q_learning): incorrect calculation of target value

This commit is contained in:
leonhard committed 2026-01-11 23:20:37 +01:00
1 parent a61fac18ed
commit 05b10a5e71
1 file changed
+5 -5
+5 -5
View File
@@ -137,16 +137,16 @@ impl<E: Environment> Policy<E> for GreedyPolicy<E> {
finished: bool,
) {
let former_value = *self.qtable.get(&(state, action)).unwrap_or(&0f32);
let target = match finished {
true => {
reward
+ self.gamma
let target = reward
+ match finished {
false => {
self.gamma
* self
.qtable
.get(&(next_state.into(), self.choose_action(next_state.into())))
.unwrap_or(&0f32)
}
false => 0f32,
true => 0f32,
};
self.qtable.insert(
(state, action),