Lecture 3 Multi-Agent Systems Lecture 3 University “Politehnica” of Bucarest 2004 - 2005 Adina...

30
Multi-Agent Systems Lecture 3 Lecture 3 University “Politehnica” of Bucarest 2004 - 2005 Adina Magda Florea [email protected] http://turing.cs.pub.ro/blia_2005

Transcript of Lecture 3 Multi-Agent Systems Lecture 3 University “Politehnica” of Bucarest 2004 - 2005 Adina...

Page 1: Lecture 3 Multi-Agent Systems Lecture 3 University “Politehnica” of Bucarest 2004 - 2005 Adina Magda Florea adina@cs.pub.ro .

Multi-Agent SystemsLecture 3Lecture 3

University “Politehnica” of Bucarest2004 - 2005

Adina Magda [email protected]

http://turing.cs.pub.ro/blia_2005

Page 2: Lecture 3 Multi-Agent Systems Lecture 3 University “Politehnica” of Bucarest 2004 - 2005 Adina Magda Florea adina@cs.pub.ro .

Formal models for Formal models for representing agentsrepresenting agentsLecture outlineLecture outline

11 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 change

Page 3: Lecture 3 Multi-Agent Systems Lecture 3 University “Politehnica” of Bucarest 2004 - 2005 Adina Magda Florea adina@cs.pub.ro .

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

universeapple01

shape: round color: green type: apple

1 Knowledge representation for 1 Knowledge representation for agentsagents Cognitive agents

declarative representaton, AI

Whatthe agentknows/believes

Page 4: Lecture 3 Multi-Agent Systems Lecture 3 University “Politehnica” of Bucarest 2004 - 2005 Adina Magda Florea adina@cs.pub.ro .

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

Page 5: Lecture 3 Multi-Agent Systems Lecture 3 University “Politehnica” of Bucarest 2004 - 2005 Adina Magda Florea adina@cs.pub.ro .

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 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

Page 6: Lecture 3 Multi-Agent Systems Lecture 3 University “Politehnica” of Bucarest 2004 - 2005 Adina Magda Florea adina@cs.pub.ro .

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

Page 7: Lecture 3 Multi-Agent Systems Lecture 3 University “Politehnica” of Bucarest 2004 - 2005 Adina Magda Florea adina@cs.pub.ro .

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 = A B B - take umbrella

r = A A 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

Page 8: Lecture 3 Multi-Agent Systems Lecture 3 University “Politehnica” of Bucarest 2004 - 2005 Adina Magda Florea adina@cs.pub.ro .

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 |= p

x young(x) success(x) M |=/ q

Bill T T

Tom F T

Alice F F

8

Page 9: Lecture 3 Multi-Agent Systems Lecture 3 University “Politehnica” of Bucarest 2004 - 2005 Adina Magda Florea adina@cs.pub.ro .

(from Lecture 2)

(a) Deduction rules

At(0,0) Free(0,1) Exit(east) Do(move_east)

Facts and rules about the environment

At(0,0)

Wall(1,1)

x y Wall(x,y) Free(x,y)

(b) Use situation calculus = describe change in FOPL

Define a function Result(Action,State) = NewState

At((0,0), S0) Free(0,1) Exit(east)

At((0,1), Result(move_east,S0)) 9

Page 10: Lecture 3 Multi-Agent Systems Lecture 3 University “Politehnica” of Bucarest 2004 - 2005 Adina Magda Florea adina@cs.pub.ro .

c) Sentential logics of beliefs

• Uses beliefs atoms BA()

• Index PL with agents

Inference rule “attachment”

BA(p1) q1 p1 p2 .. pn |-A pn+1

BA(p2) q2

…BA(pn) qn

BA(pn+1) qn+1

====================================q1 q2 .. qn qn+1

10

Page 11: Lecture 3 Multi-Agent Systems Lecture 3 University “Politehnica” of Bucarest 2004 - 2005 Adina Magda Florea adina@cs.pub.ro .

11

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

Page 12: Lecture 3 Multi-Agent Systems Lecture 3 University “Politehnica” of Bucarest 2004 - 2005 Adina Magda Florea adina@cs.pub.ro .

12

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

Page 13: Lecture 3 Multi-Agent Systems Lecture 3 University “Politehnica” of Bucarest 2004 - 2005 Adina Magda Florea adina@cs.pub.ro .

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

? q

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 p13

w0

p, q, r

w1

p, q, r

w2

p, q, r

w3

p, q, r

Page 14: Lecture 3 Multi-Agent Systems Lecture 3 University “Politehnica” of Bucarest 2004 - 2005 Adina Magda Florea adina@cs.pub.ro .

14

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

4 Logics of knowledge and 4 Logics of knowledge and beliefbelief

Page 15: Lecture 3 Multi-Agent Systems Lecture 3 University “Politehnica” of Bucarest 2004 - 2005 Adina Magda Florea adina@cs.pub.ro .

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

