Source: Lecture PDF · Lecture index

MDP ingredients and objective

A Markov decision process (MDP) models sequential choices under uncertainty:

IngredientMeaning
State Fully observed information needed for the next decision
Action Choice available in state
Transition Probability of next state after taking in
Reward Immediate reward for the state/action
Discount Weight on future rewards; here for the infinite-horizon result

The Markov property now conditions on current state and action. For every , probabilities over next states sum to one. An action chooses a transition distribution, not necessarily the next state: the gridworld’s intended move can fail or slip. If multiple outcomes lead to the same cell, add their probabilities.

Starting from , a policy’s value is

Optimise expected total discounted reward, not just immediate reward or one simulated path. With finite horizon, can be allowed because the sum has finitely many terms; infinite-horizon undiscounted problems need additional conditions.

Policies and evaluation

A deterministic stationary policy assigns one fixed action to each state: . “Stationary” means independent of time, not that the system stays still. General policies may depend on history, time or randomisation.

For a finite state/action infinite-horizon MDP with bounded rewards and , there exists a deterministic stationary policy optimal from every starting state. The optimal value still depends on the starting state. A finite-horizon optimum may depend on time remaining.

A fixed stationary policy induces a Markov chain with transitions . Its value satisfies the policy evaluation equations:

These equations are linear in for a fixed policy. Simulation provides another evaluation method: average the discounted returns of many trajectories from the same initial state. A time cutoff approximates an infinite horizon, and finite replications introduce Monte Carlo error.

With actions at each of decision states, there are deterministic stationary policies. More generally the count is . The lecture’s illustrates why exhaustive policy simulation is expensive.

Bellman optimality equation

Split the optimal return into immediate reward and optimal continuation:

For the gridworld’s state-only reward, , so

The sum averages over random next states; the maximum chooses an action. You cannot select a different current action after seeing which random next state occurs. One equation per state gives a coupled system; the maximisation makes it generally nonlinear.

An optimal policy is greedy with respect to the optimal values:

Ties permit multiple optimal actions. The same optimal continuation from a state can be used regardless of the route taken to reach it: this is the dynamic-programming principle.

Value iteration

  1. Initialise arbitrarily for nonterminal states and set terminal boundary values consistently with the reward convention.
  2. Update every nonterminal state using the preceding iteration:
  1. Compute and repeat until , then extract a greedy policy using the same action comparison.

For the finite discounted setting, the Bellman operator is a contraction:

Thus value iteration converges to the unique from any initial values. This guarantee uses ; it does not automatically extend to arbitrary undiscounted infinite-horizon models. The lecture’s numerical gridworld on p. 16 uses , terminal values and step reward ; treat it as the terminating example, separately from the discounted contraction theorem.

One backup: if an action has next-state probabilities , current successor values , immediate reward and , its candidate value is

Calculate this for each available action and keep the largest. Use throughout a synchronous sweep; changing values mid-sweep is a different update schedule.

Terminal rewards and parameter changes

Terminal accounting: reward must be counted once. If terminal payoff is stored as a fixed boundary value , stop updating that state. If instead the payoff is awarded on the transition into a terminal state, use zero continuation after termination. Do not both pay on entry and repeatedly collect the same reward in an absorbing state.

  • Discount: smaller places less weight on distant rewards; larger values future outcomes more and weakens the contraction, potentially slowing convergence.
  • Step reward: a larger per-step penalty encourages shorter routes; a smaller penalty can make safer detours worthwhile.
  • Transition risk: a policy must trade off route length and the probability of a bad terminal outcome; the visually shortest route need not maximise expected return.

Connections

  • L8: actions control transitions; fixing a stationary policy leaves a Markov chain. Here states direction explicitly, avoiding matrix-orientation ambiguity.
  • L9: simulate a policy by drawing each next state from .
  • L2: both seek an optimum, but Bellman recursion exploits sequential state structure rather than differentiating a parameterised loss.

For lecture examples: rewards, pp. 1–6 · policies and exhaustive simulation, pp. 7–12 · value iteration, pp. 13–17 · parameter changes, pp. 18–19.