# lecture 4 multi-agent systems lecture 4 computer science wpi spring 2002 adina magda florea

Embed Size (px)

DESCRIPTION

3 n Logic based representation –unique (almost) syntax x y loves(x,y) –formal (clear, well-defined) semantics Bel A loves(Bill, Mary) shape(round) color(green) type(apple) n 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 n Frame-based representation –units, frames –subset of logic, represents relationship structured around objects in the universe apple01 shape: roundcolor: greentype: apple 1 Knowledge representation for agents Cognitive agents declarative representaton, AI What the agent knows/ believesTRANSCRIPT

Multi-Agent SystemsLecture 4Lecture 4

Computer Science WPI

Spring 2002

Adina Magda [email protected]

Formal models for Formal models for representing agentsrepresenting agentsLecture outlineLecture outline11 Knowledge representation for agentsKnowledge representation for agents22 FOLFOL33 Modal logicModal logic44 Logics of knowledge and beliefLogics of knowledge and belief55 Dynamic logic, temporal logicDynamic logic, temporal logic66 BDI logicsBDI logics77 Commitments as changeCommitments as change8 Practical BDI interpreters8 Practical BDI interpreters - see Sect. 8.4 MA book

3

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

universeapple01shape: round color: green type: apple

1 Knowledge representation for 1 Knowledge representation for agentsagents Cognitive agents

declarative representaton, AI

Whatthe agentknows/believes

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

4

When and whatto do

What the agent believes andwhen and what to do

How to cope with otheragents in the environment

Reactive agents

Logic based representationsLogic 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 theoryModel theory Generate new wffs that are necessarily true, given that the old wffs are

true - entailment KB |= Proof theoryProof theory Derive new wffs based on axioms and inference rules KB |-i

5

PrL, PL

6

Extend PrL, PL

Tropistic agents(reactive)

Sentential logicof beliefsUses beliefs atoms BA()Index PL with agents

Modal logicModal operators

Logics of knowledgeand beliefModal operators B and K

Dynamic logicModal operatorsfor actions

Temporal logicModal operators for timeLinear timeBranching time

CTL logicBranching timeand action BDI logic

Adds agents, B, D, I

Linear model

Structured models

Situation calculusAdds states, actions

Symbol levelSymbol level

Knowledge levelKnowledge level

2 First order logic2 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

7

A B A B AB AAT T T T TT F F F TF T T F TF F T F T

Knowledge represents:“atomic” propositions

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} M M |= px young(x) success(x) M |=/ qBill T TTom F TAlice F F

8

9

knowledge propositional first-order

Paul is a man a man(Paul)

Bill is a man b man(Bill)

men are mortal c (x) (man(x) mortal(x))

knowledge first-order second-order

smaller istransitive

( x) (( y) (( z)((<(x,y) <(y,z)

<(x,z)))))

transitive(<)

part-of istransitive

( x) (( y) (( z)((part-of(x,y) part-of(y,z) part-of(x,z)))))

transitive(part-of)

R is transitive iffwhenever R(x,y) andR(y,z) hold, R(x,z)

holds too

not expressible(see however pseudo-

second order)

( R) ((transitive(R) ( x) (( y) (( z)((R(x,y) R(y,z)

R(x,z)))))))

Higher order logic

10

3 Modal logic3 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

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

? pThe 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 p11

w0

p, q, r

w1

p, q, r

w2

p, q, r

w3

p, q, r

12

