Presentation is loading. Please wait.

Presentation is loading. Please wait.

Koen Hindriks, Birna van RiemsdijkMulti-agent systemen Agent Programming in G OAL Multi-agent Systems & Communication Koen Hindriks Delft University of.

Similar presentations


Presentation on theme: "Koen Hindriks, Birna van RiemsdijkMulti-agent systemen Agent Programming in G OAL Multi-agent Systems & Communication Koen Hindriks Delft University of."— Presentation transcript:

1 Koen Hindriks, Birna van RiemsdijkMulti-agent systemen Agent Programming in G OAL Multi-agent Systems & Communication Koen Hindriks Delft University of Technology, The Netherlands

2 Koen Hindriks, Birna van Riemsdijk Multi-agent systemen Koen Hindriks, Birna van RiemsdijkMulti-agent systemen G OAL So Far mental states (beliefs, goals) mental state conditions & macros action specifications, built-in actions action rules environment & perception modules

3 Koen Hindriks, Birna van Riemsdijk Multi-agent systemen Koen Hindriks, Birna van RiemsdijkMulti-agent systemen Outline (today) Intro Multi-Agent Systems (MAS) Specifying a MAS in G OAL Communication in G OAL Coordination in MAS

4 Koen Hindriks, Birna van Riemsdijk Multi-agent systemen Koen Hindriks, Birna van RiemsdijkMulti-agent systemen Multi-Agent Systems (MAS)

5 Koen Hindriks, Birna van Riemsdijk Multi-agent systemen Koen Hindriks, Birna van RiemsdijkMulti-agent systemen Multi-Agent System Environment A1 Agents A2 A3 A4 Intersecting spheres of influence of multiple agents acting in an environment Intersecting spheres: Action perspective: may interfere, change same parts of environment Perception perspective: agents may have different views on environment

6 Koen Hindriks, Birna van Riemsdijk Multi-agent systemen Koen Hindriks, Birna van RiemsdijkMulti-agent systemen Multi-Agent System Environment A1 Agents A2 A3 A4 Various approaches to coordinate activity of multiple agents Various coordination techniques have been proposed, main ideas: Communication protocols impose structure on agent communication Add organization structure on top of multi-agent system Note: Without explicit agent communication still implicit communication possible via environment if perception spheres overlap

7 Koen Hindriks, Birna van Riemsdijk Multi-agent systemen Koen Hindriks, Birna van RiemsdijkMulti-agent systemen Multi-Agent System Environment A1 Agents A2 A3 A4 Not all agents need to be ‘connected’ to the environment

8 Koen Hindriks, Birna van Riemsdijk Multi-agent systemen Koen Hindriks, Birna van RiemsdijkMulti-agent systemen Specifying a MAS

9 Koen Hindriks, Birna van Riemsdijk Multi-agent systemen Koen Hindriks, Birna van RiemsdijkMulti-agent systemen MAS Specification In G OAL, a.mas file is a recipe for launching a multi-agent system, specifying: which environment will be launched, how many agents will be launched, the agent names for agent processes which agents are connected to environment which.goal file is used to create an agent.

10 Koen Hindriks, Birna van Riemsdijk Multi-agent systemen Koen Hindriks, Birna van RiemsdijkMulti-agent systemen MAS Specification A.mas file is a recipe for launching a MAS: which environment will be launched environment started by jar file, some of which may be initialized using the init command (check out environment doc). environment{ "blocksworld.jar". init[configuration="bwconfigEx1.txt"]. }

11 Koen Hindriks, Birna van Riemsdijk Multi-agent systemen Koen Hindriks, Birna van RiemsdijkMulti-agent systemen MAS Specification A.mas file is a recipe for launching a MAS: which agent files will be used agent file defines a possible agent type. agentfiles { "coffeemaker.goal". "coffeegrinder.goal". }

12 Koen Hindriks, Birna van Riemsdijk Multi-agent systemen Koen Hindriks, Birna van RiemsdijkMulti-agent systemen MAS Specification A.mas file is a recipe for launching a MAS: which agent processes will be created a launch policy specifies when, which and how many agent processes will be created. launch maker:coffeemaker. launches one agent process called maker using the agent file referenced by coffeemaker (coffeemaker.goal). does not connect agent to an environment. launchpolicy { launch maker:coffeemaker. launch grinder:coffeegrinder. }

