INNER CODE UNIT · Python

temp

rlcode/reinforcement-learning · 1-grid-world/1-policy_iteration.py:56

                temp = reward + self.discount_factor * next_value

                # We normally can't pick multiple actions in greedy policy.
                # but here we allow multiple actions with same max values
                if temp == value:
                    max_index.append(index)
                elif temp > value:
                    value = temp
                    max_index.clear()
                    max_index.append(index)

            # probability of action
            prob = 1 / len(max_index)

            for index in max_index:
                result[index] = prob

            next_policy[state[0]][state[1]] = result

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…