INNER CODE UNIT · Python

get_value

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

    def get_value(self, state):
        return round(self.value_table[state[0]][state[1]], 2)

if __name__ == "__main__":
    env = Env()
    value_iteration = ValueIteration(env)
    display = GraphicDisplay(value_iteration, title="Value Iteration")

    def on_calculate():
        value_iteration.value_iteration()
        display.show_values(value_iteration.value_table)

    def on_print_policy():
        # Build a policy arrow table from the greedy actions implied by V.
        policy = [[[0.0] * 4 for _ in range(env.width)] for _ in range(env.height)]
        for state in env.get_all_states():
            x, y = state
            actions = value_iteration.get_action(state)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…