22
MDP Tutorial - 1 An Introduction to Markov Decision Processes Bob Givan Ron Parr Purdue University Duke University

Markov Decision Process Tutorial

Embed Size (px)

DESCRIPTION

Markov Process

Citation preview

Page 1: Markov Decision Process Tutorial

sses

arrersity

MDP Tutorial - 1

An Introduction toMarkov Decision Proce

Bob Givan Ron PPurdue University Duke Univ

Page 2: Markov Decision Process Tutorial

)

MDP Tutorial - 2

OutlineMarkov Decision Processes defined (Bob

• Objective functions

• Policies

Finding Optimal Solutions (Ron)

• Dynamic programming

• Linear programming

Refinements to the basic model (Bob)

• Partial observability

• Factored representations

Page 3: Markov Decision Process Tutorial

Utilitiesl

cts in each state.

ects of an actione and not on the

MDP Tutorial - 3

Stochastic Automata withA Markov Decision Process (MDP) modecontains:

• A set of possible world states S

• A set of possible actions A

• A real valued reward function R(s,a)

• A description T of each action’s effe

We assume the Markov Property: the efftaken in a state depend only on that statprior history.

Page 4: Markov Decision Process Tutorial

Utilitiesl

cts in each state.

ects of an actione and not on the

MDP Tutorial - 4

Stochastic Automata withA Markov Decision Process (MDP) modecontains:

• A set of possible world states S

• A set of possible actions A

• A real valued reward function R(s,a)

• A description T of each action’s effe

We assume the Markov Property: the efftaken in a state depend only on that statprior history.

Page 5: Markov Decision Process Tutorial

ns

action

te and action we next states.a).

0.40.6

MDP Tutorial - 5

Representing ActioDeterministic Actions:

• T : For each state and we specify a new state.

Stochastic Actions:

• T : For each staspecify a probability distribution overRepresents the distribution P(s’ | s,

S A× S→

S A× Prob S( )→

Page 6: Markov Decision Process Tutorial

ns

action

te and action we next states.a).

1.0

MDP Tutorial - 6

Representing ActioDeterministic Actions:

• T : For each state and we specify a new state.

Stochastic Actions:

• T : For each staspecify a probability distribution overRepresents the distribution P(s’ | s,

S A× S→

S A× Prob S( )→

Page 7: Markov Decision Process Tutorial

MDP Tutorial - 7

Representing SolutionsA policy π is a mapping from S to A

Page 8: Markov Decision Process Tutorial

resulting fromystem

MDP Tutorial - 8

Following a PolicyFollowing a policy π:

1. Determine the current state s2. Execute action π(s)3. Goto step 1.

Assumes full observability: the new stateexecuting an action will be known to the s

Page 9: Markov Decision Process Tutorial

y

ite.

total rewardue.

lue?

MDP Tutorial - 9

Evaluating a PolicHow good is a policy in a state s ?

For deterministic actions just total therewards obtained... but result may be infin

For stochastic actions, instead expected obtained–again typically yields infinite val

How do we compare policies of infinite va

π

Page 10: Markov Decision Process Tutorial

snces of rewardsy)

e rewards

lly tractable and

MDP Tutorial - 10

Objective FunctionAn objective function maps infinite sequeto single real numbers (representing utilit

Options:1. Set a finite horizon and just total th2. Discounting to prefer earlier reward3. Average reward rate in the limit

Discounting is perhaps the most analyticamost widely studied approach

Page 11: Markov Decision Process Tutorial

for discount

y moment

ns

rizon lookahead

our objective

)

n

11 γ–------------ M⋅

MDP Tutorial - 11

DiscountingA reward n steps away is discounted byrate .

• models mortality: you may die at an

• models preference for shorter solutio

• a smoothed out version of limited ho

We use cumulative discounted reward as

(Max value <=

γ0 γ 1< <

M γ M⋅ γ2 M ....+⋅+ + =

Page 12: Markov Decision Process Tutorial

the

,

, and

lue function, V *

MDP Tutorial - 12

Value FunctionsA value function : represents

expected objective value obtained

following policy from each state in S .

Value functions partially order the policies

• but at least one optimal policy exists

• all optimal policies have the same va

V π S ℜ→

π

Page 13: Markov Decision Process Tutorial

sn to itself via

tate in S

V π s′( )⋅

′) γ V * s′( )⋅ ⋅

MDP Tutorial - 13

Bellman EquationBellman equations relate the value functiothe problem dynamics.

