Sesión 12: Procesos de Decisión de Markov. Incertidumbre - MDP, L.E. Sucar2 Procesos de Decisión...

Post on 23-Jan-2016

219 views 0 download

Transcript of Sesión 12: Procesos de Decisión de Markov. Incertidumbre - MDP, L.E. Sucar2 Procesos de Decisión...

Sesión 12: Procesos de Decisión de Markov

Incertidumbre - MDP, L.E. Sucar 2

Procesos de Decisión de Markov

• Procesos de Decisión Secuenciales

• Procesos de Decisón de Markov (MDP)

• Método de Iteración de Valor

• Procesos de Decisión de Markov Parcialmente Observables (POMDP)

• Extensiones (abstracción, partición)

• Aplicaciones

Incertidumbre - MDP, L.E. Sucar 3

Problemas de decisión secuenciales

• Problema de decisión que involucra un conjunto de decisiones cuyo resultado (utilidad) se conoce hasta el final

• Se considera que se tiene una serie de estados y decisiones asociadas en el tiempo

• Se tiene incertidumbre asociada con los resultados de las acciones (MDP), y posiblemente también con los estados (POMDP)

Incertidumbre - MDP, L.E. Sucar 4

Ejemplo – robot móvil

Inicio

Incertidumbre - MDP, L.E. Sucar 5

Modelo de Transición

• Normalmente existe incertidumbre respecto a los resultados de una decisión (acción)

• Esta incertidumbre se modela como una probabilidad de llegar al estado “j” dado que se encuentra en el estado “i” y se realizá la acción “a”:

Mija

Incertidumbre - MDP, L.E. Sucar 6

Modelo de Transición• Probabilidad dirección deseada – Pij=0.8• Probabilidad 2 direcciones vecinas – Pik=0.1

Incertidumbre - MDP, L.E. Sucar 7

Modelo de los Sensores

• Normalmente el agente puede sensar el ambiente para observar en que estado se encuentra.

• Existen dos casos principales:– Observa directamente el estado donde se

encuentra- proceso de decisión de Markov– Se tiene incertidumbre sobre el estado en que se

encuentra- proceso de decisión de Markov parcialmente observable

Incertidumbre - MDP, L.E. Sucar 8

MDP

Incertidumbre - MDP, L.E. Sucar 9

POMDP

Incertidumbre - MDP, L.E. Sucar 10

Política Óptima

• Dado el modelo de transición y el modelo de los sensores, el objetivo es encontrar la política óptima para maximizar la utilidad esperada

• Una política indica la acción que se debe ejecutar dado el estado (o probabilidad del estado)

• Se considera que las probabilidades de transición sólo dependen del estado actual por lo que son procesos markovianos

Incertidumbre - MDP, L.E. Sucar 11

Ejemplo de Política

Inicio

Incertidumbre - MDP, L.E. Sucar 12

Controlador basado en un MDP

solución MDP

Controlador

Sistema

Modelo

Eventos

estadoacción

política

Incertidumbre - MDP, L.E. Sucar 13

Procesos de Decisión de Markov

• Problema de obtener la política óptima en un ambiente observable – MDP

• El método clásico para resolver estos problemas se conoce como “iteración de valor” (value iteration)

• La idea básica es calcular la utilidad de cada posible estado y usar éstas para seleccionar la acción óptima en cada estado

• Otros métodos de solución son “iteración de política” (policy iteration) y programación lineal (al transformar el problema a un problema de optimización lineal)

Incertidumbre - MDP, L.E. Sucar 14

Procesos de Decisión de Markov

• Formalmente, un PDM (discreto) se define por:– Un conjunto finito de estados, S– Un conjunto finito de posibles acciones, A– Un modelo de transición, que especifica la

probabilidad de pasar a un estado dado el estado presente y la acción, P(s | s’, a)

– Una función de recompensa, que especifica el “valor” de ejecutar cierta acción a en el estado s, r(s, a)

Incertidumbre - MDP, L.E. Sucar 15

Utilidad

• La utilidad de un estado depende de la secuencia de acciones tomadas a partir de dicho estado (i) de acuerdo a la política establecida (p)

• En principio, se puede obtener como la utilidad esperada de todas las posibles secuencias de acciones (Hi) y la utilidad resultante para c/u:

U(i) = UE( Hi(p) ) = P(Hi(p)) Uh Hi(p)

Incertidumbre - MDP, L.E. Sucar 16

Utilidad

• Si la utilidad es separable, se puede estimar como la utilidad del estado presente y la utilidad de los siguiente estados

• La forma más sencilla es que sea una función aditiva:

