Lectures TDDD10AIProgramming Multi-AgentsandCommunication CyrilleBerger 1AIProgramming:Introduction 2IntroductiontoRoboRescue 3AgentsandAgentsArchitecture 4Multi-AgentsandCommunication 5MultiagentDecisionMaking 6CooperationAndCoordination1 7CooperationAndCoordination2 8MachineLearning 9KnowledgeRepresentation 10PuttingItAllTogether 2/70 Q/AFromthelabs Lecturegoals Thereisnorightwaytodothelabs, don'thesitatetobecreative Agentshavearadiusof500mm URNsforChangeSet/Propertyare definedinStandardEntityURNand StandardPropertyURN Ifyouhavefinishedlab2,helptheothers 3/70 Acquireknowledgeonmutliagent systems. Acquireknowledgeonhowagents communicate 4/70 Lecturecontent Multi-AgentSystems CMUCaseStudy Communication Multi-AgentSystems KQML FoundationforIntelligentPhysicalAgents(FIPA) ContractNet 5/70 Multi-AgentSystems CharacteristicsofMulti-AgentSystems “Amulti-agentsystem(MAS)canbe definedasalooselycouplednetworkof problemsolversthatinteracttosolve problemsthatarebeyondtheindividual capabilitiesorknowledgeofeach problemsolver.”DurfeeandLesser,1989 Theparticipantsareself-interested. Theparticipantsandtheircapabilitieschanges overtime,i.e.opensystems. Eachparticipanthasincompleteinformationor capabilitiesforsolvingtheproblemand,thus, hasalimitedviewpoint. Thereisnosystemglobalcontrol. Dataisdecentralized. Computationisasynchronous. 7 8 ViewofacanonicalMulti-AgentSystem Motivation CooperativedistributedProblemSolving NoAgentcansolvetheproblembyitself Differentcapabilities,resourcesandknowledge Cooperation:Systemsdointeracttofulfill theirtasks Task&ResultSharing TaskDecomposition&Allocation Coordination:Systemsdynamicallyadapt theirbehaviortootheragents MultiagentplanningandTaskDeconfliction 9 Challenges 10 Solutions Organizations Taskallocationandmultiagentplanning Recognizingandresolvingconflicts Modelingotheragents Communication Managingresources Adaptationandlearning Howtoformulate,describe,decompose,andallocateproblems andsynthesizeresultsamongagroupofagents. Howtoenableagentstocommunicateandinteract. Howtomakesurethatagentsactcoherentlyinmakingdecision ortakingaction. Howtoenableindividualagentstorepresentandreasonabout theactions,plans,andknowledgeofotheragentstocoordinate withthem. Howtorecognizeandreconciledisparateviewpointsand conflictingintentionsamongacollectionofagentstryingto coordinatetheiractions. 11 12 Footballsimulator CMUCaseStudy 14 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 15 16 CMUBehaviors CMURoles Abehaviorisasetofcondition/actionpairs,where conditionsarelogicalexpressionsovertheinputsand actionsarebehaviors Leavesaretheoutputs:internalstatechangesforinternal behaviorsandactionprimitivesforexternalbehaviors. Specificationofanagent’sinternaland externalbehaviours. Eitherrigid,i.e.completelyspecifyan agent’sbehaviour,orflexible,i.e.leave acertaindegreeofautonomytothe agentfillingtherole. Dynamicswitchingofroles. 17 18 CMURolesandFormations-Example CMUFormations Decomposethetaskspace. Consistofasmanyrolesasagents. Canincludesub-formations,units,for localproblemsolving,consistingof: Asubsetoftheformationroles. Aleader,thecaptain. Intra-unitinteractionsamongtheroles. 19 20 CMULocker-RoomAgreement CMUCommunication Aninitialformation. Aninitialmappingfromagentstoroles. Orderofprecedencebetweenroles. Run-timetriggersfordynamicchanging offormations. Set-plays. Syntaxandsemanticsofcommunication. Request/respondballlocation. Request/respondteammatelocation. Informpassdestination. Informgoingtoball. Informtaking/leavingposition. 21 22 ApplyCMUtotheRescueSimulator CMUChallenges Howtorepresentandfollowlocker-room agreements? Howtodeterminetheappropriatetimesfor agentstochangerolesand/orformations? Howtoensurethatallagentsareusingthe sameformation? Howtoensurethatallrolesinaformation arefilled? Roles Teamleader Formation Strategies ... 23 24 Communication “Communicationistheintentional exchangeofinformationbroughtabout bytheproductionandperceptionofsigns drawnfromasharedsystemof conventionalsigns.” RusselandNorvig,1995 Communication 26 AgentCommunication(1/3) AgentCommunication(2/3) Communicationinconcurrentsystems: Exchangeinformationandknowledge. High-levelcommunication–agent conversations,suchasnegotiationsand auctions. Makeheterogeneousagents interoperate. Synchronizationofmultipleprocesses CommunicationinObject-OrientedProgramming Methodinvocationbetweendifferentmodules CommunicationinMulti-Agent Autonomousagentshavecontroloverbothstateandbehavior Methodsareexecutedaccordingtotheagent’sself-interest However,agentscanperformcommunicativeactions,i.e.attemptto influenceotheragents Agentcommunicationimpliesinteraction,i.e.agentsperform communicationacts 27 28 AgentCommunication(3/3) SpeechActs(1/2) Tocommunicateagentsneed: acommonlanguage; acommonunderstandingoftheknowledge exchanged;and theabilitytoexchangetheabove information. Awayofdiscoveringotheragents,network addressesandtheircapabilities. MosttreatmentofcommunicationinMASisinspired fromspeechacttheory Thetheoryofspeechactsisgenerallyrecognizedto havebegunwiththeworkofthephilosopherJohn Austin:“HowtoDoThingswithWords”(Austin, Henoticedthatsomeutterancesareratherlike 1962) physicalactionsthatappeartochangethestateof theworld. declaringwar christening 29 SpeechActs(2/2) 30 TypesofSpeechAct Searle(1969)extendedAustin’sworkandidentifiedthe followingfivekeyclassesofpossibletypesofspeechacts: Representatives:suchasinforming,e.g.,“Itisraining” Directives:attemptstogetthehearertodosomething e.g.,“pleasemakethetea” Commisives:whichcommitthespeakertodoing something,e.g.,“Ipromiseto…” Expressives:wherebyaspeakerexpressesamentalstate, e.g.,“thankyou!” Declarations:suchasdeclaringwarorchristening Atheoryofhowutterancesareusedto achieveintentionsisaspeechacttheory. Speechacttheoriesarepragmatictheoriesof language,i.e.,theoriesoflanguageuse.Theyattempt toaccountforhowlanguageisusedbypeopleevery daytoachievetheirgoalsandintentions. Austinidentifiedanumberofperformativeverbs, whichcorrespondtovariousdifferenttypesof speechacts Examplesofperformativeverbsarerequest,inform,andpromise 31 32 PlanBasedSemantics(1/2) TypesofSpeechActs Howdoesonedefinethesemanticsof speechacts? performative=request content=Thebuildingisonfire speechact=pleasehelpmeextinguishthebuilding Whencanoneuttersomething,e.g.,arequestoraninform? Whencanonesaysomeonehasuttered,e.g.,arequestoran inform? performative=inform content=Thebuildingisonfire speechact=Thebuildingisonfire! Cohen&Perrault(1979)definedsemantics ofspeechactsusingthepreconditiondelete-addlistformalismof(STRIPS) planningresearch. performative=inquire content=Thebuildingisonfire speechact=Isthebuildingonfire? 33 34 SemanticsforRequest(A,B,⚔) PlanBasedSemantics(2/2) pre-conditions: STRIPS(StanfordResearchInstitute ProblemSolver) AbelievesBcando⚔ (youdon’tasksomeonetodosomethingunlessyouthink theycandoit) AbelievesBbelievesBcando⚔ (youdon’tasksomeoneunlesstheybelievetheycandoit) AbelievesAwants⚔ (youdon’tasksomeoneunlessyouwantit) Pisasetofconditions Oisasetofoperators,eachoperatorisquadruplet 1conditionsthatneedstobetrue 2conditionsthatneedstobefalse 3conditionsthataresettotrue 4conditionsthataresettofalse Iistheinitialstate Gisthegoalstate effect: BbelievesAbelievesAwantsBtodo⚔ (theeffectistomakethemawareofyourdesire) STRIPScangenerateaplanfromItoG 35 36 SpeechActonlyupdatebelief Notethataspeakercannot(generally)forceahearerto acceptsomedesiredmentalstatenortodoanaction. Ontology(1/2) Inordertobeabletocommunicate,agents musthaveagreedonacommonsetofterms. Aformalrepresentationofasetofterms andconceptsisknownasanontology. Theknowledgesharingefforthasassociated withitalargeeffortatdefiningcommon ontologies–softwaretoolslikeOntolingua isdevelopedforthispurpose. 37 38 Ontology(2/2) AgentCommunicationLanguages Sharingcommonunderstandingofthe structureofinformationamongpeople orsoftwareagents Anagentcommunicationlanguage(ACL)is astandardformatforexchangingmessages: KnowledgeQueryandManipulationLanguage(KQML) FIPAAgentCommunicationLanguage(FIPAACL) Example:usingthesametechnicaltermonawebsite (softwareisasynonymofprogram) Enablingreuseofdomainknowledge Example:usethesamerepresentationoftime Analysedomainknowledge 39 40 KnowledgeSharingEffort KSE(KnowledgeSharingEffort)inearly 1990sdesignedtwoACLswith differentpurpose KQML TheKnowledgeQueryandManipulationLanguage (KQML),whichisan'outer'languageforagent communication TheKnowledgeInterchangeFormat(KIF),alanguage forexpressingcontent,closelybasedonFirstOrder Logic 42 KnowledgeQueryandManipulationLanguage-KQML(1/2) KnowledgeQueryandManipulationLanguage-KQML(2/2) Itisan“outer”language,thatdefinesvarious acceptable“communicativeverbs”,or performatives.Exampleperformatives: High-level,message-oriented communicationlanguageandprotocol forinformationexchangeindependentof contentsyntaxandapplicableontology. KQMLisdividedintothreelayers: ask-if (isittruethat…) perform (pleaseperformthisaction…) tell(itistruethat…) reply(theansweris…) contentlayer communicationlayer messagelayer KnowledgeInterchangeFormatisalanguagefor expressingmessagecontent. 43 44 KnowledgeInterchangeFormat-KIF(1/2) KnowledgeInterchangeFormat-KIF(2/2) Examples: Aprefixversionoffirstorderpredicate calculuswithextensionstosupportnonmonotonicreasoninganddefinitions. Itallowsagentstoexpress “Thetemperatureofm1is83Celsius”: (=(temperaturem1)(scalar83Celsius)) “Anobjectisabacheloriftheobjectisamanandisnot (defrelationbachelor(?x):= (and(man?x)(not(married?x)))) propertiesofthingsinadomain,e.g.,“Michaelisa vegetarian” relationshipsbetweenthingsinadomain,e.g.,“Michaeland Janinearemarried” generalpropertiesofadomain,e.g.,“Allstudentsare registeredforatleastonecourse”(quantification∀) “Chip1hasalargersurfacethanchip2”: (>(*(widthchip1)(lengthchip1)) (*(widthchip2)(lengthchip2))) “Anyindividualwiththepropertyofbeingapersonalsohasthepropertyofbeing amammal”: (defrelationperson(?x):=>(mammal?x)) 45 KQML-Messagestructure 46 KQML-Example(1/3) (ask-one :senderjoe :receiverstock-server :reply-withibm-stock :content“(PRICEIBM?price)” :languageLPROLOG :ontologyNYSE-TICKS) :contentcontentofthemessage :languageformallanguageofthemessage :ontologyterminologyofthemessage :forcewillsendereverdenycontentofmessage? :reply-withreplyexpected?identifierofreply. :in-reply-toifitisaresponse?idofreply :sendersenderID :receiverreceiverID 47 48 KQML-Example(2/3) KQML-Example(3/3) (tell :senderstock-server :receiverjoe :in-reply-toibm-stock :content“(PRICEIBM14)” :languageLPROLOG :ontologyNYSE-TICKS) (ask-all :receiverstock-server :content“price(IBM,[?price,?time])“ :languagestandard_prolog :ontologyNYSE-TICKS) 49 KQMLPerformatives 50 KQMLCriticism 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,broker-one,broker-all Networking:register,unregister,forward,broadcast 51 ThebasicKQMLperformativesetwasoverlylarge andnotwellstandardized. NorigoroussemanticsforKQML. differentimplementationsofKQMLwheredevelopedthatcouldnot, infact,interoperate Thelanguagewasmissingtheperformative commissives Commissivesarecrucialforagentscoordinatingtheiractions. Noprecisedefinitionofthetransportmechanism forKQMLmessages. 52 FIPA FoundationforIntelligentPhysicalAgents(FIPA) 1997,theFoundationforIntelligent PhysicalAgents(FIPA)startedworkona programofagentstandards-the centrepieceisanACL. ReleasedspecificationsforFIPAACLin1999and2002. Basicstructureisquitesimilarto performative;20performativeinFIPA. housekeeping;e.g.,senderetc. content,theactualcontentofthemessage. 54 Informperformative FIPAACL InformandRequestarethetwobasic performativesinFIPA.Allothersaremacro definitions,definedintermsofthese. Themeaningofinformandrequestis definedintwoparts: Inform(j,ɸ) Thecontentɸisastatement. Feasibilitycondition: Biɸ˄¬Bi(Bifjɸ˅Ui (ibelievesɸanddoesnotalreadybelievethat therecipientjisawareofwhetherɸistrueornot) feasibilitycondition:whichthesendermustsatisfyto conformtotheFIPAACLstandard. rationaleffect:whatthesenderofthemessageattempts toachieve. Rationaleffect: Bjɸ (jbelieveɸ) 55 56 Requestperformative 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 Request(j,α) Thecontentαisanaction. Feasibilitycondition: BiAgent(α,j)˄¬BiIjDone(α) (ibelievesjwilldoαandthatjdoesnot alreadyintendtodoα) Rationaleffect: Done(α) 57 FIPAInteractionProtocols 58 FIPARequest InteractionProtocols(IPs)arestandardizedexchanges ofperformativesaccordingtowellknownsituations FIPARequest FIPAQuery FIPARequestWhen FIPAContractNet FIPAIteratedContractNet FIPAAuctionEnglish FIPAAuctionDutch FIPABrokering FIPARecruiting FIPASubscribe FIPAPropose 59 60 ContractNetProtocol(1/3) Smith(1980) Simpleandeasytoimplement ManagerandSupplierscommunicatevia offers SmithdefinedaContractSpecification Language ContractNet Requirements Formats DeadlineforPresentation 62 ContractNetProtocol(2/3) ContractNetProtocol(3/3) Announcement:Managessendsataskdescriptiontoall possiblesuppliers(RequestForBid(T,M)) Bidding:Suppliersevaluatetheofferandsendaproposal totheManager(Propose(T,Off,AG)or NotInterested(T,Ag)) Awarding:ManagerEvaluatestheProposalandallocates thecontracttothebestsupplier(Award(T,Ag,M)) Expediting:Thechosensupplierrepliespositivelyor negativelytotheManager(Accept(T,Ag),Refuse(T,Ag)) Rolesarenotspecifiedinadvance,butaredynamic TheManagercandecomposeataskandissue severalCallforProposals(CFPs) Alsoacontractormightfurtherdecomposeatask andgivesomepartsawaytoothercontractors! HierarchicalControlStructureforTaskSharing Typically,anodewilltakeonbothroles,often simultaneouslyfordifferentcontracts FullyDistributedControl 63 64 CNPFireBrigadeexample(1/2) CNPFireBrigadeexample(2/2) FirebrigadeAneedshelp toextinguishabuilding Themanagerawardsa contracttothemost appropriateagent Forexample,agentB, whichisclosertothefire Taskspecification:needed amountofwater,thelocationof thefire,andadeadline AgentBandDsubmit theirbits Thecontractorsendsbacka reportafterfinishingthetaskor furthersubdividesthetask... Thebitcontainsestimatedcosts fortravelingtothelocationand forrefillingthetank 65 LimitationsofContractNets 66 FIPAContractNet Limitations: Taskdecompositionandproblemsynthesescanbenontrivial Communicationoverhead Theawardedcontractormightnotbethebestchoice,a bettercandidatecouldbetemporarilybusyduringaward time Efficiencymodifications: Focusedaddressing/directcontracts(e.g.teamstructure) Agentsendstatusmessage,e.g.eligiblebutbusy,ineligible, uninterested,… 67 68 CommunicationinRoboRescue Summary ACLsprovidestandardsforcommunicationamong selfishagents,e.g.withinanopensystems Motivatedfromthetheoryofspeechacts, communicationisimplementedintermsof TheFIPAACLcanbeconsideredasthedefacto standardforagentcommunication Agentscommunication Shareobservations Distributetasks Coordinatedecisions Lowbandwidthunreliablechannels IsitsuitabletouseanACLhere? TheJADEframeworkimplementsitinJAVA Notastandardone:ittakestoomuch Butsimilarconceptscanbeapplied:informand requestareusefull Thereisstilllongwaytogountilwehavescalable systems! 69 70/70