Presentation is loading. Please wait.

Presentation is loading. Please wait.

Multi-Agent Systems University “Politehnica” of Bucarest Spring 2010 Adina Magda Florea curs.cs.pub.ro.

Similar presentations


Presentation on theme: "Multi-Agent Systems University “Politehnica” of Bucarest Spring 2010 Adina Magda Florea curs.cs.pub.ro."— Presentation transcript:

1 Multi-Agent Systems University “Politehnica” of Bucarest Spring 2010 Adina Magda Florea http://turing.cs.pub.ro/mas_10 curs.cs.pub.ro

2 Agent oriented programming (AOP) 1An agent scenario 2 An AOP system 3 AGENT-0 4 Program example

3 3 n Plane ticket reservation Agents:  P – passenger  C – sales agent (program)  S supervisor of C n Confirm reservation – commitment to issue a boarding pass 1 An agent scenario

4 4 March n P to C: Please inform me what flights you have from San Francisco to New York on April 18. C to P: Flight #354 departs at 08:30. flight #293 departs at 10:00, flight #441 departs at noon,  n P to C: Please book me on #354. n C to P: That is sold out. n P to C: Please book me on #293. n C to P: That is confirmed: your reservation number is 112358. Airline reservation

5 5 n P to C: Please book me also on #441. n C to P: That conflicts with #293: I am not allowed to double book a passenger. n P to C: Please get permission to do so. C to S: I request permission for the following double booking:  n S to C: Permission denied. n C to P: Sorry, I cannot get approval. April 18, at the airport n P to C: My name is P; I have a reservation for flight =293. n C to P: Here is your boarding pass. Airline reservation

6 2 An AOP system A complete AOP system: o A formal language to define mental states o A programming language to define and program agents; o Speech-act theory; o Language semantics – mental states o A process of "agentification" 6

7 3 Agent-0 3.1 Components of mental states n Beliefs n Agent actions n Capabilities or Abilities n Obligations or commitments n Decisions – commitments to itself 7

8 3.2 Representing beliefs, commitments and capabilities Time Temporal logic language, discrete time holding(robot,cup) t Action No distinction between actions and states Executing an action – the corresponding fact raise-arm(robot) t is true Instant actions 8

9 Beliefs Modal operator B, B t a  “At time t agent a believes that  “, -  - belief B 3 a B 10 b like(a,b) 7 “At time 3 agent a believes that at time 10 agent b will believe that at time 7 a liked b.” Obligations OBL t a,b  “At time t agent a is obligated (committed) to agent b about .” Decisions Commitments/obligations to itself DEC t a   def  OBL t a,a  9

10 Capabilities CAN t a  “At time t agent a is capable of .” CAN 5 robot open(door) 8 “At time 5 the robot can ensure that the door is open at time 8.” ABLE is the immediate version of CAN. time(  ) –time(open(door) t )=t ABLE a   def CAN time(  ) a  10

11 n Linear discrete time n BeliefsB a t  n Actionsraise_arm(robot) t n Obligations / commitmentsOBL a,b t  (CMT a,b t  ) n DecisionsDEC a t  = OBL a,a t  n CapabilitiesCAN a t  11 Summary of mental categories in AGENT0

12 Basic loop Every agent executes: 1. Read current message and update current mental state, including beliefs and commitments 2. Execute commitments at time t 12 3.3 Interpretor

13 Actions: n private actions n communicative actions n conditional actions Conditional action - mental condition n The agent may commit to private actions or to communicative actions 13 Interpretor - cont

14 Hypotheses for message passing n The platform can send messages to other agents n The interpretor can find out when a message is received Clock hypotheses n The clock initiate the 2 steps – equal intervals Length of time interval - timegrain. n A loop iteration < timegrain 14 Interpretor - cont

15 Initialize mental state and capabilities Define rules for making new commitments Update mental state Execute commitment for current time Clock Representation of mental state and capabilities Outgoing message Incoming message A flow diagram of the generic agent interpreter Control Data

16 Fact statements n Fact statements : facts, actions (t (employee smith acm)) (NOT (t (employee jones acm))) ::= ( ( *)) ::= | now | | (+ ) | (- ) | (  ) ; may be if in a commitment rule ::=m | h | d | y ; m (minute) =60, h (hour) 3600, etc. 16 3.4 Agent language

17 Action statements Private actions (DO t p-action) Communicative actions (INFORM t a fact) fact – fact statement (REQUEST t a action) action - action statement (REQUEST 1 a (DO 10 update-database)) (REQUEST 1 a (REQUEST 5 b (INFORM 10 a fact))) 17

18 (UNREQUEST t a action) (REFRAIN action) ::= (DO ) | (INFORM ) | (REQUEST ) | (UNREQUEST ) | (REFRAIN ) | (IF ) 18

19 Conditional actions When arriving at moment t examine the mental state of the agent The agent and the time are implicitly considered in the statement – therefore are omitted (IF (B (t1 (employee smith ibm))) (INFORM t a (t1 (employee smith ibm)))) (IF ) 19

20 ::= (IF ) ::= | (OR *) ::= | (AND *) ::= (B ) | ((CMT ) ) | (NOT ) 20

21 n Variables ?x (  )?!x (  ) Ex:(IF (NOT ((CMT ?x) (REFRAIN sing))) (DO ?!t sing)) (IF (B (t (emp ?x ibm))) (INFORM a (t (emp ?x ibm)))) ::= ? | ?! ::= | ::= 21

22 n Commitment rules Conditions to enter a commitment n Mental conditions n Message conditions Message conditions = a combination of message pattern Message pattern( ) : INFORM, REQUEST, UNREQUEST, REFRAIN : or, depinds on type Commitment rule (COMMIT ( )*) Ex: (COMMIT (?a REQUEST ?action) (B (now (myfriend ?a))) (?a ?action)) 22 OR AND ::= (B ) | ((CMT ) ) | (NOT )