U[s0, s1, ... sn] = R(s0) + U[s1, ... sn] • Donde R se conoce como la función de

recompensa

Incertidumbre - MDP, L.E. Sucar 17

Programación Dinámica

• Dada la condición de separabilidad, la utilidad de un estado se puede obtener en forma iterativa maximizando la utilidad del siguiente estado:

U(i) = R(i) + maxa j P(sj | si,a) U(j)

• La política óptima esta dada por la acción que de mayor utilidad:

P*(i) = arg maxa j P(sj | si,a) U(j)

Incertidumbre - MDP, L.E. Sucar 18

Programación Dinámica

• Si se tiene un número finito de pasos (n), entonces la política óptima se puede calcular eficientemente utilizando PD:– Se obtiene la utilidad de los estados en el paso

n-1 en base a la utilidad de los estados terminales y se determina la mejor acción

– Se obtiene la utilidad de los estados en el paso n-2 en base al paso n-1, y así sucesivamente

– Al final se tiene la política óptima (mejor acción para cada estado)

Incertidumbre - MDP, L.E. Sucar 19

PD – ejemplo robot

• Si se define la función de utilidad como:

Uh = valor estado final – 1/25 (número de pasos)

• Entonces la función de recompensa es:

R = +1, -1 para los estados terminales

R = -1/25 para los demás estados

Incertidumbre - MDP, L.E. Sucar 20

Recompensa

-1/25 -1/25

-1/25

-1/25 -1/25 -1/25

-1/25

-1/25 -1/25

-1

+1

Incertidumbre - MDP, L.E. Sucar 21

PD – ejemplo robot• Asumiendo que se llega a la meta en n pasos:

U(a=derecha) = [0.8*1-0.1*1/25 -0.1*1/25] = 0.792U(a=abajo) = [0.1*1-0.8*1/25 -0.1*1/25] = 0.064U(a=izq.) = [-0.1*1/25-0.8*1/25 -0.1*1/25] = -0.04U(s33) = -1/25 + max [.792, .064, -.04] = 0.752; P*(s31) = derecha

1

2

3

1 2 3 4

Incertidumbre - MDP, L.E. Sucar 22

Valor

0.752

-1

+1

0.422

… …

Incertidumbre - MDP, L.E. Sucar 23

Horizonte finito vs. infinito

• Los problemas de con un número finito de pasos se conocen como MDP de horizonte finito

• Los problemas en que puede haber un número infinito de pasos se conocen como MDP de horizonte infinito

• Muchos problemas, como el ejemplo del robot, son de horizonte infinito y no se pueden resolver directamente por PD

Incertidumbre - MDP, L.E. Sucar 24

Solución

• Los métodos principales para resolver MDPs son:

• Iteración de valor (Bellman, 57),

• Iteración de política (Howards, 60), and

• Programación lineal (Puterman, 94).

Incertidumbre - MDP, L.E. Sucar 25

MDPs

• Función de valor (ecuación de Bellman):

V*(s) = maxa { R(s,a) + s’ P(s’ | s, a) V*(s’) }

• Policy:

*(s) = arg maxa { R(s,a) + s’ P(s’ | s, a) V*(s’) }

• Solución:– Value iteration

– Policy iteration

Incertidumbre - MDP, L.E. Sucar 26

SoluciónFunción de valor• Una política para un MDP es una asociación

:SA (acción por estado).• Dada la política, el valor para horizonte finito es:

Vn: S

Vn(i) = R(i, (i)) + P((i) | i,j) Vn-1(j)

• Para horizonte infinito, generalmente se considera un factor de descuento, 0<<1:

V(i) = R(i, (i)) + P((i) | i,j) V(j)

Incertidumbre - MDP, L.E. Sucar 27

Solución

Política óptima• La solución a un MDP da una política óptima.• Esto es, la política que maximiza la ecuación de

Bellman:

*(i) = max [R(i, a) + P(a | i,j) V*(j)]

Incertidumbre - MDP, L.E. Sucar 28

Iteración de Valor

• En el caso de horizonte infinito, se puede obtener la utilidad de los estados –y la política óptima, mediante un método iterativo

• En cada iteración (t+1), se estima la utilidad de cada estado basada en los valores de la iteración anterior (t):

Ut+1(i) = R(i) + maxa j P(sj | si,a) Ut(j)

• Cuando tinf, los valores de utilidad convergen a un valor estable

Incertidumbre - MDP, L.E. Sucar 29

Iteración de Valor

Algoritmo:

– Inicializar: Ut = Ut+1 = R

– Repetir:

• Ut=Ut+1

