Markov Decision Processes
A Markov Decision Process (MDP) is a probabilistic model for sequential decision-making under uncertainty that satisfies the discrete-time Markov property. It consists of:
- A set of states S and actions A, similar to classical search problems.
- A start state, and possibly terminal states where no further actions are possible.
- A transition function , which specifies the probability of reaching state from state when action is taken.
- A reward function , assigning positive or negative values to transitions, typically giving small step rewards and large terminal rewards.
- An optional discount factor , which scales weights future rewards down geometrically by a factor .
The objective in an MDP is to find an optimal policy , a mapping from states to actions that maximizes the total expected discounted reward over time. Unlike deterministic planning, where we seek a fixed action sequence, solving an MDP means computing this optimal policy so the agent can act optimally from any state, not just the start
Two key quantities define optimality in MDPs:
- : the optimal state value, i.e. the expected utility of starting in state and following the optimal policy thereafter.
- : the optimal Q-value, i.e. the expected utility of starting in , taking action , and then acting optimally.
These satisfy the Bellman optimality equations:
The Bellman equations express optimal values recursively: the value of a state equals the maximum expected discounted return over all actions. Intuitively, this is equivalent to running expectimax, where Q-states act like chance nodes and state values act like maximizer nodes.Several dynamic programming algorithms solve the Bellman equations:
- Value iteration iteratively applies Bellman updates until the values converge to the true optimal . It begins with (or any arbitrary value) and applies the Bellman backup to all states at each iteration:
This process is a contraction mapping with factor , guaranteeing convergence to . This means each iteration brings the values closer to the fixed point , and the difference shrinks geometrically. Once is found, an optimal policy is obtained via policy extraction:
⠀- Instead of updating values directly toward optimality, policy iteration alternates between two processes:
- Policy evaluation measures how good a policy is by computing using the Bellman equations for policy evaluation, which yield the linear equation
Alternatively, the process can be executed akin to value iteration for each by setting (or any arbitrary value) and iterating the Bellman equations until convergence:
- Once the current policy has been evaluated, policy improvement picks actions that look better than the current policy using a one-step greedy lookahead:
If , the policy has converged.Warning
Examples
One for constructing MDP, one for Q-states, one for solving using value iteration and one for using policy