Implementing Bellman equations

We're starting with a simplified Bellman equation for the first part of our code:

Note that we are only including gamma in this equation at the moment. We'll include alpha and epsilon in later iterations. Let's assume we're choosing a value of 0.1 for gamma.

This is what that equation looks like in Python:

Q[state,action] = reward + gamma * np.max(Q[next_state])

If you're a Python programmer, but not a mathematician, this version is probably much less intimidating than the math version, but it works exactly the same way. Let's go through each part of this equation.

This is an assignment where we are setting ...

Get Hands-On Q-Learning with Python now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.