Markov Decision Process
Objective: find a strategy (a policy) that maximizes the expected discounted sum of future rewards
The Markov property
"Markov" generally means that, given the present state, the future and the past are independent. For MDPs, action outcomes depend only on the current state
i.e. The future depends on the past, only through the present.
| Component | Meaning |
|---|---|
| Set of states | |
| Set of actions | |
| Transition function: probability of reaching from by doing | |
| Reward function |
Rewards & Discounting
Rewarding is the way we influence the agent to do what we want it to do. The entire goal of the agent is to maximize this reward. So we define the task by the reward function
| Form | Meaning | When used |
|---|---|---|
| Reward for being in a state | Grid world slides, e.g. "" | |
| Reward depends on the action taken | Costs of actions, such as fuel | |
| Depends on the outcome too | Most general form |
We also care about getting the reward as quickly as possible. A big reward, sooner is the best. So even if the agent get a big reward later, the reward degrades. We note this using the discount factor . ()
Utility
Utility is the total amount of rewards the agent was able to collect by doing the actions and transitioning into different states.
| Effective horizon | Behavior | |
|---|---|---|
| 0 | 1 step | Pure greed. Only immediate reward matters. |
| 0.5 | ≈ 2 steps | Very short-sighted |
| 0.9 | ≈ 10 steps | Common for gridworlds |
| 0.99 | ≈ 100 steps | Far-sighted, but converges more slowly |
| 1 | Needs a finite horizon or guaranteed termination |
Policy
Plan vs Policy
| Plan | Policy | |
|---|---|---|
| Used in | Deterministic search | Stochastic problems (MDPs) |
| Form | A fixed sequence: | A mapping from states to actions |
| Handles surprises? | No. If the world deviates, the plan is useless. | Yes. It tells you what to do wherever you end up. |
A policy is a mapping from states to actions.
- - set of states
- - set of actions
- - policy
Deterministic policy
Tells directly what action to take when in a given state. These can be stored in a LUT for a car with a engine temp,
| State | Action |
|---|---|
| Cool | Fast |
| Warm | Slow |
| Overheated | (terminal, no action) |
Stochastic policy
(out of scope)
Stationary vs. non-stationary
- Stationary: doesn't depend on time. With infinite horizon and discounting, the optimal policy is stationary, and this is the case the lecture covers.
- Non-stationary: changes with the time step. This is needed for finite horizons. With 1 step left you might take a gamble you'd avoid with 100 steps left.
Policy Evaluation
The process of computing the state-value function for a given policy .
Optimal Policy
A policy is optimal if no other policy does better from any state:
Bellman Equations
- is the expected utility starting in and acting ==🔵optimally==.
- is the expected utility of taking action in , then acting ==🔵optimally==. The pair is called a q-state.
- is the optimal action from .
These are defined recursively.
is the sum of expected utility for taking action , and transitioning from to of all the possible states after that action
is the maximum sum of utility that can get from all of the available set of actions
Value Iteration
This is the dynamic programming algorithm used to find the optimal policy.
We iteratively apply values from the previous iteration into the next iteration and so on until we converge into a stable threshold.
Exact Value for
If we know the optimal policy for a given state, we can derive the optimal value for that state easily. Ex: when in State , policy always take action has a 20% chance of staying in and 80% chance of going to now,
If we know , we can compute exact value for