artificial intelligence and lisp #3 characterization of actions [chapter 5] representation language...
TRANSCRIPT
![Page 1: Artificial Intelligence and Lisp #3 Characterization of Actions [Chapter 5] Representation Language [Chapter 2] Lab Assignment 2](https://reader030.vdocuments.mx/reader030/viewer/2022032518/56649ccc5503460f949967e0/html5/thumbnails/1.jpg)
Artificial Intelligence and Lisp #3
Characterization of Actions [Chapter 5]
Representation Language [Chapter 2]
Lab Assignment 2
![Page 2: Artificial Intelligence and Lisp #3 Characterization of Actions [Chapter 5] Representation Language [Chapter 2] Lab Assignment 2](https://reader030.vdocuments.mx/reader030/viewer/2022032518/56649ccc5503460f949967e0/html5/thumbnails/2.jpg)
Part I: Working with action laws
[Read Lecture Notes Chapter 5 for this,but read Chapter 2 first]
![Page 3: Artificial Intelligence and Lisp #3 Characterization of Actions [Chapter 5] Representation Language [Chapter 2] Lab Assignment 2](https://reader030.vdocuments.mx/reader030/viewer/2022032518/56649ccc5503460f949967e0/html5/thumbnails/3.jpg)
Effect law for pour action
[Do .t [pour .fr .to]] = [if [and [H- .t (substance-in: .to) empty] (not [H- .t (substance-in: .fr) Empty ])] [coact [H! .t (substance-in: .to) (cv (substance-in: .fr)) ] [H! .t (substance-in: .fr) Empty ]] [soact] ]]
![Page 4: Artificial Intelligence and Lisp #3 Characterization of Actions [Chapter 5] Representation Language [Chapter 2] Lab Assignment 2](https://reader030.vdocuments.mx/reader030/viewer/2022032518/56649ccc5503460f949967e0/html5/thumbnails/4.jpg)
Notation on previous slide
[H- time feature val] is a logical expression which is true if the value of feature at time-1 is val
[H time feature val] is a logical expression which is true if the value of feature at time is val
[H! time feature val] is a low-level “action” that assigns val as the value of feature at time
![Page 5: Artificial Intelligence and Lisp #3 Characterization of Actions [Chapter 5] Representation Language [Chapter 2] Lab Assignment 2](https://reader030.vdocuments.mx/reader030/viewer/2022032518/56649ccc5503460f949967e0/html5/thumbnails/5.jpg)
Use of effect law in simulator Check whether precondition is satisfied If so, execute the 'then' clause in the
environment. A composite action (coact) always takes one
timestep. A sequence (soact) takes one timestep per component.
If precondition is not satisfied, then execute the 'else' clause.
Report success or failure, failed precondition, and culprit of the failure (so that the agent has a chance to fix the problem)
![Page 6: Artificial Intelligence and Lisp #3 Characterization of Actions [Chapter 5] Representation Language [Chapter 2] Lab Assignment 2](https://reader030.vdocuments.mx/reader030/viewer/2022032518/56649ccc5503460f949967e0/html5/thumbnails/6.jpg)
Precondition for pour action
[Do .t [pour .fr .to]] = [if [and [H- .t (substance-in: .to) empty] (not [H- .t (substance-in: .fr) empty ])] [coact [H! .t (substance-in: .to) (cv (substance-in: .fr)) ] [H! .t (substance-in: .fr) empty ]] [soact] ]]
Failed precondition as reported by simulator: [H- now (substance-in: g2) empty]
![Page 7: Artificial Intelligence and Lisp #3 Characterization of Actions [Chapter 5] Representation Language [Chapter 2] Lab Assignment 2](https://reader030.vdocuments.mx/reader030/viewer/2022032518/56649ccc5503460f949967e0/html5/thumbnails/7.jpg)
Operations done on the precondition
Evaluate precondition. If failed: Instantiate variables (most of them) Insert now for current time in simulated world Identify which (one or more) of the conjuncts
has the value false Return both entire instantiated precondition,
and failed conjuncts More complicated operation if the precondition
is more complicated
![Page 8: Artificial Intelligence and Lisp #3 Characterization of Actions [Chapter 5] Representation Language [Chapter 2] Lab Assignment 2](https://reader030.vdocuments.mx/reader030/viewer/2022032518/56649ccc5503460f949967e0/html5/thumbnails/8.jpg)
Agent's response to failed precondition: alternatives
Recall: [H- now (substance-in: g2) empty] Simplest: Look up reaction in table - but based on what? Associate reaction(s) with pattern: [H- now (substance-in: .g) empty] [H- now (substance-in: .g) .c] Check postconditions of all available actions to find one
with desired effect: dispose [H! .t (substance-in: .e) empty] Find sequence of actions (a plan) whose combined effect
will be the desired one.
![Page 9: Artificial Intelligence and Lisp #3 Characterization of Actions [Chapter 5] Representation Language [Chapter 2] Lab Assignment 2](https://reader030.vdocuments.mx/reader030/viewer/2022032518/56649ccc5503460f949967e0/html5/thumbnails/9.jpg)
Operations on action expressions
Consist of expressions for precondition and for effect which are treated separately
Evaluation of precondition Partial evaluation of precondition Effect is ~ postcondition Match partially evaluated precondition with
postcondition/effect of another action Send expression to another agent Save expression for later reuse (learning)
![Page 10: Artificial Intelligence and Lisp #3 Characterization of Actions [Chapter 5] Representation Language [Chapter 2] Lab Assignment 2](https://reader030.vdocuments.mx/reader030/viewer/2022032518/56649ccc5503460f949967e0/html5/thumbnails/10.jpg)
Part II: Representation formalism[Read Lecture Notes, Chapter 2 for parts II-IV]
Requirements: Adequate expressivity: facts, scripts, action
laws Facilitate processing in computer Readability for humans Conciseness - avoid multiple representations Use available standards both from mathematics
and logic, and from computer world
![Page 11: Artificial Intelligence and Lisp #3 Characterization of Actions [Chapter 5] Representation Language [Chapter 2] Lab Assignment 2](https://reader030.vdocuments.mx/reader030/viewer/2022032518/56649ccc5503460f949967e0/html5/thumbnails/11.jpg)
KRF - atomic elements
Atomic entities, e.g. Plato Strings, e.g. ”Ursus ursus” Numbers, e.g. 451
![Page 12: Artificial Intelligence and Lisp #3 Characterization of Actions [Chapter 5] Representation Language [Chapter 2] Lab Assignment 2](https://reader030.vdocuments.mx/reader030/viewer/2022032518/56649ccc5503460f949967e0/html5/thumbnails/12.jpg)
KRF - composite elements
Composite entities, e.g. (age-of: Plato) Sets, e.g. {Plato Socrates} Sequences, e.g. <Caesar Augustus Nero> Records, e.g. [dispose :e glass4] Maplets, e.g. [: 45 empty] Forms, e.g. (cv (age-of: Plato)) or (+ 2 (cv (age-of: Plato)))
![Page 13: Artificial Intelligence and Lisp #3 Characterization of Actions [Chapter 5] Representation Language [Chapter 2] Lab Assignment 2](https://reader030.vdocuments.mx/reader030/viewer/2022032518/56649ccc5503460f949967e0/html5/thumbnails/13.jpg)
Composite entities vs forms
Composite entities, e.g. (age-of: Plato) Forms, e.g. (cv (age-of: Plato)) or (+ 2 (cv (age-of: Plato))) Composite entities can have attributes and
values Forms are replaced by their value during
evaluation - composite entities are not
![Page 14: Artificial Intelligence and Lisp #3 Characterization of Actions [Chapter 5] Representation Language [Chapter 2] Lab Assignment 2](https://reader030.vdocuments.mx/reader030/viewer/2022032518/56649ccc5503460f949967e0/html5/thumbnails/14.jpg)
KRF - records
Records, e.g. [dispose :e glass4] More generally: [oper arg1 arg2... :tag1 val1 :tag2 val2 ... ] Alternative, equivalent: [oper :tag1 val1 :tag2 val2 ... ^ arg1 arg2... ]
![Page 15: Artificial Intelligence and Lisp #3 Characterization of Actions [Chapter 5] Representation Language [Chapter 2] Lab Assignment 2](https://reader030.vdocuments.mx/reader030/viewer/2022032518/56649ccc5503460f949967e0/html5/thumbnails/15.jpg)
KRF - mappings
Maplets, e.g. [: 45 empty] Used to form mappings, e.g. {[: 21 water] [: 28 empty] [: 35 beer] [: 45 empty]}
![Page 16: Artificial Intelligence and Lisp #3 Characterization of Actions [Chapter 5] Representation Language [Chapter 2] Lab Assignment 2](https://reader030.vdocuments.mx/reader030/viewer/2022032518/56649ccc5503460f949967e0/html5/thumbnails/16.jpg)
Part III: Generic Scripting Language
Used as a basis for a range of scripting languages:
Agent Scripting Language Document Scripting Language (for texts and
web pages) Operations Scripting Language ...
![Page 17: Artificial Intelligence and Lisp #3 Characterization of Actions [Chapter 5] Representation Language [Chapter 2] Lab Assignment 2](https://reader030.vdocuments.mx/reader030/viewer/2022032518/56649ccc5503460f949967e0/html5/thumbnails/17.jpg)
Scripting Expressions
Action expression, record, [verb a1 a2...] Action composition using if, soact, etc. Feature, comp.ent., (feaop: arg1 ...) Term, form, (function arg1 arg2 ...) Query, form, is a kind of term Atomic propos., record, [pred a1 a2 ...] Composite propos., form, (and p1 p2 ...)
and similarly for or, not, etc.
![Page 18: Artificial Intelligence and Lisp #3 Characterization of Actions [Chapter 5] Representation Language [Chapter 2] Lab Assignment 2](https://reader030.vdocuments.mx/reader030/viewer/2022032518/56649ccc5503460f949967e0/html5/thumbnails/18.jpg)
Part IV: Entity-files
Entity-files are used in Leonardo for persistent storage of information between sessions
In principle, each entityfile is a two-level mapping:
{[: ent-1 {[: a1 val-1-1] [: a2 val-1-2] ...}] [: ent-2 {[: a1 val-2-1] [: a2 val-2-2] ...}] ... ... }
![Page 19: Artificial Intelligence and Lisp #3 Characterization of Actions [Chapter 5] Representation Language [Chapter 2] Lab Assignment 2](https://reader030.vdocuments.mx/reader030/viewer/2022032518/56649ccc5503460f949967e0/html5/thumbnails/19.jpg)
Practical representation of entityfiles------------------------------------- entity-1
[: type sometype][: a1 “value of attribute a1 for entity-1”][: a2 (symbfun: a5)][: (attrfun: color) {red green}]
------------------------------------- entity-2
[: type sometype][: a1 “value of attribute a1 for entity-2”]
@CommentComments may be expressed in free text, or mayuse a specialized notations as selected by thedesigner. They are preserved in textual formuntil processed by an application program.
ooooooooooooooooooooooooooooooooooo
![Page 20: Artificial Intelligence and Lisp #3 Characterization of Actions [Chapter 5] Representation Language [Chapter 2] Lab Assignment 2](https://reader030.vdocuments.mx/reader030/viewer/2022032518/56649ccc5503460f949967e0/html5/thumbnails/20.jpg)
Entityfile facilities
Each entity in the file must have a value for the type attribute. That value must again be an entity in a file, and so on.
Entityfiles can be written and read back. Only attributes that are included in the attributes attribute of the type are written to the file
Entities not having a value for any of the attributes of their type, are not written to file
Notice the use of properties, e.g. Comment
![Page 21: Artificial Intelligence and Lisp #3 Characterization of Actions [Chapter 5] Representation Language [Chapter 2] Lab Assignment 2](https://reader030.vdocuments.mx/reader030/viewer/2022032518/56649ccc5503460f949967e0/html5/thumbnails/21.jpg)
Some additional aspects An entity of type section can be used for
partitioning an entityfile into parts separated by a =================== line
The in-categories attribute is always optional and should have a set of entities as value
The command sortfil myfile sorts the entities in a file in alphabetical order
The name of an entityfile is always the first entity in the file
![Page 22: Artificial Intelligence and Lisp #3 Characterization of Actions [Chapter 5] Representation Language [Chapter 2] Lab Assignment 2](https://reader030.vdocuments.mx/reader030/viewer/2022032518/56649ccc5503460f949967e0/html5/thumbnails/22.jpg)
Lab 2: Defining a Zoo Miniworld
Milestone 1: static structure in the zoo world Milestone 2: defining actions in the zoo world What to do for the lab:
![Page 23: Artificial Intelligence and Lisp #3 Characterization of Actions [Chapter 5] Representation Language [Chapter 2] Lab Assignment 2](https://reader030.vdocuments.mx/reader030/viewer/2022032518/56649ccc5503460f949967e0/html5/thumbnails/23.jpg)
What to do for the lab(your “script”)
Read lab instructions on the course webpage: page on labserver access and lab 2 definition
Start a session with your Leonardo agent Download lab materials from labserver using
commands getlabs and getlab lab2a-kb Do the work as specified Make a local check using check-lab command Upload results using upload-lab command Await final approval