15

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)

Page 16: Lecture 3 Multi-Agent Systems Lecture 3 University “Politehnica” of Bucarest 2004 - 2005 Adina Magda Florea adina@cs.pub.ro .

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

16

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, A2 A2: K(a, )

5. KB(White(A) White(B)) 2, A2

6. KB(White(A)) KB(White(B)) 5, A1 A1: K(a, ) K(a, ) K(a, )

7. White(A) KB(White(B)) 4, 6

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

Proof

Page 17: Lecture 3 Multi-Agent Systems Lecture 3 University “Politehnica” of Bucarest 2004 - 2005 Adina Magda Florea adina@cs.pub.ro .

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 sequence

a+b - do either a or b - nondeterministic choice

p? - an action based on the truth value of p - deterministic choice

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) 17

Page 18: Lecture 3 Multi-Agent Systems Lecture 3 University “Politehnica” of Bucarest 2004 - 2005 Adina Magda Florea adina@cs.pub.ro .

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 of temporal logicp 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

18

Fp true U pGp F p

Page 19: Lecture 3 Multi-Agent Systems Lecture 3 University “Politehnica” of Bucarest 2004 - 2005 Adina Magda Florea adina@cs.pub.ro .

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 logic Fp - 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 agents x[a]p x<a>p

Other modal operators

Va:p - there is a under which p comes true19

Page 20: Lecture 3 Multi-Agent Systems Lecture 3 University “Politehnica” of Bucarest 2004 - 2005 Adina Magda Florea adina@cs.pub.ro .

s is true in each time point (situation) and on all path r is true in each time point on a single path p will eventually be true on a single path q will eventually be true on all path

20

rs

ssq

rs

psq

rsq

s

AGs

EGr

AFq

EFp

r - Alice is in Italy p -Alice visits Pariss – Paris is the capital of France q - it is spring time

F - eventuallyG - alwaysA - inevitableE - optional

Page 21: Lecture 3 Multi-Agent Systems Lecture 3 University “Politehnica” of Bucarest 2004 - 2005 Adina Magda Florea adina@cs.pub.ro .

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

21

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 a choice available in apossible world

1/36 1/18

Dice

1/36 1/18

Page 22: Lecture 3 Multi-Agent Systems Lecture 3 University “Politehnica” of Bucarest 2004 - 2005 Adina Magda Florea adina@cs.pub.ro .

LB - set of moment formula

LS - set of path-formula, X - set of agents, A - set of actions

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,t X p iff M4 |=s,t+1 p)

Fp true Up

Gp F p

22

Page 23: Lecture 3 Multi-Agent Systems Lecture 3 University “Politehnica” of Bucarest 2004 - 2005 Adina Magda Florea adina@cs.pub.ro .

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 moment

p holds in the real path at the present moment

23

Ep A p

Page 24: Lecture 3 Multi-Agent Systems Lecture 3 University “Politehnica” of Bucarest 2004 - 2005 Adina Magda Florea adina@cs.pub.ro .

6 BDI logic6 BDI logicModal operators Bel, Des, Int, (Kw)

L I based on LB and LS, set of agents A

Sin18) if pLS and x A then xBelp, xIntp, xDesp, xKwpL 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 t24

Page 25: Lecture 3 Multi-Agent Systems Lecture 3 University “Politehnica” of Bucarest 2004 - 2005 Adina Magda Florea adina@cs.pub.ro .

rs

s sq

rs

psq

rsq

s

rs

psq

s

belief accessible world

goal accessible world

intention accessible world

25

rs

rsq

r - Alice is in Italy p -Alice visits Pariss – Paris is the capital of France q - it is spring time

Page 26: Lecture 3 Multi-Agent Systems Lecture 3 University “Politehnica” of Bucarest 2004 - 2005 Adina Magda Florea adina@cs.pub.ro .

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

26

(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

Page 27: Lecture 3 Multi-Agent Systems Lecture 3 University “Politehnica” of Bucarest 2004 - 2005 Adina Magda Florea adina@cs.pub.ro .

Belief-goal compatibilityIf an agent adopts p as a goal, 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 (xBel (E G p)

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))27

F - eventuallyG - alwaysA - inevitableE - optional

Page 28: Lecture 3 Multi-Agent Systems Lecture 3 University “Politehnica” of Bucarest 2004 - 2005 Adina Magda Florea adina@cs.pub.ro .

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.

28

F - eventuallyG - alwaysA - inevitableE - optional

Page 29: Lecture 3 Multi-Agent Systems Lecture 3 University “Politehnica” of Bucarest 2004 - 2005 Adina Magda Florea adina@cs.pub.ro .

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)

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)))

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)))

29

F - eventuallyG - alwaysA - inevitableE - optional

Page 30: Lecture 3 Multi-Agent Systems Lecture 3 University “Politehnica” of Bucarest 2004 - 2005 Adina Magda Florea adina@cs.pub.ro .

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