Comunicare in SMA - Artificial Intelligence

Sisteme multi-agent
Curs 3
Universitatea “Politehnica” din
Bucuresti
anul universitar 2007-2008
Adina Magda Florea
[email protected]
http://turing.cs.pub.ro/blia_08
curs.cs.pub.ro
Comunicare in SMA


Comunicare indirecta
Comunicare directa

–
–
–
–

ACL
Limbaje pentru continut
Teoria actelor de vorbire
KQML
FIPA and FIPA-ACL
Protocoale de interactiune
1. Comunicare in SMA
Comunicare agenti



nivel scazut
nivel inalt
Implica interactiuni
Protocoale de comunicare
Protocoale de interactiune – conversatii = schimb structurat de
mesaje
Scop  comunicarea permite agentilor:
 coordinarea actiunii si comportarii
 schimbarea starii altor agenti
 determina agenti sa faca actiuni
3
2. Comunicare indirecta


In general pt agenti reactivi
Comunicare prin semnale
V(x)=V(x0)/dist(x,x0)

S - stimulus
S
Agent A

(stimulus genreaza
comportare P)

x0

Agent B
(stimulus genereaza
comportare P)
Comunicare prin "urme" lasate in mediu
4
Comunicare indirecta

Comunicare in sisteme tip "blackboard"
Control
KS
Blackboard
KSAR
KS
KS
KS
5
3. Comunicare directa






SMA – limbaje de nivel inalt
Presupun in general agenti BDI
ACL = Agent Communication Languages
Comunica cunostinte  rep. cunostinte
Intelegerea mesajului in context  ontologii
Comunicare vazuta ca o actiune – acte de
vorbire (de comunicare)
6
3.1 ACL
Concepts (distinguish ACLs from RPC, RMI or CORBA,
ORB):
 An ACL message describes a desired state in a declarative





language, rather than a procedure or method invocation
ACLs handle propositions, rules, and actions instead of
objects with no associated semantics - KR
ACLs are mainly based on BDI theories: BDI agents attempt
to communicate their BDI states or attempt to alter
interlocutor's BDI state – Cognitive Agents
ACLs are based on Speech Act Theory – Communicative
Acts
ACLs refer to shared Ontologies
Agent behavior and strategy drive communication and lead
to conversations Protocols
7
Origins of ACLs
Knowledge Sharing Effort - DARPA, 1990
 External Interface Group - interaction between KBS - KQML
 Interlingua - common language of KB - KIF
 Shared, Reusable Knowledge Bases - Ontolingua



Communication primitives
and protocols
- KQML
Content languages
– KIF
Ontologies
– DAML
ACL
Content language
DARPA Agent Markup Language (August 2000).
The goal of the DAML effort was to develop a language
and tools to facilitate the concept of the Semantic Web.
Ontology
8
3 straturi ale comunicarii

Primitive si protocol
- KQML
- FIPA


Limbaje pentru continut
– KIF
– Prolog
– Clips
– SQL
– DL
– FIPA-SL, FIPA-KIF
Ontologii
– DAML
– OWL
ACL
Content language
Ontology
9
3.2 Primitive ACL

Bazate pe acte de comunicare / acte de vorbire
J. Austin - How to do things with words, 1962,
J. Searle - Speech acts, 1969




Cele 3 straturi separa:
– continutul si semantica mesajului
– semantica comunicarii (acte vorbire) –
independenta de domeniu
Un ACL are o semantica formala bazata pe un
formalism logic
2 ACL-uri care s-au impus:
– KQML
– FIPA-ACL
Pot include definitii de protocoloale
10
Acte de vorbire
Un act de comunicare:
 locutie = fraza spusa de locutor
 ilocutie = intelesul dorit spre a fi comunicat de locutor (performativa)
 prelocutie = actiunea care rezulta din locutie
Maria i-a spus lui Gigel: "Te rog inchide usa"
locutie
illocutie:continut
prelocutie: usa inchisa
Categorii ilocutionale
 Asertive
 Directive
 Comisive
 Permisive
 Prohibitive
 Declarative
 Expresive
11
KQML
Parametrii comunicarii
- identitate emitator si
receptor
- identificator unic asociat
comunicarii
Content
KQML de baza
- protocol retea
- act de vorbire
Communication
Message
Optional
- limbajul continutului
- ontologie
Tipuri de performative
 Queries - ask-one, ask-all, ask-if, stream-all,...
 Generative - standby, ready, next, rest, discard, generate,...
 Response - reply, sorry ...
 Informational - tell, untell, insert, delete, ...
 Capability definition - advertise, subscribe, recommend...
 Networking - register, unregister, forward, route, ...