FOL augmented with two modal operatorsK(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 worldB(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

4 Logics of knowledge and 4 Logics of knowledge and beliefbelief

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

13

Properties of beliefs(A1) - OK, (A2) - no, (A3) - yes,(A4) - maybe but more problematic

Inference rules(R1) Epistemic necessitation |- infer K(a, )(R2) Logical omniscience and K(a, ) infer K(a, )

problematic

w0

p, q, r

w1

p, q, r

w2

p, q, r

w3

p, q, r

in w0 ?K(a,p), ?K(a, r), ?K(a,q)

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

14

1. KA(White(A) KB( White(A)) (1b)2. KA(KB(White(A) White(B))) (2a)3. KA(KB(White(B))) (3)4. White(A) KB(White(A)) 1, A25. KB(White(A) White(B)) 2, A2

6. KB(White(A)) KB(White(B)) 5, A17. White(A) KB(White(B)) 4, 6

8. KB(White(B)) White(A) contrapositive of 79. KA(White(A)) 3, 8, R2

Proof

5 Dynamic logic, temporal logic5 Dynamic logic, temporal logicDynamic logic - the modal logic of actionLD and LR Builds on LP , A - set of action symbols

a;b - do a and b in sequencea+b - do either a or b - nondeterministic choicep? - an action based on the truth value of pa* - 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 worldsL: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 operatorsp U q - p is true until q becomes true - untilXp - p is true in the next moment - nextPp - p was true in a past moment - past

Fp - p will eventually be true in the future - eventuallyGp - p will always be true in the future – always

F = ? UG = ? F

16

Fp true U pGp F p

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 formulasTemporal logic Fp - p will sometime be true in the future - eventually

Gp - p will always be true in the future - alwaysXp - p is true in the next moment - nextp U q - p is true until q becomes true - until

Modal operators over path formulas - Branching temporalAp - at a particular time moment, p is true in all paths emanating from that point - inevitable pEp - at a particular time moment, p is true in some path emanating from that point - optional p

Dynamic logic indexed over agents x[a]p x<a>pOther modal operatorsVa: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

18

rs

ssq

rs

psq

rsq

s

EFp

EGr

AFq

AGs

p -Alice visits Paris q - be spring timer - Alice lives in Italy s – Paris is in France

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

19

Player 1

Player 2

Player 1

Dice

Chance nodes

Decision nodes

• Each arc emanating froma chance node correspondsto a possible world

• Each arc emanating froma decision node correspondsto choice available in apossible world

1/36 1/18

Dice

1/36 1/18

LB - set of moment formula

LS - set of path-formula, B - set of agents, V - set of variables

Syntax - see bookSemanticsM4 = <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,t X 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 |=t A 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 |=t R p iff M4 |=R(t),t p)

R picks out at each moment the real path at that momentp holds in the real path at the present moment

21

Ep A p

6 BDI logic6 BDI logicModal operators Bel, Des, Int, (Kh, KW)

L I based on LB and LS, set of agents ASin18) if pLS and x A then xBelp, xIntp, xDesp, xKhpL I

xDes(A Fwin) xInt(E Fbuy) xBel(A Fwin)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 GoalsD - 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

rs

s sq

rs

psq

rsq

s

rs

psq

s

belief accessible world

goal accessible world

intention accessible world

23

p -Alice visits Paris q - be spring timer - Alice lives in Italy s – Paris is in France

rs

rsq

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,t Fp)

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

24

(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

Belief-goal compatibilityIf 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 compatibilityIf an agent adopts p as an intention, it should have adopted it as a goal to be

achieved

xIntp xDesp

Beliefs about intentionsxIntp xBel(xIntp))

No infinite deferralThe 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 A F(xIntp))25

7 Commitments as change7 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 agentBlindly committed agent maintains its intentions until it believes it has achieved them

xInt(A Fp) A (xInt(A Fp) 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 agentBlindly committed agent (same as the prev slide)

maintains its intentions until it believes it has achieved them

xInt(A Fp) A (xInt(A Fp) xBelp)

Agent control loopAgent control loopB = B0;

I = I0 ;

D = D0 ;

while true doget 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 agentSingle-minded committed agent maintains its intentions as long as it belives they are still options

xInt(A Fp) A (xInt(A Fp) (xBelp xBel(E Fp)))

Agent control loopAgent control loopB = B0; I = I0 ; D = D0

while true doget 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) ;if not sound(, I, B) ;then = plan(B, I) ;end whileend while 28

Open-minded committed agentOpen-minded committed agent maintains its intentions as long as these intentions are still its

desires (goals)

xInt(A Fp) A (xInt(A Fp) (xBelp xDes(E Fp)))

Agent control loopAgent control loopB = B0; I = I0 ; D = D0 ;

while true doget 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) ;if not sound(, I, B)then = plan(B, I) ;end whileend while 29

if reconsider(I,B) then endif

ReferencesReferences 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