Presentation is loading. Please wait.

Presentation is loading. Please wait.

Artificial Intelligence and Lisp Lecture 2 LiU Course TDDC65 Autumn Semester, 2010

Similar presentations


Presentation on theme: "Artificial Intelligence and Lisp Lecture 2 LiU Course TDDC65 Autumn Semester, 2010"— Presentation transcript:

1 Artificial Intelligence and Lisp Lecture 2 LiU Course TDDC65 Autumn Semester, 2010 http://www.ida.liu.se/ext/TDDC65/

2 List Processing - Recursive Functions (length.s) == (if [equal.s <>] 0 (+ 1 (length (t1.s)))) (replace.a.b.s) == (if [equal.s.a].b (if [atom.s] s (cons (replace.a.b (e1.s)) (replace.a.b (t1.s)) )))

3 The Autonomous Intelligent Agent Much of the software technology for A.I. systems centers around the concept of an autonomous intelligent agent. This is a software platform with good capabilities for the following: Representing a world model based on 'entities' and their relationships Representing the components of e.g. the BDI model or the HTN model as data so that they can be modified dynamically Contain the various algorithms etc that are need for aspects of the behavior Persist over time, e.g. so that learned behavior can be kept Communicate with other agents Interface to specialized software, e.g. sensors and actuators

4 Example Hierachical Task Network Goto Trainstation Go from Sth C to Globen Take train to Stockholm Walkto Busstop Take bus to Linköping C Wait for bus to Linköping C Go to Globen Preconditions: Bus stop close enough, agent is able to walk,... Preconditions: There is such a busline, bus actually arrives...

5 Formulas and Languages Language requirements for agent platform software: Support for expressing and using formulas in logic, for example for preconditions of actions Support for implementing a variety of specialized languages, for example for representing particular kinds of environment models, or for use in agent-to-agent communication, or for representing scripts for sequences of actions The language requirement is often met by identifying a common syntactic style that can be used by a set of related languages. The Lisp language is related to the syntactic style of S-expressions.

6 Implementation of Languages in a Style Implement a parser that converts expressions in that style to an internal representation as a datastructure For each of the participating languages, implement an interpreter or a compiler that operates on the datastructure Advantages: Less implementation work Enables library of programs that operate on internal representation and that can be used for several languages Greater uniformity of languages makes them easier to learn Facilitates embedding embedding one language in another, and cross-language invocation

7 S-expression Style Examples: color.red "Yes or no: " 421 (walkto busstop-4) (walk :from home :to busstop-4) (seq (walkto busstop-4)(takebus Lkp-C)) (set busstop-4 busstop-7 busstop-12) (+ (timefor (walkto busstop-d)) (timefor (waitfor (some (and bus (going-to Lkp-C)) ))) (timefor (go bus busstop-4 Lkp-C)) )

8 S-expression Style 1. Nested parenthesized expressions (lists) 2. Convention: operator as first element in list 3. Convention: use of tags e.g. :from, :to 4. Convention, sometimes: variables as ?vbl Can be used for programming language, but also for plain data, for logic, and for alternative languages S-expression-based programming languages: Lisp, Scheme

9 S-expression Style Can be used for programming language, but also for plain data, for logic, and for alternative languages S-expression-based programming languages: Lisp, Scheme Some other S-expression-based languages: KIF, Knowledge Interchange Format FIPA-ACL, Agent Communication Language PDDL, Planning Domain Definition Language

10 XML Style Example (from Web Ontology Language, OWL): <CabernetSauvignon rdf:ID="SantaCruzMountainVineyardCabernetSauvignon" >

11 XML Style Originates from SGML which was intended for markup of text, via HTML for markup of web pages XML wanted to have the same notation for markup of text and for structured data Use for programs and other formula languages was not considered initially but has been brought up more recently Strong emphasis on standardization and on use in very large systems Difficult to read for the human eye

12 KR Expressions Similar to S-expressions but easier to read Closer to the notation for logic formulas Contains some higher-level constructs that are found in some S-expression-based languages, but which are generally useful Used both in lecture notes/compendiums and in the software system being used (Leonardo)

13 KR Expressions Examples of use: color.red "Answer yes or no: " {busstop-4 busstop-7 busstop-12} (union {a b}{a c d}) [subset {a b} {c a d b g}] [knows-what peter (phone-number-of: lars)] [walk peter :from (home-of peter) :to Lkp-C]