13 Koen Hindriks, Birna van Riemsdijk Multi-agent systemen Koen Hindriks, Birna van RiemsdijkMulti-agent systemen MAS Specification A.mas file is a recipe for launching a MAS: which agent processes will be created a conditional launch rule is triggered by the environment: whenever a controllable entity becomes available in the environment, an event is generated. the agent created by the launch part of the rule is connected to that entity. launchpolicy { when do launch elevator:file1. }

14 Koen Hindriks, Birna van Riemsdijk Multi-agent systemen Koen Hindriks, Birna van RiemsdijkMulti-agent systemen MAS Specification A.mas file is a recipe for launching a MAS: additional checks in launch rule this launch rule can only be applied if there is an available entity of type car, and the rule can be applied at most 3 times. Remark: launch rules are applied in linear order. launchpolicy { when do launch elevator:file1. }

15 Koen Hindriks, Birna van Riemsdijk Multi-agent systemen Koen Hindriks, Birna van RiemsdijkMulti-agent systemen MAS Specification: Example A.mas file is a recipe for launching a MAS: environment section may be empty, in that case mas is run without an environment. agentfiles and launchpolicy must be non-empty. agentfiles { "coffeemaker.goal". "coffeegrinder.goal". } launchpolicy { launch maker:coffeemaker. launch grinder:coffeegrinder. }

16 Koen Hindriks, Birna van Riemsdijk Multi-agent systemen Koen Hindriks, Birna van RiemsdijkMulti-agent systemen Agent Identity and Other Agents How does an agent know it is not alone? The names of all agents generated by GOAL are inserted in the belief base of all other agents. For example, agent(tarzan) is inserted in the belief base of agent jane when tarzan is created. How is an agent able to differentiate itself from other agents? I.e. how does agent jane know she is not tarzan? Upon creation, the fact me( ) where name is the agent’s name is inserted in the belief base of that agent.

17 Koen Hindriks, Birna van Riemsdijk Multi-agent systemen Koen Hindriks, Birna van RiemsdijkMulti-agent systemen Communication in G OAL

18 Koen Hindriks, Birna van Riemsdijk Multi-agent systemen Koen Hindriks, Birna van RiemsdijkMulti-agent systemen Communication: Primitives Communication primitives: –send(, ) –sendonce(, ) Example: Tarzan sends Jane a message: –send(jane, meeting(date(1,2,2010), time(12,0), duration(1,0), [jane, tarzan]))

19 Koen Hindriks, Birna van Riemsdijk Multi-agent systemen Koen Hindriks, Birna van RiemsdijkMulti-agent systemen GOAL Agent Architecture The basis of communication in GOAL is a simple mailbox semantics. Agent Environment Real or simulated world of events action percept Beliefs Goals Action Rules Process percepts message Process message

20 Koen Hindriks, Birna van Riemsdijk Multi-agent systemen Koen Hindriks, Birna van RiemsdijkMulti-agent systemen Communication: Semantics Action: send(, ) ground send action can always be performed, i.e. precondition is true, assume agent sender sends message to recipients then GOAL puts sent(, ) in the mailbox of sender, agents that receive message put received(sender, ) in their mailbox. NB: keep in mind it may take some time before agent b receives the message.