12
KQML - exemple
querie
A
(ask-one :sender joe
:receiver ibm-stock
:reply-with ibm-stock
:language PROLOG
:ontology NYSE-TICKS
:content (price ibm ?price) )
B
ask-all(P)
A
tell(P)
tell(P1,P2,...)
:sender willie
:receiver joe
:reply-with block1
:language KIF
:ontology BlockWorld
:content (AND (Block A) (Block B) (On A B)) )
informational
B
stream-all(P)
A
(tell
ask-one(P)
B
tell(P1)
tell(P2)
eos
13
Agent facilitator
point-to-point
querie
ask-one(P)
capability
A
subscribe(ask(P))
A
tell(P)
B
tell(P)
tell(P)
B
recommend(ask(P))
advertise(ask(P))
reply(B)
recruit(ask(P))
advertise(ask(P))
reply(A)
A
B
A
ask-one(P)
B
tell(P)
tell(P)
14
Semantica KQML
Logica modala
Bel(A,P)
Know(A,S)
Want(A,S)
Int(A,S)
 Preconditii: starea agentului emitator si a celui receptor pt a trimite si
receptiona un mesaj
 Postconditii – statrea emitatorului si receptorului dupa primirea cu succes a
unui mesaj
 Conditie de finalizare – dupa incheierea mesajului si realizarea intentiei
asociate
tell(A,B,X)
Pre(A): Bel(A,X)  Know(A, Want(B, Know(B, Bel(A,X))))
Pre(B): Int(B, Know(B, Bel(A,X)))
Post(A): Know(A, Know(B, Bel(A,X)))
Post(B): Know(B, Bel(A,X))
Completion: Know(B, Bel(A,X))
15
FIPA ACL
• Asemanator cu KQML
• Primitive oarecum diferite
• Semantica semnificativ diferita
(inform
:sender (agent-identifier :name i)
:receiver (set (agent-identifier :name j))
:content "weather (today, raining)"
:language Prolog)
16
FIPA - exemple
(request :sender (agent-identifier :name i)
:receiver (set (agent-identifer :name j)
:content ((action (agent-identifier :name j)
(deliver box7 (loc 10 15))))
:protocol fipa-request
:language fipa-sl
:reply-with order56 )
(agree
sender (agent-identifier :name j)
:receiver (set (agent-identifer :name i)
:content ((action (agent-identifier :name j)
(deliver box7 (loc 10 15))) (priority order56 low))
:protocol fipa-request
:language fipa-sl
:in-reply-to order56 )
17
FIPA - primitive

FIPA – acte de comunicare

Informative
- query_if, subscribe, inform, inform_if, confirm, disconfirm,
not_understood

Distributie taskuri
- request, request_whenever, cancel, agree, refuse, failure

Negociere
- cfp, propose, accept_proposal, reject_proposal
18
FIPA ACL
SL (Semantic Language)
B  - belief C  - desire U  - uncertain belief
Bif  = B  V B~ 
 Preconditii – conditiile necesare pt agentul emitator; nu
neaparat trimite mesaj
 Rational effect – efectul sperat la receptor; nu neaparat
realizat
<A, inform(B, )>
Pre: BA   BA (BifB   UifB )
Post: BB 
19
FIPA ACL

Inform indicates that the sending agent:
–
–
–

<A, inform(B, )>
Pre: BA   BA (BifB   UifB )
Post: BB 
holds that some proposition is true,
intends that the receiving agent also comes to believe that the proposition is true, and,
does not already believe that the receiver has any knowledge of the truth of the
proposition.
From the receiver’s viewpoint, receiving an inform message entitles
it to believe that:
– the sender believes the proposition that is the content of the message, and,
–

the sender wishes the receiver to believe that proposition also.
Whether or not the receiver does, indeed, adopt belief in the
proposition will be a function of the receiver's trust in the sincerity
and reliability of the sender.
20
FIPA - Protocoale

Defineste o serie de protocoale standard
– FIPA-query, FIPA-request, FIPAcontract-net, ...
21
FIPA - Request
22
Contract net
Initiator si contractori (potentiali)
23
FIPA - Contract net
24
3.3 Limbaje pentru continut
– KIF
– Prolog
– Clips
– SQL
– FIPA-SL, FIPA-KIF
KIF



Knowledge Interchange Format (KIF)
- is based on first order predicate logic
and has a LISP-like prefix syntax.
KIF is capable of expressing facts
and rules.
KIF provides constructs for
describing procedures, i.e. programs to
(possibly) be executed by an agent.
Knowledge Interchange Format (KIF)
 Facts
(salary 015-46-3946 john 72000)
(salary 026-40-9152 michael 36000)
(salary 415-32-4707 sam 42000)
 Asserted relation
(> (* (width chip1) (length chip1))
(* (width chip2) (length chip2)))
Rule
(=> (and (real-number ?x)
(even-number ?n))
(> (expt ?x ?n) 0))
Procedure
(progn (fresh-line t)
(print "Hello!")
(fresh-line t))
3.4 Ontologii
Ontology = a specification of objects, concepts, and
relationships in a particular domain
It comprises a vocabulary, a domain theory and a
conceptual schemata to describe organization and
interpretation
 Lexicalized ontologies (WordNet, EuroWordNet,
BalkanNet, FrameNet, MikroKosmos).
 Ontologies for knowledge representation
Ontology languages use “object
oriented” model based on:



Objects/Instances/Individuals
– Elements of the domain of discourse
– Equivalent to constants in FOL
Types/Classes/Concepts
– Sets of objects sharing certain characteristics
– Equivalent to unary predicates in FOL
Relations/Properties/Roles
– Sets of pairs (tuples) of objects
– Equivalent to binary predicates in FOL
4. Protocoale de interactiune
Interaction protocols = enable agents
to have conversations, i.e., structured
exchanges of messages
 Finite
automata
 Conversations in KQML
 Petri nets
4.1 Finite state automata
COOL, Barbuceanu,95
A:B<<ask(do P)
B:A<<accept(do P)
proposeS(P)
B:A<<refuse(do P)
acceptR(P)
B:A<<result(do P)
rejectR(P)
B:A<<fail(do P)
counterR(P)
counterS(P)
Winograd, Flores, 1986
acceptS(P)
rejectS(P)
31
4.2 Conversations in KQML
Use Definite Clause Grammars (DCG) formalism for the specification of
conversation policies for KQML performatives
DCGs extend Context Free Grammars in the following way:
 non-terminals may be compound terms
 the body of the rule may contain procedural attachments, written as "{" and
"}" that express extra conditions that must be satisfied for the rule to be
valid
Ex: noun(N)  [W], {RootForm(W,N), is_noun(N)}
S  s(Conv, P, S, R, inR, Rw, IO, Content), {member(P, [advertise, ask-if]}
s(Conv, ask-if, S, R, inR, Rw, IO, Content) 
[ask-if, S, R, inR, Rw, IO, Content] |
[ask-if, S, R, inR, Rw, IO, Content], {OI is inv(IO)},
r(Conv, ask-if, S, R, _, Rw, OI, Content)
r(Conv, ask-if, R, S, _, inR, IO, Content) 
[tell, S, R, inR, Rw, IO, Content] |
problem(Conv, R, S, inR, _, IO)
Labrou, Finin, 1998
32
4.3 Petri nets
Ferber, 1997
Petri net = oriented graph with 2 type of nodes: places and transitions;
there are moving tokens through the net - representation of dynamic aspect of processes.
Tokens are moved from place to place, following firing rules.
A transition T is enabled if all the input places P of T posses a token (several other rules may be defined).
A marking is a distribution of tokens over places. Colored Petri-nets
A wants to do P,
A cannot do P
B does not want
to do(P)
DA
DB
Request do(P)
AR1
Refuse do(P)
Accept/request do(P)
Success AR2
B is willing
to do(P)
Fail to do(P)
BR
Completed(P)
Impossible
to do(P)
Notification of end(P)
FA
FB
Failure
SA
Satisfaction
33
References
 M. Huhns, L. Stephens. Multiagent systems and societies of agents. In
Multiagent Systems - A Modern Approach to Distributed Artificial
Intelligence, G. Weiss (Ed.), The MIT Press, 2001, p.79-120.
 M. Wooldrige. Reasoning about Rational Agents. The MIT Press, 2000,
Chapter 7
 Y. Labrou, T. Finin. Semantics and conversations for an agent
communication language. In Readings in Agents, M. Huhns & M. Singh
(Eds.), Morgan Kaufmann, 1998, p.235-242.
 J. Ferber - Multi-Agent Systems. Addison-Wesley, 1999, Chapter 6
 T. Finnin, R. Fritzson - KQML as an agent communication language. In
Proc. of the Third International Conference on Information and
Knowledge Management (CIKM'94), ACM Press, 1994.
 M. Singh. Agent communication languages: Rethinking the principles.
IEEE Computer, Dec. 1998, p.40-47.
 Y. Labrou, T. Finnin, Y. Peng. Agent communication languages: The
current Landscape. IEEE Computer, March/April 1999, p. 45-52.
 FIPA97. "Agent Communication Language" Specification FIPA, 11/28/97
34
Web References
DARPA KSEhttp://www-ksl.stanford.edu/knowledge-sharing/
KQML
http://www.cs.umbc.edu/kqml/
KIF
http://logic.stanford.edu/kif/
Ontolingua http://www-ksl-svc.stanford.edu:5915/&service=frameeditor
FIPAhttp://www.fipa.org/
DAML
http://www.daml.org/
OWL
http://www.w3.org/TR/owl-guide/
Gruber, T., What is an Ontology, http://www.kr.org/top/definitions.html
 http://www.w3.org/2001/sw/WebOnt/
 http://www.cs.man.ac.uk/~horrocks/Slides/index.html
35