Sequential Decision Making
No notes for first half of video
The action which a rational agent should choose is that which maximises the agent’s utility. In other words, the agent should pick:
Where is the state obtained by choosing action and is the utility of that state. The problem is that in any realistic situation, the resulting state is probabilistic. Instead we have to calculate the expected utility of each action and make choice based on that.
In other words, for each action with a set of outcomes , the agent should calculate:
and pick the best.
Example: decision between and .
We are working with stochastic actions whereby an action has several possible outcomes, and we don’t know which will happen in advance.
Policies
Maximin
Maximin is a decision rule that dictates that you should choose the least-bad option for a worst case (maximum loss) scenario.
Link to original
Maximax
Maximax is optimistic risk-seeker, which will ignore all bad possible outcomes and just focus on the best possible outcome.
Link to original
Transition Model
We can write a transition model to describe these actions. Since the actions are stochastic, the model looks like:
Where is the action that takes the agent from to .
Transitions are assumed to be first order Markovian, that is, they only depend on the current and next states. So we can write a large set of probability tables that describe all possible actions executed in all possible states.
Link to original
Example
The reward for non-terminal states is . We assume the utility of a run is the sum of utility of states, therefore is an incentive to take fewer steps to get to the terminal state.
This gives us the policy:
Here are different optimal policies for values of :
The problem the agent faces here is a
Markov Decision Process
A Markov Decision Process is the process of looking at actions influencing state transitions. It is a sequential decision making problem for a fully observable yet stochastic environment.
Markov Chain holds, but now with probability of actions between states and rewards for action execution. This is reliant on two principles:
- Assume Markov property holds for action transitions.
- Probability distributions are stationary and don’t change.
We encode a reward for each state. Total utility of the agent is the sum of all rewards from all states visited.
A negative reward incentives optimality.
The MDP components for all states :
- transition model:
- initial state of the problem:
- reward function for a given state:
The MDP solution is not a plan of actions. The MDP solution is a policy which denotes the action that should be taken for any state . The optimal policy () will yield the highest expected utility in any given situation.
Link to original
Optimal Policies
So far we’ve assumed utilities are summed along a run, but it’s not the only approach.
- In general, we need to compute for general , this is the utility of the run.
- Before, was just the sum of rewards in every state.
- We can consider either finite or infinite ‘horizons’ / games. For us, dealing with infinite horizons is easier so that’s what we will use.
We have to also consider whether the utilities are stationary: that is whether a state always has the same value, it could change after we visit it for example. We assume utilities are stationary.
With stationary utilities, there are two ways to establish from .
- Additive rewards:
- Discounted rewards: where the discount factor is a number between and
The discount factor models the preference of the agent for current over future rewards.
There is an issue with infinite sequences with additive, undiscounted rewards.
The utility of the policy will be unbounded, hence or . This is problematic when we want to compare policies.
We have some solutions to this problem:
- Proper policies
- Average reward
- Discounted rewards
Proper Policies
Proper Policy
A proper policy always ends up in a terminal state eventually, thus have a finite expected utility.
Link to original
Average Reward
Average Reward (policies)
We can compute the average reward per time step. Even for an infinite policy, this will usually be finite.
Link to original
Discounted Rewards
Discounted Rewards (policies)
Assume and rewards are bounded by . With discounted rewards, the utility of an infinite sequence is finite:
We can compare policies by computing their expected values. The expected utility of executing starting in is given by:
Where is the state the agent gets to at time .
is a random variable and we compute the probability of all its values by looking at all the runs which end up there after steps.
The optimal policy is then:
This is independent of the state the agent starts in.
Link to original
Bellman and Value Iteration
3. Value Iteration
Solving the MDP
We wish to find an optimal policy () for the problem that is:
- complete: covers all states
- optional: gives the best action for state
- stationary: actions dependent only on current state
- proper: guaranteed to reach terminal state
Our policy should yield an expected utility for a given state following a policy
Consider for the problem as : it is the expected sum of discounted rewards if the agent is running the optimal policy.
Hence we now have two ways of acknowledging rewards in the problem space:
- : the short-term reward when reaching a given state
- : the long-term reward of passing through on the way to the goal
Meaning that our optimal solution is selecting the action with best expected utility:
Calculating Optimal Policy
We need to calculate the utility of each state so we can derive the optimal action. Utility calculation considers all discounted rewards over time, but future rewards are derived from states with other utility values. Hence we can calculate a utility as the immediate reward plus the expected utility of the successor, assuming optimal action selection.
Bellman Equation
The Bellman equation:
Link to originalFor the example given prior, take for example we want to know the value of :
Value Iteration Algorithm
To create the value iteration algorithm, we use the Bellman update equation:
We initialise then update for all states in the problem. As time , the utility values will reach an equilibrium and stabilise.
Value Iteration Psuedocode
Link to original
Policy Iteration
Policy Iteration
Rather than compute optimal utility values, policy iteration looks through the space of possible policies. We start from some initial policy and do:
- Policy evaluation: given a policy , calculate Given a policy, the choice of action in a given state is fixed so compute for every state:
Abstract
We have lots of simultaneous equations again, but this is now linear! (no max)
- Policy improvement: given , compute Calculate a new policy by applying:
for each state . (we do a one-step MEU lookahead)
We perform both of these until convergence, the iteration will terminate when there is no improvement in utility from one iteration to the next. (at this point the utility is a fixed point of the Bellman update and so must be optimal)
Link to original
Issue with policy evaluation stage
If we have states, we have linear equations with unknowns. The solution is in (there is also an impractical solution with ). For large , we will run into problems. So we need an approximate solution.
Approximate Policy Evaluation
Approximate Policy Evaluation
Run a simplified value iteration. The policy is fixed, so we know what action to do in each state. Repeat the following a fixed number of times:
Link to original
Modified policy iteration using approximate evaluation
Policy Iteration (using approximate evaluation)
Hence our modified policy iteration is, repeated until convergence:
Link to original
- Approximate policy evaluation: repeat fixed number of times
- Policy improvement: for every state :
This is often more efficient than policy iteration or value iteration.
This is an approximate solution, which may not always converge.
However, one could use the approximate values found here and then continue to use value iteration or policy iteration going forwards.








