rnb-tutorial.nb
8 Pages
English
Downloading requires you to have access to the YouScribe library
Learn all about the services we offer

rnb-tutorial.nb

-

Downloading requires you to have access to the YouScribe library
Learn all about the services we offer
8 Pages
English

Description

A tutorial of the R&B ToolkitRational and Behavioral reasoning in Assistant AgentsJ-P Sansonnet, 4 dec, 2009 - beta version - Release 0.9You need some basic knowledge about the interface of the front ends of Mathematca to understand this tutorial.This file contains Mathematica code that can be freely edited and executed.To Evaluate the code of the examples in this notebook do the following:1) Put the good path to the R&B directory on your computer like in the example just above;2) Do MENU Evaluation / 'Evaluate Initialisation Cells' and then evaluate the cells that launch the examples inLightYellowTHERNBPATH  "E:\\RNB\\";  change only this line  THEDATAPATH  THERNBPATH "DATA\\";THESOUNDPATH  "SOUNDS\\";THEPICTPATH  "PICTS\\";Get THERNBPATH "rnb code.m" A Simple Model: Todoü The model of todoü The Simulation panel of todoA more complex model: Robbieü The model of Robbieã PresentationRobbie is very simple robot that walks in a 3x3 cell room and can go outside (through a door) in order to eat a piece of cake.In the room, there are some physical objects: 2 keys (one opens the door) and a cup of coffee.The basic situation at T0 is like illustrated in the following figure:2 rnb-tutorial.nbã Model structure : MODELROBBIEThe model of Robbie is defined by the following code, stored in the variable MODELROBBIE.Then, it can be compiled into the BASE by the function: MAKEMODEL[MODELROBBIE]After that, a simulation can be launched by ...

Subjects

Informations

Published by
Reads 7
Language English

Exrait

