Lecture 7

Transcription

Lecture 7
MULTIAGENT SYSTEMS
Ubi-Comp Lecture 7
MAS Architectures
Agent Theories, Architectures
and Languages
References
1.
O’Hare, G.P. and Jennings, N.R., “Foundation of Distributed
Artificial Intelligence”, Wiley-Interscience, 1996.
2.
Wooldridge, M. and Jennings, N.R., “Intelligent Agents:
Theory and Practice”, Knowledge Engineering Review, Vol.
10, No. 2, pp. 115-152, 1995.
(The following section draws especially from Ref. 2 which is
recommended for further study. Citations given are from this
reference.)
18 June 2012
Multi-Agent Systems
2
Agent Theory
What is an agent? What are its characteristics, both
individually and in relation to other agents? What formalisms
(eg. symbolisms) can be used to represent and reason about
agents and these characteristics?
Agent Architecture
How can agents be modelled and structured? How can
software and hardware systems be designed to implement
agent theories and approaches.
Agent Languages
What are suitable agent-oriented software development
systems? How can agents be programmed?
18 June 2012
Multi-Agent Systems
3
Agent Theories
Agency: The characteristics or properties of agents.
Weak Notion of Agency
•
autonomy: agents operate without the direct intervention
of humans or others, and have some control over their
actions and internal state;
•
social ability: agents interact with other agents (and
possibly humans) via some kind of agent-communication
language;
•
reactivity: agents perceive their environment and respond
to changes in it;
18 June 2012
Multi-Agent Systems
4
•
pro-activeness: agents do not just act in response to
their environment, but exhibit goal-directed behaviour
by taking the initiative.
Weak agency includes agents that are self-contained,
concurrently executing software processes that
encapsulate some state and are able to communicate
with other agents via message passing.
18 June 2012
Multi-Agent Systems
5
Communication in Agent Theory
•
formalisms for communication often based on speech act
theory
•
basic axiom of this theory is that ‘speech acts’ are actions:
-
speaker has intention of desired change in world
-
usually intends some mental state in listener
•
speech act theory classifies different types of speech acts
•
two important classes of speech acts are:
18 June 2012
-
representatives (e.g. informing)
-
directives (e.g. requesting)
Multi-Agent Systems
6
•
agent communication languages commonly derive some
of their concepts from speech act theory
•
ARPA knowledge sharing project developed two related
languages:
-
knowledge query and manipulation language
(KQML)
-
knowledge interchange format (KIF)
•
KQML is a message vehicle for the content
•
KIF provides syntax for message content
18 June 2012
Multi-Agent Systems
7
Communication
(Uses TCP/IP but could use other protocols)
Message Intent
(Each expression is a speech act
described by a performative)
Content
(Expressed in KIF or KRSL or
other language)
KQML
(tell
: content “cost(bt, service-4, £5677)”
: language standard prolog
: ontology bt-services-domain
: in-reply-to quote service-4
: receiver customer-2
: sender bt-customer-services)
KIF in KQML
(untell
: language KIF
: ontology motors
: in-reply-to S1
: content (= (val (torque motor) (sim-time 5))
(scalar 12kgf)))
Note: The content slot in the above KQML example uses KIF.
Assignment 4
 Due on June 20 at 10AM (either email me or
bring it to my office) We will discuss your
solutions at class on that day.
 Design the Agent part for an eGadget that you
will use in your final project
 Choose an architectural style (e.g. BDI, hybrid,
etc.), justify your architectural choice and explain
the role of each module as well as how they
enable the interaction of your eGadget with your
project’s eGadgetworld
 Diagram and 1 page of explanations
