Introduction to AgentSpeak and Jason for Programming Multi-agent Systems (1) Dr Fuhua (Oscar) Lin SCIS Athabasca University June 19, 2009.

Slides:



Advertisements
Similar presentations
© Johan Bos Logic Programming About the course –Taught in English –Tuesday: mostly theory –Thursday: practical work [lab] Teaching material –Learn Prolog.
Advertisements

SCL: A Logic Standard for Semantic Integration Christopher Menzel Philosophy Department Texas A&M University
Peer-to-peer and agent-based computing Agent-Based Computing: tools, languages and case studies (Cont’d)
Formal Semantics for an Abstract Agent Programming Language K.V. Hindriks, Ch. Mayer et al. Lecture Notes In Computer Science, Vol. 1365, 1997
10 October 2006 Foundations of Logic and Constraint Programming 1 Unification ­An overview Need for Unification Ranked alfabeths and terms. Substitutions.
1 Introduction to Prolog References: – – Bratko, I., Prolog Programming.
CS6133 Software Specification and Verification
Rigorous Software Development CSCI-GA Instructor: Thomas Wies Spring 2012 Lecture 11.
Models and Propositional Logic In propositional logic, a model in general simply fixes the truth value – true or false – for every proposition symbol.
Answer Set Programming Overview Dr. Rogelio Dávila Pérez Profesor-Investigador División de Posgrado Universidad Autónoma de Guadalajara
Knowledge Representation Methods
Computability and Complexity 9-1 Computability and Complexity Andrei Bulatov Logic Reminder (Cnt’d)
Computability and Complexity 8-1 Computability and Complexity Andrei Bulatov Logic Reminder.
Constraint Logic Programming Ryan Kinworthy. Overview Introduction Logic Programming LP as a constraint programming language Constraint Logic Programming.
TCP1211-Logic Programming Formal Syntax and Semantics of Logic Programs Faculty of Information Technology Multimedia University.
JavaScript, Third Edition
FIRST ORDER LOGIC Levent Tolga EREN.
Software Agent - BDI architecture -. Outline BDI Agent AgentSpeak(L) Summary 1/39.
DEDUCTIVE DATABASE.
Formal Models of Computation Part II The Logic Model
ARTIFICIAL INTELLIGENCE [INTELLIGENT AGENTS PARADIGM] Professor Janis Grundspenkis Riga Technical University Faculty of Computer Science and Information.
2APL A Practical Agent Programming Language March 6, 2007 Cathy Yen.
Ontologies Reasoning Components Agents Simulations Belief Update, Planning and the Fluent Calculus Jacques Robin.
First Order Logic Chapter 7. PL is a Weak Representational Language §Propositional Logic (PL) is not a very expressive language because: §Hard to identify.
INTRODUCTION TO THE THEORY OF COMPUTATION INTRODUCTION MICHAEL SIPSER, SECOND EDITION 1.
1st-order Predicate Logic (FOL)
1 Knowledge Based Systems (CM0377) Lecture 4 (Last modified 5th February 2001)
Declarative vs Procedural Programming  Procedural programming requires that – the programmer tell the computer what to do. That is, how to get the output.
Pattern-directed inference systems
PART TWO PREDICATE LOGIC. Chapter Seven Predicate Logic Symbolization.
ARTIFICIAL INTELLIGENCE Lecture 3 Predicate Calculus.
First-Order Logic Introduction Syntax and Semantics Using First-Order Logic Summary.
Propositional Calculus Knowledge based agent Knowledge is contained in agents in the form of sentences in a knowledge representation language stored in.
PROLOG SYNTAX AND MEANING Ivan Bratko University of Ljubljana Faculty of Computer and Info. Sc. Ljubljana, Slovenia.
When you read a sentence, your mind breaks it into tokens—individual words and punctuation marks that convey meaning. Compilers also perform tokenization.
October 27, 2006 BDI Agents and AgentSpeak(L) Romelia Plesa PhD Candidate SITE, University of Ottawa.
Programming Languages and Design Lecture 3 Semantic Specifications of Programming Languages Instructor: Li Ma Department of Computer Science Texas Southern.
Fariba Sadri - ICCL 08 Agent Examples 1 Agents Some Examples Fariba Sadri Imperial College London ICCL Summer School Dresden August 2008.
By: Cory Canter CSC 415 Programming Languages. History  Created by Alain Colmerauer, Phillipe Roussel and Robert Kowalski in 1971  Started as a natural.
Dr. Muhammed Al-Mulhem ICS An Introduction to Logical Programming.
Logic Programming Languages Session 13 Course : T Programming Language Concept Year : February 2011.
Ch. 13 Ch. 131 jcmt CSE 3302 Programming Languages CSE3302 Programming Languages (notes?) Dr. Carter Tiernan.
Introduction to Prolog. Outline What is Prolog? Prolog basics Prolog Demo Syntax: –Atoms and Variables –Complex Terms –Facts & Queries –Rules Examples.
CS 337 Programming Languages Logic Programming I (Logic, Intro to Prolog)
1 CSC384: Intro to Artificial Intelligence Lecture 5.  Knowledge Representation.
1 Knowledge Based Systems (CM0377) Lecture 6 (last modified 20th February 2002)
Web Science & Technologies University of Koblenz ▪ Landau, Germany Models in First Order Logics.
1 Reasoning with Infinite stable models Piero A. Bonatti presented by Axel Polleres (IJCAI 2001,
Programming Language Concepts Lecture 17 Prepared by Manuel E. Bermúdez, Ph.D. Associate Professor University of Florida Logic Programming.
1-1 An Introduction to Logical Programming Sept
Restrictions Objectives of the Lecture : To consider the algebraic Restrict operator; To consider the Restrict operator and its comparators in SQL.
Artificial Intelligence CIS 342 The College of Saint Rose David Goldschmidt, Ph.D.
Albert Gatt LIN3021 Formal Semantics Lecture 3. Aims This lecture is divided into two parts: 1. We make our first attempts at formalising the notion of.
PREDICATE CALCULS In Propositional Calculus, each atomic symbol denotes a proposition. But there is no way to access the components of an individual assertion.
ARTIFICIAL INTELLIGENCE [INTELLIGENT AGENTS PARADIGM] Professor Janis Grundspenkis Riga Technical University Faculty of Computer Science and Information.
ARTIFICIAL INTELLIGENCE Lecture 2 Propositional Calculus.
Web Science & Technologies University of Koblenz ▪ Landau, Germany Models in First Order Logics.
Java-02 Basic Concepts Review concepts and examine how java handles them.
Artificial Intelligence Knowledge Representation.
Information Systems & Semantic Web University of Koblenz ▪ Landau, Germany Advanced Data Modeling Steffen Staab with Simon Schenk TexPoint fonts used in.
By P. S. Suryateja Asst. Professor, CSE Vishnu Institute of Technology
Introduction to Logic for Artificial Intelligence Lecture 2
tautology checking continued
Java Primer 1: Types, Classes and Operators
Back to “Serious” Topics…
Predicate Logic: Syntax.
Predicate Logic.
Representations & Reasoning Systems (RRS) (2.2)
PROLOG.
Logical Agents Prof. Dr. Widodo Budiharto 2018
Presentation transcript:

Introduction to AgentSpeak and Jason for Programming Multi-agent Systems (1) Dr Fuhua (Oscar) Lin SCIS Athabasca University June 19, 2009

AgentSpeak Originally Proposed by Rao (1996) Programming language for BDI agents Elegant notation, based on logic programming Inspired By PRS (Georgeff & Lansky), dMARS (Kinny), and BDI Logics Abstract programming language aimed at theoretical results Why BDI? The BDI architecture is the predominant approach to the implementation of “intelligent” or “rational” agents (Wooldridge, 2000).

AgentSpeak(L) Agent An AgentSpeak(L) agent is created by the specification of a set of base beliefs and a set of plans. A belief atom is simply a first-order predicate in the usual notation, and belief atoms or their negations are termed belief literals An initial set of beliefs is just a collection of ground belief atoms. A formula is called ground when it has no more uninstantiated variables.

Syntax of AgentSpeak The main language constructs of AgentSpeak are: – Beliefs – Goals – Plans The architecture of an AgentSpeak agent has four main components: – Belief Base – Plan Library – Set of Events – Set of Intentions

Agent an agent is simply specified by – a set bs of beliefs (the agent’s initial belief base) a set of ground (first-order) atomic formula (i.e., variables are not allowed): bs ::= at 1, at 2, …, at m. – a set ps of plans (the agent’s plan library): ps ::= p1, p2, …, pn The atomic formula at of the language are predicates – at ::= P(t1, t2, …, tn) – where P is a predicate symbol, – t1,..., tn are standard terms of first order logic.

Plan p p ::= te : ct <- h – te triggering event, – ct plan’s context, – h sequence of actions, goals, or belief updates; – te : ct head of the plan, conditions under which the plan can be executed – h its body. The formula ct must be a logical consequence of the agent’s beliefs if the plan is to be considered applicable.

The Concrete Syntax of AgentSpeak(L) A triggering event te can then be the addition or the deletion of a belief from an agent’s belief base (+at and −at, respectively), or the addition or the deletion of a goal (+g and −g, respectively). A sequence h of actions, goals, and belief updates defines the body of a plan. We assume the agent has at its disposal a set of actions and we use a as a metavariable ranging over them. They are given as normal predicates except that an action symbol A is used instead of a predicate symbol.

Beliefs Beliefs or a belief base represent the information available to an agent (e.g. about the environment or other agents) A collection of literals, as in traditional logic programming. A literal is a predicate or its negation. An example of predicates: tall(john) the agent believes a particular property (“tall”) of an individual (“John”) Fact(0, 1) the agent believes the factorial of 0 is 1. Fact(X, Y) the agent believes the factorial of X is Y. So, when the agent starts executing, this belief is added to the agent’s belief base. To represent the fact that a certain relationship holds between two or more objects, we can use a predicate such as: likes(john, music) Which states that John likes music. To compose predicates, we must use Terms !

Types of AgentSpeak Terms in Jason --- Basics of Logic Programming (1/5) Atom – As in Prolog, any symbol starting with a lower-case is called an atom, which is used to represent particular individuals or object; – They are the equivalent of “constants” in first-order logic. – E.g. john is an atom Variable – A symbol starting with an uppercase letter is interpreted as a logical variable. – For example, Person is a variable. Number and String – Are Represented as usual in programming languages – Are classified as constants terms constant Variables Person Variables Person Structures staff(john, age(36)) Structures staff(john, age(36)) List [] [1, X, john] List [] [1, X, john] Number 3 12, 14 Number 3 12, 14 String “John” String “John” Atom john box1 Atom john box1

Variable instantiation – Initially variables are free or uninstantiated and once instantiated or bound to a particular value, they maintain that value throughout their scope --- in the case of AgentSpeak, we shall see that the scope is the plan in which they appear. – Variables are bound to values by unification; – A formula is called ground when it has no more uninstantiated variables. – For example, a variable Person could be bound to the atom john. – More generally, variables can be bound to a constant (i.e. an atom, a number, or a string), or to a more complex data type called structure. Term – Is used to refer to a constant, a variable, or a structure.

Structure – Is used to represent complex data, – for example, staff(“Oscar Lin”, , professor, married, wife(Yu), daughter(Sally)) – Can be used to represent the information about a member of staff in a university. – Structures start with an atom (called the functor) and are followed by a number of terms (called arguments) separated by commas and enclosed in parentheses.

Predicate facts in Prolog Have the exactly same format as structures, e.g. like(john, music) Difference is purely semantical – A structure is used as term to represent an individual or object. – A fact is used to represent a logical proposition --- i.e. a formula that is to be interpreted as being either true or false.

arity The number of arguments of a predicate/structure is important, and is called its arity. A particular structure is referred to by its functor and its arity For example, ‘staff/6’, as it must have always exactly six different terms as arguments (otherwise it is considered a different structure altogether).

List – e.g. [Spring, Winter, Summer, Fall] – A special type of structure – The Prolog syntax for lists is also used in Jason. – There are some special operators for lists in particular ‘|’ can be used to separate the first item in a list from the list of all remaining items in it.

Types of AgentSpeak formula terms predicate literal goal belief Triggering event

Goals Goals g can be either achievement goals (!at) or test goals (?at). Goals represent states of affairs the agent wants to bring (come to believe, when goals are used declaratively) g – Achievement goals: !g !write(book) Or attempts to retrieve information from the belief base – Test goals: ?g ?publisher(P)

Events Events happen as a consequence to changes in the agent’s beliefs or goals Changes: + addition - deletion Events +b (belief addition) -b (belief deletion) +!g (achievement-goal addition) -!g (achievement-goal deletion) +?g (test-goal addition) -?g (test-goal deletion)

Plans An agent reacts to events by executing plans Plans are recipes for action, representing the agent’s know-how An AgentSpeak plan has the following general structure: trigger_event : context <- body Where The triggering event denotes the events that the plan is meant to handle; The context represents the circumstances in which the plan can be used; The body is the course of action to be used to handle the event if the context is believed true at the time a plan is being chosen to handle the event.

Triggering Events trigger_event : context <- body +b when the agent acquires the belief b; +started. +fact(X, Y) --- when the agent acquires the belief that the factorial of X is Y. -b (belief deletion) +!g (achievement-goal addition), whenever you acquire the goal g, or to achieve the goal g. +!print_fact(N) <- !fact(N,F);.print("Factorial of ", N, " is ", F). +!fact(N, F): N>0 <- !fact(N-1, F1); F = F1*N. +!fact(N, 1): N == 0. -!g (achievement-goal deletion) +?g (test-goal addition) -?g (test-goal deletion)

Plan Context +at and −at (in the body of a plan) represent operations for updating (u) the belief base by, respectively, adding and removing at. The context is logical expression, typically a conjunction of literals to be checked whether they follow from the current state of belief base. Types of literals in a plan context l --- the agent believes l is true ~l --- the agent believes l is false not l --- the agent does not believe l is true not ~l --- the agent does not believe l is false Example: +!prepare(Something) : number_of_people(N) & stock(Something, S) & S > N <- ……

Body The body is a sequence of actions and (sub) goals to achieve. Note: this is the original AgentSpeak syntax; Jason allows other things in the context and body of plans. trigger_event : context <- body