Artificial Intelligence and Lisp #3

Slides:



Advertisements
Similar presentations
Semantics Static semantics Dynamic semantics attribute grammars
Advertisements

HTML 5 and CSS 3, Illustrated Complete Unit L: Programming Web Pages with JavaScript.
Introduction to Unix – CS 21 Lecture 11. Lecture Overview Shell Programming Variable Discussion Command line parameters Arithmetic Discussion Control.
Artificial Intelligence and Lisp #3 Characterization of Actions [Chapter 5] Representation Language [Chapter 2] Lab Assignment 2.
ISBN Chapter 3 Describing Syntax and Semantics.
1 Semantic Description of Programming languages. 2 Static versus Dynamic Semantics n Static Semantics represents legal forms of programs that cannot be.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 5 More SQL: Complex Queries, Triggers, Views, and Schema Modification.
Artificial Intelligence and Lisp #9 Reasoning about Actions.
Basic Elements of Programming A VB program is built from statements, statements from expressions, expressions from operators and operands, and operands.
Programming Languages Structure
Artificial Intelligence and Lisp Lecture 12 Finish "Programming in Lisp, II" + Lab 5 a-b + Review and Synthesis of the Course LiU Course TDDC65 Autumn.
Javascript II Expressions and Data Types. 2 JavaScript Review programs executed by the web browser programs embedded in a web page using the script element.
Describing Syntax and Semantics
JavaScript, Third Edition
Extending HTML CPSC 120 Principles of Computer Science April 9, 2012.
Linux Operations and Administration
Introduction to PHP A user navigates in her browser to a page that ends with a.php extension The request is sent to a web server, which directs the request.
1 A Balanced Introduction to Computer Science, 2/E David Reed, Creighton University ©2008 Pearson Prentice Hall ISBN Chapter 11 Conditional.
ISBN Chapter 3 Describing Semantics -Attribute Grammars -Dynamic Semantics.
[ Part III of The XML seminar ] Presenter: Xiaogeng Zhao A Introduction of XQL.
Chapter 3 Part II Describing Syntax and Semantics.
Programming Languages and Design Lecture 3 Semantic Specifications of Programming Languages Instructor: Li Ma Department of Computer Science Texas Southern.
The Category-Partition Method for Specifying and Generating Functional Tests. Thomas J. Ostrand and Marc J.Balcer [ CACM,1988 ]. Slides from Prof. Shmuel.
Lecture by: Prof. Pooja Vaishnav.  Language Processor implementations are highly influenced by the kind of storage structure used for program variables.
1 Assertions. 2 A boolean expression or predicate that evaluates to true or false in every state In a program they express constraints on the state that.
Restrictions Objectives of the Lecture : To consider the algebraic Restrict operator; To consider the Restrict operator and its comparators in SQL.
1 CSC 384 Lecture Slides (c) , C. Boutilier and P. Poupart CSC384: Intro to Artificial Intelligence  Jan 12 th  Announcements: Tutorial splits.
1 FP Foundations, Scheme In Text: Chapter Chapter 14: FP Foundations, Scheme Mathematical Functions Def: A mathematical function is a mapping of.
Logical Agents. Outline Knowledge-based agents Logic in general - models and entailment Propositional (Boolean) logic Equivalence, validity, satisfiability.
Artificial Intelligence and Lisp #4 Decision Trees Causal Nets (beginning) Lab Assignment 2b.
Artificial Intelligence and Lisp Lecture 6 LiU Course TDDC65 Autumn Semester,
More SQL: Complex Queries, Triggers, Views, and Schema Modification
Functional Programming Languages
Chapter 3 of Programming Languages by Ravi Sethi
Introduction to Logic for Artificial Intelligence Lecture 2
Artificial Intelligence and Lisp Lecture 3 LiU Course TDDC65 Autumn Semester,
Artificial Intelligence and Lisp #4
Expressions and Assignment
Agenda Bash Shell Scripting – Part II Logic statements Loop statements
Representation, Syntax, Paradigms, Types
Intro to PHP & Variables
Relational Algebra Chapter 4, Part A
Relational Algebra 461 The slides for this text are organized into chapters. This lecture covers relational algebra, from Chapter 4. The relational calculus.
Syntax Questions 6. Define a left recursive grammar rule.
More Selections BIS1523 – Lecture 9.
Phil Tayco Slide version 1.0 Created Oct 2, 2017
The Metacircular Evaluator
Slides by Steve Armstrong LeTourneau University Longview, TX
FP Foundations, Scheme In Text: Chapter 14.
Relational Algebra Chapter 4, Sections 4.1 – 4.2
Representation, Syntax, Paradigms, Types
Event-Based Architecture Definition Language
CSE S. Tanimoto Introduction to ML
Software Design Lecture : 15.
SQL: Structured Query Language
Representation, Syntax, Paradigms, Types
Back to “Serious” Topics…
Conditional Execution
CSE S. Tanimoto Paradigms
Python Primer 1: Types and Operators
CSE S. Tanimoto Introduction to ML
Representation, Syntax, Paradigms, Types
Classes CS 21a: Introduction to Computing I
CSE S. Tanimoto Introduction to ML
Chapter 11 Conditional Execution
CSE S. Tanimoto Introduction to ML
Chapter 15 Functional Programming 6/1/2019.
Representations & Reasoning Systems (RRS) (2.2)
Computers and Scientific Thinking David Reed, Creighton University
Logical Agents Prof. Dr. Widodo Budiharto 2018
Presentation transcript:

Artificial Intelligence and Lisp #3 Characterization of Actions [Chapter 5] Representation Language [Chapter 2] Lab Assignment 2

Part I: Working with action laws [Read Lecture Notes Chapter 5 for this, but read Chapter 2 first]

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] ]]

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

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)

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]

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

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.

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)

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

KRF - atomic elements Atomic entities, e.g. Plato Strings, e.g. ”Ursus ursus” Numbers, e.g. 451

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)))

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

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... ]

KRF - mappings Maplets, e.g. [: 45 empty] Used to form mappings, e.g. {[: 21 water] [: 28 empty] [: 35 beer] [: 45 empty]}

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 ...

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.

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] ...}] ... ... }

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 [: a1 “value of attribute a1 for entity-2”] @Comment Comments may be expressed in free text, or may use a specialized notations as selected by the designer. They are preserved in textual form until processed by an application program. ooooooooooooooooooooooooooooooooooo

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

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

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:

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