Agent Architectures (for your projects!)
Agent Architecture
“[A] particular methodology for building [agents]. It specifies
how … the agent can be decomposed into the construction of a
set of component modules and how these modules should be
made to interact. The total set of modules and their
interactions has to provide an answer to the question of how
the sensor data and the current internal state of the agent
determine the actions … and future internal state of the agent.
An architecture encompasses techniques and algorithms that
support this methodology (Maes, 1991).”
“[A] specific collection of software (or hardware) modules,
typically designated by boxes with arrows indicating the data and
control flow among the modules. A more abstract view of an
architecture is as a general methodology for designing particular
modular decompositions for particular tasks (Kaelbling, 1991).”
18 June 2012
Multi-Agent Systems
12
Types of Architecture
Deliberative
• reasoning based on logical reasoning (manipulating symbols)
Reactive
• based on conditioned reflexes
- stimulus (*initiates a response*) response
- thus stimulus starts activity/action
- inhibitor stops or otherwise modifies a response
- acts on the *……..*
• Conditioned reflexes can be emulated by:
- manipulating symbols
- electrical circuitry
- neural nets
- electrical circuitry
- computer program
Hybrid System
• Uses combination of deliberative and reactive approaches
Deliberative Architectures
Deliberative Architectures
•
basis is physical-symbol system hypothesis: “A physical
symbol system is defined to be a physically realizable set of
physical entities (symbols) that can be combined to form
structures, and which is capable of running processes that
operate on those symbols according to symbolically coded
sets of instructions. The physical-symbol system hypothesis
then says that such a system is capable of general intelligent
action.”
•
a deliberative agent or agent architecture:
-
has a symbolic model of the world
-
decisions result from logical reasoning (i.e. symbolic
manipulation)
18 June 2012
Multi-Agent Systems
15
Example: Deliberative Architecture
BELIEF – DESIRES – INTENTION (BDI)
Goals, Attitudes, Responsibilities, etc
Reasoning, Deciding,
Reacting
Sensors
Belief
s KB
Script Execution
Intention
Cognition
Actuators
Protocol Execution
Communication
To/From Other Agents
Implemented BDI Agents: IRMA
 IRMA – Intelligent Resource-bounded Machine
Architecture – Bratman, Israel, Pollack
 IRMA has four key symbolic data structures:
a plan library
explicit representations of
beliefs: information available to the agent —
may be represented symbolically, but may be
simple variables
desires: those things the agent would like to
make true — think of desires as tasks that the agent
has been allocated; (goals)
intentions: desires that the agent has chosen
and committed to
BDI Theory and Practice
We now consider the semantics of BDI
architectures: to what extent does a BDI
agent satisfy a theory of agency
BDI Logic
Semantics of BDI components are given
via accessibility relations over ‘worlds’,
where each world is itself a branching time
structure
Properties required of accessibility
relations ensure belief logic, desire logic,
intention logic (Plus interrelationships. . . )
Axioms of BDI
 (1) Bel(p → q) → (Bel p → Bel q)
(K)
If you believe that p implies q then if you
believe p then you believe q
 (2) Bel p → ¬Bel ¬p
(D)
Consistency axiom, stating that if you believe p
then you do not believe that p is false
 (3) Bel p → Bel Bel p
If you believe p then you believe that you
believe p
Axioms of KD45
 (4) ¬Bel p → Bel ¬Bel p
(5)
If you do not believe p then you believe that you
do not believe that p is true
It also entails the two inference rules of modus
ponens and necessitation:
 (5) if p, and p → q, then q
(MP)
 (6) if p is a theorem of KD45 then so is Bel p
(Nec)
This last rule just states that you believe all
theorems implied by the logic
BDI Logic
Belief goal compatibility:
(Des α) → (Bel α)
States that if the agent has a goal to optionally
achieve something, this thing must be an
option.
This axiom is operationalized in the function
options: an option should not be produced if
it is not believed possible.
Goal-intention compatibility:
(Int α) → (Des α)
States that having an intention to optionally
achieve something implies having it as a
goal (i.e., there are no intentions that are not
goals). Operationalized in the deliberate
BDI Logic
Volitional commitment:
(Int does(a)) → does(a)
If you intend to perform some action a next,
then you do a next.
Operationalized in the execute function.
Awareness of goals & intentions:
(Des φ) → (Bel (Des φ))
(Int φ) → (Bel (Int φ))
Requires that new intentions and goals be
posted as events.
BDI Logic
No unconscious actions:
done(a) → Bel(done(a))
If an agent does some action, then it is aware
that it has done the action.
Operationalized in the execute function.
A stronger requirement would be for the
success or failure of the action to be posted.
No infinite deferral:
(Int φ) → A◊(¬(Int φ))
An agent will eventually either act for an
intention, or else drop it.
IRMA
Additionally, the architecture has:
a reasoner for reasoning about the world; an
inference engine
a means-ends analyzer determines which plans
might be used to achieve intentions
an opportunity analyzer monitors the
environment, and as a result of changes,
generates new options
a filtering process determines which options are
compatible with current intentions
a deliberation process responsible for deciding
upon the ‘best’ intentions to adopt
IRMA
Model-Based Architecture (from Jennings, 1993)
Brooks – behavior languages
 Brooks has put forward three theses:
1. Intelligent behavior can be generated without
explicit representations of the kind that
symbolic AI proposes
2. Intelligent behavior can be generated without
explicit abstract reasoning of the kind that
symbolic AI proposes
3. Intelligence is an emergent property of certain
complex systems
Brooks – behavior languages
 He identifies two key ideas that have