14 KR Expressions Constructs: Entity color.red String "Answer yes or no: " Number 421 Composite entity (phone-number-of: lars) Set {busstop-4 busstop-7 busstop-12} Sequence Mapping {[: rose red][: waterlily white]} Form (union {a b}{a c d}) (+ 14.offset) use of variable Record [subset {a b} {c a d b g}] [walk peter :from (home-of peter) :to Lkp- C]

15 KR Expressions, extensions Constructs: Entity color.red String "Answer yes or no: " Number 421 Composite entity (phone-number-of: lars) Set {busstop-4 busstop-7 busstop-12} Sequence Mapping {[: rose red][: waterlily white]} Form ({a b} union {a c d}) (14 +.offset) use of variable Record [{a b} subset {c a d b g}] [peter walk :from (home-of peter) :to Lkp- C]

16 Common Expression Language (CEL) CEL is one of the languages using KRE style. It can be used in command-line dialog with a system, and in files in a knowledgebase Each construct in CEL is written using one of the constructs in KRE Literals (atomic propositions) as records [...] Actions as records [...] Composite propositions (using and, or, etc) as forms (...) Terms, i.e. arguments for actions and atomic propositions, are written as forms (...) The operator in an action record is called a verb The operator in a literal record is called a predicate

17 Common Expression Language (CEL) Literal [subset {b} {a b c}] [-subset {d} {a b c}] Proposition (or [equal a b][equal a c]) (not [equal a b]) Literals are also propositions Action [peter walk :from (home-of peter) :to Lkp-C] Term (home-of peter) (union {a b}{b c}]

18 Simple Session Example 1

19 The Autonomous Intelligent Agent Much of the software technology for A.I. systems centers around the concept of an autonomous intelligent agent. This is a software platform with good capabilities for the following: Representing a world model based on 'entities' and their relationships Representing the components of e.g. the BDI model or the HTN model as data so that they can be modified dynamically Contain the various algorithms etc that are need for aspects of the behavior Persist over time, e.g. so that learned behavior can be kept Communicate with other agents Interface to specialized software, e.g. sensors and actuators

20 In this course: Leonardo Platform Allegro CommonLisp agent indivma p individual Session with the agent leohost Other individual and agent

21 Manifestations, etc The individual has a persistent manifestation as a directory structure with files, and a dynamic manifestation as a run in a computer. These are kept consistent during the run. The persistent manifestation is expected to be long-lived (months, years) and to accumulate information over time. One indidivual can contain several agents. An individual (and an agent) can move between hosts. Agents can exchange messages. The indivmap structure contains location and addressing information. The leohost structure contains information about the current host, for use by visiting agents/individuals.

22 Structure of Leonardo system for this course Allegro CommonLisp remus orange lablib indivma p

23 Leonardo Platform and Registrar Allegro CommonLisp remus orange lablib indivma p Allegro CommonLisp remus registrar indivma p

24 Registration and Lab Routine The first time you use your agent it will prompt you for your name, student id, some more. Asap you should register your agent, i.e. give a command where it sends a registration message to the registrar. At this time your computer must be connected to the Internet. Lab assignments are downloaded from registrar to your Leonardo agent, using a download command. You do the work for the labs using your agent. The results of your work are put in a particular results file for each of the labs. To report your work, you issue a command whereby your agent sends the results file to the registrar. In some of the labs there is a command that you can use for checking your results file before sending it. We check the results file manually and/or automatically and send back a confirmation message by email.

25 Structure of Leonardo system after registration Allegro CommonLisp remus orange lablib indivma p yourname

26 Simple Session Example 2

27 Leonardo platform in virtual host Allegro CommonLisp remus orange lablib indivma p ubuntu linux

28 Available Operational Modes Use Leonardo system in virtual host from VMware on your own computer. Recommended if you have one, you are comfortable with it, and it is sufficiently powerful. Available for Windows and Linux systems (not Mac). Use Leonardo system on IDA's student computer network. Recommended if you do not have a computer that you wish to use for this purpose. Use Leonardo system on your own computer without virtual host. Avoids the overhead of the virtual host, but requires you to install Allegro yourself, and minor problems may arise. Available for Windows, Linux and Mac systems. Note: You will be using an evaluation license for the Lisp system that expires on March 15, 2011. Technical information will be given in the tutorial session on Thursday (tomorrow).


Download ppt "Artificial Intelligence and Lisp Lecture 2 LiU Course TDDC65 Autumn Semester, 2010"

Similar presentations


Ads by Google