• Ut+1(i) = R(i) + maxa j P(sj | si,a) Ut(j)

– Hasta: | Ut-Ut+1 | <

Incertidumbre - MDP, L.E. Sucar 30

Iteración de Valor

• ¿Cuántas veces repetir la iteración?

• Normalmente el número de iteraciones para obtener la política óptima es menor que el requerido para que las utilidades converjan

• En la práctica, el número de iteraciones es relativamente pequeño

Incertidumbre - MDP, L.E. Sucar 31

Iteración de valor

• Para evitar problemas de valores muy grandes (infinito) de la recompensa, normalmente se aplica un factor de descuento, 0<<1, para el valor de los siguientes estados

• El cálculo iterativo de la utilidad con el factor de descuento es entonces:

Ut+1(i) = R(i) + maxa j P(sj | si,a) Ut(j)

Incertidumbre - MDP, L.E. Sucar 32

Ejemplo – utilidades de los estados

Inicio

0.812

0.762

0.868 0.912

0.660

0.6110.705 0.3380.655

Incertidumbre - MDP, L.E. Sucar 33

Ejemplo – política óptima

Inicio

Incertidumbre - MDP, L.E. Sucar 34

Iteración de Política• Empezando de cierta política (aleatoria),

esta se mejora encontrando una acción por estado que tenga un mejor valor que la acción actual

• Se puede usar conocimiento del problema para definir la política inicial

• El proceso termina cuando ya no puede haber mejoras

• Normalmente converge en menor número de iteraciones que iteración de valor, pero cada iteración es más costosa

Incertidumbre - MDP, L.E. Sucar 35

Ejemplo –robot virtual

Incertidumbre - MDP, L.E. Sucar 36

Política óptima

Incertidumbre - MDP, L.E. Sucar 37

Otra configuración

Incertidumbre - MDP, L.E. Sucar 38

Función de valor

Incertidumbre - MDP, L.E. Sucar 39

POMDP

• En muchos problemas reales, no se puede observar exactamente el estado del agente, por lo que se tiene un POMDP

• Además de los elementos de un MDP, un POMDP incluye:– Una función de observación que especifica la

probabilidad de las observaciones dado el estado, P(O|S)

– Una distribución de probabilidad inicial para los estados, P(S)

Incertidumbre - MDP, L.E. Sucar 40

POMDP

• El enfoque exacto para resolver un POMDP consiste en considerar la distribución de probabilidad sobre los estados y en base a esta determinar las decisiones óptimas

• Para ello, se puede considerar un POMDP como un MDP en que los estados corresponden a la distribución de probabilidad

• El problema es que el espacio de estados se vuelve infinito y la solución exacta es muy compleja

Incertidumbre - MDP, L.E. Sucar 41

POMDP

• Soluciones aproximadas:– Asumir que el agente se encuentra en el estado

más probable – se transforma en un MDP que se puede resolver por el método de iteración de valor

– Considerar un número finito de pasos y modelar el problema como una red de decisión dinámica – la aproximación depende del número de estados que se “ven” hacia delante (lookahead)

Incertidumbre - MDP, L.E. Sucar 42

Ejemplo POMDP• El robot detecta su posición con sonares

• Hay errores y ruido en las lecturas, alcance limitado• Ciertas celdas son muy parecidas (1,2 – 3,2)

Incertidumbre - MDP, L.E. Sucar 43

Extensiones

• Representaciones factorizadas

• Representaciones abstractas (cualitativas)

• Modelos jerárquicos (serie / paralelo)

(las siguiente láminas están basadas en un tutorial impartido en Iberamia con Alberto Reyes)

Incertidumbre - MDP, L.E. Sucar 44

Factored Representations

• Extensional representation of the system's states are those in which each state is explicitly named.

• In AI research, intensional representations are more common.

• An intensional representation is one in which states or sets of states are described using sets of multi-valued features.

• The use of MDP formalism in AI has recently adopted this representation.

Incertidumbre - MDP, L.E. Sucar 45

Factored MDPs

• Boutillier, Dearden y Goldsmith (1995) exploits action description and domain structure through state features to represent states as sets of factors (features).

• A factored state is any possible instantiation of a small set of variables defining a problem domain.

• They represent the state transition function as a 2-stage DBN with which they exploit state variables independence.

• Conditional Probability Tables (CPTs) which are the state transition distributions are represented as decision trees.

Incertidumbre - MDP, L.E. Sucar 46

Factored MDPs

Each value xi’ of a variable X is associated to a probability distribution in X’

PT(xi’|ParentsT(xi’)).