informed his research:
1. Situatedness and embodiment: ‘Real’
intelligence is situated in the world, not in
disembodied systems such as theorem provers
or expert systems
2. Intelligence and emergence: ‘Intelligent’
behavior arises as a result of an agent’s
interaction with its environment. Also,
intelligence is ‘in the eye of the beholder’; it is
not an innate, isolated property
Brooks – Reactive Architecture
 A subsumption architecture is a hierarchy of taskaccomplishing behaviors
 Each behavior is a rather simple rule-like structure
 Each behavior ‘competes’ with others to exercise
control over the agent
 Lower layers represent more primitive kinds of
behavior (such as avoiding obstacles), and have
precedence over layers further up the hierarchy
 The resulting systems are, in terms of the amount of
computation they do, extremely simple
 Some of the robots do tasks that would be impressive if
they were accomplished by symbolic AI systems
A Traditional Decomposition of a Mobile
Robot Control System into Functional
Modules
From Brooks, “A Robust Layered Control System for a Mobile Robot”, 1985
ROBOT MODEL
BEHAVIORAL VIEW
Sensing
Stimulu
(Subsumption/Reactive
Architecture)
Acting
Respons
Behavior 1 (
)
Inhibit
Behavior 2 (eg explore)
Sensors
Inhibit
Behavior 3 (eg wander)
Inhibit
Behavior 4 (eg avoid obstacles)
Actuators
A Decomposition of a Mobile Robot
Control System Based on Task Achieving
Behaviors
From Brooks, “A Robust Layered Control System for a Mobile Robot”, 1985
Layered Control in the Subsumption
Architecture
From Brooks, “A Robust Layered Control System for a Mobile Robot”, 1985
Example of a Module – Avoid
From Brooks, “A Robust Layered Control System for a Mobile Robot”, 1985
Schematic of a Module
From Brooks, “A Robust Layered Control System for a Mobile Robot”, 1985
Levels 0, 1, and 2 Control Systems
From Brooks, “A Robust Layered Control System for a Mobile Robot”, 1985
Steels’ Mars Explorer
Steels’ Mars explorer system, using the
subsumption architecture, achieves nearoptimal cooperative performance in
simulated ‘rock gathering on Mars’
domain:
The objective is to explore a distant planet,
and in particular, to collect sample of a
precious rock. The location of the samples
is not known in advance, but it is known
that they tend to be clustered.
Steels’ Mars Explorer Rules
 For individual (non-cooperative) agents, the lowest-level
behavior, (and hence the behavior with the highest “priority”)
is obstacle avoidance:
if detect an obstacle then change direction
(1)
 Any samples carried by agents are dropped back at the
mother-ship:
if carrying samples and at the base
then drop samples
(2)
 Agents carrying samples will return to the mother-ship:
if carrying samples and not at the base
then travel up gradient
(3)
Steels’ Mars Explorer Rules
 Agents will collect samples they find:
if detect a sample then pick sample up
(4)
 An agent with “nothing better to do” will explore
randomly:
if true then move randomly
(5)
 We will discuss how this relates to stigmergy
when we tackle self-organization and
complexity
Hybrid Architectures
 Many researchers have argued that neither a
completely deliberative nor completely reactive
approach is suitable for building agents
 They have suggested using hybrid systems,
which attempt to marry classical and alternative
approaches
 An obvious approach is to build an agent out of
two (or more) subsystems:
a deliberative one, containing a symbolic world model,
which develops plans and makes decisions in the way
proposed by symbolic AI
a reactive one, which is capable of reacting to events
without complex reasoning
Hybrid Architectures
 A key problem in such architectures is what kind
of control framework to embed the agent’s
subsystems in, to manage the interactions
between the various layers
 Horizontal layering
Layers are each directly connected to the
sensory input and action output.
In effect, each layer itself acts like an agent,
producing suggestions as to what action to
perform.
 Vertical layering
Sensory input and action output are each dealt
with by at most one layer each
Ferguson – TOURINGMACHINES
FIPA-OS as Microkernel
Application Agents
A.C.L.
Agent Configuration
Agent Shell
Task Management;
Conversation Management
Directory Facilitator
Agent Management
Message Transport Services; Internal Message
Transport Protocols
Agent Communication Channel
Core Platform Functionality
(FIPA - mK)
 a collection of services that are closely coupled
 provides an infrastructure where agents are deployed
 a FIPA-compliant AP consists of three agents:AMS,
ACC,DF
Agent Interactions
FIPA ACL deals with intention
interpretation and supports the
communication between agents through
explicit linguistic actions (speech acts)
The information content transmitted and the
protocols are those described and defined in
FIPA specifications
www.fipa.org
ACL Message structure
 Represents a communicative act (Policy) that can be
