Lectures AIProgramming: IntroductiontoRoboRescue 3AgentsandAgents 4Multi-AgentsandCommunication 5MultiagentDecision 6CooperationAndCoordination 7CooperationAndCoordination 8Machine 9Knowledge 10PuttingItAll 1 2 TDDD10AIProgramming Multi-AgentsandCommunication CyrilleBerger 2/72 Lecturegoals Lecturecontent Acquireknowledgeonmutliagent systems. Acquireknowledgeonhowagents communicate Multi-Agent CMUCaseStudy Communication KQML FoundationforIntelligentPhysicalAgents (FIPA) ContractNet JADE 3/72 4/72 Multi-AgentSystems Multi-AgentSystems “Amulti-agentsystem(MAS)canbe definedasalooselycoupled networkofproblemsolversthat interacttosolveproblemsthatare beyondtheindividualcapabilitiesor knowledgeofeachproblemsolver.” DurfeeandLesser,1989 6/72 CharacteristicsofMulti-AgentSystems ViewofacanonicalMulti-AgentSystem Theparticipantsareself-interested. Theparticipantsandtheircapabilities changesovertime,i.e.opensystems. Eachparticipanthasincomplete informationorcapabilitiesforsolvingthe problemand,thus,hasalimited viewpoint. Thereisnosystemglobalcontrol. Dataisdecentralized. Computationisasynchronous. 7/72 8/72 Motivation Challenges Howtoformulate,describe,decompose,and allocateproblemsandsynthesizeresultsamonga groupofagents. Howtoenableagentstocommunicateandinteract. Howtomakesurethatagentsactcoherentlyin makingdecisionortakingaction. Howtoenableindividualagentstorepresentand reasonabouttheactions,plans,andknowledgeof otheragentstocoordinatewiththem. Howtorecognizeandreconciledisparate viewpointsandconflictingintentionsamonga collectionofagentstryingtocoordinatetheiractions. CooperativedistributedProblem NoAgentcansolvetheproblembyitself Differentcapabilities,resourcesandknowledge Cooperation:Systemsdointeractto fulfilltheirtasks Task&ResultSharing TaskDecomposition&Allocation Coordination:Systemsdynamically adapttheirbehaviortootheragents MultiagentplanningandTask 9/72 10/72 Solutions Organizations Taskallocationandmultiagent planning Recognizingandresolvingconflicts Modelingotheragents Communication Managingresources Adaptationandlearning 11/72 CMUCaseStudy CMUCaseStudy CMUAgentArchitecture Abehavior-basedarchitecture. Flexibleagentroleswithprotocolsforswitching amongthem. Collectionofrolesbuiltintoteamformations. Locker-roomagreement. Set-plays:Multi-step,multi-agentplansfor executioninspecificsituations. http://www.cs.cmu.edu/afs/cs/usr/pstone/public/ papers/98springer/final-champ/final-champ.html 13/72 CMUBehaviors 14/72 CMURoles Abehaviorisasetofcondition/actionpairs, whereconditionsarelogicalexpressions overtheinputsandactionsarebehaviors Leavesaretheoutputs:internalstate changesforinternalbehaviorsand actionprimitivesforexternalbehaviors. 15/72 Specificationofanagent’sinternal andexternalbehaviours. Eitherrigid,i.e.completelyspecifyan agent’sbehaviour,orflexible,i.e. leaveacertaindegreeofautonomy totheagentfillingtherole. Dynamicswitchingofroles. 16/72 CMUFormations CMURolesandFormations-Example Decomposethetaskspace. Consistofasmanyrolesasagents. Canincludesub-formations,units, forlocalproblemsolving, consistingof: Asubsetoftheformation Aleader,the Intra-unitinteractionsamongthe 17/72 CMULocker-RoomAgreement Aninitialformation. Aninitialmappingfromagentstoroles. Orderofprecedencebetweenroles. Run-timetriggersfordynamicchanging offormations. Set-plays. Syntaxandsemanticsof communication. 19/72 18/72 CMUCommunication Request/respondballlocation. Request/respondteammatelocation. Informpassdestination. Informgoingtoball. Informtaking/leavingposition. 20/72 CMUChallenges ApplyCMUtotheRescueSimulator Howtorepresentandfollowlocker-room agreements? Howtodeterminetheappropriatetimes foragentstochangerolesand/or formations? Howtoensurethatallagentsareusing thesameformation? Howtoensurethatallrolesinaformation arefilled? Roles Teamleader Formation Strategies ... 21/72 22/72 Communication Communication “Communicationistheintentional exchangeofinformationbrought aboutbytheproductionand perceptionofsignsdrawnfroma sharedsystemofconventional signs.” RusselandNorvig,1995 24/72 AgentCommunication(1/3) Communicationinconcurrentsystems: Synchronizationofmultipleprocesses CommunicationinObject-OrientedProgramming Methodinvocationbetweendifferentmodules CommunicationinMulti-AgentSystems? Autonomousagentshavecontroloverbothstateand behavior Methodsareexecutedaccordingtotheagent’sself-interest However,agentscanperformcommunicativeactions,i.e. attempttoinfluenceotheragents Agentcommunicationimpliesinteraction,i.e.agents performcommunicationacts AgentCommunication(2/3) Exchangeinformationandknowledge. High-levelcommunication–agent conversations,suchasnegotiationsand auctions. Makeheterogeneousagents interoperate. 25/72 AgentCommunication(3/3) Tocommunicateagentsneed: 26/72 SpeechActs(1/2) MosttreatmentofcommunicationinMASis inspiredfromspeechacttheory Thetheoryofspeechactsisgenerally recognizedtohavebegunwiththeworkofthe philosopherJohnAustin:“HowtoDoThingswith Words”(Austin,1962) Henoticedthatsomeutterancesareratherlike physicalactionsthatappeartochangethe stateoftheworld. acommon acommonunderstandingof theknowledgeexchanged;and theabilitytoexchangethe aboveinformation. Awayofdiscoveringotheragents, networkaddressesandtheir declaringwar christening 27/72 28/72 SpeechActs(2/2) TypesofSpeechAct Atheoryofhowutterancesareusedto achieveintentionsisaspeechacttheory. Speechacttheoriesarepragmatictheoriesof language,i.e.,theoriesoflanguageuse.They attempttoaccountforhowlanguageisusedby peopleeverydaytoachievetheirgoalsand intentions. Austinidentifiedanumberofperformative verbs,whichcorrespondtovariousdifferent typesofspeechacts Examplesofperformativeverbsarerequest,inform,andpromise 29/72 TypesofSpeechActs performative= content=Thebuildingisonfire speechact=pleasehelpmeextinguishthebuilding performative=inform content=Thebuildingisonfire speechact=Thebuildingisonfire! performative= content=Thebuildingisonfire speechact=Isthebuildingonfire? 31/72 Searle(1969)extendedAustin’sworkandidentified thefollowingfivekeyclassesofpossibletypesof speechacts: Representatives:suchasinforming,e.g.,“Itis raining” Directives:attemptstogetthehearertodo somethinge.g.,“pleasemakethetea” Commisives:whichcommitthespeakertodoing something,e.g.,“Ipromiseto…” Expressives:wherebyaspeakerexpressesa mentalstate,e.g.,“thankyou!” Declarations:suchasdeclaringwarorchristening 30/72 PlanBasedSemantics Howdoesonedefinethesemanticsof speechacts?Whencanonesay someonehasuttered,e.g.,arequestor Cohen&Perrault(1979)definedsemantics ofspeechactsusingthepreconditiondelete-addlistformalismof(STRIPS) planningresearch. Notethataspeakercannot(generally) forceahearertoacceptsomedesired mentalstate. 32/72 SemanticsforRequest(A,B,⚔) SpeechActonlyupdatebelief pre-conditions: AbelievesBcando⚔ (youdon’tasksomeonetodosomethingunlessyouthink theycandoit) AbelievesBbelievesBcando⚔ (youdon’tasksomeoneunlesstheybelievetheycandoit) AbelievesAwants⚔ (youdon’tasksomeoneunlessyouwantit) effect: BbelievesAbelievesAwantsBtodo⚔ (theeffectistomakethemawareofyourdesire) 33/72 Ontology 34/72 AgentCommunicationLanguages Inordertobeabletocommunicate,agents musthaveagreedonacommonsetofterms. Aformalrepresentationofasetoftermsand conceptsisknownasanontology. Realhumanscallthemvocabulary Theknowledgesharingefforthasassociated withitalargeeffortatdefiningcommon ontologies–softwaretoolslikeOntolinguais developedforthispurpose. 35/72 Anagentcommunicationlanguage(ACL)is astandardformatforexchanging messages: KnowledgeQueryandManipulationLanguage(KQML) FIPAAgentCommunicationLanguage(FIPAACL) 36/72 KnowledgeSharingEffort KSE(KnowledgeSharingEffort)inearly 1990sdesignedtwoACLswith differentpurpose KQML TheKnowledgeQueryandManipulation Language(KQML),whichisan'outer'language foragentcommunication TheKnowledgeInterchangeFormat(KIF),a languageforexpressingcontent,closelybased onFirstOrderLogic 38/72 KnowledgeInterchangeFormat-KIF(1/2) KnowledgeInterchangeFormat-KIF(2/2) Examples: Aprefixversionoffirstorderpredicate calculuswithextensionstosupport non-monotonicreasoningand definitions. Itallowsagentsto “Thetemperatureofm1is83Celsius”: (=(temperaturem1)(scalar83Celsius)) propertiesofthingsinadomain,e.g.,“Michaelisa vegetarian” relationshipsbetweenthingsinadomain,e.g.,“Michael andJaninearemarried” generalpropertiesofadomain,e.g.,“Allstudentsare registeredforatleastonecourse”(quantification∀) 39/72 “Anobjectisabacheloriftheobjectisamanandisnotmarried”: (defrelationbachelor(?x):= (and(man?x)(not(married?x)))) “Chip1hasalargersurfacethanchip2”: (>(*(widthchip1)(lengthchip1))(*(widthchip2)(length chip2))) “Anyindividualwiththepropertyofbeingapersonalsohastheproperty ofbeingamammal”: (defrelationperson(?x):=>(mammal?x)) 40/72 KnowledgeQueryandManipulationLanguage-KQML(1/2) High-level,message-oriented communicationlanguageandprotocol forinformationexchangeindependent ofcontentsyntaxandapplicable ontology. KQMLisdividedintothree contentlayer communicationlayer messagelayer KnowledgeQueryandManipulationLanguage-KQML(2/2) Itisan“outer”language,thatdefines variousacceptable“communicativeverbs”, orperformatives.Exampleperformatives: ask-if (isittruethat…) perform (pleaseperformthisaction…) tell(itistruethat…) reply(theansweris…) KnowledgeInterchangeFormatisalanguage forexpressingmessagecontent. 41/72 KQML-Messagestructure :contentcontentofthemessage :languageformallanguageofthemessage :ontologyterminologyofthemessage :forcewillsendereverdenycontentof message? :reply-withreplyexpected?identifierof reply? :in-reply-toidofreply :sendersenderID :receiverreceiverID 43/72 42/72 KQML-Example(1/3) (ask-one :senderjoe :receiverstock-server :reply-withibm-stock :content“(PRICEIBM?price)” :languageLPROLOG :ontologyNYSE-TICKS) 44/72 KQML-Example(2/3) (tell :senderstock-server :receiverjoe :in-reply-toibm-stock :content“(PRICEIBM14)” :languageLPROLOG :ontologyNYSE-TICKS) KQML-Example(3/3) (ask-all :receiverstock-server :content“price(IBM,[?price,?time])“ :languagestandard_prolog :ontologyNYSE-TICKS) 45/72 KQMLPerformatives Basicquery:ask-if,ask-one,ask-all Multi-response(query):stream-all,eos Response:error,sorry Genericinformational:tell,deny,untell,achieve, unachieve,insert,uninsert Generator:standby,ready,next,rest,discard Capability-definition:advertise,unadvertise, subscribe,recommend-one,recommend-all,brokerone,broker-all Networking:register,unregister,forward, broadcast 47/72 46/72 KQMLCriticism ThebasicKQMLperformativesetwas overlylargeandnotstandardized: differentimplementationsofKQMLwheredevelopedthat couldnot,infact,interoperate Thelanguagewasmissingtheperformative commissives Commissivesarecrucialforagentscoordinatingtheir actions. Noprecisedefinitionofthetransport mechanismforKQMLmessages. Norigoroussemanticsfor 48/72 FIPA FoundationforIntelligentPhysicalAgents(FIPA) 1997,theFoundationforIntelligent PhysicalAgents(FIPA)startedworkon aprogramofagentstandards-the centrepieceisanACL. ReleasedspecificationsforFIPAACLin1999and 2002. BasicstructureisquitesimilartoKQML: performative;20performativeinFIPA. housekeeping;e.g.,senderetc. content,theactualcontentofthemessage. 50/72 FIPAACL Informperformative InformandRequestarethetwobasic performativesinFIPA.Allothersaremacro definitions,definedintermsofthese. Inform(j, Thecontentɸisa Feasibilitycondition: Biɸ˄¬Bi(Bifjɸ˅Ui (ibelievesɸanddoesnotalreadybelievethat therecipientjisawareofwhetherɸistrueor Themeaningofinformandrequestis definedintwoparts: feasibilitycondition:whichthesendermustsatisfyto conformtotheFIPAACLstandard. rationaleffect:whatthesenderofthemessage attemptstoachieve. 51/72 Rationaleffect: Bjɸ (jbelieve 52/72 Requestperformative Request(j,α) Thecontentαisanaction. Feasibility BiAgent(α,j)˄¬BiIjDone(α) (ibelievesjwilldoαandthatjdoesnotalready intendtodoα) Rationaleffect: Done(α) FIPAperformatives requestinformation:subscribe,query-if, query-ref passinginformation:inform,inform-ref, confirm,disconfirm negotiation:cfp,propose,accept-proposal, reject-proposal performingactions:request,request-when, request-whenever,agree,cancel,refuse 53/72 FIPAInteractionProtocols 54/72 FIPARequest InteractionProtocols(IPs)arestandardized exchangesofperformativesaccordingtowellknown FIPARequest FIPAQuery FIPARequestWhen FIPAContractNet FIPAIteratedContractNet FIPAAuctionEnglish FIPAAuctionDutch FIPABrokering FIPARecruiting FIPASubscribe FIPAPropose 55/72 56/72 ContractNetProtocol(1/3) Smith(1980) Simpleandeasytoimplement ManagerandSupplierscommunicate viaoffers SmithdefinedaContractSpecification Language ContractNet Requirements Formats DeadlineforPresentation 58/72 ContractNetProtocol(2/3) Announcement:Managessendsatask descriptiontoallpossiblesuppliers (RequestForBid(T,M)) Bidding:Suppliersevaluatetheofferandsend aproposaltotheManager(Propose(T,Off,AG)or NotInterested(T,Ag)) Awarding:ManagerEvaluatestheProposaland allocatesthecontracttothebestsupplier (Award(T,Ag,M)) Expediting:Thechosensupplierreplies positivelyornegativelytotheManager (Accept(T,Ag),Refuse(T,Ag)) 59/72 ContractNetProtocol(3/3) Rolesarenotspecifiedinadvance,but aredynamic TheManagercandecomposeataskand issueseveralCallforProposals(CFPs) Alsoacontractormightfurtherdecomposea taskandgivesomepartsawaytoother HierarchicalControlStructureforTaskSharing Typically,anodewilltakeonbothroles, oftensimultaneouslyfordifferentcontracts FullyDistributed 60/72 CNPFireBrigadeexample(1/2) FirebrigadeAneeds helptoextinguisha CNPFireBrigadeexample(2/2) Themanagerawards acontracttothemost appropriateagent Forexample,agent B,whichiscloserto thefire Taskspecification:needed amountofwater,thelocationof thefire,andadeadline AgentBandD submittheirbits Thebitcontainsestimatedcosts fortravelingtothelocationand forrefillingthetank Thecontractorsendsbacka reportafterfinishingthe taskorfurthersubdivides thetask... 61/72 LimitationsofContractNets 62/72 FIPAContractNet Limitations: Taskdecompositionandproblemsynthesescanbenontrivial Communicationoverhead Theawardedcontractormightnotbethebestchoice,a bettercandidatecouldbetemporarilybusyduringaward time Efficiency Focusedaddressing/directcontracts(e.g.teamstructure) Agentsendstatusmessage,e.g.eligiblebutbusy, ineligible,uninterested,… 63/72 64/72 CommunicationinRoboRescue Agentscommunication Share Distribute Coordinate Lowbandwidthunreliable JADE IsitsuitabletouseanACLhere? Notastandardone:ittakestoomuch Butsimilarconceptscanbeapplied:inform andrequestareusefull 65/72 JADE(1/3) JADE(2/3) OpenSourceprojectoriginatedby Telecom(TILAB),currentlygoverned byaninternationalboard,e.g. Motorola,FranceTelecom,Whitestein, JADEallowstherapidcreationof multi-agentsystemsinJava Highinteroperabilitythrough FIPAcompliance 67/72 JADEincludes: Alibraryfordevelopingagents(which implementsmessagetransportandparsing) Aruntimeenvironmentallowingmultiple,parallel andconcurrentagentactivities Graphicaltoolsthatsupportmonitoring,logging, anddebugging YellowPages,adirectorywhereagentscan registertheircapabilitiesandsearchforother agentsandservices 68/72 JADE(3/3) JADEBehaviors JADEBehaviors Abehaviorisbasicallyaneventhandler,amethodwhich describeshowanagentreactstoanevent:thereceptionofa messageoratimerinterrupt TheEventHandlercodeisplacedinamethodcalledaction. Everybehaviorisscheduledfollowingaroundrobinalgorithm ExamplesofBehaviorsalreadyincludedinJADE: SimpleBehavior CyclicBehavior TickerBehavior WakerBehavior ReceiverBehavior SequentialBehavior ParallelBehavior FSMBehavior 69/72 JADEDebuggingtools 70/72 Summary ACLsprovidestandardsfor communicationamongselfishagents,e.g. withinanopensystems Motivatedfromthetheoryofspeechacts, communicationisimplementedinterms ofactions TheFIPAACLcanbeconsideredasthe defactostandardforagent TheJADEframeworkimplementsitinJAVA communication Thereisstilllongwaytogountilwe havescalablesystems! 71/72 72/72