PT(X’|X)= PT(xi’|ui) where ui is the value in X of the variables in ParentsT(xi’).

There is one DBD per action

x2

x3

x4

x5

x1

x2’

x3’

x4’

x5’

x1’

t t+1

X X’

Incertidumbre - MDP, L.E. Sucar 47

Factored MDPs

Reward

p

q

p q R

T F 1.0

T T 0.9

F F 0.1

F T 0.0

A1

A2

A3

A4

X1

X2

X3

X4

X’1

X’2

X’3

X’4

G

t t+1

Incertidumbre - MDP, L.E. Sucar 48

Algebraic Decision Diagrams–SPUDD algorithm (Hoey, 1999) uses algebraic decision diagrams (ADD) to represent state transitions, utilities, policies and rewards. One of its contributions is the fact that many instantiations of the state variables map a same value

Incertidumbre - MDP, L.E. Sucar 49

Relational Representations

• State Aggregation= Group of states with similar properties (utility, features).

• [Morales 2003] uses the notion of state aggregation for grouping states that share the same set of relations to structure and abstract state spaces.

• The value function is approximated over this abstract state space in a RL context.

Incertidumbre - MDP, L.E. Sucar 50

R-states

• Relational variables are first-order relations.• States are defined by the possible

instantiations of these relational variables (r-states)

e.g., relation(agent,goal,south) AND relation(agent,obst,north-west) AND not(relation(agent,border)).

Incertidumbre - MDP, L.E. Sucar 51

R-states

• An r-state can cover a large number of states

• For N relations there are in principle 2N r-states. In practice, only a small fraction of them is possible

• The user needs to define the relations

Incertidumbre - MDP, L.E. Sucar 52

R-actions

• Actions are represented in terms of first-order relations (r-actions)

• Syntax:– pre-conditions (set of relations)– g-action (generalized action)– post-conditions (set of relations)

• When several primitive actions are applicable choose one randomly

• The user needs to define the r-actions

Incertidumbre - MDP, L.E. Sucar 53

R-actionsAn example of an r-action in the grid domain can be:

r-action(1,agent,goal,Move,State) :-

relation(agent,goal, Pos),

not relation(agent, obst, Pos),

not relation(agent,border),

move(Pos,[Move|_],State).

If an r-action is applicable to a particular instance of an r-state it must be applicable to all the instances of that r-state.

Incertidumbre - MDP, L.E. Sucar 54

R-actionsWhere,

r-acc1: close

r-acc2: getAway

Here, different movements are possible according to the current r-state !

Incertidumbre - MDP, L.E. Sucar 55

Qualitative MDPs

• An alternative way to improve efficiency and accuracy in the MDP formalism to deal with real world problems is by using Qualitative MDPs.

• In a Qualitative MDP states are qualitative change vectors (q-states) and actions are STRIPS-like operators that constrain the set of actions applicable in a particular Q-state (r-actions)

Incertidumbre - MDP, L.E. Sucar 56

1: (zero,pos,neg)

4: (neg,neg,neg)

2: (pos,neg,pos)

Qual. change vectors at point (315, 56, 11.25)Numeric examples (points in attribute space)

3: (neg,neg,pos)

Pre

sLearning QCFsLearning QCFs

1:

qTemp=neg

qVol=neg

qPres=pos

1:

qTemp=neg

qVol=neg

qPres=pos

Qualitative Change Vectors

Pres = 2 Temp / Vol Temp Vol Pres315.00 56.00 11.25315.00 62.00 10.16330.00 50.00 13.20300.00 50.00 12.00300.00 55.00 10.90

Pres = 2 Temp / Vol Temp Vol Pres315.00 56.00 11.25315.00 62.00 10.16330.00 50.00 13.20300.00 50.00 12.00300.00 55.00 10.90

For each pair of examples form a qualitative change vectorFor each pair of examples form a qualitative change vector

From [Suc & Bratko 2002]

Incertidumbre - MDP, L.E. Sucar 57

Q-States• State variables q are qualitative change vectors.

Example: q1=pos(current_mw, demand_mw)

q2=neg(turbine_vel, synchronism_vel)

• A qualitative state is an instance of the set of state variables. Example:

Q = pos(current_mw, demand_mw) AND

neg(turbine_vel, synchronism_vel)

Incertidumbre - MDP, L.E. Sucar 58

Q-States

x2

y

x

x1

y1 y2 y3

x3

x1, x2, x3, y1, y2, y3 are reference values over variables x and y

Q1=pos(x, x2), ~pos(x,x3), pos(y, y1), ~pos(y,y3).

Q2=pos(x, x1), ~pos(x,x2), pos(y, y1), ~pos(y,y3).

