View
63
Download
0
Category
Tags:
Preview:
DESCRIPTION
eXAT: Software Agents in Erlang. Corrado Santoro University of Catania, Italy 11th Erlang User Conference – Stockholm, Nov. 10, 2005. Overview. Motivation Agent Characteristics and Erlang The eXAT Platform Agent Tasks Agent Intelligence Agent Communication Conclusions. Motivation. - PowerPoint PPT Presentation
Citation preview
eXAT:Software Agents in Erlang
Corrado SantoroUniversity of Catania, Italy
11th Erlang User Conference – Stockholm, Nov. 10, 2005
Corrado Santoro, "eXAT: Software Agents in Erlang", Erlang User Conference 2005, Stockholm, Sweden, Nov. 10, 2005 2
Overview
• Motivation• Agent Characteristics and Erlang• The eXAT Platform
– Agent Tasks– Agent Intelligence– Agent Communication
• Conclusions
Corrado Santoro, "eXAT: Software Agents in Erlang", Erlang User Conference 2005, Stockholm, Sweden, Nov. 10, 2005 3
Motivation• Agents are software entities featuring
– Autonomy: they are goal-oriented– Reactive: they react to environment changes– Pro-active: they build plans to achieve their goals– Social: they can communicate to each other
• Can Erlang support them?• Is Erlang a good approach for agent-oriented
programming?
Corrado Santoro, "eXAT: Software Agents in Erlang", Erlang User Conference 2005, Stockholm, Sweden, Nov. 10, 2005 4
Agent Characteristics and Erlang
• Reactivity means the ability to specify a computation to be executed when an event occurs:– Symbols (Atoms)/Tuples: well suited to represent
events– Function clauses: well suited to represent actions
bound to events
– Agent Tasks modeled as FSM:• gen_fsm and gen_event are OK, but we need
something of “higher-level” and more “agent-specific”
action({switch,off}) -> …action({temperature, X}) when X > 20 -> …
Corrado Santoro, "eXAT: Software Agents in Erlang", Erlang User Conference 2005, Stockholm, Sweden, Nov. 10, 2005 5
Agent Characteristics and Erlang
• Pro-activeness means the ability to implement an “intelligent” reasoning process:– Atoms and Tuples: well suited to represent facts
of a knowledge– Function clauses: well suited to represent
production rules
– Function clauses are OK to represent production rules but who “crunches” them?
parent_rule({‘child-of’,X,Y},{female,Y}) -> % ..then Y is X’s motherparent_rule({‘child-of’,X,Y},{male,Y}) -> % ..then Y is X’s father
Corrado Santoro, "eXAT: Software Agents in Erlang", Erlang User Conference 2005, Stockholm, Sweden, Nov. 10, 2005 6
Agent Characteristics and Erlang
• Social Ability means to support message passing between (local or remote) agents:– Erlang is message-oriented!– But Agent Communication requires
standardized protocols. FIPA defines:• A set of “communicative acts” based on speech act
theory [Searle]• “inform” act to tell something, “request” act to ask
the execution of something, etc.• An Agent Communication Language (ACL) to exchange
messages based on CA• A representation standard for ACL messages• Some network protocols to exchange ACL messages
Corrado Santoro, "eXAT: Software Agents in Erlang", Erlang User Conference 2005, Stockholm, Sweden, Nov. 10, 2005 7
Erlang Perfect for Agents?
A platform (runtime environment) is needed
eXAT : erlang eXperimental Agent TooleXAT
Erlang is not enough for agents as-is.
Corrado Santoro, "eXAT: Software Agents in Erlang", Erlang User Conference 2005, Stockholm, Sweden, Nov. 10, 2005 8
eXATThe erlang eXperiment Agent
ToolAn “all-in one” agent platform for agent
programming
• Agent Behaviors:– Agent Tasks modeled as FSM enriched with
composition and specialization/extension
• Agent Intelligence:– By means of the ERESYE rule processing engine
• Agent Interaction:– By means of FIPA standard messaging, enriched with
ontology and semantic support
Corrado Santoro, "eXAT: Software Agents in Erlang", Erlang User Conference 2005, Stockholm, Sweden, Nov. 10, 2005 9
eXAT Internals: Task Model• Agent Tasks are modeled as FSMs• A task is executed asynchronously (autonomous agent semantics)
eXAT Task Model•E, the set of event types (acl, timeout, eresye, silent)•P, the set of data patterns to be associated to a certain event type
• Pattern: predicate on event’s data•S, the set of states of the FSM•A, the set actions to be done
Separation between event types and associated patterns to allow reuse
Corrado Santoro, "eXAT: Software Agents in Erlang", Erlang User Conference 2005, Stockholm, Sweden, Nov. 10, 2005 10
eXAT Task: An Example-module (contractnetinitiator).
action (Self, start) -> [{cfp_event, send_cfp}];action (Self, gp) -> [{propose_event,gather_propose}, {refuse_event,gather_refuse}, {timeout_event,evaluate_proposals}];action (Self, ev) -> [{failure_event,gather_failure}, {inform_event,gather_inform}].
event (Self, cfp_event) -> {silent, nil};event (Self, propose_event) -> {acl, propose_pattern};event (Self, refuse_event) -> {acl, refuse_pattern}.
pattern (Self, propose_pattern) -> [#aclmessage {speechact = ’PROPOSE’, protocol = ’fipa-contractnet’}];pattern (Self, refuse_pattern) -> [#aclmessage {speechact = ’REFUSE’, protocol = ’fipa-contractnet’}];...
Start
gp
acl:(propose …)
gather_propose
acl:(refuse …)
gather_refuse
silent
send_cfp
ev
timeout:x
evaluate_proposals
acl:(inform …)
gather_inform
acl:(failure …)
gather_failure
Corrado Santoro, "eXAT: Software Agents in Erlang", Erlang User Conference 2005, Stockholm, Sweden, Nov. 10, 2005 11
eXAT Task: Composition-module (my_task).
action (Self, start) -> [{propose_event, do_propose}, {refuse_event, do_refuse}].
event (Self, propose_event) -> {acl, propose_pattern};event (Self, refuse_event) -> {acl, refuse_pattern}.
pattern (Self, propose_pattern) -> [#aclmessage {speechact = ’PROPOSE’}];pattern (Self, refuse_pattern) -> [#aclmessage {speechact = ’REFUSE’}].
do_propose (Self, Event, Data, State) -> agent:behave (Self, b1).
do_refuse (Self, Event, Data, State) -> agent:behave (Self, [b2, b3]), object:stop (Self).
Start
acl:(propose …)
do_propose
b1
b2 b3
acl:(refuse …)
do_refuse
Corrado Santoro, "eXAT: Software Agents in Erlang", Erlang User Conference 2005, Stockholm, Sweden, Nov. 10, 2005 12
eXAT Task: Extension• An “eXAT Task” is a class that can be extended (reused),
according to object-oriented concepts• Any element of a transition (event type, data pattern,
associated action, next state) can be changed according to new requirements
Start
gp
acl:(propose …)
gather_propose
acl:(refuse …)
gather_refuse
silent
send_cfp
acl: (inform …)
send_cfp
-module (triggeredcontractnetinitiator).
extends () -> contractnetinitiator.
event (Self, cfp_event) -> {acl, inform_pattern}.
pattern (Self, inform_pattern) -> [#aclmessage {speechact = ’INFORM’}].
E.g., a contract-net initiated by the arrival of an inform message:
redefine the cfp_event
Corrado Santoro, "eXAT: Software Agents in Erlang", Erlang User Conference 2005, Stockholm, Sweden, Nov. 10, 2005 13
eXAT Intelligence: ERESYE• ERESYE is an integrated tool that allows the creation and execution of
rule processing engines in Erlang
• Each engine has a knowledge base and a set of rules• Facts (knowledge) are represented using Erlang tuples (or records), e.g.
– {temperature, 50, ‘F’}– {father, ‘Caesar’, ‘Brutus’}– #speed { value = 30, unit = ‘km/h’}
• Inference rules are written using standard Erlang functions• The Forgy’s RETE algorithm is implemented to efficiently process the
rules
• ERESYE engines are connected with tasks:– Task events: event activated by the assertion of a given fact in a
given engine– Task action: any call to ERESYE API functions, e.g. fact
assertion/retraction, rule adding/removing/activating, etc.
Corrado Santoro, "eXAT: Software Agents in Erlang", Erlang User Conference 2005, Stockholm, Sweden, Nov. 10, 2005 14
An ERESYE Program-module (parents).-export ([parent_rule/3, start/0]).
parent_rule (Engine, {‘child-of’,X,Y}, {female,Y}) -> eresye:assert (Engine, {‘mother-of’,Y,X});
parent_rule (Engine, {‘child-of’,X,Y}, {male,Y}) -> eresye:assert (Engine, {‘father-of’,Y,X}).
start () -> eresye:start (parents_engine), eresye:add_rule (parents_engine, {parent, parent_rule}).
Rule Declaration
Engine Identifier
Conditions on facts
Actions
Engine creation
Rule Addition(in the engine)
Corrado Santoro, "eXAT: Software Agents in Erlang", Erlang User Conference 2005, Stockholm, Sweden, Nov. 10, 2005 15
eXAT Communication: ACL• eXAT provides an Erlang record to represent FIPA-ACL
messages#aclmessage {speechact = ‘REQUEST’, receiver = ..., ontology = ‘book-ontology’, content = #buying_action { item = #book { title = ..., author = ..., ... } } }
• ACL messages are sent using functions of the acl module
• A different function for each communicative act type– acl:inform, acl:request, acl:confirm, etc.
• ACL messages are received by using the acl event in task specification
Corrado Santoro, "eXAT: Software Agents in Erlang", Erlang User Conference 2005, Stockholm, Sweden, Nov. 10, 2005 16
eXAT Communication: ACL#aclmessage {speechact = ‘REQUEST’, receiver = ..., ontology = ‘book-ontology’, content = #buying_action { item = #book { title = ..., author = ..., ... } } }
• FIPA-ACL messages feature a content expressed with a given ontology
• Ontology handling is needed in eXAT
• FIPA-ACL messages are transferred using a proper string representations (SL = Semantic Language)(request :receiver (…) :ontology book-ontology :content (buying-action :item (book :title …) ) )
• Translation from Erlang types to SL expression is needed in eXAT
Corrado Santoro, "eXAT: Software Agents in Erlang", Erlang User Conference 2005, Stockholm, Sweden, Nov. 10, 2005 17
eXAT Communication: Ontologies
• eXAT allows the specification of the “universe of discourse” by means of a (object-oriented) ontology
• An “ontology_compiler”, provided with eXAT, translate the specification and generates:– An .hrl file containing a record definition for each class of the
ontology– A .erl file containing some Erlang function usefull to maintain
the hierarchy– A .erl file containing the SL/Erlang codec for message content
• Ontology types can be also used in ERESYE engines to represent fact: a very important connection between “intelligence” and “communication”
Corrado Santoro, "eXAT: Software Agents in Erlang", Erlang User Conference 2005, Stockholm, Sweden, Nov. 10, 2005 18
eXAT Communication: A Sample Ontology
-ontology(book).
class (book) -> { title = [ string , mandatory , nodefault], author = [ string , mandatory , nodefault], genre = [ string , mandatory , nodefault]};
class (‘adventure-book’) -> is_a(book), { genre = [ string , mandatory , default (adventure)] };
class (‘thriller-book’) -> is_a(book), {genre = [ string , mandatory , default (thriller)] };
class (buying_action) -> {item = [book, mandatory, nodefault] }.
•Capability to use OWL or RDF available in future eXAT releases
Corrado Santoro, "eXAT: Software Agents in Erlang", Erlang User Conference 2005, Stockholm, Sweden, Nov. 10, 2005 19
eXAT and ACL Semantics• FIPA-ACL specification defines for each communicative act
– Feasibility Precondition: a predicate that must be true before sending the message
• Eg: <i, confirm (j, X)> BiX BiUjX (agent i believes X and believes that j is uncertain on X)
– Rational Effect: a predicate that must be true after the message has been send/delivered
• Eg: <i, confirm (j, X)> BjX BiBjX (agent j believes X and agent i believes that j believes X)
• FIPA-ACL semantics allows the development of “true rational agents”
• It is the real link between intelligence and communication• But no agent platforms currently support FIPA-ACL
semantics
Corrado Santoro, "eXAT: Software Agents in Erlang", Erlang User Conference 2005, Stockholm, Sweden, Nov. 10, 2005 20
eXAT and ACL Semantics
• An ERESYE engine to represent agent mental state (from ontologies, we can use the same Erlang types for facts and message contents)
• Each time a message is sent and received, an actions is performed onto the agent’s mental state, according to FIPA-ACL semantics
eXAT represents the first attempt (initiated in 2003) to implement FIPA-ACL Semantics
ACL Module(encoding and
transport)
SemanticsModule
(resoning)
ERESYEEngine
(agent mental state)
Task(agent Behavior)
Corrado Santoro, "eXAT: Software Agents in Erlang", Erlang User Conference 2005, Stockholm, Sweden, Nov. 10, 2005 21
Conclusions• Erlang seems designed “for software agents”!• But people in the agent community still want to use Java• But a real agent programming language is needed (see
AgentLink III RoapMap)• A proposal: an agent-oriented language including the main
characteristics of both Erlang and Java? Is it too hard?
• eXAT needs:– A better way to express tasks (the use of action, event and
pattern functions is not so simple)– To be (more) OTP-compliant– An improved documentation (sorry)!– Some applications and test-beds that prove eXAT/Erlang
effectiveness
Corrado Santoro, "eXAT: Software Agents in Erlang", Erlang User Conference 2005, Stockholm, Sweden, Nov. 10, 2005 22
Our Next Action• To use eXAT in the implementation of a robot
for Eurobot 2006 competition (http://www.eurobot.org/)
• The game is a “funny golf”• Will be the first Erlang-enabled robot?
We are searching for sponsors,anyone interested here ?
Corrado Santoro, "eXAT: Software Agents in Erlang", Erlang User Conference 2005, Stockholm, Sweden, Nov. 10, 2005 23
eXAT
Thank you for your attention!
Contact InfoCorrado SantoroUniversity of Catania, Engineering FacultyViale Andrea Doria, 6 - 95125 - CATANIA - ITALYEMail: csanto@diit.unict.it
Corrado Santoro, "eXAT: Software Agents in Erlang", Erlang User Conference 2005, Stockholm, Sweden, Nov. 10, 2005 24
eXAT Internals: the Agent Model
Agent TasksAgent Intelligence(ERESYE Engines)
Agent Actions(assert/retract facts)
Triggering Events(fact assertion)
User-defined Interfaces to
external world
ACL Module
Agent Actions(ACL Message
Sending)
Triggering Events(ACL Message Arrival)
Rational Effects(ACL Semantics)
eXAT Agent
Corrado Santoro, "eXAT: Software Agents in Erlang", Erlang User Conference 2005, Stockholm, Sweden, Nov. 10, 2005 25
Linking Interaction and Mental States
• Writing an agent that does something when it knows the age of Corrado {age-of, ‘Corrado’, 39}
• The knowledge can be obtained by– A result of a reasoning process (e.g. by knowing the year in which Corrado
was born)– An “inform” message from another agent:
• (inform … :content (age-of Corrado 39) … )
ERESYEEngine
Reasoning process(Fact assertion)
Agentinform
Rational Effect (Fact
assertion)
A single event specification (“eresye” event) to capture both cases
This is the first attempt (initiated in 2003) to implement FIPA-ACL Semantics
Recommended