For the discounted objective function,

In each case, there is one equation per s

V π s( ) R s π s( ),( ) T s π s( ) s′, ,( ) γ⋅s′ S∈∑+=

V * s( ) =MAX

a A∈R s a,( ) T s a s, ,(

s′ S∈∑+

Page 14: Markov Decision Process Tutorial

quations

are related by

V π n 1–, s′( )

MDP Tutorial - 14

Finite-horizon Bellman E

Finite-horizon values at adjacent horizonsthe action dynamics

V π 0, s( ) R s π s( ),( )=

V π n, s( ) R s a,( ) T s a s′, ,( ) γ⋅ ⋅s′ S∈∑+=

Page 15: Markov Decision Process Tutorial

cking

pected value

us on worst case

o exploitggressively

MDP Tutorial - 15

Relation to Model CheSome thoughts on the relationship

• MDP solution focuses critically on ex

• Contrast safety properties which foc

• This contrast allows MDP methods tsampling and approximation more a

Page 16: Markov Decision Process Tutorial

slly

of state

ction behaviors

DPs?

MDP Tutorial - 16

Large State SpaceIn AI problems, the “state space” is typica

• astronomically large

• described implicitly, not enumerated

• decomposed into factors, or aspects

Issues raised:

• How can we represent reward and ain such MDPs?

• How can we find solutions in such M

Page 17: Markov Decision Process Tutorial

entationte variables:

ula (or BDD, etc)

space partition:

r?

. . . . . Reward=0 . . . . . Reward=4? . . Reward=5

MDP Tutorial - 17

A Factored MDP Repres• State Space S — assignments to sta

• Partitions — each block a DNF form

• Reward function R — labelled state-

On-Mars?, Need-Power?, Daytime?,..etc...

Block 1: not On-Mars?Block 2: On-Mars? and Need-Power?Block 3: On-Mars? and not Need-Powe

Block 1: not On-Mars? . . . . . . . . . . . . . . .Block 2: On-Mars? and Need-Power? . .Block 3: On-Mars? and not Need-Power

Page 18: Markov Decision Process Tutorial

of Actions independently.1

ars? | x, a)

le as labelled

d-Power? | Block n). . . . 0.9. . . . 0.3. . . . 0.1

le Need-Power?

MDP Tutorial - 18

Factored Representations • Assume: actions affect state variables

e.g.....Pr(Nd-Power? ^ On-Mars? | x, a) = Pr (Nd-Power? | x, a) * Pr (On-M

• Represent effect on each state variabpartition:

1. This assumption can be relaxed.

Pr(NeeBlock 1: not On-Mars? . . . . . . . . . . . . . . . . . Block 2: On-Mars? and Need-Power? . . . . Block 3: On-Mars? and not Need-Power?

Effects of Action Charge-Battery on variab

Page 19: Markov Decision Process Tutorial

kss

MDP Tutorial - 19

Representing Bloc• Identifying “irrelevant” state variable

• Decision trees

• DNF formulas

• Binary/Algebraic Decision Diagrams

Page 20: Markov Decision Process Tutorial

tyed

DP)

able

odel

o) for each state

r system states

MDP Tutorial - 20

Partial ObservabiliSystem state can not always be determin

⇒ a Partially Observable MDP (POM

• Action outcomes are not fully observ

• Add a set of observations O to the m

• Add an observation distribution U(s,

• Add an initial state distribution I

Key notion: belief state, a distribution ove representing “where I think I am”

Page 21: Markov Decision Process Tutorial

ersion|o) using Bayes’

)

ed

ble relative to

ous state MDP

MDP Tutorial - 21

POMDP to MDP ConvBelief state Pr(x) can be updated to Pr(x’rule:

Pr(s’|s,o) = Pr(o|s,s’) Pr(s’|s) / Pr(o|s

= U(s’,o) T(s’,a,s) normaliz

Pr(s’|o) = Pr(s’|s,o) Pr(s)

A POMDP is Markovian and fully observathe belief state.

⇒ a POMDP can be treated as a continu

Page 22: Markov Decision Process Tutorial

ationonomical, belief

DP impractical

mately

resentation

l independence

MDP Tutorial - 22

Belief State ApproximProblem: When MDP state space is astrstates cannot be explicitly represented.

Consequence: MDP conversion of POM

Solution: Represent belief state approxi

• Typically exploiting factored state rep

• Typically exploiting (near) conditionaproperties of the belief state factors