Q1

Q2

Incertidumbre - MDP, L.E. Sucar 59

Q-State refinements

• Additional improvements can be obtained refining the initial state partition.

Q1

Q2

Q3

Q4Q5

x1

x2

Q1-p1Q2

Q3-p1

Q5

x1

x2Q1-p2

Q3-p2-1

Q3-p2-1

Q4-p1 Q4-p2

Incertidumbre - MDP, L.E. Sucar 60

R-Actions

• Additional computational savings can be obtained during the MDP solution using the notion of relational actions (r-actions)

• An (r-action) is a STRIPS-like operator where preconditions are qualitative state features

Incertidumbre - MDP, L.E. Sucar 61

R-Actions

• raction(pred(term1,term2)):-q1, q2, qn.

where pred={pos,neg,zero}term1=action ground variable

term2=reference value of term1

q1, q2, ..,qn= qualitative features

Incertidumbre - MDP, L.E. Sucar 62

R-Actions• An r-action constrains the number of

actions for each state.

Example from the power domain :

raction(pos(vel,vel_ref)):-

pos(current_mw, demand_mw),

neg(current_vel, synchronism_vel).

Incertidumbre - MDP, L.E. Sucar 63

R-Actions• State values and optimal policy is obtained by

using value iteration algorithm.

• In each iteration (t+1), the state utility is computed according to the values from the previous iteration (t), maximizing this value only over a constrained set of actions:

Ut+1(i) = R(i) + maxa j P(sj | si,a) Ut(j)

• Using this method, the explicit action space enumeration is avoided.

Incertidumbre - MDP, L.E. Sucar 64

Transition Model

R-A1

R-A2

R-A3

R-A4

q1

q2

q3

q4

q’1

q’2

q’3

q’4

qi variable in time t

q'i variable qi in time t+1

G transition graph (DBN)nodes(G)={R-A1, .. ,R-Ag, q1, .. ,qn, q'1, .. , q'n}