21 Koen Hindriks, Birna van Riemsdijk Multi-agent systemen Koen Hindriks, Birna van RiemsdijkMulti-agent systemen Communication: Semantics Action: sendonce(, ) same as send(, ), but sendonce action can only be performed if the mailbox of the sending agent does not contain: sent(, ) i.e. precondition is: not(sent(, )

22 Koen Hindriks, Birna van Riemsdijk Multi-agent systemen Koen Hindriks, Birna van RiemsdijkMulti-agent systemen Using Messages in Mailbox The facts in the mailbox can be used like any other facts in the belief base of an agent. That is, sent(, ) and received(name, ) can be used in: –in conditions in action rules –c lauses in the knowledge or beliefs section

23 Koen Hindriks, Birna van Riemsdijk Multi-agent systemen Koen Hindriks, Birna van RiemsdijkMulti-agent systemen Using Messages in Mailbox After receiving a message from tarzan, agent jane will have: received(tarzan, meeting(date(1,2,2010), time(12,0), duration(1,0), [jane,tarzan])) in her mailbox. Consequently, jane will believe: bel(received(tarzan, meeting(date(1,2,2010), …, …, [jane,tarzan])))

24 Koen Hindriks, Birna van Riemsdijk Multi-agent systemen Koen Hindriks, Birna van RiemsdijkMulti-agent systemen Processing Message Pattern Inserting received information into belief base and removing received message: Removing received message cleans up the mailbox and makes sure that the action rule is not applied repeatedly (even after the received info is outdated). Using received messages in mental state conditions other than for processing the message, and using them in knowledge base, gives less readable code. if bel(received(A,Proposition)) then insert(Proposition) + delete(received(A,Proposition))

25 Koen Hindriks, Birna van Riemsdijk Multi-agent systemen Koen Hindriks, Birna van RiemsdijkMulti-agent systemen Using Messages in Mailbox More complex conditions may be defined. For example: #define not_yet_invited(Person,Date,Time,Duration,Attendees) goal(meeting(Date, Time, Duration, Attendees)), bel(member(Person, Attendees), me(Me), not(Person = Me)), not(bel(sent(Person, meeting(Date,Time,Duration, Attendees)))). which informally means: I want to have a meeting with Attendees, Person is one of the Attendees (different from myself), and I did not send that person an invitation for the meeting I want yet.

26 Koen Hindriks, Birna van Riemsdijk Multi-agent systemen Koen Hindriks, Birna van RiemsdijkMulti-agent systemen Message Types GOAL supports three message types, called moods: –declarative, typically used to inform Example: The time is 2 o'clock operator: ‘:’ : send(jane, :time(14,0)) –imperative, typically used to indicate a goal Example: I want the door to be closed! operator: ‘!’ : send(jane, !door(closed)) –interrogative, typically used to ask a question Example: How much milk is left? operator: ‘? : send(jane, ?amountMilk(_))

27 Koen Hindriks, Birna van Riemsdijk Multi-agent systemen Koen Hindriks, Birna van RiemsdijkMulti-agent systemen Message Types Mood operators are translated to Prolog predicates in mailbox: –declarative: no predicate received(tarzan, time(14,0)) –imperative: imp received(tarzan, imp(door(closed))) –interrogative: int received(tarzan, int(amountMilk(_))) See programming guide, section 6.5.

28 Koen Hindriks, Birna van Riemsdijk Multi-agent systemen Koen Hindriks, Birna van RiemsdijkMulti-agent systemen Agent Selectors First argument of a send action is called an agent selector, which can be: An agent name: send(jane, …) A variable (to be instantiated): send(Person, …) A list of selectors: send([jane,tarzan,Person], …) A quantor: –send(self, …) : message sent to agent itself –send(all, …) : message sent to all agents (incl. itself) –send(allother, …) : message sent to all other agents

29 Koen Hindriks, Birna van Riemsdijk Multi-agent systemen Koen Hindriks, Birna van RiemsdijkMulti-agent systemen Sending messages to oneself Messages sent to oneself change the agent’s own mental state! Sending messages to oneself has special meaning. Changes are different for different moods: –send(self, :fact) inserts fact in belief base –send(self, !fact) adopts fact as goal and deletes fact from belief base. –send(self, ?fact) deletes fact from belief base N.B.: Do not use messages to self as an alternative way of updating the agent’s beliefs and goals!

30 Koen Hindriks, Birna van Riemsdijk Multi-agent systemen Koen Hindriks, Birna van RiemsdijkMulti-agent systemen Selecting agents to send to Suppose agent wants to send to all other agents that are producers of milk that it wants to have milk. Q: Write an action rule which achieves this: –Use predicates have/1 and producerOf/2. A: if a-goal(have(milk)), bel(agent(X), producerOf(X, milk)) then send(X, !have(milk))


Download ppt "Koen Hindriks, Birna van RiemsdijkMulti-agent systemen Agent Programming in G OAL Multi-agent Systems & Communication Koen Hindriks Delft University of."

Similar presentations


Ads by Google