Week 02 · Markov decision processes

Specify a state that makes transitions predictable from the present.

← Week 1 · Subject contents · Week 3 →

Specify a state that makes transitions predictable from the present.

Work through the problem

An MDP specifies a state s, action a, and a distribution over reward and next state given (s,a). The Markov assumption requires this distribution to stay the same across histories with the same current state and action.

Consider a grid with start (0,0), goal (1,0), and a key. Moving east from the start reaches the goal only when the key was collected. Two visits to (0,0) can therefore have different east transitions. Include a Boolean key flag in the state. An observation that hides it makes this problem partially observable.

Run the Python lab

def east(state):
    row, col, key = state
    if (row,col)==(0,0) and key:
        return (1,0,key), 1, True
    return state, -1, False
for key in [False,True]:
    print((0,0,key),"east ->",east((0,0,key)))
assert east((0,0,False))[0] != east((0,0,True))[0]

Output from the lab

(0, 0, False) east -> ((0, 0, False), -1, False)
(0, 0, True) east -> ((1, 0, True), 1, True)

Practice

  1. Should elapsed time be in the state if rewards change when a deadline approaches?

Check your reasoning

  1. Include remaining time when it affects transitions or rewards. It can turn a finite-horizon problem into a Markov state description.

← Week 1 · Subject contents · Week 3 →

Further reading · Sutton and Barto · Reinforcement Learning