Parents(q'i) Q A

Gt t+1

[ Dearden & Boutilier 97]

Variables are change relations

Actions are r-actions

Q Q’

Incertidumbre - MDP, L.E. Sucar 65

Reward Function

• Reward function is represented as a decision tree or an influence diagram.

• The difference now is that random variables are qualitative, and the function is applicable to abstract states with these factors (attributes).

Reward

q1

q2

Incertidumbre - MDP, L.E. Sucar 66

Particiones

• La otra alternativa para simplificar la solución de un MDP es “partir” el problema en subproblemas, de forma que se puede resolver c/u por separado y después “integrar la solución

• Dos principales enfoques:– serie: se descompone la tarea en subtareas de forma que

cada es una submeta que hay que cumplir para alcanzar la meta global (p. ej. Heirarchical RL)

– paralelo: se descompone el problema en subproblemas que puedan resolverse “independientemente” y ejecutarse en “paralelo” (p. ej. Parallel MDPs)

Incertidumbre - MDP, L.E. Sucar 67

Learning an MDP

• Learning the model:– State Partition by Reward (ID3)– Learning a Transition Model (K2)– Learning r-actions (C4.5)

• Reinforcement Learning

Incertidumbre - MDP, L.E. Sucar 68

Learning the Reward Function• The reward function can

be approximated by using algorithms to learn decision trees (C4.5) from continuous data.

• The nodes in the obtained d-tree are the qualitative variables necessary to represent an state compactly.

Incertidumbre - MDP, L.E. Sucar 69

The power plant domain

• States were obtained from simulation under different power generation conditions. – Minimum load (10 MW)– Medium load (20 MW)– Maximum load (30 MW)

• The set of actions were those observed in the classical control system.

• Undesirable states were characterized from load disturbances (negative reward).

• Desirable states were those occurred during normal operation (positive reward)

Incertidumbre - MDP, L.E. Sucar 70

Qualitative state partition by reward

Deseado

No Deseado

4102

3826

3447

3445

40.6

40.7

40.846.5

Pre

sión

Vap

or (

KP

a)

Flujo Vapor (Kg/s)

Generación<=4804.18

4102

3826

3447

3445

40.6

40.7

40.846.5

Generación>4804.18

Flujo Vapor (Kg/s)

Pre

sión

Vap

or (

KP

a)

Incertidumbre - MDP, L.E. Sucar 71

Learning the Transition Model• Given the set of qualitative variables, we then take

advantage of factored representations to produce DBN-based transition models.

• We obtained DBNs representing probabilistic state transitions for the actions increase/decrease fwv position, decrease msv position and the null action by using structural and parametric learning algorithms (Elvira).

• The training data set given to Elvira are also attribute-value augmented tables where the set of variables are XX’ per action.

Incertidumbre - MDP, L.E. Sucar 72

Reinforcement Learning

• Reinforcement Learning (RL) is: – “the problem faced by an agent through trial-and-

error interactions with a dynamic environment” [Kaelbling, Littman, Moore, 1995].

– “learning what to do - how to map situations to actions – so as to maximize a numerical reward signal.. but instead must discover which actions yield the most reward by trying them” [Sutton, 98].

Incertidumbre - MDP, L.E. Sucar 73

Reinforcement Learning

• RL addresses the question of how an autonomous agent that senses and acts in its environment can learn to choose optimal actions to achieve its goals [Mitchell, 97].

• Example: When training an agent to play a game the trainer might provide a positive reward when the game is won, negative when it is lost , and zero in all other states.

Incertidumbre - MDP, L.E. Sucar 74

Reinforcement Learning

Incertidumbre - MDP, L.E. Sucar 75

What’s the difference between DP and RL ?

• In each type of problem, we want to sequentially control a system to maximize a reward.

• To apply the dynamic programming methods we need to assume:– The system dynamics and expected rewards are known

– We can observe the state system perfectly.

– The size of the state space is not too large – the problem is computationally tractable.

• RL approaches operate without these assumptions.

Incertidumbre - MDP, L.E. Sucar 76

Aplicaciones

• Manejo de inventarios• Mantenimiento de equipos y carreteras• Control de sistemas de comunicaciones• Modelado de procesos biológicos• Planeación en robótica móvil• Construcción de mapas / localización • Control de procesos industriales• Control de aviones• …

Ejemplo de Aplicación

Control de una Planta Eléctrica utilizando MDP

Incertidumbre - MDP, L.E. Sucar 78

Incertidumbre - MDP, L.E. Sucar 79

Generador de vapor y domo

Incertidumbre - MDP, L.E. Sucar 80

Espacio de controlRecommended curve

164

166

168

170

172

174

176

178

180

182

184

186

50% 60% 70% 80% 90% 100%

531 649 767 885 1003 1120

Flow of main steam (t/h)

Pre

ssu

re i

n t

he

du

m (

kg/c

m2

g)

0

10987

30

6

54321

11

12 13 14 15 16 17

24 25 26 27 28

31 32 33 34 35

36

18 19 20 21 22 23

29

37

42

38 39 40

43 44 45 46 47

41

Incertidumbre - MDP, L.E. Sucar 81

Resultados preliminaresRecommended curve

164

166

168

170

172

174

176

178

180

182

184

186

50% 60% 70% 80% 90% 100%

531 649 767 885 1003 1120

Flow of main steam (t/h)

Pre

ssu

re i

n t

he

du

m (

kg/c

m2

g)

0

10987

30

6

54321

11

12 13 14 15 16 17

24 25 26 27 28

31 32 33 34 35

36

18 19 20 21 22 23

29

37

42

38 39 40

43 44 45 46 47

41

Incertidumbre - MDP, L.E. Sucar 82

Arquitectura del Control

Planta

PID

MDP

Set point Nuevo Set point

ajuste

Incertidumbre - MDP, L.E. Sucar 83

Application example

Flujo de agua

Flujo de vapor

Presión vapor

dmsv

fwv

Power Plant Domain

Incertidumbre - MDP, L.E. Sucar 84

MDP Ground Elements• States: Any possible instantiation of the process

variables: Drum pressure (Pd), Feedwater flow (Ffw), Steam flow (Fms), Power Generation (normal, abnormal), Load rejection (false, true).

• Actions: Open/Close fwv, msv• Reward: good for states under optimal

operation, bad for the remaining operation states.

• Transition Model: Causal relation among variables in time. Process Dynamics.

Incertidumbre - MDP, L.E. Sucar 85

Reward Function

• This function rewards states matching the optimal operation curve and penalizes the remaining ones.

Recompensa

32263446366638864106432645464766

39.8 40.7 41.6 42.5 43.4 44.3

Flujo vapor principal (Kg/s)

Pre

sio

n d

om

o (

KP

a)

Incertidumbre - MDP, L.E. Sucar 86

Transition Model

fms, fms_ref1

fms, fms_ref2

ffw, ffw_ref

d, d_ref

pd, pd_ref1

pd, pd_ref2

pd, pd_ref3

g, g_ref

fms, fms_ref1’‘

fms, fms_ref2’

ffw, ffw_ref’

d, d_ref’

pd, pd_ref1’

pd, pd_ref2’

pd, pd_ref3’

g, g_ref’

  0 + -

0 0.33 0.13 0.01

+ 0.33 0.82 0.00

- 0.33 0.05 0.99

r-action: neg(msv, msvref)

Q'

t'

Incertidumbre - MDP, L.E. Sucar 87

r-actions in Prolog-like

format

Incertidumbre - MDP, L.E. Sucar 88

Operator Assistant Architecture• The power plant operator assistant was

implemented in Sun Microsystems Java2.

Data Base

Power PlantSimulator

Operator Interface

Factored MDP

Operator

Process

Operator Assistant

Incertidumbre - MDP, L.E. Sucar 89

Experimental Results

The transition model was successfully induced by using K2 and EM algorithms (Elvira).

Incertidumbre - MDP, L.E. Sucar 90

Experimental Results

• Value Iteration algorithm was used to calculate the optimal policy, which converged in 12 iterations with a discount factor = 0.9.

• The experiments showed that it is possible to get important computational savings by doing dynamic programming without explicit enumeration of state space.

Incertidumbre - MDP, L.E. Sucar 91

Experimental Results

State Space

S = 61 x 81 x 23 = 384 states

VAR msf fwf pd g d

# Vals 6 2 8 2 2

Variable discretization

Parameters enumerated

a0 a1 a2 a3 Total Compilation time

Traditional MDP

147456 147456 147456 147456 589824 5.6 days

Factored MDP

175 175 204 204 758 2 mins

CPTs dimensions

Incertidumbre - MDP, L.E. Sucar 92

Experimental ResultsPolicy Behavior (Medium Load)

0

1

2

3

4

5

1 9 17 25 33 41 49 57 65 73 81 89 97 105

113

121

129

137

145

153

No of samples (500 ms time step)

Act

ion

control

discreteFactoredMDP

In many cases, control commands and MDP commands seems to be similar. The difference is that the MDP sets up the plant on the operation curve faster.

Incertidumbre - MDP, L.E. Sucar 93

Task Coordination

• A complex robotic task, such as message delivery, requires several capabilities:– Path planning– Obstacle avoidance– Localization– Mapping– Person finding– Speech synthesis and recognition– Gesture generation– …

Incertidumbre - MDP, L.E. Sucar 94

Task Coordination

• Each task can be implemented fairly independent as a software module

• Challenge: how to integrate and coordinate these modules so the robot performs the “best” actions in each situation

• Our solution: MS-MDP –Multiply Sectioned Markov Decision Processes, that can be specified and solved independently, and executed concurrently to select the best actions according to the optimal policy

Incertidumbre - MDP, L.E. Sucar 95

MS-MDPs

• We partition the global task into a number of subtasks, so each subtask is assigned to an MDP an each one is solved independently– The actions for each MDP are independent and

can be performed concurrently– There is no conflict bewteen the actions of

different MDPs– All the MDPs have a common goal (reward)

Incertidumbre - MDP, L.E. Sucar 96

MS-MDPs

• We solve each MDP independently (off-line) and execute the optimal policy for each one concurrently (on-line)

• The MDPs are coordinated by a common state vector – each only needs to consider the state variables that are relevant for its subtask, this reduces the complexity of the model

• Each MDP only considers its actions, which implies a further reduction in complexity

Incertidumbre - MDP, L.E. Sucar 97

MS-MDPs

• Advantages:– Reduction in complexity– Easier to build or learn the models– Concurrent actions– Modularity

• Current limitations:– No guarantee of global optimality– Does not consider action conflicts

Incertidumbre - MDP, L.E. Sucar 98

Homer

• RWI B-14 robot• Bumblebee stereo vision

camera• LCD display – animated face• “Head” – pan tilt unit• Omnidirectional microphone• 4 on-board computers,

interconnect with a 100Mbps LAN

• Wireless comm. to external computers at 10Mbps

Incertidumbre - MDP, L.E. Sucar 99

Homer: “head”

Incertidumbre - MDP, L.E. Sucar 100

Homer: Software Architecture

Incertidumbre - MDP, L.E. Sucar 101

Message Delivery

• Homer explores the environment looking for a sender• A sender is detected by speech or vision• Homer asks for the receiver and sender name, and the

message• Homer goes to the receiver expected location (model of

the environment –map)• When the potential receiver is detected, Homer confirms

and delivers the message• If not, it continues looking for the receiver or it aborts and

looks for a new message• At the same time, Homer keeps localized in the map and

will go home if its battery is low

Incertidumbre - MDP, L.E. Sucar 102

Message Delivery – subtasks • Navigator

• Dialogue manager

• Gesture generator

Locali-zation

UserLoc.

SpeechGen.

N D G

Naviga-tion

GestureGen.

Incertidumbre - MDP, L.E. Sucar 103

MDPs for message delivery

• Navigator– Explore– Navigate– Localize– Get new goal– Go home– Wait

• Dialogue– Ask– Confirm– Give message

• Gesture– Neutral– Happy– Sad– Angry

Incertidumbre - MDP, L.E. Sucar 104

State variables

• Has message• Receiver name• Sender name• At location• Has location• Location unreachable• Receiver unreachable

• Battery low• Uncertain location• Voice heard• Person close• Called Homer• Yes/No

Incertidumbre - MDP, L.E. Sucar 105

Experiments

1. Person approached• D: ask• G: smile

2. Message received• N: navigate• D: mute• G: neutral

3. Position uncertain• N: localize

Incertidumbre - MDP, L.E. Sucar 106

Experiments

3. Deliver message• N: wait• D: deliver• G: smile

4. Battery low-go home

• N: go home

Incertidumbre - MDP, L.E. Sucar 107

Demo 5: Homer’s video

Demo

Herramienta en MatLab

Incertidumbre - MDP, L.E. Sucar 109

Referencias

• [Russell & Norvig] – Cap. 17

• H. A. Taha, “Investigación de Operaciones”, Alfaomega, 1991 – Cap. 14

• M. Puterman, “Markov Decision Processes”, Wiley, 1994.

Incertidumbre - MDP, L.E. Sucar 110

BibliographyClassic papers:

• Blythe, J., 1999, Decision –Theoretic Planning. AAAI. AI Magazine, 37-54.

• C. Boutilier, T. Dean, and S. Hanks. Decision-theoretic planning: structural assumptions and computational leverage. Journal of Artificial Intelligence Research, 11:1–94, 1999

• D. Suc and I. Bratko. Qualitative reverse engineering. In Proceedings of the 19th International Conference on Machine Learning, 2000.

• E. Morales. Scaling up reinforcement learning with a relation representation.pages 15–26. Proc. of the Workshop on Adaptability in Multi-agent Systems (AORC-2003), 2003.

Incertidumbre - MDP, L.E. Sucar 111

BibliographyClassic papers:

• J. Hoey, R. St-Aubin, A. Hu, and C. Boutilier. Spudd: Stochastic planning using decision diagrams. In Proceedings of the 15th Conference on Uncertainty in Artificial Intelligence, UAI-99, pages 279–288, 1999.

• K. Forbus. Qualitative process theory. Artificial Intelligence, 24, 1984.

• R.S. Sutton and A.G. Barto. Reinforcement Learning: An Introduction. 1998.

Incertidumbre - MDP, L.E. Sucar 112

BibliographyOur papers:

• P. Elinas, E. Sucar, A. Reyes and J. Hoey; A decision theoretic approach to task coordination in social robots, IEEE International Workshop on Robots and Human Interactive Communications RO-MAN 04; Japan 2004. Demo Videos.

• A. Reyes, P. H. Ibarguengoytia, L. E. Sucar; Power Plant Operator Assistant: An Industrial Application of Factored MDPs; Mexican International Conference on Artificial Intelligence (MICAI-04); Mexico City; April 2004.

• A. Reyes, L. E. Sucar, E. Morales, P. H. Ibarguengoytia; Abstract MDPs using Qualitative Change Predicates: An Application in Power Generation; Planning under Uncertainty in Real-World Problems Workshop. Neural Information Processing Systems (NIPS-03), Vancouver CA, Winter 2003. Poster.

Incertidumbre - MDP, L.E. Sucar 113

BibliographyOur papers:

• A. Reyes, L. E. Sucar, P. Ibarguengoytia; Power Plant Operator Assistant; Bayesian Modeling Applications Workshop in the 19th Conference on Uncertainty in Artificial Intelligence UAI-03, Acapulco-Mexico, August 2003.

• A. Reyes, M.A. Delgadillo, P. H. Ibarguengoytia; An Intelligent Assistant for Obtaining the Optimal Policy during Operation Transients in a HRSG; 13th Annual Joint ISA POWID/ EPRI Controls and Instrumentation Conference; Williamsburg, Virginia, June 2003.

• Ibargüengoytia P. H., Reyes A. 2001. Continuous Planning for The Operation of Power Plants, Memorias del Encuentro Nacional de Computación ENC 2001, Aguscalientes-Mexico.

Incertidumbre - MDP, L.E. Sucar 115

Actividades

• Ejercicio de MDPs en Matlab (ver página)

• Proyecto final