To put it in simple terms, in value iteration, we first initialize some random value to the value function. There is a great probability that the random value we initialize is not going to be optimal. So, we iterate over each state and find the new value function; we stop the iteration until we find the optimal value function. Once we find the optimal value function, we can easily extract the optimal policy from that.
Now we will see how to solve the frozen lake problem using value iteration.
First, we import necessary libraries:
import gymimport numpy as np
Then we make our frozen lake environment using OpenAI's Gym:
env = gym.make('FrozenLake-v0')
We will first explore the environments.
The number of states in the environment ...