23 n Commitment rules ::= (COMMIT ( )*) ::= | (OR *) ::= | (AND *) ::= ( INFORM ) | ( REQUEST ) | ( UNREQUEST ) | ( REFRAIN ) | (NOT ) 23

24 A commitment rule adds a commitment to execute an action (COMMIT ( )*) if: n is true for the received message n is true for the current mental state n Agent can do all action i n Agent is not committed to REFRAIN action i n if action i = REFRAIN action1, the agent will not commit to action1 then, for all i, makes a commitment to agent i to execute action i. 24

25 Agent program n Set up the timegrain n Define capabilities n Define initial beliefs n Write commitment rules ::= timegrain := CAPABILITIES := ( )* INITIAL BELIEFS := * COMMITMENT RULES := * 25

26 Basic loop of AGENT0 1. Read current message and update mental states, (1a) Update beliefs (1b) Update commitments 2. Execute commitments at time t (1a) Beliefs are updated: n As the result of receiving an INFORM message n As the results of executing a private action - A BDI agents believes that John works at Intel as the result of a private action retrieve - A BDI agents believes that John works at Intel as the result of an INFORM message 26

27 Basic loop of AGENT0 (1b) Commitments are updated KB n Commitments (agent action) (a1 (rotate wheelbase ?degrees)) n Capabilities (privateaction mental-cond). ( (rotate wheelbase ?degrees) (NOT(CMT ?a (REFRAIN rotate)))) The mental condition prevents commitments to uncompatible actions 27

28 Commitment strategy (when to drop commitments) Existing commitments are dropped: As the result of an UNREQUEST message or n As the result of a change in beliefs When beliefs are updated, the interpretor checks the commitments to private actions and removes commitments for which mental-cond of the capability is not true any more - It should send a message – AGENT0 does not enforce this n Drop commitment – independent of agent's program n Add commitment – depends on commitment rules 28

29 Conditions for an agent to execute an action n REQUEST or UNREQUEST to any agent n May inform any agent n May inform itself n Private action - if mental-cond is true at time moment t n A agent is free not to execute an action provided it is not committed to this action Conditional action (IF mental-cond action) 29

30 (2) Commitment execution n In KB every commitment has an associated time moment t In (2) agent “executes” all commitments ( now - timegrain, now ]. n “executes” depends on the type of action:  INFORM, REQUEST, UNREQUEST – sends a message  REFRAIN – no effect  DO, IF – beliefs, commitments, mental-cond 30

31 5 Program example n An AGENT-0 program for the initial scenario n Relevant activity – issue a boarding pass n Reservation confirmaton is a commitment to issue a boarding pass 31

32 5.1 Macro definitions (issue_bp pass flightnum time)  (IF (AND (B ((- time h) (present pass))) (B (time (flight ?from ?to flightnum)))) (DO time – h (physical_issue_bp pass flightnum time))) (query_which t asker askee q)  (REQUEST t askee (IF (B q) (INFORM (+ t 1) asker q))) (query_whether t asker askee q)  (REQUEST t askee (IF (B q) (INFORM (+ t 1) asker q))) (REQUEST t askee (IF (B (NOT q)) (INFORM (+ t 1) asker (NOT q)))) 32 Private action

33 5.2 Initial beliefs Flights (time (flight from to number)) Available seats (time (remaining_seats time1 flight_number seats) 5.3 Capabilities Issue tickets and update available seats ((issue_bp ?a ?flight ?time) true) ((DO ?time (update_remaining_seats ?time1 ?flight_number ?additional_seats)) (AND (B (?time (remaining_seats ?time1 ?flight_number ?current_seats))) (?current_seats >= |?additional_seats|))) 33

34 5.4 Commitment rule (COMMIT (?cust REQUEST (issue_bp ?pass ?flight ?time)) (AND (B (?time (remaining_seats ?flight ?n) (?n > 0) (NOT ((CMT ?anyone) (issue_bp ?pass ?anyflight ?time)))) (myself (DO (+ now 1) (update_remaining_seats ?time ?flight -1))) (?cust (issue_bp ?pass ?flight ?time))) 34 (COMMIT ( )*)

35 5.5 Dialog pasager - agent smith (query_which lmarch/l:00 smith airline (18april/?!time (flight sf ny ?!num))) airline (INFORM lmarch/2:00 smith (18april/8:30 (flight sf ny #354))) airline (INFORM lmarch/2:00 smith (18april/10:00 (flight sf ny #293))) airline (INFORM lmarch/2:00 smith (18april/  smith (REQUEST lmarch/3:00 airline (issue_bp smith #354 18april/8:30)) smith (query_whether lmarch/4:00 smith airline ((CMT smith) (issue-bp smith #354 18april/8:30))) 35

36 airline (INFORM lmarch/5:00 smith (NOT ((CMT smith) (issue-bp smith #354 18april/8:30)))) smith (REQUEST lmarch/6:00 airline (issue-bp smith #293 18april/10,.00)) smith (query-whether lmarch/7:00 smith airline ((CMT smith) (issue-bp smith #293 18april/10:00))) airline (INFORM lmarch/8:00 smith ((CMT smith) (issue-bp smith #293 18april/10:00)))  smith (INFORM 18april/9:00 airline (present smith)) airline (DO 18april/9:00 (issue-bp smith #293 18april/10:00)) 36


Download ppt "Multi-Agent Systems University “Politehnica” of Bucarest Spring 2010 Adina Magda Florea curs.cs.pub.ro."

Similar presentations


Ads by Google