300 likes | 316 Views
Multi-Agent Systems Lecture 4 Computer Science WPI Spring 2002 Adina Magda Florea adina@wpi.edu. Formal models for representing agents Lecture outline. 1 Knowledge representation for agents 2 FOL 3 Modal logic 4 Logics of knowledge and belief 5 Dynamic logic, temporal logic 6 BDI logics
E N D
Multi-Agent SystemsLecture 4Computer Science WPISpring 2002Adina Magda Floreaadina@wpi.edu
Formal models for representing agentsLecture outline 1 Knowledge representation for agents 2 FOL 3 Modal logic 4 Logics of knowledge and belief 5 Dynamic logic, temporal logic 6 BDI logics 7 Commitments as change 8 Practical BDI interpreters - see Sect. 8.4 MA book
1 Knowledge representation for agents Cognitive agents declarative representaton, AI • Logic based representation • unique (almost) syntax xy loves(x,y) • formal (clear, well-defined) semantics BelAloves(Bill, Mary) shape(round) color(green) type(apple) • Rule based representation • situation-action or condition-conclusion rules + facts • subset of logic (Horn clauses) that emphasize implication if shape(round) and color(green) then type=apple • Frame-based representation • units, frames • subset of logic, represents relationship structured around objects in the universe apple01 shape: round color: green type: apple What the agent knows/ believes 3
Plan representation • represent actions • may be combined with any of the previous representations • partial representation of states stack(x,y) Precond: hold(x) clear(y) Postcond: clear(x) hold(x) on(x,y) armempty • BDI representations • combines most (all) of the above • A big diversity of techniques and formalisms to represent interactions: • communication • cooperation • coordination • No symbolic representation When and what to do What the agent believes and when and what to do How to cope with other agents in the environment Reactive agents 4
Logic based representations • 2 possible aims • to make MAS function according to the logic • to specify and validate the design • Conceptualization of the world / problem • Syntax - wffs • Semantics - significance, model • Model - the domain interpretation for which a formula is true • Model - linear or structured; index in a model • M |=S - " is true or satisfied in component S of the structure M" Model theory • Generate new wffs that are necessarily true, given that the old wffs are true - entailmentKB |= Proof theory • Derive new wffs based on axioms and inference rules KB |-i 5
Linear model Extend PrL, PL Sentential logic of beliefs Uses beliefs atoms BA() Index PL with agents Tropistic agents (reactive) Situation calculus Adds states, actions PrL, PL Symbol level Modal logic Modal operators Structured models Knowledge level Temporal logic Modal operators for time Linear time Branching time Dynamic logic Modal operators for actions Logics of knowledge and belief Modal operators B and K CTL logic Branching time and action BDI logic Adds agents, B, D, I 6
2 First order logic • LP - the language of Propositional logic • - the set of atomic propositions Sin-1) implies that LP Sin-2) p, q LP implies that pq LP, q LP • M0 =<L> is the formal model for LP • L - interpretation Sem-1) M0 |= iff L, where Sem-2) M0 |= pq iff M0 |= p and M0 |= q Sem-3) M0 |= p iff M0 |=/ p • p=A B A - it rains • q=AB B - take umbrella • r=AA Knowledge represents: “atomic” propositions A B A B AB AA T T T T T T F F F T F T T F T F F T F T 7
Predicate logic • Knowledge represents: • Extensional knowledge • existence of objects: ¬(x)(¬P(x)) is true exactly when P is true for at least one object of D, (x)(P(x)) • facts about objects, not about properties of objects • p = (x) young(x) success(x) • q = (x) young(x) success(x) D = {Bill, Tom, Alice} MM |= p x young(x) success(x) M |=/ q Bill T T Tom F T Alice F F 8
3 Modal logic • LM - the language of Modal logic • 2 modal operators p - p possible true p - p necessarily true Sin-3) the rules of LP are in LM Sin-4) p LP implies that p, p LM • Possible worlds • The structure of the model is given by relating different worlds via a binary accessibility relation • M1 =<W, L, R> W - a set of worlds L:W P() - set of formula true in a world, R W X W • p p - it rains in NY • q q - the sun will rise tomorrow 10
w1 p, q, r w2 p, q, r w0 p, q, r w3 p, q, r Sem-4) M1 |=W iff L(w), where Sem-5) M1 |=W pq iff M1 |=W p and M1 |=W q Sem-6) M1 |=W p iff M1 |=/W p Sem-7) M1 |=W p iff (w': R(w,w') M1 |=W' p) Sem-8) M1 |=W p iff (w': R(w,w') M1 |=W' p) in w0? p, ? q, ? r ? p The accessibility relation - reflexive iff (w: (w,w)R) p p - serial iff (w: (w': (w,w')R)) p p - transitive iff (w1,w2,w3: (w1,w2)R (w2, w3)R (w1,w3)R) p p - symmetric iff (w1,w2: (w1,w2)R (w2,w1)R) p p - euclidian iff (w1,w2,w3: (w1,w2)R (w1, w3)R (w2,w3)R) p p 11
4 Logics of knowledge and belief FOL augmented with two modal operators K(a,) - a knows B(a,) - a believes • Associate with each agent a set of possible worlds • Mk =<W, L, R> W - a set of worlds L:W P() - set of formula true in a world, R A x W X W • An agent knows/believes a propositions in a given world if the proposition holds in all worlds accessible to the agent from the given world B(Bill, father-of(Zeus, Cronos)) ? B(Bill, father-of(Jupiter,Saturn)) referential opaque operators • The difference between B and K is given by their properties 12
w1 p, q, r w2 p, q, r w0 p, q, r w3 p, q, r Properties of knowledge (A1) Distribution axiom K(a, ) K(a, ) K(a, ) (A2) Knowledge axiom K(a, ) - satisfied if R is reflexive (A3) Positive introspection axiom K(a, ) K(a, K(a, )) - satisfied if R is transitive (A4) Negative introspection axiom K(a, ) K(a, K(a, )) - satisfied if R is euclidian in w0 ?K(a,p), ?K(a, r), ?K(a,q) Properties of beliefs (A1) - OK, (A2) - no, (A3) - yes, (A4) - maybe but more problematic Inference rules (R1) Epistemic necessitation |- inferK(a, ) (R2) Logical omniscience and K(a, ) inferK(a, ) problematic 13
Two-wise men problem - Genesereth, Nilsson (1) A and B know that each can see the other's forehead. Thus, for example: (1a) If A does not have a white spot, B will know that A does not have a white spot (1b) A knows (1a) (2) A and B each know that at least one of them have a white spot, and they each know that the other knows that. In particular (2a) A knows that B knows that either A or B has a white spot (3) B says that he does not know whether he has a white spot, and A thereby knows that B does not know 1. KA(White(A) KB( White(A)) (1b) 2. KA(KB(White(A) White(B))) (2a) 3. KA(KB(White(B))) (3) Proof 4. White(A) KB(White(A)) 1, A2 5. KB(White(A) White(B)) 2, A2 6. KB(White(A)) KB(White(B)) 5, A1 7. White(A) KB(White(B)) 4, 6 8. KB(White(B)) White(A) contrapositive of 7 9. KA(White(A)) 3, 8, R2 14
5 Dynamic logic, temporal logic Dynamic logic - the modal logic of action LD and LR Builds on LP , A - set of action symbols a;b - do a and b in sequence a+b - do either a or b - nondeterministic choice p? - an action based on the truth value of p a* - 0 or more (finitely many) iterations of a <a>p - the execution of a will possibly make p true [a]p - the execution of a will necessarily make p true <a>, [a] LR , p LD M2 = <W, L, R> W - a set of worlds L:W P() - set of formula true in a world, R A X W X W R - accessibility relation based on LR - a world is accessible by executing an action a Sem-9) M2 |=W<a> p iff (w': Ra(w,w') M2 |=W' p) Sem-10) M2 |=W[a] p iff (w': Ra(w,w') M2 |=W' p) 15
Temporal logic - the modal logic of time • Linear vs. branching; the branching can be in the past, in the future of both • Time is viewed as a set of moments with a strict partial order, <, which denotes temporal precedence. • Every moment is associated with a possible state of the world, identified by the propositions that hold at that moment • In a branching logic of time, a path at a given moment is any maximal set of moments containing the given moment and all the moments in the future along some particular branch of < Modal operators p U q - p is true until q becomes true - until Xp - p is true in the next moment - next Pp - p was true in a past moment - past Fp - p will eventually be true in the future - eventually Gp - p will always be true in the future – always F = ? U G = ? F Fp true U p Gp F p 16
Branching temporal and action logic - CTL • Temporal structure with a branching time future and a single past - time tree • Situation - a world w at a particular time point t, wt • State formulas - evaluated at a specific time point in a time tree • Path formulas - evaluated over a specific path in a time tree Modal operators over both state and path formulas Temporal logicFp - p will sometime be true in the future - eventually Gp - p will always be true in the future - always Xp - p is true in the next moment - next p U q - p is true until q becomes true - until Modal operators over path formulas - Branching temporal Ap - at a particular time moment, p is true in all paths emanating from that point - inevitable p Ep - at a particular time moment, p is true in some path emanating from that point - optional p Dynamic logic indexed over agentsx[a]px<a>p Other modal operators Va:p - there is a under which p comes true R - reality operator 17
s is true in each time point (situation) and on all path • r is true in each time point on a single path • q will eventually be true on all path • q will eventually be true on a single path s p s q EFp EGr AFq AGs r s r s r s q s q s p -Alice visits Paris q - be spring time r - Alice lives in Italy s – Paris is in France 18
Each situation has associated a set of accessible words - the worlds the agent believes to be possible. Each such world is a time tree. • Within these worlds, the branching future represents the choices (options) available to the agent in selecting which action to perform • Similar to a decision tree in games of chance Decision nodes Player 1 Dice • Each arc emanating from • a chance node corresponds • to a possible world Player 2 1/18 1/36 Chance nodes Dice • Each arc emanating from • a decision node corresponds • to choice available in a • possible world Player 1 1/36 1/18 19
LB- set of moment formula LS - set of path-formula, B - set of agents, V - set of variables Syntax - see book Semantics M4 = <W, T, <, | |, R> - every tT has associated a world wtW Sem-14) M4 |=t iff t||, where is true in the set of moments for which holds Sem-15) M4 |=t pq iff M4 |=t p and M4 |=t q Sem-16) M4 |=t p iff M4 |=/t p Sem-17) M4 |=s,t pUq iff (t': tt' and M4 |=s,t' q and (t": t t" t' M4 |=s,t" p)) p holds on a path starting in the current moment until q comes true Sem-18) M4 |=s,tX p iff M4 |=s,t+1 p) Fp true Up Gp F p 20
Sem-19) M4 |=s,t x[a]p iff (t's: [s;t,t']|a|x M4 |=s,t' p) p is true on all the set of moments t' on a given path s starting at the current moment t while agent x executes action a Sem-20) M4 |=s,t x<a>p iff (t's: [s;t,t']|a|x M4 |=s,t' p) p is true at a moment t' on a given path s starting at the current moment t while agent x executes action a Sem-21) M4 |=tA p iff (s: sSt M4 |=s,t p) s is a path, St - all paths starting at the present moment E = ?A Sem-22) M4 |=t (V a : p) iff (b: bB and M4 |=t p|ab) there is an action, be it b, under which p comes true, if executed at t Sem-23) M4 |=tR p iff M4 |=R(t),t p) R picks out at each moment the real path at that moment p holds in the real path at the present moment Ep A p 21
6 BDI logic Modal operators Bel, Des, Int, (Kh, KW) L I based on LB and LS, set of agents A Sin18) if pLS and x A then xBelp, xIntp, xDesp, xKhpL I xDes(AFwin) xInt(EFbuy) xBel(AFwin) M5=<W, T, <, | |, R, B, D, I> B - belief accessible relation - belief accessible worlds; the worlds the agent believes possible • Require the desires to be consistent; therefore Desires Goals D - desire (goal) accessible relation • Each situation has associated a set of goal-accessible worlds - realism • Strong realism = for each belief-accessible world w at a given time moment t, there must be a goal-accessible world that is a sub-world of w at time t I - intention accessible relation • Intentions - similarly represented by sets of intention-accessible worlds. These are the worlds the agent has committed to realize. • Corresponding to each goal-accessible world at some time t there must be an intention-accessible world that is a subworld of w at time t 22
intention accessible world belief accessible world s s p s q p s q s r s s q r s r s q r s q r s r s goal accessible world p -Alice visits Paris q - be spring time r - Alice lives in Italy s – Paris is in France 23
Sem-24) M5 |=t xBelp iff (t': (t,t')B(x,t) M5 |=t' p) an agent x has a belief p in a given moment t if and only if p is true in all belief accessible worlds of the agent in that moment Sem-25) M5 |=t xDesp iff (t': (t,t')D(x,t) M5 |=t' p) an agent x has a desire p in a given moment t if and only if p is true in all goal accessible worlds of the agent in that moment Sem-26) M5 |=t xIntp iff (s: sI(x,t) M5 |=s,tFp) at each moment t, I assigns a set of paths that the agent x has selected or preferred, i.e., if the agent has selected p as an intention, p will hold eventually in the future Properties of BDI and KW (A2) Knowledge axiom aKwp p (A3) Positive introspection axiom aBelp aBel(aBelp)) - satisfied if B is transitive (A4) Negative introspection axiom aBelp aBel(aBelp)) - satisfied if B is euclidian 24
Belief-goal compatibility If an agent adopts p as a goal, the agent believes p; the agent believes that there is a path on which p will be true as it is an adopted desire but it needs not believe that it will ever reach that point xDesp xBelp Goal-intention compatibility If an agent adopts p as an intention, it should have adopted it as a goal to be achieved xIntp xDesp Beliefs about intentions xIntp xBel(xIntp)) No infinite deferral The agent should not procrastinate with respect to its intentions; if the agent forms an intention, then sometimes in the future it will give up this intention xIntp AF(xIntp)) 25
7 Commitments as change • Desires (goals) and intentions are quite similar in their semantic structure. The difference in these modalities arises in their relationships with the other modalities and in terms of how they may evolve over time. • An agent is treated as being committed to its intention but, cf. no infinite deferral, it will give up these intentions eventually - when? • Different types of agents will have different commitment strategies. Blindly committed agent • maintains its intentions until it believes it has achieved them xInt(AFp) A (xInt(AFp) xBelp) (exclusive ) • an agent can be committed to means (p is an action) or to ends (p is a formula) • defined only for intentions toward actions or conditions that are true for all paths in the agent's intention accessible worlds. • nothing specified about the commitment of agents to optionally (E) achieve particular means or ends 26
Blindly committed agent (same as the prev slide) • maintains its intentions until it believes it has achieved them xInt(AFp) A (xInt(AFp) xBelp) Agent control loop B = B0; I = I0 ; D = D0 ; while true do get next perceipt p; B = brf(B,p); I = options(D,I) ; /* D = options(B,I); */ I = filter(B, D, I); = plan(B, I); execute(); end while 27
Single-minded committed agent • maintains its intentions as long as it belives they are still options xInt(AFp) A (xInt(AFp) (xBelp xBel(EFp))) Agent control loop B = B0; I = I0 ; D = D0 while true do get next perceipt p ; B = brf(B,p) ; D = options(B,I); /* I = options(D,I) ; */ I = filter(B, D, I) ; = plan(B, I) ; while not (empty() or succeeded (I, B) or impossible(I, B)) do = head(); execute(); = tail() get next perceipt p ; B = brf(B,p) ; ifnot sound(, I, B) ; then = plan(B, I) ; end while end while 28
Open-minded committed agent • maintains its intentions as long as these intentions are still its desires (goals) xInt(AFp) A (xInt(AFp) (xBelp xDes(EFp))) Agent control loop B = B0; I = I0 ; D = D0 ; while true do get next perceipt p ; B = brf(B,p); D = options(B,I); I = filter(B, D, I) ; = plan(B, I) ; while not (empty() or succeeded (I, B) or impossible(I, B)) do = head(); execute(); = tail() ; get next perceipt p ; B = brf(B,p); D = options(B,I); I = filter(B, D, I) ; ifnot sound(, I, B) then = plan(B, I) ; end while end while if reconsider(I,B) then endif 29
References • M. P. Singh, A.S. Rao. Formal methods in DAI: Logic-based representation and reasoning. In Multiagent Systems - A Modern Approach to Distributed Artficial Intelligence, G. Weiss (Ed.), The MIT Press, 2001, p.331-355. • M. Wooldrige. Reasoning about Rational Agents. The MIT Press, 2000, Chapter 2 • A.S. Rao, M.P. Georgeff. Modeling rational agents within a BDI-architecture. In Readings in Agents, M. Huhns & M. Singh (Eds.), Morgan Kaufmann, 1998, p.317-328. • M.R. Genesereth, N.J. Nilsson. Logical Foundations of Artificial Intelligence. Morgan Kaufmann, 1987, Chapter 9. • D. Kayser: La représentation des connaissances. Hermès, 1997. • J.Y. Halpern. Reasoning about knowledge: A survey. In Handbook of Logic in Artificial Intelligence and Logic Programming, Vol.4, D. Gabbay, C.A. Hoare, J.A. Robinson (Eds.), Oxford University Press, 1995, p.1-34. • A. Florea. Bazele logice ale inteligentei artificiale. UPB, 1995. 30