13.07.2015 Views

Lecture 7 - theimpactinstitute.org

Lecture 7 - theimpactinstitute.org

Lecture 7 - theimpactinstitute.org

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

• pro-activeness: agents do not just act in response totheir environment, but exhibit goal-directed behaviourby taking the initiative.Weak agency includes agents that are self-contained,concurrently executing software processes thatencapsulate some state and are able to communicatewith other agents via message passing.18 June 2012 Multi-Agent Systems 5


Communication in Agent Theory• formalisms for communication often based on speech acttheory• 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:- representatives (e.g. informing)- directives (e.g. requesting)18 June 2012 Multi-Agent Systems 6


• agent communication languages commonly derive someof their concepts from speech act theory• ARPA knowledge sharing project developed two relatedlanguages:- knowledge query and manipulation language(KQML)- knowledge interchange format (KIF)• KQML is a message vehicle for the content• KIF provides syntax for message content18 June 2012 Multi-Agent Systems 7


Communication(Uses TCP/IP but could use other protocols)Message Intent(Each expression is a speech actdescribed by a performative)Content(Expressed in KIF or KRSL orother 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)


(untellKIF in KQML: 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 orbring it to my office) We will discuss yoursolutions at class on that day.• Design the Agent part for an eGadget that youwill use in your final project• Choose an architectural style (e.g. BDI, hybrid,etc.), justify your architectural choice and explainthe role of each module as well as how theyenable the interaction of your eGadget with yourproject’s eGadgetworld• Diagram and 1 page of explanations


Agent Architectures (for your projects!)Agent Architecture“[A] particular methodology for building [agents]. It specifieshow … the agent can be decomposed into the construction of aset of component modules and how these modules should bemade to interact. The total set of modules and theirinteractions has to provide an answer to the question of howthe sensor data and the current internal state of the agentdetermine the actions … and future internal state of the agent.An architecture encompasses techniques and algorithms thatsupport this methodology (Maes, 1991).”“[A] specific collection of software (or hardware) modules,typically designated by boxes with arrows indicating the data andcontrol flow among the modules. A more abstract view of anarchitecture is as a general methodology for designing particularmodular decompositions for particular tasks (Kaelbling, 1991).”18 June 2012 Multi-Agent Systems 12


Types of ArchitectureDeliberative• 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 programHybrid System• Uses combination of deliberative and reactive approaches


Deliberative ArchitecturesDeliberative Architectures• basis is physical-symbol system hypothesis: “A physicalsymbol system is defined to be a physically realizable set ofphysical entities (symbols) that can be combined to formstructures, and which is capable of running processes thatoperate on those symbols according to symbolically codedsets of instructions. The physical-symbol system hypothesisthen says that such a system is capable of general intelligentaction.”• a deliberative agent or agent architecture:- has a symbolic model of the world- decisions result from logical reasoning (i.e. symbolicmanipulation)18 June 2012 Multi-Agent Systems 15


Example: Deliberative ArchitectureBELIEF – DESIRES – INTENTION (BDI)Goals, Attitudes, Responsibilities, etcIntentionSensorsBeliefs KBReasoning, Deciding,ReactingScript ExecutionActuatorsCognitionProtocol ExecutionCommunicationTo/From Other Agents


Implemented BDI Agents: IRMA• IRMA – Intelligent Resource-bounded MachineArchitecture – 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 besimple variables•desires: those things the agent would like tomake true — think of desires as tasks that the agenthas been allocated; (goals)•intentions: desires that the agent has chosenand committed to


BDI Theory and Practice•We now consider the semantics of BDIarchitectures: to what extent does a BDIagent satisfy a theory of agency


BDI Logic•Semantics of BDI components are givenvia accessibility relations over ‘worlds’,where each world is itself a branching timestructure•Properties required of accessibilityrelations 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 youbelieve p then you believe q• (2) Bel p → ¬Bel ¬p(D)Consistency axiom, stating that if you believe pthen you do not believe that p is false• (3) Bel p → Bel Bel pIf you believe p then you believe that youbelieve p


