Académique Documents
Professionnel Documents
Culture Documents
Soar Tuto PDF
Soar Tuto PDF
Cyrille Baudouin
Cerv : Centre Européen de Réalité Virtuelle
ea3883 – lisyc
Laboratoire d’Informatique pour les SYstèmes Complexes
25 février 2005
1
Introduction à SOAR : Présentation et tutoriel
Résumé
Ce document d’introduction à soar regroupe une description détaillée, quelques
éléments d’études et un tutoriel.
Mots-clés : soar, intelligence artificielle, tutoriel.
2 Découvrir soar 4
2.1 Qu’est-ce que soar ? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.2 Comment soar fonctionne-t-il ? . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.3 Le fonctionnement de soar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.4 Les possibilités de soar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.5 Quelques applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.6 Evolutions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.7 Extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
3 Utiliser soar 7
3.1 Ressources et installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
3.2 Présentation de Eaters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
3.3 Un première règle en soar : Hello-world . . . . . . . . . . . . . . . . . . . . . . . 8
3.4 Utiliser un opérateur . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
3.5 Première application : bouger vers le nord . . . . . . . . . . . . . . . . . . . . . . 9
1 Introduction
2 Découvrir soar
2.1 Qu’est-ce que soar ?
2.1.1 Une architecture pour simuler le raisonnement humaine
2.1.2 un langage d’intelligence artificielle
2.1.3 Une théorie unifié de la cognition
En .... Newell élargit encore la portée de soar puisqu’il propose d’en faire un candidat
à l’UCT (Unified Cognition Théorie).
2.5.2 Quake-soar
...
2.6 Evolutions
La première version de soar date de 1982 et la version courante est la 8.5.2. Le
graphique suivant1 montre l’évolution de soar accompagnée des résultats obtenus et des
idées qui ont inspirées les changements ou les ajouts de fonctionnalités.
1
Réalisé par John E. Laird dans une présentation du 23rd soar Workshop
2.7 Extensions
soar est une architecture qui se veut générale et, pour cela, elle n’est pas forcément
simple ou optimale pour certains domaines ou certaines utilisations. Plusieurs équipes de
recherches ont donc créés leurs propres extensions de soar afin de résoudre des problèmes
spécifiques.
et au langage sont mélangés et sur un même plan décisionnel (communiquer est alors une
action comme les autres).
LG-soar3 , est une autre extension spécifique au langage et concerne l’extraction de
prédicat dans des textes en langage naturel par analyse syntaxique.
3
LG pour Link Grammar
3 Utiliser soar
Cette partie s’inspire de la première partie du tutoriel ”officiel” distribué avec soar.
Nous y présenterons les concepts de bases nécessaires pour la bonne utilisation de soar.
(http://sitemaker.umich.edu/\acronyme{soar}/\acronyme{soar}_software_downloads)
n’est pas consommée. Lorsque deux eater se rencontrent, leur score est équilibré et ils
sont tous les deux renvoyés sur une case non occupée choisi au hasard.
L’interface de Eaters permet de créer un nouvel agent, de le détruire, de sélectionner
le fichier de règles qui lui sera appliqué. Les trois boutons (step, run et stop) permettent
de contrôler la simulation.
—¿capture console comandes
Plusieurs fichiers de règles (*.soar) sont livrés avec la distribution de Eaters et sont
donnés en annexe II. Ces fichiers se trouvent dans le repertoire :
[repertoire d’’installation de \acronyme{soar}
suite]\eaters-3.0.8\agents\tutorial
Il n’est pas utile de consulter ces fichiers pour le moment puisque nous allons les réécrire
au fur et a mesure du tutoriel. Ils pourront servir de référence ou d’exemple.
nom : "hello-world"
conditions : si j’existe,
actions alors j’affiche "hello-world" puis je m’arr^
ete.
Notre eater ne peut pas interpréter le langage naturel et cette règle doit donc être
traduite pour être compréhensible par notre eater.
— ¿ image règle ”hello-world” annotée
La condition ”j’existe” est assimilé a l’existence du premier état dans la mémoire de
travail (working memory ou WE) de soar.
propose hello-world :
si j’existe,
alors, je propose l’opérateur "hello-world"
applique hello-world :
si l’opérateur "hello-world" est sélectionné
alors j’affiche "hello-world"
puis je m’arr^ete.
| <float_constant>
Remarque sur la ”Condition Side” : Dans un ¡id test¿, seul une ¡variable¿ peut être
utilisée dans un ¡single test¿.
sp {hello-world
(state <s> ^type state)
-->
(write |Hello World|)
(halt)
}
5.2 hello-world-operator.soar
########################################################################
# From Chapter 3 of \acronyme{soar} 8 Tutorial #### This operator
writes "Hello World" and halts.
sp {propose*hello-world
(state <s> ^type state)
-->
(<s> ^operator <o> +)
(<o> ^name hello-world)
}
sp {apply*hello-world
(state <s> ^operator <o>)
(<o> ^name hello-world)
-->
(write |Hello World|)
(halt)
}
5.3 move-north.soar
########################################################################
# From Chapter 4 of \acronyme{soar} 8 Tutorial # #
Propose*move-north: # If I exist, then propose the move-north
operator.
sp {propose*move-north
(state <s> ^type state)
-->
(<s> ^operator <o> +)
(<o> ^name move-north)}
# Apply*move-north:
# If the move-north operator is selected, then generate an output command to
# move north.
sp {apply*move-north
(state <s> ^operator <o>
^io <io>)
(<io> ^output-link <ol>)
(<o> ^name move-north)
-->
(<ol> ^move <move>)
(<move> ^direction north)
}
5.4 move-north-2.soar
########################################################################
# From Chapter 5 of \acronyme{soar} 8 Tutorial # Corrected from
move-north.\acronyme{soar} so that operator applies more than
once. # # Propose*move-north: # If I am at some location, then
propose the move-north operator.
sp {propose*move-north
(state <s> ^io.input-link.eater <e>)
(<e> ^x <x> ^y <y>)
-->
(<s> ^operator <o> +)
(<o> ^name move-north)
}
# Apply*move-north:
# If the move-north operator is selected, then generate an output command to
# move north.
sp {apply*move-north
(state <s> ^operator.name move-north
^io.output-link <ol>)
-->
# Apply*move-north*remove-move
# If the move-north successfully performs a move command, then remove
# the command from the output-link
sp {apply*move-north*remove-move
(state <s> ^operator.name move-north
^io.output-link <ol>)
(<ol> ^move <move>)
(<move> ^status complete)
-->
(<ol> ^move <move> -)}
5.5 move-to-food.soar
########################################################################
# From Chapter 6 of \acronyme{soar} 8 Tutorial # # These are the
final versions of the rules. # # This program proposes the
move-to-food operator in any direction # that contains normal or
bonus food. If there is no food nearby, no # instances of the
operator will be proposed and the halt operator # will be
proposed.
# Propose*move-to-food*normalfood
# If there is normalfood in an adjacent cell,
# propose move-to-food in the direction of that cell
# and indicate that this operator can be selected randomly.
sp {propose*move-to-food
(state <s> ^io.input-link.my-location.<dir>.content
<< normalfood bonusfood >>)
-->
(<s> ^operator <o> + =)
(<o> ^name move-to-food
^direction <dir>)}
# Apply*move-to-food
# If the move-to-food operator for a direction is selected,
# generate an output command to move in that direction.
sp {apply*move-to-food
(state <s> ^io.output-link <ol>
^operator <o>)
(<o> ^name move-to-food
^direction <dir>)
-->
(<ol> ^move.direction <dir>)}
# Apply*move-to-food*remove-move:
# If the move-to-food operator is selected,
# and there is a completed move command on the output link,
# then remove that command.
sp {apply*move-to-food*remove-move
(state <s> ^io.output-link <ol>
^operator.name move-to-food)
(<ol> ^move <move>)
(<move> ^status complete)
-->
(<ol> ^move <move> -)}
5.6 move.soar
########################################################################
# From Chapter 8 of \acronyme{soar} 8 Tutorial # # These are the
final versions of the rules for the generalized move operator # #
Propose*move: # If there is normalfood, bonusfood, eater, or empty
in an adjacent cell, # propose move in the direction of that
cell # and indicate that this operator can be selected
randomly.
sp {propose*move
(state <s> ^io.input-link.my-location.<dir>.content
{ <content> <> wall })
-->
(<s> ^operator <o> + =)
(<o> ^name move
^direction <dir>
^content <content>)}
# Apply*move
# If the move operator for a direction is selected,
# generate an output command to move in that direction.
sp {apply*move
(state <s> ^io.output-link <ol>
^operator <o>)
(<o> ^name move
^direction <dir>)
-->
(<ol> ^move.direction <dir>)}
# Apply*move*remove-move:
# If the move operator is selected,
# and there is a completed move command on the output link,
# then remove that command.
sp {apply*move*remove-move
(state <s> ^io.output-link <ol>
^operator.name move)
(<ol> ^move <direction>)
(<direction> ^status complete)
-->
(<ol> ^move <direction> -)}
# Select*move*bonusfood-better-than-normalfood
# If there is a proposed operator to move to a cell with bonusfood and
# there is a second proposed operator to move to a cell that is empty or
# has normalfood
# prefer the first operator.
sp {select*move*bonusfood-better-than-normalfood-empty
(state <s> ^operator <o1> +
^operator <o2> +)
(<o1> ^name move
^content bonusfood)
(<o2> ^name move
^content << normalfood empty >>)
-->
(<s> ^operator <o1> > <o2>)}
# Select*move*avoid-empty-eater
# If there is a proposed operator to move to an empty cell or a cell with
# another eater,
# then avoid that operator.
sp {select*move*avoid-empty-eater
(state <s> ^operator <o1> +)
(<o1> ^name move
^content << empty eater >>)
-->
(<s> ^operator <o1> <)}
5.7 advanced-move.soar
########################################################################
# From Chapter 9 of \acronyme{soar} 8 Tutorial # # These are the
sp {initialize*state*directions
(state <ss> ^type state)
-->
(<ss> ^directions <n> <e> <s> <w>)
(<n> ^value north ^opposite south)
(<e> ^value east ^opposite west)
(<s> ^value south ^opposite north)
(<w> ^value west ^opposite east)}
# Propose*move*no-backward:
# If there is normalfood, bonusfood, eater, or empty in an adjacent cell,
# and there is no last direction equal to the opposite direction for that # cell,
# propose move in the direction of that cell, with the cell’s content,
# and indicate that this operator can be selected randomly.
sp {propose*move*no-backward
(state <s> ^io.input-link.my-location.<dir>.content { <co> <> wall }
^directions <d>
-^last-direction <o-dir>)
(<d> ^value <dir>
^opposite <o-dir>)
-->
(<s> ^operator <o> +, =)
(<o> ^name move
^direction <dir>
^content <co>)}
# Apply*move
# If the move operator for a direction is selected,
# generate an output command to move in that direction.
sp {apply*move
(state <s> ^io.output-link <ol>
^operator <o>)
(<o> ^name move
^direction <dir>)
-->
(write | | <dir>)
(<ol> ^move.direction <dir>)}
# Apply*move*remove-move:
# If the move operator is selected,
# and there is a completed move command on the output link,
# then remove that command.
sp {apply*move*remove-move
(state <s> ^io.output-link <ol>
^operator.name move)
(<ol> ^move <direction>)
(<direction> ^status complete)
-->
(<ol> ^move <direction> -)}
# Apply*move*create*last-direction
# If the move operator for a direction is selected,
# create an augmentation called last-direction with that direction.
sp {apply*move*create*last-direction
(state <s> ^operator <o>)
(<o> ^name move
^direction <direction>)
-->
(<s> ^last-direction <direction>)}
# Apply*move*remove*last-direction
# If the move operator for a direction is selected,
# and the last-direction is not equal to that direction,
# then remove the last-direction.
sp {apply*move*remove*last-direction
(state <s> ^operator <o>
^last-direction <direction>)
(<o> ^direction <> <direction>
^name move)
-->
(<s> ^last-direction <direction> -)}
# Select*move*bonusfood-better-than-normalfood
# If there is a proposed operator to move to a cell with bonusfood and
# there is a second proposed operator to move to a cell that is empty or
# has normalfood
# prefer the first operator.
sp {select*move*bonusfood-better-than-normalfood-empty
(state <s> ^operator <o1> +
^operator <o2> +)
(<o1> ^name move
^content bonusfood)
(<o2> ^name move
^content << normalfood empty >>)
-->
# Select*move*avoid-empty-eater
# If there is a proposed operator to move to an empty cell or a cell with
# another eater,
# then avoid that operator.
sp {select*move*avoid-empty-eater
(state <s> ^operator <o1> +)
(<o1> ^name move
^content << empty eater >>)
-->
(<s> ^operator <o1> <)}
# Select*move*reject*backward
# If there is a proposed operator to move in the direction
# opposite the last move,
# reject that operator.
sp {select*move*reject*backward
(state <s> ^operator <o> +
^directions <d>
^last-direction <dir>)
(<d> ^value <dir>
^opposite <o-dir>)
(<o> ^name move
^direction <o-dir>)
-->
(write | Reject | <o-dir>)
(<s> ^operator <o> -)}