INNER CODE UNIT · Python

prob

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

            prob = 1 / len(max_index)

            for index in max_index:
                result[index] = prob

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

        self.policy_table = next_policy

    # get action according to the current policy
    def get_action(self, state):
        random_pick = random.randrange(100) / 100

        policy = self.get_policy(state)
        policy_sum = 0.0
        # return the action in the index
        for index, value in enumerate(policy):
            policy_sum += value

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…