Axioms of KD45• (4) ¬Bel p → Bel ¬Bel p (5)If you do not believe p then you believe that youdo not believe that p is trueIt also entails the two inference rules of modusponens 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 alltheorems implied by the logic


BDI Logic•Belief goal compatibility:(Des α) → (Bel α)States that if the agent has a goal to optionallyachieve something, this thing must be anoption.This axiom is operationalized in the functionoptions: an option should not be produced ifit is not believed possible.•Goal-intention compatibility:(Int α) → (Des α)States that having an intention to optionallyachieve something implies having it as agoal (i.e., there are no intentions that are notgoals). 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 beposted as events.


BDI Logic•No unconscious actions:done(a) → Bel(done(a))If an agent does some action, then it is awarethat it has done the action.Operationalized in the execute function.A stronger requirement would be for thesuccess or failure of the action to be posted.•No infinite deferral:(Int φ) → A◊(¬(Int φ))An agent will eventually either act for anintention, or else drop it.


IRMA•Additionally, the architecture has:◦a reasoner for reasoning about the world; aninference engine◦a means-ends analyzer determines which plansmight be used to achieve intentions◦an opportunity analyzer monitors theenvironment, and as a result of changes,generates new options◦a filtering process determines which options arecompatible with current intentions◦a deliberation process responsible for decidingupon 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 withoutexplicit representations of the kind thatsymbolic AI proposes2. Intelligent behavior can be generated withoutexplicit abstract reasoning of the kind thatsymbolic AI proposes3. Intelligence is an emergent property of certaincomplex systems


Brooks – behavior languages• He identifies two key ideas that haveinformed his research:1. Situatedness and embodiment: ‘Real’intelligence is situated in the world, not indisembodied systems such as theorem proversor expert systems2. Intelligence and emergence: ‘Intelligent’behavior arises as a result of an agent’sinteraction with its environment. Also,intelligence is ‘in the eye of the beholder’; it isnot an innate, isolated property


Brooks – Reactive Architecture• A subsumption architecture is a hierarchy of taskaccomplishingbehaviors• Each behavior is a rather simple rule-like structure• Each behavior ‘competes’ with others to exercisecontrol over the agent• Lower layers represent more primitive kinds ofbehavior (such as avoiding obstacles), and haveprecedence over layers further up the hierarchy• The resulting systems are, in terms of the amount ofcomputation they do, extremely simple• Some of the robots do tasks that would be impressive ifthey were accomplished by symbolic AI systems


A Traditional Decomposition of a MobileRobot Control System into FunctionalModulesFrom Brooks, “A Robust Layered Control System for a Mobile Robot”, 1985


ROBOT MODELBEHAVIORAL VIEWSensingStimulu(Subsumption/ReactiveArchitecture)ResponsActingBehavior 1 ()InhibitBehavior 2 (eg explore)SensorsInhibitActuatorsBehavior 3 (eg wander)InhibitBehavior 4 (eg avoid obstacles)


A Decomposition of a Mobile RobotControl System Based on Task AchievingBehaviorsFrom Brooks, “A Robust Layered Control System for a Mobile Robot”, 1985


Layered Control in the SubsumptionArchitectureFrom Brooks, “A Robust Layered Control System for a Mobile Robot”, 1985


Example of a Module – AvoidFrom Brooks, “A Robust Layered Control System for a Mobile Robot”, 1985


Schematic of a ModuleFrom Brooks, “A Robust Layered Control System for a Mobile Robot”, 1985


Levels 0, 1, and 2 Control SystemsFrom Brooks, “A Robust Layered Control System for a Mobile Robot”, 1985


Steels’ Mars Explorer•Steels’ Mars explorer system, using thesubsumption architecture, achieves nearoptimalcooperative performance insimulated ‘rock gathering on Mars’domain:The objective is to explore a distant planet,and in particular, to collect sample of aprecious rock. The location of the samplesis not known in advance, but it is knownthat they tend to be clustered.


