QLearning and never-ending episodes
- by devoured elysium
Let's imagine we have an (x,y) plane where a robot can move. Now we define the middle of our world as the goal state, which means that we are going to give a reward of 100 to our robot once it reaches that state.
Now, let's say that there are 4 states(which I will call A,B,C,D) that can lead to the goal state.
The first time we are in A and go to the goal state, we will update our QValues table as following:
Q(state = A, action = going to goal state) = 100 + 0
One of 2 things can happen. I can end the episode here, and start a different one where the robot has to find again the goal state, or I can continue exploring the world even after I found the goal state. If I try to do this, I see a problem though. If I am in the goal state and go back to state A, it's Qvalue will be the following:
Q(state = goalState, action = going to A) = 0 + gamma * 100
Now, if I try to go again to the goal state from A:
Q(state = A, action = going to goal state) = 100 + gamma * (gamma * 100)
Which means that if I keep doing this, as 0 <= gamma <= 0, both qValues are going to rise forever.
Is this the expected behavior of QLearning? Am I doing something wrong? If this is the expected behavior, can't this lead to problems? I know that probabilistically, all the 4 states(A,B,C and D), will grow at the same rate, but even so it kinda bugs me having them growing forever.
The ideia of allowing the agent to continue exploring even after finding the goal has to do with that the nearer he is from the goal state, the more likely it is to being in states that can be updated at the moment.