simple (inform ,request,confirm)
 or composed request(propose(action))
 Has its corresponding semantics and protocol
 Contains parameters=>attributes /values:
 :language representation language for content
 :content the information about which a message is sent
 :receiver
agent that receives the message
 :protocol interaction protocol used by sender
 ontology ontology to which the content refers to
Message Encoding
ACL
Message:
(inform
:sender a1
:content (-----)
:receiver a2
:language(---)
:ontology ("symbol")
Envelope
Transport
Protocol
Content
Language
ACL - Example
 The information content will be communicated
through the existing message types.
 Ex: (request
:sender OrderAgent
:receiver OperationPlanningAgent
:content(action d (produce 50 parts A (product
ABC))(due date: Dec 12, 2000))
:protocol fipa-request
:reply-with order 132
)
Constructing a Task
public class FirstTask extends Task{
public FirstTask(OrderAgent owner){
}
public void startTask(){
}
public void sendRequest( Conversation conv ){
ACLMessage acl= getNewConversation(String protocol)
acl.setContent(…)
acl.setLanguage(…)
acl.setOntology(…)
forward(acl)
}
}
Tasks and Conversations
FIPAOSAgent
ConversationManager
TaskManager
MTS
Task
FIPAQuery
protocol
Conversation
TaskEvent
FIPARequest
protocol
ConversationUpdateEvent
public void handleRequest(conv)
Other Events
Examples of FIPA Implementations
Supply Chain Scenario
Customer
Agent
Order Manager
Agent
Logistics
Agent
Assembly Plant
Agent
Transmitter Receiver
Plant Agent
Molded Cases
Supplier Agent
Power Adapter
Plant Agent
Cables
Supplier Agent
Bank
Agent
Transport
Agent
Printed Circuit Board
Plant Agent
Electronic Parts
Supplier Agent

•
•
Agency Design
•
System Architecture
Agent Definitions
Knowledge Modeling
Agent Class Structure
JADE Service Agents
Platform Agents
Agent Template (JADE)
Application Specific Agents
Protocol and Communication Layer
Transport Layer
Network
System Architecture
 Agent Definitions
• Knowledge Modeling
Agency Design
• Agent Class Structure
 The agents are defined and their responsibilities are
presented.
 Example:
•
Role Schema:
Manufacturer Agents
Description: Manufacturers represent providers of components to the
Assembly plant consumer of resources (parts) provided by suppliers
Protocols: FIPA REQUEST and FIPA ITERATED CONTRACT NET
Responsibilities: To respond to requests to supply the required
components, to initiate request for needed parts, to transfer the required
components, to receive and consume resources, to be aware of suppliers
of parts and their capabilities, to participate in negotiations about the terms
of acquiring and/or supplying a specified resource
•
•
Agency Design
Customer Agent
interface : Customer_GUI
content : ContentManager
content_language : Codec
scm_ontology : Ontology
•

System Architecture
Agent Definitions
Knowledge Modeling
Agent Class Structure
JADE Agent
ContentManager
Codec
Ontology
setup(addBehaviour())
Request_Behavior
concepts : Concept
predicates : Predicate
actions : AgentAction
action()
Concept
Predicate
AgentAction

•
•
Application Deployment
Ontology Creation
Inference Engine
Agent Creation
The creation of Ontology implies :
 Define the schema for concepts, predicates, actions
 Create Java classes
 Selection of a content language
 Register the ontology and the content language to the agent
Deliver (Agent Action)
Slots
(Attributes)
Description
Type
Presence
Cardinality
order
The order to
be delivered
Order
Mandatory
single
customer
Who places
the order
AgentID
Mandatory
single
Restricted
Values

•
•
Application Deployment
Ontology Creation
Inference Engine
Agent Creation
Order (Concept)
Slots
(Attributes)
Description
Type
Presenc
e
Cardinality
Restricted
Values
priority
Priority of the
order
String
Optional
single
“HIGH”
“LOW”
orderNo
Reference order
number
integer
Mandatory
single
>0
ordered_product
s
A list of ordered
products
Mandatory
multiple
destination
The destination
of the order
List of
Product
s
String
Mandatory
single
issueDate
The date when
the order was
placed
Date
Mandatory
single
•
Application
Deployment

•
<RULE name=“low price1">
<IF>
Agent.resolve()
Inference
Engine
EqualsPredicate
Ontology Creation
Inference Engine
Agent Creation
Negotiation.xml
Condition
<CONDITION name="Equals">
<VARIABLE>price</VARIABLE>
<VALUE>3.0</VALUE>
</CONDITION>
</IF>
Rule Base
Conclusion
<THEN>
<CONCLUSION name="Offer">
<VARIABLE>lower_price</VARIABLE>
OfferCommand
<VALUE>2.5</VALUE>
</CONCLUSION>
</THEN>
Rule
Goal
</RULE>
<GOAL>
<VARIABLE>lower_price</VARIABLE>
</GOAL>
public class CustomerAgent extends Agent {
private ContentManager manager
private Codec
codec
private Ontology
= (ContentManager)getContentManager();
= new SLCodec();
ontology1 = ScmOntology.getInstance();
protected void setup() {
manager.registerLanguage(codec);
manager.registerOntology(ontology1);
// Setting slots in ontology concepts
Order ord = new Order();
ord.setIssueDate(new Date(System.currentTimeMillis());
Telephones tele1 = new Telephones();
Answering_Machine am = new Answering_Machine();
tele1.setTel_type(order_gui.telTypeField.getText());
ord.addProduct(tele1);
ord.addProduct(am);
addBehaviour(new RequestBehaviour(this, ord));
}//end of setup()
class RequestBehaviour extends OneShotBehaviour{
public RequestBehaviour(Agent a, Order or) { super(a);}
public void action() {
// Prepare message
ACLMessage msg = new ACLMessage(ACLMessage.REQUEST);
msg.addReceiver(new AID("OrderManager", AID.ISLOCALNAME) );
msg.setLanguage(codec.getName());msg.setOntology(ontology1.getName());
// Fill content
Deliver del = new Deliver();
del.setCustomer(getAID());
del.setOrder(or);
Action a = new Action(); a.setAction(del);
ContentElementList cont = new ContentElementList();
cont.add(a); manager.fillContent(msg, cont);
//Send message
send(msg);
} }
Customer GUI
Resource Manager
Agent Messages Display
Real World Example

Procter & Gamble's use of agent-based modeling helped it
transform its supply chain system into a supply network with the help
of agent-based operational software developed with BiosGroup Inc. in
Santa Fe, N.M. Their work is a real-world example of what we can call
"agent-based modeling of complex, adaptive systems"
 The idea behind this approach was that systems that are very
complex overall are made up of semiautonomous "agents" acting on
a few simple rules. By modeling and changing the agents' behavior,
one can understand and optimize the entire system
 The simulations performed what-if analyses to test the impact of new
logistics rules on : inventory levels, transportation costs and in-store
stock-outs
Scalable Secure Web Based Services for e-Health
Static Environment
WIRED/WIRELESS
WIRED/WIRELESS
WIRED/WIRELESS
Distributed System
Problems:
• Different Network Protocols
• Proprietary Code
• No interaction possible
Very difficult or
impossible to create an
independent application.
Multi-Agent Approach
1 - Agents registers
their services to the DF
2 - Ag4 query DF for
information
3 - Ag1 and Ag4
exchange information
Advantages:
• Interoperability
• Standardized (FIPA)
• Expandability
• JAVA-based
Sequence Diagram
: User
: Am b u l a n ce M a n a ge r
: Ho sp i ta l M a n a ge r
RegisterAmbulance
RegisterHospital
RequestSpecialist
FindHospitals
QueryHospitals
BookSpecialist
Figure : Sequence Diagram
: DF
ONTOLOGY: CLASSES
The following figure shows the UML diagram that identifies the classes in our domain and the relationships among them:
Figure 15: UML Diagram
Properties of the ‘Ambulance’ class
 The following constraint was applied to the ResponseTeam:
 (defrange ?emergency :FRAME Crash emergency)
 (defrange ?special :FRAME Paramedic paramedic)
 (forall ?emergency

(forall ?special

(=> (substring-of "true" ('chemicalSpill' ?emergency))

(substring-of "chemical" ('specialization' ?special)))))
 This means that if the emergency is a crash where there
is a chemical spill, then the specialization of the
paramedic that will be assigned to the response team
should be anything related to chemicals.
If the chemicalSpill slot in a Crash is true
 paramedic’s or doctor’s specialization
should be “chemical”
If the availableBeds of the hospital is 0 
cannot be assigned to the ResponseTeam
Developed Application
Messages Screen
Deployed Platform
Planet-Lab Node
(planetlab2.enel.ucalgary.ca:1099)
JADE-LEAP Server
Hospital Manager
Agents
Ambulance Manager
Agent
GPRS
Windows Station
Ag.3
Ag.1
Internet
DB1
Bluetooth
Linux Station
Ag.2
DB2
GPS Fortuna
GPSmart
Nokia
6600
Developed Application
Eye Surgeon