A tutorial of the R&B Toolkit
Rational and Behavioral reasoning in Assistant Agents
JP Sansonnet, 4 dec, 2009  beta version  Release 0.9
You need some basic knowledge about the interface of the front ends of Mathematca to understand this tutorial.
This file containsMathematicacode that can be freely edited and executed. To Evaluate the code of the examples in this notebook do the following: 1) Put the good path to the R&B directory on your computer like in the example just above; 2) Do MENU Evaluation / 'Evaluate Initialisation Cells' and then evaluate the cells that launch the examples in LightYellow
THERNBPATH"E:\\RNB\\";change only this lineTHEDATAPATHTHERNBPATH"DATA\\"; THESOUNDPATHTHERNBPATH"SOUNDS\\"; THEPICTPATHTHERNBPATH"PICTS\\"; GetTHERNBPATH"rnbcode.m"
A Simple Model: Todo
üThe model of todo
üThe Simulation panel of todo
A more complex model: Robbie
üThe model of Robbie
ãPresentation
Robbie is very simple robot that walks in a 3x3 cell room and can go outside (through a door) in order to eat a piece of cake. In the room, there are some physical objects: 2 keys (one opens the door) and a cup of coffee. The basic situation at T0 is like illustrated in the following figure:
2 rnbtutorial.nb
ãModel structure : MODELROBBIE
The model of Robbie is defined by the following code, stored in the variable MODELROBBIE. Then, it can be compiled into the BASE by the function: MAKEMODEL[MODELROBBIE] After that, a simulation can be launched by the function: DISPLAYSIMULATIONPANEL[MODELROBBIE, 10, 0.1] (see below for arguments 10 and 0.1)
MODELROBBIEDEFm1, class"model", useru1, agenta1, topict1, sessions1, DEFs1, class"session", type, requesthisto, is, DEFu1, class"user", type, name, DEFt1, class"topic", type"game", name"Closed room", creator"jps", objectsk1, k2, d1, c1, c2, spacesc, agentsDEFa1, class"agent", type"robot", name"Robbie", gender"none", ageunit"year", is2, role, open0, consciencious0, extravert0, agreable0, neurotic0, 1 0 1confidencehisto, delta0., is0.,1.,1.energyhisto, delta0., is0.8,0., 1.pleasurehisto, delta0., is0., onclockDECRH, 0.1,1& notused ,1.,1.satisfactionhisto, delta0., is0., exist, visible, mobile, displayPICT"robot", "stand", lochisto, histosize10, spacesr, is1, 1,locationstatus"inside", bagmax1notused, content, face,
rnbtutorial.nb
emoteseh, es, actionsrw, sk, sd, gb, tk, dk, ec, ed, od, cd, ex, xe, xc, xp, plansps1, ps2, pp1, pa1, p1, p2, p3, planisp4, stack, spacesDEFsc, class"space", type"chain", partssr, se, DEFsr, class"space", type"grid", name"room", dims3, 3, DEFse, class"space", type"place", name"end", emotesDEFeh, class"emote", type"happy", displayPICT"emote", "sun", DEFes, class"emote", type"sad", displayPICT"emote", "blackcloud", objectsDEFk1, class"object", type"key", size"small", portable, exist, visible, used, displayPICT"key", 1, locspacesr, is3, 2, DEFk2, class"object", type"key", size"big", portable, exist, visible, used, displayPICT"key", 2, locspacesr, is1, 1, DEFd1, class"object", type"door", usek2, exist, visible, status"closed", used, displayPICT"door", GET.status&, locspacesr, is2, 3, DEFc1, class"object", type"cake", exist, visible, consumable, energy0.6, pleasure0.6, used, displayPICT"cake", 1, locspacese, is0, DEFc2, class"object", type"cup", exist, visible, consumable, energy0.2, pleasure0.5, used, displayPICT"cup", "full", locspacesr, is1, 1, actionsDEFrw, class"action", type"randwalk", bya1, DEFsk, class"action", type"stepto", bya1, targetk2, DEFsd, class"action", type"stepto", bya1, targetd1, DEFgb, class"action", type"goback", bya1, DEFtk, class"action", type"take", bya1, onk2, DEFdk, class"action", type"drop", bya1, onk2, DEFec, class"action", type"consume", bya1, onc1, DEFed, class"action", type"consume", bya1, onc2, DEFod, class"action", type"do", bya1, ond1, withk2, setrefstatus, is"open", DEFcd, class"action", type"do", bya1, ond1, withk2, setrefstatus, is"closed", DEFex, class"action", type"do", bya1, viaobjectd1, refstatus, is"open", locspacese, is0,setrefmobile,isFalse, DEFxe, class"action", type"express", bya1, whenGETa1.energy.is0 &, playemotees, sound"tick", DEFxc, class"action", type"express", bya1, whenGETa1.confidence.is0 &, freq2, playemotees, sound"wimp", DEFxp, class"action", type"express", bya1, whenGETa1.pleasure.is0.5 &,
3
4 rnbtutorial.nb
times1, playemoteeh, sound"chimes", plans compoundDEFps1, class"plan", type"seq", name"KDX", partsp1, tk, p2, od, ex, ec, index1, DEFps2, class"plan", type"seq", name"Dcup;CAKE", partsp3, p4, index1, DEFpp1, class"plan", type"par", name"DcupCAKE", partsed, tk, list, DEFpa1, class"plan", type"alt", name"DcupCAKE", partsed, tk, plans basicDEFp1, class"plan", type"basic", name"GoK", goalQSAMELOCa1, k2&, preferesk, option, defaultrw, DEFp2, class"plan", type"basic", name"GoD", goalQSAMELOCa1, d1&, preferesd, option, defaultrw, DEFp3, class"plan", type"basic", name"Dcup", goalISc2.exist&, prefereed, option, defaultrw, DEFp4, class"plan", type"basic", name"CAKE", goalec, prefereex, od, tk, optioned, xe, xc, xp, defaultrw ;
ãthe model complete model BASETEST: see
If you evaluate the following cell, you will create the BASE that contains the model (the list is the identifiers/symbols of the specificentities conatined in the model)
MAKEMODELMODELROBBIE
m1, s1, u1, t1, a1, sc, sr, se, eh, es, k1, k2, d1, c1, c2, rw, sk, sd, gb, tk, dk, ec, ed, od, cd, ex, xe, xc, xp, ps1, ps2, pp1, pa1, p1, p2, p3, p4
If you evaluate the following cell, you will see the symbols of thepredefinedtags used in the model:
THETAGLIST
actions, age, agent, agreable, bag, by, class, confidence, consciencious, consumable, content, creator, default, delta, dims, display, emote, emotes, energy, exist, extravert, face, freq, gender, goal, histo, histosize, index, is, list, loc, max, mobile, name, neurotic, Null, object, objects, on, onclock, open, option, parts, plan, plans, play, pleasure, portable, prefere, ref, request, role, satisfaction, session, set, size, sound, space, stack, status, target, times, topic, type, unit, use, used, user, via, visible, when, with
If you evaluate the following cell, you will see the complete structure of the BASE. It can be long!
BASE
If you evaluate the following cell, you will see the complete structure of the BASE but ordered by the paths. It can take long!
ü
SEE
Simulation of Robbie
FrontEndExecute[FrontEndToken["ToggleDynamicUpdating"]] (*just don't care*)
ãComputer Window warning
rnbtutorial.nb5
In order to see the simualtion prperly you have to open a large window with at least 1200 pixels width, otherwise the simaula tion panel will be jaggered
ãSimulation panel
The simulation panel is displayed at T0 by DISPLAYSIMULATIONPANEL:  argument 1: a model variable  argument 2: initial value of STEP MAX  argument 3: initial value of SPEED
SUB PANEL: RATIONAL AGENT  The current plan is in the stack  the alternative plans can be seleceted by clicking on one of the PLAN buttons  within a plan, a particular action can be forced to execution (if possible at that moment) by clicking on one of the EXEC buttons  POSS list the possible actions at any moment  SOUND check box switches the sound if available on the machine  TRACE switches the Print tracing under the simulation panel (low level tarcing!)  SPEED sets the speed of the simulation  STEP 0 to MAX makes n steps to be executed in a row  PLAY is the button that launches the n steps of the simulation (stops when goal is achieved)  STOP/START suspends and resumes PLAY  RESET resets the simulation panel to intial state T0. SUB PANEL SIMULATION  show the topology , the objects etc.  can be clicked or any interaction SUB PANEL BEHAVIRAL AGENT  ENGY = energy is the current value of the energy of the agent  PLEA = pleasure is the current value of the pleasure of the agent  CONF = confidence is the current value of the confidence of the agent  EXP is the current list od the agent's expecteations  DONE is the current list of the achieved expectations from EXP
ãSimulation at T0
Here is the simulation at T0 You can click on PLAY to launch it
6 rnbtutorial.nb
DISPLAYSIMULATIONPANELMODELROBBIE, 10, 0.1
NOTE: This panel has been converted to bitmap format for the pdf export of the tutorial
ãSimulation at T0+10
Here is the simulation at T0 The mission is not completely accomplished. NOTE: the cell of the panel has been converted to literal (because of the Dynamics inMathematica). Don't click on PLAY.
DISPLAYSIMULATIONPANELMODELROBBIE, 10, 0.1
NOTE: This panel has been converted to bitmap format for the pdf export of the tutorial
ãSimulation at T0+20
Here is the simulation at T0 The mission is accomplished! NOTE: the cell of the panel has been converted to literal (because of the Dynamics inMathematica). Don't click on PLAY.
DISPLAYSIMULATIONPANELMODELROBBIE, 20, 0.1
NOTE: This panel has been converted to bitmap format for the pdf export of the tutorial
ãSome tests
You can see, at a given moment, the content of the BASE. Here is the current state of the information about the key k2
SEEk2
k2, classk2, typek2, sizek2, portablek2, existk2, usedk2, display
k2, visiblek2, loc, spacek2, loc, is
object key big True True 
False into a1
See the current information about the agent itself:
rnbtutorial.nb7
8 rnbtutorial.nb
SEEa1
a1, classa1, typea1, namea1, gendera1, age, unita1, age, isa1, rolea1, opena1, conscienciousa1, extraverta1, agreablea1, neurotica1, pleasure, histoa1, pleasure, deltaa1, pleasure, isa1, pleasure, onclocka1, satisfaction, histoa1, satisfaction, deltaa1, satisfaction, isa1, exista1, visiblea1, mobile
a1, display
a1, loc, histosizea1, loc, spacea1, statusa1, bag, maxa1, emotesa1, actionsa1, plansa1, plan, isa1, plan, stacka1, bag, contenta1, facea1, loc, histoa1, loc, isa1, energy, histoa1, energy, deltaa1, energy, isa1, confidence, histoa1, confidence, deltaa1, confidence, is
agent robot Robbie none year 2 Null 0 0 0 0 0  0. 0. DECRH1, 0.1,1&  0. 0. True True True
10 sr inside 1 eh, esrw, sk, sd, gb, tk, dk, ec, ed, od, cd, ex, xe, xc, xpps1, ps2, pp1, pa1, p1, p2, p3p4 p4k2essr,1, 1,sr,2, 1,sr,3, 2,sr,3, 3,sr,3, 2,sr, 1, 20.8, 0.7, 0.6, 0.5, 0.4, 0.30.1 0.2 0., 0.1,0.02, 0.13,0.05, 0.1,0.08, 0.07,0.11, 0.09,0.15, 0.1, 0.48 0.48
END