![Page 1: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/1.jpg)
1
Construction de comportements intelligents
Présentation ISN 2017 - 30/03/2017
Vincent THOMAS – Université de [email protected]
https://members.loria.fr/VThomas/mediation/ISN_planif
![Page 2: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/2.jpg)
2
Principe
● Construire bribes intelligence● Relativement simple ● Solution à des besoins étudiants● Nombreux exemples
● Agent intelligent / prise de décision
● 3 idées fortes● Représenter un problème => MDP deterministe● Propriétés de la solution => Equation Bellman● Résolution du problème => Value iteration
![Page 3: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/3.jpg)
3
Plan
● Problème de prise de décision séquentiel● Exemples
● (1) Représenter un problème● (2) Equation de Bellman● (3) Algorithme de résolution
● Perspectives
![Page 4: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/4.jpg)
4
Boucle perception-action
Agent Environnement
Perception
Action
Decision
Un agent intelligent est une entité réelle ou artificielle, dotée de capteurs et d'effecteurs, capable d'agir de
manière autonome grâce à une fonction de décision
![Page 5: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/5.jpg)
5
Boucle perception-action (simple)
Agent Environnement
Etat systeme
Action
Decision
Un agent intelligent est une entité réelle ou artificielle, dotée de capteurs et d'effecteurs, capable d'agir de
manière autonome grâce à une fonction de décision
Agent voit tout
![Page 6: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/6.jpg)
6
Plan
● Problème de prise de décision séquentiel● Exemples
● (1) Représenter un problème● (2) Equation de Bellman● (3) Algorithme de résolution
● Perspectives
![Page 7: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/7.jpg)
7
Exemple - Labyrinthe
● Labyrinthe● Déplacer
● Atteindre sortie
● Prise décision sequentielle
![Page 8: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/8.jpg)
8
Exemple - Sokoban
● Sokoban● Déplacer● Pousser caisses
● Amener objectif
● Prise de décision séquentielle
Sokoban touch
![Page 9: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/9.jpg)
9
Exemple – Robot café
● Robot cafe● 3 salles● Robot se déplace● Café dans cuisine
● Objectif● Ramener un café
● Prise de décision sequentielle
Pièce 1 Pièce 2 Pièce 3
![Page 10: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/10.jpg)
10
Plan
● Problème de prise de décision séquentiel● Exemples
● (1) Représenter un problème● (2) Equation de Bellman● (3) Algorithme de résolution
● Perspectives
![Page 11: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/11.jpg)
11
Exemple robot-Cafe
● 3 pièces qui se suivent● Cuisine au bout du couloir● Pièce représentée par indices● Ramener café pièce 1
Pièce 1 Pièce 2 Pièce 3
![Page 12: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/12.jpg)
12
Exemple robot-Cafe
Pièce 1 Pièce 2 Pièce 3
● Elements utiles ?
![Page 13: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/13.jpg)
13
Exemple robot-Cafe
● Elements utiles ?● Actions● Etats● Dynamique ● Objectif
Pièce 1 Pièce 2 Pièce 3
![Page 14: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/14.jpg)
14
Exemple robot-Cafe
● Elements utiles ?● Actions => gauche, droite, prendre, poser● Etats => (p1,0) (p2,0) (p3,0) (p1,1) (p2,1) (p3,1)● Dynamique => fonction T : S x A --> S● Objectif => fonction rec : S x A --> Reel
Pièce 1 Pièce 2 Pièce 3
![Page 15: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/15.jpg)
15
Problème générique
class Probleme: """"permet de definir un probleme"""
def actions(self): """returne la liste d'actions""" return ([])
def etats(self): """returne la liste d'etats""" return ([])
def transition(self,s,a): """definit les consequence d une action""" return(s)
def recompense(self,s,a,sarr): """definit la recompense obtenue""" return(0)
![Page 16: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/16.jpg)
16
Problème RobotCafeclass Cafe: def actions(self): return(['gauche','droite','prendre','poser'])
def etats(self): return([(1,0),(1,1),(2,0),(2,1),(3,0),(3,1)]) def transition(self,s,a): pos=s[0]; cafe=s[1]; if (a=='gauche'): if (pos>1): pos=pos-1 if (a=='droite'): if (pos<3): pos=pos+1 if (a=='prendre'): if (pos==3): cafe=1 if (a=='poser'): cafe=0 return(pos,cafe)
def recompense(self,s,a,sarr): if (s[0]==1) and (s[1]==1) and (a=='poser'): return(100) return(-1)
![Page 17: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/17.jpg)
17
Représentation graphe
p = 1 – cafe =0 p = 2 – cafe =0 p = 3 – cafe =0
p = 1 – cafe = 1 p = 2 – cafe = 1 p = 3 – cafe = 1
![Page 18: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/18.jpg)
18
Représentation graphe
p = 1 – cafe =0 p = 2 – cafe =0 p = 3 – cafe =0
droite droite
gauche gauche
p = 1 – cafe = 1 p = 2 – cafe = 1 p = 3 – cafe = 1
droite droite
gauche gauche
droite
gauche
gauche
droite
![Page 19: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/19.jpg)
19
Représentation graphe
p = 1 – cafe =0 p = 2 – cafe =0 p = 3 – cafe =0
droite droite
gauche gauche
p = 1 – cafe = 1 p = 2 – cafe = 1 p = 3 – cafe = 1
droite droite
gauche gauche
droite
gauche
gauche
droite
poser prendreposer+100
![Page 20: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/20.jpg)
20
Comportement agent
● Fonction politique π : S -> A● Boucle fermée● Un exemple avec cafeRobot
● Comportement● Dans s● Choix a selon π(s)● Etat s' selon T(s,a)
Etat -> Action
P1, c0 « Droite »
P1, c1 « Gauche »
P2, c0 « Droite »
P2, c1 « Droite »
P3, c0 « Prendre »
P3, c1 «Gauche »
s’ = T(s,a)r = r(s,a)
s
a
pi(s)
![Page 21: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/21.jpg)
21
Code python execution agentpb=Cafe()
pi={}pi[(1,0)]='droite'pi[(1,1)]='gauche'pi[(2,0)]='droite'pi[(2,1)]='droite'pi[(3,0)]='prendre'pi[(3,1)]='gauche'
print("*** test execution ***")systemExec = SystemeExecute(pb)systemExec.executerPi(pi,(1,0),10)
p1 c0 p2 c0 p3 c0
d d
g g
p1 c1 p2 c1 p3 c1
d d
g g
d
g
g
d
poser prendreposer
![Page 22: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/22.jpg)
22
Code python execution agentpb=Cafe()
pi={}pi[(1,0)]='droite'pi[(1,1)]='gauche'pi[(2,0)]='droite'pi[(2,1)]='droite'pi[(3,0)]='prendre'pi[(3,1)]='gauche'
print("*** test execution ***")systemExec = SystemeExecute(pb)systemExec.executerPi(pi,(1,0),10)
p1 c0 p2 c0 p3 c0
d d
g g
p1 c1 p2 c1 p3 c1
d d
g g
d
g
g
d
poser prendreposer
![Page 23: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/23.jpg)
23
Code python execution agentpb=Cafe()
pi={}pi[(1,0)]='droite'pi[(1,1)]='gauche'pi[(2,0)]='droite'pi[(2,1)]='droite'pi[(3,0)]='prendre'pi[(3,1)]='gauche'
print("*** test execution ***")systemExec = SystemeExecute(pb)systemExec.executerPi(pi,(1,0),10)
p1 c0 p2 c0 p3 c0
d d
g g
p1 c1 p2 c1 p3 c1
d d
g g
d
g
g
d
poser prendreposer
![Page 24: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/24.jpg)
24
Code python execution agentpb=Cafe()
pi={}pi[(1,0)]='droite'pi[(1,1)]='gauche'pi[(2,0)]='droite'pi[(2,1)]='droite'pi[(3,0)]='prendre'pi[(3,1)]='gauche'
print("*** test execution ***")systemExec = SystemeExecute(pb)systemExec.executerPi(pi,(1,0),10)
p1 c0 p2 c0 p3 c0
d d
g g
p1 c1 p2 c1 p3 c1
d d
g g
d
g
g
d
poser prendreposer
![Page 25: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/25.jpg)
25
Code python execution agentpb=Cafe()
pi={}pi[(1,0)]='droite'pi[(1,1)]='gauche'pi[(2,0)]='droite'pi[(2,1)]='droite'pi[(3,0)]='prendre'pi[(3,1)]='gauche'
print("*** test execution ***")systemExec = SystemeExecute(pb)systemExec.executerPi(pi,(1,0),10)
p1 c0 p2 c0 p3 c0
d d
g g
p1 c1 p2 c1 p3 c1
d d
g g
d
g
g
d
poser prendreposer
![Page 26: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/26.jpg)
26
Code python execution agentpb=Cafe()
pi={}pi[(1,0)]='droite'pi[(1,1)]='gauche'pi[(2,0)]='droite'pi[(2,1)]='droite'pi[(3,0)]='prendre'pi[(3,1)]='gauche'
print("*** test execution ***")systemExec = SystemeExecute(pb)systemExec.executerPi(pi,(1,0),10)
p1 c0 p2 c0 p3 c0
d d
g g
p1 c1 p2 c1 p3 c1
d d
g g
d
g
g
d
poser prendreposer
![Page 27: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/27.jpg)
27
Code python execution agentpb=Cafe()
pi={}pi[(1,0)]='droite'pi[(1,1)]='gauche'pi[(2,0)]='droite'pi[(2,1)]='droite'pi[(3,0)]='prendre'pi[(3,1)]='gauche'
print("*** test execution ***")systemExec = SystemeExecute(pb)systemExec.executerPi(pi,(1,0),10)
p1 c0 p2 c0 p3 c0
d d
g g
p1 c1 p2 c1 p3 c1
d d
g g
d
g
g
d
poser prendreposer
![Page 28: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/28.jpg)
28
Code python execution agentpb=Cafe()
pi={}pi[(1,0)]='droite'pi[(1,1)]='gauche'pi[(2,0)]='droite'pi[(2,1)]='droite'pi[(3,0)]='prendre'pi[(3,1)]='gauche'
print("*** test execution ***")systemExec = SystemeExecute(pb)systemExec.executerPi(pi,(1,0),10)
p1 c0 p2 c0 p3 c0
d d
g g
p1 c1 p2 c1 p3 c1
d d
g g
d
g
g
d
poser prendreposer
![Page 29: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/29.jpg)
29
Code python execution agent
class SystemeExecute:
def __init__(self,pb): self.pb=pb
def executerPi(self,pi,depart,nb): s=depart for i in range(nb): action=pi[s] sFin=pb.transition(s,action) print(s," -> ",action," : ",sFin) s=sFin
pb=Cafe()
pi={}pi[(1,0)]='droite'pi[(1,1)]='gauche'pi[(2,0)]='droite'pi[(2,1)]='droite'pi[(3,0)]='prendre'pi[(3,1)]='gauche'
print("*** test execution ***")systemExec = SystemeExecute(pb)systemExec.executerPi(pi,(1,0),10)
![Page 30: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/30.jpg)
30
Code python execution agent
class SystemeExecute:
def __init__(self,pb): self.pb=pb
def executerPi(self,pi,depart,nb): s=depart for i in range(nb): action=pi[s] sFin=pb.transition(s,action) print(s," -> ",action," : ",sFin) s=sFin
p1 c0 p2 c0 p3 c0
d d
g g
p1 c1 p2 c1 p3 c1
d d
g g
d
g
g
d
poser prendreposer
![Page 31: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/31.jpg)
31
Code python execution agentpb=Cafe()
pi={}pi[(1,0)]='droite'pi[(1,1)]='gauche'pi[(2,0)]='droite'pi[(2,1)]='droite'pi[(3,0)]='prendre'pi[(3,1)]='gauche'
print("*** test execution ***")systemExec = SystemeExecute(pb)systemExec.executerPi(pi,(1,0),10)
p1 c0 p2 c0 p3 c0
d d
g g
p1 c1 p2 c1 p3 c1
d d
g g
d
g
g
d
poser prendreposer
![Page 32: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/32.jpg)
32
Code python execution agentpb=Cafe()
pi={}pi[(1,0)]='droite'pi[(1,1)]='gauche'pi[(2,0)]='droite'pi[(2,1)]='droite'pi[(3,0)]='prendre'pi[(3,1)]='gauche'
print("*** test execution ***")systemExec = SystemeExecute(pb)systemExec.executerPi(pi,(1,0),10)
p1 c0 p2 c0 p3 c0
d d
g g
p1 c1 p2 c1 p3 c1
d d
g g
d
g
g
d
poser prendreposer
-1
Récompense reçue
![Page 33: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/33.jpg)
33
Code python execution agentpb=Cafe()
pi={}pi[(1,0)]='droite'pi[(1,1)]='gauche'pi[(2,0)]='droite'pi[(2,1)]='droite'pi[(3,0)]='prendre'pi[(3,1)]='gauche'
print("*** test execution ***")systemExec = SystemeExecute(pb)systemExec.executerPi(pi,(1,0),10)
p1 c0 p2 c0 p3 c0
d d
g g
p1 c1 p2 c1 p3 c1
d d
g g
d
g
g
d
poser prendreposer
-1
![Page 34: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/34.jpg)
34
Code python execution agentpb=Cafe()
pi={}pi[(1,0)]='droite'pi[(1,1)]='gauche'pi[(2,0)]='droite'pi[(2,1)]='droite'pi[(3,0)]='prendre'pi[(3,1)]='gauche'
print("*** test execution ***")systemExec = SystemeExecute(pb)systemExec.executerPi(pi,(1,0),10)
p1 c0 p2 c0 p3 c0
d d
g g
p1 c1 p2 c1 p3 c1
d d
g g
d
g
g
d
poser prendreposer
-1
![Page 35: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/35.jpg)
35
Code python execution agentpb=Cafe()
pi={}pi[(1,0)]='droite'pi[(1,1)]='gauche'pi[(2,0)]='droite'pi[(2,1)]='droite'pi[(3,0)]='prendre'pi[(3,1)]='gauche'
print("*** test execution ***")systemExec = SystemeExecute(pb)systemExec.executerPi(pi,(1,0),10)
p1 c0 p2 c0 p3 c0
d d
g g
p1 c1 p2 c1 p3 c1
d d
g g
d
g
g
d
poser prendreposer
-1
![Page 36: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/36.jpg)
36
Code python execution agentpb=Cafe()
pi={}pi[(1,0)]='droite'pi[(1,1)]='gauche'pi[(2,0)]='droite'pi[(2,1)]='droite'pi[(3,0)]='prendre'pi[(3,1)]='gauche'
print("*** test execution ***")systemExec = SystemeExecute(pb)systemExec.executerPi(pi,(1,0),10)
p1 c0 p2 c0 p3 c0
d d
g g
p1 c1 p2 c1 p3 c1
d d
g g
d
g
g
d
poser prendreposer
-1
![Page 37: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/37.jpg)
37
Code python execution agentpb=Cafe()
pi={}pi[(1,0)]='droite'pi[(1,1)]='gauche'pi[(2,0)]='droite'pi[(2,1)]='droite'pi[(3,0)]='prendre'pi[(3,1)]='gauche'
print("*** test execution ***")systemExec = SystemeExecute(pb)systemExec.executerPi(pi,(1,0),10)
p1 c0 p2 c0 p3 c0
d d
g g
p1 c1 p2 c1 p3 c1
d d
g g
d
g
g
d
poser prendreposer
-1
![Page 38: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/38.jpg)
38
Code python execution politique
● Récupére la somme des récompenses
● Définition● π donné, performance Perf (π , s0)=∑trajectoire
γt∗rt
p1 c0 p2 c0 p3 c0
d d
g g
p1 c1 p2 c1 p3 c1
d d
g g
d
g
g
d
poser prendreposer
Perf (π ,(1,0))=−1+(−1)∗γ+(−1)∗γ2+(−1)∗γ
3+ ...
![Page 39: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/39.jpg)
39
Code python execution politiqueclass SystemeExecute: def __init__(self,pb): self.pb=pb
def executerPi(self,pi,depart,nb): s=depart for i in range(nb): action=pi[s] sFin=pb.transition(s,action) print(s," -> ",action," : ",sFin) s=sFin
def executerPiRec(self,pi,depart,nb): s=depart gamma=0.99 somme=0 for i in range(nb): action=pi[s] sFin=pb.transition(s,action) r=pb.recompense(s,action,sFin) somme=somme + (gamma**i)*r print(s," -> ",action," : ",sFin,"<",r,">") s=sFin return somme
![Page 40: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/40.jpg)
40
Code python execution politiqueclass SystemeExecute: def __init__(self,pb): self.pb=pb
def executerPi(self,pi,depart,nb): s=depart for i in range(nb): action=pi[s] sFin=pb.transition(s,action) print(s," -> ",action," : ",sFin) s=sFin
def executerPiRec(self,pi,depart,nb): s=depart gamma=0.99 somme=0 for i in range(nb): action=pi[s] sFin=pb.transition(s,action) r=pb.recompense(s,action,sFin) somme=somme + (gamma**i)*r print(s," -> ",action," : ",sFin,"<",r,">") s=sFin return somme
![Page 41: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/41.jpg)
41
Resultat execution
*** test execution recompense ***(1, 0) -> droite : (2, 0) < -1 >(2, 0) -> droite : (3, 0) < -1 >(3, 0) -> prendre : (3, 1) < -1 >(3, 1) -> gauche : (2, 1) < -1 >(2, 1) -> droite : (3, 1) < -1 >(3, 1) -> gauche : (2, 1) < -1 >(2, 1) -> droite : (3, 1) < -1 >(3, 1) -> gauche : (2, 1) < -1 >(2, 1) -> droite : (3, 1) < -1 >(3, 1) -> gauche : (2, 1) < -1 >somme: -9.561792499119552
Etat -> Action
P1, c0 « Droite »
P1, c1 « Gauche »
P2, c0 « Droite »
P2, c1 « Droite »
P3, c0 « Prendre »
P3, c1 «Gauche »
p1 c0 p2 c0 p3 c0
d d
g g
p1 c1 p2 c1 p3 c1
d d
g g
d
g
g
d
poser prendreposer
![Page 42: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/42.jpg)
42
Politique
● Meilleure politique ?
Etat -> Action
P1, c0 « Droite »
P1, c1 « Gauche »
P2, c0 « Droite »
P2, c1 « Droite »
P3, c0 « Prendre »
P3, c1 « Gauche »
p1 c0 p2 c0 p3 c0
d d
g g
p1 c1 p2 c1 p3 c1
d d
g g
d
g
g
d
poser prendreposer
![Page 43: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/43.jpg)
43
Politique
● Meilleure politique ?
Etat -> Action
P1, c0 « Droite »
P1, c1 « Gauche »
P2, c0 « Droite »
P2, c1 « Gauche »
P3, c0 « Prendre »
P3, c1 « Gauche »
p1 c0 p2 c0 p3 c0
d d
g g
p1 c1 p2 c1 p3 c1
d d
g g
d
g
g
d
poser prendreposer
![Page 44: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/44.jpg)
44
Politique
● Meilleure politique ?
Etat -> Action
P1, c0 « Droite »
P1, c1 « Poser »
P2, c0 « Droite »
P2, c1 « Gauche »
P3, c0 « Prendre »
P3, c1 « Gauche »
p1 c0 p2 c0 p3 c0
d d
g g
p1 c1 p2 c1 p3 c1
d d
g g
d
g
g
d
poser prendreposer
![Page 45: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/45.jpg)
45
Resultat execution
*** test execution recompense ***(1, 0) -> droite : (2, 0) < -1 >(2, 0) -> droite : (3, 0) < -1 >(3, 0) -> prendre : (3, 1) < -1 >(3, 1) -> gauche : (2, 1) < -1 >(2, 1) -> gauche : (1, 1) < -1 >(1, 1) -> poser : (1, 0) < 100 >(1, 0) -> droite : (2, 0) < -1 >(2, 0) -> droite : (3, 0) < -1 >(3, 0) -> prendre : (3, 1) < -1 >(3, 1) -> gauche : (2, 1) < -1 >somme: 86.48820254078045
Etat -> Action
P1, c0 « Droite »
P1, c1 « Poser »
P2, c0 « Droite »
P2, c1 « Gauche »
P3, c0 « Prendre »
P3, c1 « Gauche »
p1 c0 p2 c0 p3 c0
d d
g g
p1 c1 p2 c1 p3 c1
d d
g g
d
g
g
d
poser prendreposer
![Page 46: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/46.jpg)
46
Politique
● Meilleure politique ?
Etat -> Action
P1, c0 « Droite »
P1, c1 « Poser »
P2, c0 « Droite »
P2, c1 « Gauche »
P3, c0 « Prendre »
P3, c1 « Gauche »
p1 c0 p2 c0 p3 c0
d d
g g
p1 c1 p2 c1 p3 c1
d d
g g
d
g
g
d
poser prendreposer
Notre objectif : Algorithme pour construire automatiquement
![Page 47: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/47.jpg)
47
Idee forte – représenter pb
● Problème (Markov Decision Process déterministe)● Ensemble d'états S● Ensemble d'actions A● Fonction transition T : S x A -> S● Fonction récompense r : S x A -> Reel
● Cherche π : S -> A● Maximise somme
● Représente de trés nombreux problèmes
Perf (π , s0)=∑trajectoireγt∗r t
Idée 1
![Page 48: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/48.jpg)
48
Idee forte – représenter pb
● Problème (Markov Decision Process déterministe)● Ensemble d'états S● Ensemble d'actions A● Fonction transition T : S x A -> S● Fonction récompense r : S x A -> Reel
● Cherche π : S -> A● Maximise somme
● Représente de trés nombreux problèmes
Perf (π , s0)=∑trajectoireγt∗r t
Idée 1
Question BONUS
Combien de politiques différentes ???
![Page 49: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/49.jpg)
49
Plan
● Problème de prise de décision séquentiel● Exemples
● (1) Représenter un problème● (2) Equation de Bellman● (3) Algorithme de résolution
● Perspectives
![Page 50: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/50.jpg)
50
Equation de bellman
● Principe d'optimalité● Propriété que vérifie la politique ● Fonction de valeur optimale Q*(s,a)
– Ce que je peux attendre en partant de s en faisant a– Puis en suivant la meilleure politique
● Equation optimalité de bellman
![Page 51: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/51.jpg)
51
Equation de bellman
● Principe d'optimalité● Propriété que vérifie la politique ● Fonction de valeur optimale Q*(s,a)
– Ce que je peux attendre en partant de s en faisant a– Puis en suivant la meilleure politique
● Equation optimalité de bellman
Ce que j'ai tout de suite Ce que j'aurai plus tard au mieuxAttentes =
![Page 52: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/52.jpg)
52
Equation de bellman
● Principe d'optimalité● Propriété que vérifie la politique ● Fonction de valeur optimale Q*(s,a)
– Ce que je peux attendre en partant de s en faisant a– Puis en suivant la meilleure politique
● Equation optimalité de bellman
Q*(s , a)=R(s , a ,T (s , a))+γmaxa 'Q*(T (s , a), a ' )
Ce que j'ai tout de suite Ce que j'aurai plus tard au mieuxAttentes =
![Page 53: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/53.jpg)
53
Facteur actuation
● Facteur actuation gamma < 1● Ratio aujourd'hui / demain
● Deuxieme Idée forte● Equation optimalité Bellman
Q*(s , a)=R(s , a ,T (s , a))+γ .maxa 'Q*(T (s , a) , a ')
Idée 2
![Page 54: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/54.jpg)
54
Facteur actuation
● Facteur actuation gamma < 1● Ratio aujourd'hui / demain
● Deuxieme Idée forte● Equation optimalité Bellman
Q*(s ,a)=R(s , a ,T (s , a))+γ .maxa 'Q*(T (s ,a) , a ')
Idée 2
Dérouler pour quelques couples (s,a)
![Page 55: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/55.jpg)
55
Représentation graphe
p = 1 – cafe =0 p = 2 – cafe =0 p = 3 – cafe =0
droite droite
gauche gauche
p = 1 – cafe = 1 p = 2 – cafe = 1 p = 3 – cafe = 1
droite droite
gauche gauche
droite
gauche
gauche
droite
poser prendreposer+100
![Page 56: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/56.jpg)
56
Plan
● Problème de prise de décision séquentiel● Exemples
● (1) Représenter un problème● (2) Equation de Bellman● (3) Algorithme de résolution
● Perspectives
![Page 57: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/57.jpg)
57
Résolution
● 1) Résolution simple● Énumérer toutes les politiques● Mais beaucoup politiques => S^A
● 2) Utiliser équation de Bellman● Calcul récursif● Mais Recalculer plein de choses (cf Markov)● Et Plein de boucles
● 3) Utiliser la programmation dynamique
![Page 58: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/58.jpg)
58
Principe algorithme
● Part de la fin● Action dispo = 0● Performance = 0
0 0 0
0 0 0
● Remonte temps● Action dispo = 1
![Page 59: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/59.jpg)
59
Principe algorithme
● Part de la fin● Action dispo = 0● Performance = 0
0 0 0
0 0 0
● Remonte temps● Action dispo = 1
Q*(s ,a)=R(s , a ,T (s , a))+γ .maxa 'Q*(T (s , a) , a ')
![Page 60: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/60.jpg)
60
Principe algorithme
● Part de la fin● Action dispo = 0● Performance = 0
0 0 0
0 0 0
● Remonte temps● Action dispo = 1
-1
Q*(s ,a)=R(s , a ,T (s , a))+γ .maxa 'Q*(T (s , a) , a ')
gauche, poser, prendre (-1)
droite (-1)
![Page 61: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/61.jpg)
61
Principe algorithme
● Part de la fin● Action dispo = 0● Performance = 0
0 0 0
0 0 0
● Remonte temps● Action dispo = 1
-1
Q*(s ,a)=R(s , a ,T (s , a))+γ .maxa 'Q*(T (s , a) , a ')
![Page 62: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/62.jpg)
62
Principe algorithme
● Part de la fin● Action dispo = 0● Performance = 0
0 0 0
0 0 0
● Remonte temps● Action dispo = 1
-1 -1
Q*(s ,a)=R(s , a ,T (s , a))+γ .maxa 'Q*(T (s , a) , a ')
gauche (-1)droite (-1)poser,prendre (-1)
![Page 63: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/63.jpg)
63
Principe algorithme
● Part de la fin● Action dispo = 0● Performance = 0
0 0 0
0 0 0
● Remonte temps● Action dispo = 1
-1 -1 -1
-1 -1
Q*(s ,a)=R(s , a ,T (s , a))+γ .maxa 'Q*(T (s , a) , a ')
![Page 64: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/64.jpg)
64
Principe algorithme
● Part de la fin● Action dispo = 0● Performance = 0
0 0 0
0 0 0
● Remonte temps● Action dispo = 1
-1 -1 -1
-1 -1
Q*(s ,a)=R(s , a ,T (s , a))+γ .maxa 'Q*(T (s , a) , a ')
gauche (-1)droite (-1)
poser (+100)
![Page 65: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/65.jpg)
65
Principe algorithme
● Part de la fin● Action dispo = 0● Performance = 0
0 0 0
0 0 0
● Remonte temps● Action dispo = 1
-1 -1 -1
100 -1 -1
Q*(s ,a)=R(s , a ,T (s , a))+γ .maxa 'Q*(T (s , a) , a ')
gauche (-1)droite (-1)
poser (+100)
![Page 66: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/66.jpg)
66
Principe algorithme
● Part de la fin● Action dispo = 0● Performance = 0
0 0 0
0 0 0
● Remonte temps● Action dispo = 1
-1 -1 -1
100 -1 -1
Q*(s ,a)=R(s , a ,T (s , a))+γ .maxa 'Q*(T (s , a) , a ')
![Page 67: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/67.jpg)
67
Principe algorithme
● Part de la fin● Action dispo = 0● Performance = 0
0 0 0
0 0 0
● Remonte temps● Action dispo = 1
-1 -1 -1
100 -1 -1
Q*(s ,a)=R(s , a ,T (s , a))+γ .maxa 'Q*(T (s , a) , a ')
![Page 68: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/68.jpg)
68
Exemple RobotCafe
(2, 0) - gauche -> -1.0 - droite -> -1.0 - prendre -> -1.0 - poser -> -1.0
(2, 1) - gauche -> -1.0 - droite -> -1.0 - prendre -> -1.0 - poser -> -1.0
(1, 0) - gauche -> -1.0 - droite -> -1.0 - prendre -> -1.0 - poser -> -1.0
(1, 1) - gauche -> -1.0 - droite -> -1.0 - prendre -> -1.0 - poser -> 100.0
(3, 0) - gauche -> -1.0 - droite -> -1.0 - prendre -> -1.0 - poser -> -1.0
(3, 1) - gauche -> -1.0 - droite -> -1.0 - prendre -> -1.0 - poser -> -1.0
● Iteration 1
p1 c0 p2 c0 p3 c0
d d
g g
p1 c1 p2 c1 p3 c1
d d
g g
d
g
g
d
poser prendreposer
![Page 69: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/69.jpg)
69
Principe algorithme
● Part de la fin● Action dispo = 1
● Remonte temps● Action dispo = 2
Q*(s ,a)=R(s , a ,T (s , a))+γ .maxa 'Q*(T (s , a) , a ')
-1 -1 -1
100 -1 -1
Pas de temps précédent
![Page 70: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/70.jpg)
70
Principe algorithme
● Part de la fin● Action dispo = 1
● Remonte temps● Action dispo = 2
Q*(s ,a)=R(s , a ,T (s , a))+γ .maxa 'Q*(T (s , a) , a ')
-1 -1 -1
100 -1 -1
Quel état intéressant t=2 ?
![Page 71: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/71.jpg)
71
Principe algorithme
● Part de la fin● Action dispo = 1
● Remonte temps● Action dispo = 2
Q*(s ,a)=R(s , a ,T (s , a))+γ .maxa 'Q*(T (s , a) , a ')
-1 -1 -1
100 -1 -1
Quel état intéressant t=2 ?
![Page 72: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/72.jpg)
72
Principe algorithme
● Part de la fin● Action dispo = 1
● Remonte temps● Action dispo = 2
Q*(s , a)=R(s , a ,T (s , a))+γ .maxa 'Q*(T (s , a) , a ')
-1 -1 -1
100 -1 -1
gauche (-1)
![Page 73: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/73.jpg)
73
Principe algorithme
● Part de la fin● Action dispo = 1
● Remonte temps● Action dispo = 2
Q*(s ,a)=R(s , a ,T (s , a))+γ .maxa 'Q*(T (s , a) , a ')
-1 -1 -1
100 -1 -1 98
gauche (-1)
![Page 74: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/74.jpg)
74
Principe algorithme
● Continue à remonter le temps● À chaque pas de temps, applique Bellman
Q*(s ,a)=R(s , a ,T (s , a))+γ .maxa 'Q*(T (s ,a) , a ')
-1 -1 -1
100 -1 -1
-2 -2 -2
100 98 -2
![Page 75: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/75.jpg)
75
Exemple2 – chercheur or (fin diapos)
● 3 etats: ● Chemin (C), Mine gauche/droite (MG/MD)
● 2 actions: ● Gauche (G), droite (D)
MG C MD
+3+8
+1
![Page 76: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/76.jpg)
76
Value iteration
● Repeter pour t● Chaque état et chaque action
–
● Principe● Initialiser avec Q*=0● Remonter le temps
– Q*(t+1) dépend de la valeur de l'état d'arrivée● Preuve de converge (pas magique => discussion)
● Python : Q = dictionnaire (etat,action) -> valeur
Qt+1*
(s , a)=R(s ,a ,T (s , a))+γ .maxa 'Qt*(T (s , a) , a ')
Idée 3
![Page 77: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/77.jpg)
77
ValueIteration - commentairesdef valueIteration(self,nb,gamma):
# initialiser Qvaleurs # faire nb iterations
# executer une Maj de Q# retourner Q
def executerUneIteration(self,Q,gamma):# initialiser Q2# pour chaque etat
# pour chaque action# calculer arrivee et recompense# cherche max arrivee# Mise à jour Q2Q2[(etat,action)]=r+gamma*max
# retourne resultat Q2
def calculerMax(self,Q,sArriv):# pour chaque action
# si c'est mieux que max, stocker max# retourner max
![Page 78: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/78.jpg)
78
ValueIteration
def valueIteration(self,nb,gamma): Q=self.initialiserQ() #nb iteration iteration for i in range(0,nb): Q=self.executerUneIteration(Q,gamma) return(Q)
def initialiserQ(self): Q={} for s in self.pb.etats(): for a in self.pb.actions(): Q[(s,a)]=0 return Q
![Page 79: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/79.jpg)
79
ValueIteration
def executerUneIteration(self,Q,gamma): Q2={} #pour chaque etat,action for etat in self.pb.etats(): for action in self.pb.actions(): #calculer arrivee sArriv=self.pb.transition(etat,action) r=self.pb.recompense(etat,action,sArriv) # cherche max arrivee max=self.calculerMax(Q,sArriv) #mise à jour Q2[(etat,action)]=r+gamma*max
#retourne resultat return(Q2)
def calculerMax(self,Q,sArriv): max=-100000 for actionMax in self.pb.actions(): if (Q[(sArriv,actionMax)]>max): max=Q[(sArriv,actionMax)] return(max)
![Page 80: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/80.jpg)
80
Code pythondef valueIteration(self,nb,gamma): Q={} for s in self.pb.etats(): for a in self.pb.actions(): Q[(s,a)]=0 #une iteration for i in range(0,nb): Q2={} #pour chaque etat,action for etat in self.pb.etats(): for action in self.pb.actions(): #calculer arrivee sArriv=self.pb.transition(etat,action) r=self.pb.recompense(etat,action,sArriv) # cherche max arrivee max=-100000 for actionMax in self.pb.actions(): if (Q[(sArriv,actionMax)]>max): max=Q[(sArriv,actionMax)] #mise à jour Q2[(etat,action)]=r+gamma*max #on augmente iteration Q=Q2 return(Q)
![Page 81: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/81.jpg)
81
Politique optimale
● Théorème : Value iteration converge● Preuve : Fonction recurrente contractante
● Politique optimale● Choisir action max Q* ==> π(s) = Argmax (Q*(s,a))
def politiqueFromQ(self,Q):pi={}# pour chaque étatfor etat in self.pb.etats():
max = -100000amax = ''# cherche le maximumfor actionMax in self.pb.actions():
if (Q[(etat,actionMax)]>max):max=Q[(etat,actionMax)]amax=actionMax
pi[etat]=amaxreturn(pi)
![Page 82: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/82.jpg)
82
Exemple RobotCafe
(2, 0) - gauche -> 0 - droite -> 0 - prendre -> 0 - poser -> 0
(2, 1) - gauche -> 0 - droite -> 0 - prendre -> 0 - poser -> 0
(1, 0) - gauche -> 0 - droite -> 0 - prendre -> 0 - poser -> 0
(1, 1) - gauche -> 0 - droite -> 0 - prendre -> 0 - poser -> 0
(3, 0) - gauche -> 0 - droite -> 0 - prendre -> 0 - poser -> 0
(3, 1) - gauche -> 0 - droite -> 0 - prendre -> 0 - poser -> 0
● Iteration 0
p1 c0 p2 c0 p3 c0
d d
g g
p1 c1 p2 c1 p3 c1
d d
g g
d
g
g
d
poser prendreposer
![Page 83: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/83.jpg)
83
Exemple RobotCafe
(2, 0) - gauche -> -1.0 - droite -> -1.0 - prendre -> -1.0 - poser -> -1.0
(2, 1) - gauche -> -1.0 - droite -> -1.0 - prendre -> -1.0 - poser -> -1.0
(1, 0) - gauche -> -1.0 - droite -> -1.0 - prendre -> -1.0 - poser -> -1.0
(1, 1) - gauche -> -1.0 - droite -> -1.0 - prendre -> -1.0 - poser -> 100.0
(3, 0) - gauche -> -1.0 - droite -> -1.0 - prendre -> -1.0 - poser -> -1.0
(3, 1) - gauche -> -1.0 - droite -> -1.0 - prendre -> -1.0 - poser -> -1.0
● Iteration 1
p1 c0 p2 c0 p3 c0
d d
g g
p1 c1 p2 c1 p3 c1
d d
g g
d
g
g
d
poser prendreposer
![Page 84: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/84.jpg)
84
Exemple RobotCafe
(2, 0) - gauche -> -1.99 - droite -> -1.99 - prendre -> -1.99 - poser -> -1.99
(2, 1) - gauche -> 98.0 - droite -> -1.99 - prendre -> -1.99 - poser -> -1.99
(1, 0) - gauche -> -1.99 - droite -> -1.99 - prendre -> -1.99 - poser -> -1.99
(1, 1) - gauche -> 98.0 - droite -> -1.99 - prendre -> 98.0 - poser -> 99.01
(3, 0) - gauche -> -1.99 - droite -> -1.99 - prendre -> -1.99 - poser -> -1.99
(3, 1) - gauche -> -1.99 - droite -> -1.99 - prendre -> -1.99 - poser -> -1.99
● Iteration 2
p1 c0 p2 c0 p3 c0
d d
g g
p1 c1 p2 c1 p3 c1
d d
g g
d
g
g
d
poser prendreposer
![Page 85: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/85.jpg)
85
Exemple RobotCafe
(2, 0) - gauche -> -2.97 - droite -> -2.97 - prendre -> -2.97 - poser -> -2.97
(2, 1) - gauche -> 97.02 - droite -> -2.97 - prendre -> 96.02 - poser -> -2.97
(1, 0) - gauche -> -2.97 - droite -> -2.97 - prendre -> -2.97 - poser -> -2.97
(1, 1) - gauche -> 97.02 - droite -> 96.02 - prendre -> 97.02 - poser -> 98.03
(3, 0) - gauche -> -2.97 - droite -> -2.97 - prendre -> -2.97 - poser -> -2.97
(3, 1) - gauche -> 96.02 - droite -> -2.97 - prendre -> -2.97 - poser -> -2.97
● Iteration 3
p1 c0 p2 c0 p3 c0
d d
g g
p1 c1 p2 c1 p3 c1
d d
g g
d
g
g
d
poser prendreposer
![Page 86: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/86.jpg)
86
Exemple RobotCafe
(2, 0) - gauche -> -3.94 - droite -> -3.94 - prendre -> -3.94 - poser -> -3.94
(2, 1) - gauche -> 96.05 - droite -> 94.06 - prendre -> 95.05 - poser -> -3.94
(1, 0) - gauche -> -3.94 - droite -> -3.94 - prendre -> -3.94 - poser -> -3.94
(1, 1) - gauche -> 96.05 - droite -> 95.05 - prendre -> 96.05 - poser -> 97.06
(3, 0) - gauche -> -3.94 - droite -> -3.94 - prendre -> 94.06 - poser -> -3.94
(3, 1) - gauche -> 95.05 - droite -> 94.06 - prendre -> 94.06 - poser -> -3.94
● Iteration 3
p1 c0 p2 c0 p3 c0
d d
g g
p1 c1 p2 c1 p3 c1
d d
g g
d
g
g
d
poser prendreposer
![Page 87: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/87.jpg)
87
Exemple RobotCafe
(2, 0) - gauche -> 86.44 - droite -> 88.37 - prendre -> 87.4 - poser -> 87.4
(2, 1) - gauche -> 185.48 - droite -> 89.35 - prendre -> 183.54 - poser -> 87.4
(1, 0) - gauche -> 86.44 - droite -> 87.4 - prendre -> 86.44 - poser -> 86.44
(1, 1) - gauche -> 185.48 - droite -> 183.54 - prendre -> 185.48 - poser -> 187.44
(3, 0) - gauche -> 87.4 - droite -> 88.37 - prendre -> 89.35 - poser -> 88.37
(3, 1) - gauche -> 183.54 - droite -> 89.35 - prendre -> 89.35 - poser -> 88.37
● Iteration 8
p1 c0 p2 c0 p3 c0
d d
g g
p1 c1 p2 c1 p3 c1
d d
g g
d
g
g
d
poser prendreposer
Surprenant ?
![Page 88: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/88.jpg)
88
Exemple RobotCafe
(2, 0) - gauche -> 250.69 - droite -> 256.15 - prendre -> 253.41 - poser -> 253.41
(2, 1) - gauche -> 347.99 - droite -> 258.92 - prendre -> 261.72 - poser -> 253.41
(1, 0) - gauche -> 250.69 - droite -> 253.41 - prendre -> 250.69 - poser -> 250.69
(1, 1) - gauche -> 347.99 - droite -> 261.72 - prendre -> 347.99 - poser -> 351.69
(3, 0) - gauche -> 253.41 - droite -> 256.15 - prendre -> 258.92 - poser -> 256.15
(3, 1) - gauche -> 261.72 - droite -> 258.92 - prendre -> 258.92 - poser -> 256.15
● Iteration 20
p1 c0 p2 c0 p3 c0
d d
g g
p1 c1 p2 c1 p3 c1
d d
g g
d
g
g
d
poser prendreposer
![Page 89: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/89.jpg)
89
Exemple RobotCafe
● Gerer tous les problèmes de cette forme
● Experimentations - Gère les compromis● Modifie gain
– Recompense café = 4● Ajoute action rien
– Action += { rien }
![Page 90: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/90.jpg)
90
Plan
● Problème de prise de décision séquentiel● Exemples
● (1) Représenter un problème● (2) Equation de Bellman● (3) Algorithme de résolution
● Perspectives
![Page 91: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/91.jpg)
91
Autres exemples
● Principe● Algorithme générique● Adapté à TOUS les problèmes (cadre)
● Problème gestion orientation
Idée 4
![Page 92: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/92.jpg)
92
Probleme Orientation
● Agent dispose d'une orientation● Tourner● Avancer
● Modifie espace d'état● Position + orientation
![Page 93: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/93.jpg)
93
Probleme Orientation
● Robot Cafe (bis)● Action
– avancer, tournerG, tournerD, prendre, poser● Etat
– Position, orientation, cafe● Transition : S x A -> S
– Gère orientation et déplacement● Recompense : S x A -> Reel
– Amener café
![Page 94: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/94.jpg)
94
Probleme Orientation
● Robot Cafe (bis)● Action
– avancer, tournerG, tournerD, prendre, poser● Etat
– Position, orientation, cafe● Transition : S x A -> S
– Gère orientation et déplacement● Recompense : S x A -> Reel
– Amener café
La « preuve » (???) !
04_cafe_rotation
![Page 95: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/95.jpg)
95
Probleme Orientation
● Passer en 2D● 06_cafeRotation2D
![Page 96: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/96.jpg)
96
Probleme Orientation
● Ajouter des murs● 07_cafe_rotation_2D_murs
![Page 97: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/97.jpg)
97
Sokoban
● Workspace Sokoban
![Page 98: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/98.jpg)
98
Autres exemples
● Orientation ● Labyrinthe (cf slides bonus)● Sokoban (cf code Java)● Robot et plaque de pression● Glissement sol (cf site)
● Autre exemple value iteration (cf slides bonus)
![Page 99: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/99.jpg)
99
Perspectives
● Stochastique ● MDP
● Taille de l'espace etat ou Continu ● approximation, MCTS
● Modele inconnu ● Apprentissage
● Guider la recherche A* ● Heuristiques
● Observabilite partielle (wumpus)● POMDP
![Page 100: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/100.jpg)
100
Slides Bonus
(issus principalement 2016)
![Page 101: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/101.jpg)
101
Plan slides Bonus
● Autres exemples● Chercheur d'or + deroulé Value iteration● Labyrinthe● RaceTracker
● Apprentissage par renforcement● Observabilité partielle
![Page 102: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/102.jpg)
102
Exemple2 – chercheur or
● Meilleure politique ?
MG C MD
+3+8
+1
![Page 103: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/103.jpg)
103
Exemple – chercheur or
● Récriture Equation Bellman
MG C MD
+3+8
+1
Q*(s ,a)=R(s , a ,T (s , a))+maxa 'Q*(T (s , a) , a')
![Page 104: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/104.jpg)
104
Exemple – chercheur or
● 6 cas
Q*(s ,a)=R(s , a ,T (s , a))+maxa 'Q*(T (s , a) , a')
MG C MD
+3+8
+1
![Page 105: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/105.jpg)
105
Exemple – chercheur or
● 6 cas– MG + Gauche -> MG, +3– MG + Droite -> C, +0– C + Droite -> MD, +8– C + Gauche -> MG, +0– MD + Gauche -> C, +0– MD + Droite -> MD, +1
Q*(s ,a)=R(s , a ,T (s , a))+maxa 'Q*(T (s , a) , a')
MG C MD
+3+8
+1
![Page 106: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/106.jpg)
106
Exemple – chercheur or
Q*(s ,a)=R(s , a ,T (s , a))+maxa 'Q*(T (s , a) , a')
MG C MD
+3+8
+1
Q*(MG,G)=R(MG,G , MG)+0,9.max (Q*(MG,G),Q*(MG, D))
Q*(MG,D)=R (MG,D ,C)+0,9.max(Q*(C ,G) ,Q*(C , D))
Q*(C ,G)=R (C ,G ,MG)+0,9.max(Q*(MG,G) ,Q*(MG,D))
Q*(C , D)=R(C , D ,MD)+0,9.max(Q*(MD,G) ,Q*(MD ,D))
Q*(MD,G)=R (MD,G ,C)+0,9.max(Q*(C ,G),Q*(C , D))
Q*(MD, D)=R (MD, D ,MD)+0,9.max (Q*(MD,G) ,Q*(MD, D))
![Page 107: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/107.jpg)
107
Exemple – chercheur or
Q*(s ,a)=R(s , a ,T (s , a))+maxa 'Q*(T (s , a) , a')
MG C MD
+3+8
+1
Q*(MG,G)=3+0,9.max(Q*(MG,G) ,Q*(MG, D))
Q*(MG,D)=0+0,9.max(Q*(C ,G),Q*(C , D))
Q*(C ,G)=0+0,9.max(Q *(MG,G) ,Q*(MG,D))
Q*(C , D)=8+0,9.max (Q*(MD,G) ,Q*(MD, D))
Q*(MD,G)=0+0,9.max(Q*(C ,G),Q*(C , D))
Q*(MD, D)=1+0,9.max(Q*(MD,G) ,Q*(MD,D))
![Page 108: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/108.jpg)
108
Exemple – chercheur or
Q*(s ,a)=R(s , a ,T (s , a))+maxa 'Q*(T (s , a) , a')
MG C MD
+3+8
+1
Q*(MG,G)=3+0,9.max(Q*(MG,G) ,Q*(MG, D))
Q*(MG,D)=0,9.max(Q*(C ,G) ,Q*(C , D))
Q*(C ,G)=0,9.max(Q*(MG,G) ,Q*(MG, D))
Q*(C , D)=8+0,9.max (Q*(MD,G) ,Q*(MD, D))
Q*(MD,G)=0,9.max (Q*(C ,G) ,Q *(C ,D))
Q*(MD, D)=1+0,9.max(Q*(MD,G) ,Q*(MD,D))
![Page 109: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/109.jpg)
109
Exemple – chercheur or
Q*(s ,a)=R(s , a ,T (s , a))+maxa 'Q*(T (s , a) , a')
MG C MD
+3+8
+1
MG, G
MG, D
C, G
C, D
MD, G
MD, D
t=0
![Page 110: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/110.jpg)
110
Exemple – chercheur or
Q*(s ,a)=R(s , a ,T (s , a))+maxa 'Q*(T (s , a) , a')
MG C MD
+3+8
+1
MG, G
MG, D
C, G
C, D
MD, G
MD, D
0
0
0
0
0
0
t=0
![Page 111: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/111.jpg)
111
Exemple – chercheur or
Q*(s ,a)=R(s , a ,T (s , a))+maxa 'Q*(T (s , a) , a')
MG C MD
+3+8
+1
MG, G
MG, D
C, G
C, D
MD, G
MD, D
0
0
0
0
0
0
t=0 t=1
![Page 112: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/112.jpg)
112
Exemple – chercheur or
Q*(s ,a)=R(s , a ,T (s , a))+maxa 'Q*(T (s , a) , a')
MG C MD
+3+8
+1
MG, G
MG, D
C, G
C, D
MD, G
MD, D
0
0
0
0
0
0
t=0 t=1
= 3 +0,9 max Q(MG,G), Q(MG,D)
![Page 113: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/113.jpg)
113
Exemple – chercheur or
Q*(s ,a)=R(s , a ,T (s , a))+maxa 'Q*(T (s , a) , a')
MG C MD
+3+8
+1
MG, G
MG, D
C, G
C, D
MD, G
MD, D
0
0
0
0
0
0
t=0 t=1
= 3
![Page 114: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/114.jpg)
114
Exemple – chercheur or
Q*(s ,a)=R(s , a ,T (s , a))+maxa 'Q*(T (s , a) , a')
MG C MD
+3+8
+1
MG, G
MG, D
C, G
C, D
MD, G
MD, D
0
0
0
0
0
0
t=0 t=1
= 3
= 0 + 0,9 max (Q (C,G), Q(C,D)
![Page 115: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/115.jpg)
115
Exemple – chercheur or
Q*(s ,a)=R(s , a ,T (s , a))+maxa 'Q*(T (s , a) , a')
MG C MD
+3+8
+1
MG, G
MG, D
C, G
C, D
MD, G
MD, D
0
0
0
0
0
0
t=0 t=1
= 3
= 0
= 0 + max (Q(MD, G) Q(MD,D))
= 8 + max (Q(MD,G), Q(MD,G))
= 0 + max (Q(C,G), Q(C,D))
= 1 + max (Q(MD,G),Q(MD,D))
![Page 116: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/116.jpg)
116
Exemple – chercheur or
Q*(s ,a)=R(s , a ,T (s , a))+maxa 'Q*(T (s , a) , a')
MG C MD
+3+8
+1
MG, G
MG, D
C, G
C, D
MD, G
MD, D
0
0
0
0
0
0
t=0 t=1
= 3
= 0
= 0
= 8
= 0
= 1
![Page 117: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/117.jpg)
117
Exemple – chercheur or
Q*(s ,a)=R(s , a ,T (s , a))+maxa 'Q*(T (s , a) , a')
MG C MD
+3+8
+1
MG, G
MG, D
C, G
C, D
MD, G
MD, D
0
0
0
0
0
0
t=0 t=1
3
0
0
8
0
1
![Page 118: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/118.jpg)
118
Exemple – chercheur or
Q*(s ,a)=R(s , a ,T (s , a))+maxa 'Q*(T (s , a) , a')
MG C MD
+3+8
+1
MG, G
MG, D
C, G
C, D
MD, G
MD, D
0
0
0
0
0
0
t=0 t=1
3
0
0
8
0
1
MG
C
MD
t=2
= 3 + 0,9 . max Q(MG)
= 0 + 0,9 . max (C)
= 0 + 0,9 . max (MG)
= 8 + 0,9 . max (MD)
= 0 + 0,9 . max (C)
= 1 + 0,9 . max (MD)
![Page 119: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/119.jpg)
119
Exemple – chercheur or
Q*(s ,a)=R(s , a ,T (s , a))+maxa 'Q*(T (s , a) , a')
MG C MD
+3+8
+1
MG, G
MG, D
C, G
C, D
MD, G
MD, D
0
0
0
0
0
0
t=0 t=1
3
0
0
8
0
1
MG
C
MD
t=2
= 3 + 0,9 * 3
= 0 + 0,9 *8
= 0 + 0,9 * 3
= 8 + 0,9 * 1
= 0 + 0,9 * 8
= 1 + 0,9 * 1
![Page 120: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/120.jpg)
120
Exemple – chercheur or
Q*(s ,a)=R(s , a ,T (s , a))+maxa 'Q*(T (s , a) , a')
MG C MD
+3+8
+1
MG, G
MG, D
C, G
C, D
MD, G
MD, D
0
0
0
0
0
0
t=0 t=1
3
0
0
8
0
1
MG
C
MD
t=2
= 5,7
= 7,2
= 2,7
= 8,9
= 7,2
= 1,9
![Page 121: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/121.jpg)
121
t=1 t=2
MG
C
MD7,2
1,9
5,7
7,2
2,7
8,9
Exemple – chercheur or
Q*(s ,a)=R(s , a ,T (s , a))+maxa 'Q*(T (s , a) , a')
MG C MD
+3+8
+1
MG, G
MG, D
C, G
C, D
MD, G
MD, D
0
0
0
0
0
0
t=0
3
0
0
8
0
1
![Page 122: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/122.jpg)
122
t=1 t=2
MG
C
MD7,2
1,9
5,7
7,2
2,7
8,9
Exemple – chercheur or
Q*(s ,a)=R(s , a ,T (s , a))+maxa 'Q*(T (s , a) , a')
MG C MD
+3+8
+1
MG, G
MG, D
C, G
C, D
MD, G
MD, D
0
0
0
0
0
0
t=0
3
0
0
8
0
1
t=3
3 + 0,9 * 7,2
0 + 0,9 * 8,9
0 + 0,9 * 7,2
8 + 0,9 * 7,2
0 + 0,9 * 8,9
1 + 0,9 * 7,2
![Page 123: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/123.jpg)
123
t=1 t=2
MG
C
MD7,2
1,9
5,7
7,2
2,7
8,9
Exemple – chercheur or
Q*(s ,a)=R(s , a ,T (s , a))+maxa 'Q*(T (s , a) , a')
MG C MD
+3+8
+1
MG, G
MG, D
C, G
C, D
MD, G
MD, D
0
0
0
0
0
0
t=0
3
0
0
8
0
1
t=3
9,48
8,01
6,48
14,48
8,01
7,48
![Page 124: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/124.jpg)
124
t=1 t=2
7,2
1,9
5,7
7,2
2,7
8,9
Exemple – chercheur or
Q*(s ,a)=R(s , a ,T (s , a))+maxa 'Q*(T (s , a) , a')
MG C MD
+3+8
+1
MG, G
MG, D
C, G
C, D
MD, G
MD, D
0
0
0
0
0
0
t=0
3
0
0
8
0
1
t=3
9,48
8,01
6,48
14,48
8,01
7,48
t=10
23.18..
24.68..
20.18..
27.81..
24.68..
20.81..
t=100
37.10...
37.89...
34.10...
42.10...
37.89...
35.10...
![Page 125: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/125.jpg)
125
Plan slides Bonus
● Autres exemples● Chercheur d'or + deroulé Value iteration● Labyrinthe● RaceTracker
● Apprentissage par renforcement● Observabilité partielle
![Page 126: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/126.jpg)
126
Propagation dans labyrinthe
● Exemple labyrinthe● Appliquer l'algorithme fourni
● Montrer application
![Page 127: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/127.jpg)
127
Propagation dans labyrinthe
● Exemple labyrinthe● Appliquer l'algorithme fourni
● Montrer application
● Probleme de taille de l'espace d'état● Idée : ne construire Qval que états rencontrés● Exemple RaceTracker
![Page 128: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/128.jpg)
128
Probleme labyrinthe
● Labyrinthe à traverser avec des trous
![Page 129: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/129.jpg)
129
Probleme labyrinthe
● Labyrinthe à traverser avec des trous
● Etat : position robot● Action : N, S, E, O● Transition :
● position x action -> position
● Recompense● Position == trou => -5● Position == arrivee ==> +100● Deplacer ==> -1
![Page 130: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/130.jpg)
130
Probleme labyrinthe
● Etats et actions
def actions(self): return(['N','S','E','O'])
def etats(self): etats=[] for i in range(0,11): for j in range(0,11): etats+=[(i,j)]
#etat final etats+=[(-1,-1)]
return(etats)
![Page 131: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/131.jpg)
131
Probleme labyrinthe
● Transitiondef transition(self,s,a): """fait evoluer d une unite le systeme""" x=s[0]; y=s[1];
#si on part de 10,10 on retourne en 0 if (x==10) and (y==10): return(-1,-1) if (x==-1) and (y==-1): return(-1,-1) if (a=='N'): y=y-1 if (y<0): y=0 if (a=='S'): y=y+1 if (y>10): y=10 if (a=='E'): x=x+1 if (x>10): x=10 if (a=='O'): x=x-1 if (x<0): x=0 return((x,y))
![Page 132: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/132.jpg)
132
Probleme labyrinthe
● Recompense
def recompense(self,s,a,sarr):
"""ok si on est en 10,10""" if ((sarr[0]==10)and(sarr[1]==10)): return(100)
if (sarr in self.trou): return(-5)
if (sarr[0]==-1)and (sarr[1]==-1): return(0)
return(-1)
![Page 133: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/133.jpg)
133
Probleme labyrinthe
● Recompense
def recompense(self,s,a,sarr):
"""ok si on est en 10,10""" if ((sarr[0]==10)and(sarr[1]==10)): return(100)
if (sarr in self.trou): return(-5)
if (sarr[0]==-1)and (sarr[1]==-1): return(0)
return(-1)
Cf code sur site
![Page 134: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/134.jpg)
134
Probleme du labyrinthe
● Exemple de solution ?
● Politique : S -> A● Générateur de politiques
![Page 135: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/135.jpg)
135
Probleme du labyrinthe
● Exemple 1 de solution ?
![Page 136: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/136.jpg)
136
Probleme du labyrinthe
● Autre Exemple de solution ?
![Page 137: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/137.jpg)
137
Probleme du labyrinthe
● Autre Exemple de solution ?
![Page 138: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/138.jpg)
138
Probleme du labyrinthe
● Enumerer les solutions● Combien de solutions différentes ?
![Page 139: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/139.jpg)
139
Probleme du labyrinthe
● Enumerer les solutions● Combien de solutions différentes ?
● Nombre de solutions ● Ici => 4^16 = 4.294.967.296● Énumération impossible
|A||S|
![Page 140: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/140.jpg)
140
Probleme du labyrinthe
● Evaluer une politique● Exactement meme code qu'avant
● Meilleure politique dépend● Compromis entre récompense trou (-5)● Distance parcourue (-1 case)● Récompense objectif (100)
![Page 141: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/141.jpg)
141
Probleme du labyrinthe
● Meilleure politique dépend● Compromis entre récompense trou (-5)● Distance parcourue (-1 case)● Récompense objectif (100)
![Page 142: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/142.jpg)
142
Plan slides Bonus
● Autres exemples● Chercheur d'or + deroulé Value iteration● Labyrinthe● RaceTracker
● Apprentissage par renforcement● Observabilité partielle
![Page 143: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/143.jpg)
143
Exemple - Racetracker
![Page 144: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/144.jpg)
144
Modélisation de problemes
● Probleme RaceTrack (wikipedia)
![Page 145: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/145.jpg)
145
Modélisation de problemes
● Probleme RaceTrack
![Page 146: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/146.jpg)
146
Modélisation de problemes
● Probleme RaceTrack● Etat ?● Action ?
Cf code sur site
![Page 147: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/147.jpg)
147
Modélisation de problemes
● Probleme RaceTrack● Etat ?● Action ?
![Page 148: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/148.jpg)
148
Plan slides Bonus
● Autres exemples● Chercheur d'or + deroulé Value iteration● Labyrinthe● RaceTracker
● Apprentissage par renforcement● Observabilité partielle
![Page 149: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/149.jpg)
149
Apprentissage par renforcement
● Apprentissage par renforcement ● Probleme de décision● Monde inconnu (T, R), mais experiences possibles
Environnement
Agent
Etat Action
Récompense
![Page 150: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/150.jpg)
150
Apprentissage par renforcement
● Apprentissage par renforcement ● Probleme Monde inconnu● Connait pas T, R
● A chaque pas de temps● (s, a) -> s' et r● Mettre à jour Q(s,a) à partir informations
● Exemple● (C, gauche) => (MG, 0) ; (MG, D) => (C, 0) ; ...
![Page 151: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/151.jpg)
151
Apprentissage par renforcement
● Objectif:● Apprendre au fur et à mesure à partir Xp
● Principe Q-learning : ● Apprendre directement politique (AR direct)● Pour tuple s, a => s', r● On applique équation Bellman
Q*(s ,a)=R(s , a ,T (s , a))+γ maxa 'Q*(T (s ,a) , a ')
Q*(s ,a)=r+γ maxa 'Q*(s ' , a' )
![Page 152: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/152.jpg)
152
Apprentissage par renforcement
MG C MD
+3+8
+1
![Page 153: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/153.jpg)
153
Apprentissage par renforcement
● C, Gauche ==> MG , +0
MG C MD
+3+8
+1
Q*(C ,G)=r+γ maxa 'Q*(MG,a' )
![Page 154: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/154.jpg)
154
Apprentissage par renforcement
● C, Gauche ==> MG , +0
MG, G
MG, D
C, G
C, D
MD, G
MD, D
0
0
0
0
0
0
t=0
0
0
0
0
0
0
t=1
Q*(C ,G)=r+γ maxa 'Q*(MG,a' )
MG C MD
+3+8
+1
![Page 155: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/155.jpg)
155
Apprentissage par renforcement
● C, Gauche ==> MG , +0
MG, G
MG, D
C, G
C, D
MD, G
MD, D
0
0
0
0
0
0
t=0
0
0
0
0
0
0
t=1
Q*(C ,G)=r+γ maxa 'Q*(MG,a' )
MG C MD
+3+8
+1
![Page 156: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/156.jpg)
156
Apprentissage par renforcement
MG, G
MG, D
C, G
C, D
MD, G
MD, D
0
0
0
0
0
0
t=0
0
0
0
0
0
0
t=1
MG C MD
+3+8
+1
![Page 157: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/157.jpg)
157
Apprentissage par renforcement
● MG, Gauche ==> MG , +3
MG, G
MG, D
C, G
C, D
MD, G
MD, D
0
0
0
0
0
0
t=0
0
0
0
0
0
0
t=1
XX
0
0
0
0
0
t=2
Q*(MG,G)=3+γ maxa'Q*(MG,a ')
MG C MD
+3+8
+1
![Page 158: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/158.jpg)
158
Apprentissage par renforcement
● MG, Gauche ==> MG , +3
MG, G
MG, D
C, G
C, D
MD, G
MD, D
0
0
0
0
0
0
t=0
0
0
0
0
0
0
t=1
3
0
0
0
0
0
t=2
Q*(MG,G)=3+γ maxa'Q*(MG,a ')
MG C MD
+3+8
+1
![Page 159: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/159.jpg)
159
Apprentissage par renforcement
● MG, Gauche ==> MG , +3
MG, G
MG, D
C, G
C, D
MD, G
MD, D
0
0
0
0
0
0
t=0
0
0
0
0
0
0
t=1
3
0
0
0
0
0
t=2
Q*(MG,G)=3+γ maxa'Q*(MG,a ')
MG C MD
+3+8
+1
![Page 160: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/160.jpg)
160
Apprentissage par renforcement
MG, G
MG, D
C, G
C, D
MD, G
MD, D
0
0
0
0
0
0
t=0
0
0
0
0
0
0
t=1
3
0
0
0
0
0
t=2
MG C MD
+3+8
+1
![Page 161: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/161.jpg)
161
Apprentissage par renforcement
● MG, Droite ==> C , +0
MG, G
MG, D
C, G
C, D
MD, G
MD, D
0
0
0
0
0
0
t=0
0
0
0
0
0
0
t=1
3
0
0
0
0
0
t=2
3
XX
0
0
0
0
t=3
MG C MD
+3+8
+1
Q*(MG,D)=0+γ maxa 'Q*(C ,a ')
![Page 162: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/162.jpg)
162
Apprentissage par renforcement
● MG, Droite ==> C , +0
MG, G
MG, D
C, G
C, D
MD, G
MD, D
0
0
0
0
0
0
t=0
0
0
0
0
0
0
t=1
3
0
0
0
0
0
t=2
3
0
0
0
0
0
t=3
MG C MD
+3+8
+1
Q*(MG,D)=0+γ maxa 'Q*(C ,a ')
![Page 163: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/163.jpg)
163
Apprentissage par renforcement
● C
MG, G
MG, D
C, G
C, D
MD, G
MD, D
0
0
0
0
0
0
t=0
0
0
0
0
0
0
t=1
3
0
0
0
0
0
t=2
3
0
0
0
0
0
t=3
MG C MD
+3+8
+1
![Page 164: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/164.jpg)
164
Apprentissage par renforcement
● C, Gauche => MG, 0
MG, G
MG, D
C, G
C, D
MD, G
MD, D
0
0
0
0
0
0
t=0
0
0
0
0
0
0
t=1
3
0
0
0
0
0
t=2
3
0
0
0
0
0
t=3
3
0
XXX
0
0
0
t=4
MG C MD
+3+8
+1
![Page 165: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/165.jpg)
165
Apprentissage par renforcement
● C, Gauche => MG, 0
MG, G
MG, D
C, G
C, D
MD, G
MD, D
0
0
0
0
0
0
t=0
0
0
0
0
0
0
t=1
3
0
0
0
0
0
t=2
3
0
0
0
0
0
t=3
3
0
2,7
0
0
0
t=4
MG C MD
+3+8
+1
Q*(C ,G)=0+γ maxa 'Q*(MG,a ')
![Page 166: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/166.jpg)
166
Apprentissage par renforcement
● Dilemme exploration / exploitation
● Exploration● Je me déplace au hasard● Mais récompenses faibles
● Exploitation● Je me déplace au mieux de mes connaissances● MAIS ....
![Page 167: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/167.jpg)
167
Apprentissage par renforcement
● Dilemme exploration / exploitation
● Table me dit que mieux C ==> G● Mais je n'apprends pas à droite (qui est mieux)
MG, G
MG, D
C, G
C, D
MD, G
MD, D
0
0
0
0
0
0
t=0
0
0
0
0
0
0
t=1
3
0
0
0
0
0
t=2
3
0
0
0
0
0
t=3
3
0
2,7
0
0
0
t=4
![Page 168: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/168.jpg)
168
Apprentissage par renforcement
● Ecrire code python
def QLearning(self,Sdep,nPas,nEpisode,affiche): # repeter n episode # on reinitiliase au depart # pour chaque iteration de l'episode # miseAJour Qvaleur # part de l'etat d'arrivee
def majQLearning(self,s,Q): '''Permet de faire une mise a jour du Qlearning''' # on choisit une action au hasard # on execute l'action (s et rec) # cherche max arrivee
# on met a jour Qvaleur Q[(s,a)]=rec+gamma*max
#on retourne le nouvel etat
![Page 169: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/169.jpg)
169
Plan slides Bonus
● Autres exemples● Chercheur d'or + deroulé Value iteration● Labyrinthe● RaceTracker
● Apprentissage par renforcement● Stochastique● Observabilité partielle
![Page 170: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/170.jpg)
170
Monde stochatique
● MDP avec des probabilités● Transition S x A -> P(S)
● Pourquoi ?● Modélise phenomène continu / inconnu● Monde probabiliste
● Exemple
![Page 171: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/171.jpg)
171
Déplacement avec glissements
● Labyrinthe identique● Mais quand on se déplace proba d'avancer 2 fois
● Gestion risque● Quelle politique ?
![Page 172: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/172.jpg)
172
Equation bellman
● Equation de bellman légérement modifiée● Calcul d'esperance
● Monde deterministe
Q*(s ,a)=R(s , a ,T (s , a))+γ maxa 'Q*(T (s ,a) , a ')
![Page 173: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/173.jpg)
173
Equation bellman
● Equation de bellman légérement modifiée● Calcul d'esperance
● Monde deterministe
● Monde stochastique
Q*(s ,a)=R(s , a ,T (s , a))+γ maxa 'Q*(T (s ,a) , a ')
Q*(s ,a)=∑s 'P(s , a , s ')(R(s , a , s ' )+γ maxa'Q
*(s ' , a '))
![Page 174: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/174.jpg)
174
Value itération
● Meme principe que précédent
● Repeter pour t● Chaque état et chaque action
Q*(s ,a)=∑s 'P(s , a , s ')(R(s ,a , s ' )+γ maxa'Q
*(s ' , a '))
![Page 175: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/175.jpg)
175
Apprentissage par renforcement
● Meme principe que précédent● MAIS ...
![Page 176: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/176.jpg)
176
Apprentissage par renforcement
● Meme principe que précédent● MAIS ...● Une expérience ne suffit plus
![Page 177: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/177.jpg)
177
Apprentissage par renforcement
● Meme principe que précédent● MAIS ...● Une expérience ne suffit plus
● Principe● Faire des statistiques sur les résultats obtenus
Q*(s ,a)=α [r+γ maxa 'Q*(s ' , a')]+(1−α )Q *
(s , a)
α =1 /t
![Page 178: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/178.jpg)
178
Plan slides Bonus
● Autres exemples● Chercheur d'or + deroulé Value iteration● Labyrinthe● RaceTracker
● Apprentissage par renforcement● Stochastique● Observabilité partielle
![Page 179: Construction de comportements intelligents · 2017. 3. 30. · 2 Principe Construire bribes intelligence Relativement simple Solution à des besoins étudiants Nombreux exemples Agent](https://reader036.vdocuments.site/reader036/viewer/2022081620/610e13410adb587a23499e03/html5/thumbnails/179.jpg)
179
Problemes difficiles
● Observabilité partielle● Mondes continus● Taille espace d'états