Steels’ Mars Explorer Rules• For individual (non-cooperative) agents, the lowest-levelbehavior, (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 themother-ship:if carrying samples and at the basethen drop samples (2)• Agents carrying samples will return to the mother-ship:if carrying samples and not at the basethen 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 explorerandomly:if true then move randomly (5)• We will discuss how this relates to stigmergywhen we tackle self-<strong>org</strong>anization andcomplexity


Hybrid Architectures• Many researchers have argued that neither acompletely deliberative nor completely reactiveapproach is suitable for building agents• They have suggested using hybrid systems,which attempt to marry classical and alternativeapproaches• An obvious approach is to build an agent out oftwo (or more) subsystems:◦a deliberative one, containing a symbolic world model,which develops plans and makes decisions in the wayproposed by symbolic AI◦a reactive one, which is capable of reacting to eventswithout complex reasoning


Hybrid Architectures• A key problem in such architectures is what kindof control framework to embed the agent’ssubsystems in, to manage the interactionsbetween the various layers• Horizontal layeringLayers are each directly connected to thesensory input and action output.In effect, each layer itself acts like an agent,producing suggestions as to what action toperform.• Vertical layeringSensory input and action output are each dealtwith by at most one layer each


Ferguson – TOURINGMACHINES


FIPA-OS as MicrokernelApplication AgentsA.C.L.Agent ConfigurationAgent ShellTask Management;Conversation ManagementDirectory FacilitatorAgent ManagementMessage Transport Services; Internal MessageTransport ProtocolsAgent 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 intentioninterpretation and supports thecommunication between agents throughexplicit linguistic actions (speech acts)•The information content transmitted and theprotocols are those described and defined inFIPA specifications•www.fipa.<strong>org</strong>


ACL Message structure• Represents a communicative act (Policy) that can besimple (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 EncodingACLMessage:(inform:sender a1 :content (-----):receiver a2 :language(---):ontology ("symbol")ContentLanguageE n v e l o p eTransportProtocol


ACL - Example• The information content will be communicatedthrough the existing message types.• Ex: (request:sender OrderAgent:receiver OperationPlanningAgent:content(action d (produce 50 parts A (productABC))(due date: Dec 12, 2000)):protocol fipa-request:reply-with order 132)


Constructing a Taskpublic 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 ConversationsFIPAOSAgentConversationManagerTaskManagerMTSFIPAQueryprotocolConversationTaskTaskEventFIPARequestprotocolConversationUpdateEventpublic void handleRequest(conv)Other Events


Examples of FIPA Implementations


Supply Chain ScenarioCustomerAgentOrder ManagerAgentLogisticsAgentBankAgentAssembly PlantAgentTransportAgentTransmitter ReceiverPlant AgentMolded CasesSupplier AgentPower AdapterPlant AgentCablesSupplier AgentPrinted Circuit BoardPlant AgentElectronic PartsSupplier Agent


Agency Design‣ System Architecture• Agent Definitions• Knowledge Modeling• Agent Class StructureJADE Service AgentsAgent Template (JADE)Platform AgentsApplication Specific AgentsProtocol and Communication LayerTransport LayerNetwork


• System Architecture‣ Agent Definitions• Knowledge Modeling• Agent Class Structure• The agents are defined and their responsibilities arepresented.• Example:Agency DesignRole Schema:Manufacturer AgentsDescription: Manufacturers represent providers of components to theAssembly plant consumer of resources (parts) provided by suppliersProtocols: FIPA REQUEST and FIPA ITERATED CONTRACT NETResponsibilities: To respond to requests to supply the requiredcomponents, to initiate request for needed parts, to transfer the requiredcomponents, to receive and consume resources, to be aware of suppliersof parts and their capabilities, to participate in negotiations about the termsof acquiring and/or supplying a specified resource


Agency DesignCustomer Agentinterface : Customer_GUIcontent : ContentManagercontent_language : Codecscm_ontology : Ontologysetup(addBehaviour())Request_Behaviorconcepts : Conceptpredicates : Predicateactions : AgentActionaction()• System Architecture• Agent Definitions• Knowledge Modeling‣ Agent Class StructureContentManagerJADE AgentCodecConceptPredicateOntologyAgentAction


Application Deployment‣ Ontology Creation• Inference Engine• Agent CreationThe 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 agentSlots(Attributes)Deliver (Agent Action)Description Type Presence Cardinality RestrictedValuesordercustomerThe order tobe deliveredWho placesthe orderOrder Mandatory singleAgentID Mandatory single


Application Deployment‣ Ontology Creation• Inference Engine• Agent CreationOrder (Concept)Slots(Attributes)Description Type PresenceCardinalityRestrictedValuespriorityorderNoordered_productsdestinationissueDatePriority of theorderReference ordernumberA list of orderedproductsThe destinationof the orderThe date whenthe order wasplacedString Optional single “HIGH”“LOW”integer Mandatory single >0List ofProductsMandatory multipleString Mandatory singleDate Mandatory single


ApplicationDeploymentEqualsPredicateOfferCommandAgent.resolve()InferenceEngineRule BaseNegotiation.xmlConditionConclusionRuleGoal• Ontology Creation‣ Inference Engine• Agent Creation


public class CustomerAgent extends Agent {private ContentManager manager = (ContentManager)getContentManager();private Codec codec = new SLCodec();private Ontology ontology1 = ScmOntology.getInstance();protected void setup() {manager.registerLanguage(codec);manager.registerOntology(ontology1);// Setting slots in ontology conceptsOrder 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 messageACLMessage msg = new ACLMessage(ACLMessage.REQUEST);msg.addReceiver(new AID("OrderManager", AID.ISLOCALNAME) );msg.setLanguage(codec.getName());msg.setOntology(ontology1.getName());// Fill contentDeliver 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 messagesend(msg); } }


Customer GUI


Resource Manager


Agent Messages Display


Real World Example• Procter & Gamble's use of agent-based modeling helped ittransform its supply chain system into a supply network with the helpof agent-based operational software developed with BiosGroup Inc. inSanta 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 verycomplex overall are made up of semiautonomous "agents" acting ona 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 newlogistics rules on : inventory levels, transportation costs and in-storestock-outs


Scalable Secure Web Based Services for e-HealthStatic EnvironmentWIRED/WIRELESSWIRED/WIRELESSWIRED/WIRELESS


Distributed SystemProblems:• Different Network Protocols• Proprietary Code• No interaction possibleVery difficult orimpossible to create anindependent application.


Multi-Agent Approach1 - Agents registerstheir services to the DF2 - Ag4 query DF forinformation3 - Ag1 and Ag4exchange informationAdvantages:• Interoperability• Standardized (FIPA)• Expandability• JAVA-based


Sequence Diagram: User : AmbulanceManager : HospitalManager : DFRegisterAmbulanceRegisterHospitalRequestSpecialistFindHospitalsQueryHospitalsBookSpecialistFigure : Sequence Diagram


ONTOLOGY: CLASSESThe 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 thereis a chemical spill, then the specialization of theparamedic that will be assigned to the response teamshould be anything related to chemicals.


•If the chemicalSpill slot in a Crash is true paramedic’s or doctor’s specializationshould be “chemical”•If the availableBeds of the hospital is 0 cannot be assigned to the ResponseTeam


Developed Application•Messages Screen


Deployed PlatformPlanet-Lab Node(planetlab2.enel.ucalgary.ca:1099)JADE-LEAP ServerHospital ManagerAgentsAmbulance ManagerAgentWindows StationGPRSAg.1Ag.3DB1Linux StationInternetBluetoothNokia6600DB2Ag.2GPS FortunaGPSmart


Developed ApplicationEye Surgeon

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!