+ All Categories
Home > Documents > 1 CS 2710, ISSP 2160 The Situation Calculus KR and Planning Some final topics in KR.

1 CS 2710, ISSP 2160 The Situation Calculus KR and Planning Some final topics in KR.

Date post: 05-Jan-2016
Category:
Upload: abigayle-richardson
View: 217 times
Download: 3 times
Share this document with a friend
Popular Tags:
43
1 CS 2710, ISSP 2160 The Situation Calculus KR and Planning Some final topics in KR
Transcript
Page 1: 1 CS 2710, ISSP 2160 The Situation Calculus KR and Planning Some final topics in KR.

1

CS 2710, ISSP 2160

The Situation CalculusKR and Planning

Some final topics in KR

Page 2: 1 CS 2710, ISSP 2160 The Situation Calculus KR and Planning Some final topics in KR.

Situation Calculus

• Planning in propositional logic: Section 7.7 through 7.7.2

• Section 10.4.2• Handouts

2

Page 3: 1 CS 2710, ISSP 2160 The Situation Calculus KR and Planning Some final topics in KR.

Other topics in KR

• Semantic Networks: 12.5.1• [Description Logic: 12.5.2: we didn’t cover this]• [Satisfiability and WalkSat: Intro to Section 7.6;

7.6.2: we didn’t cover this]

3

Page 4: 1 CS 2710, ISSP 2160 The Situation Calculus KR and Planning Some final topics in KR.

4

Actions, Situations, and Events

The Situation Calculus• The robot is in the kitchen.

– in(robot,kitchen)• He walks into the living room.

– in(robot,livingRoom)• in(robot,kitchen,2:02pm)• in(robot,livingRoom,2:17pm)• But what if you are not sure when it was? • We can do something simpler than rely on time

stamps…• The Situation Calculus is a logic formalism for

representing and reasoning about dynamic domains.

Page 5: 1 CS 2710, ISSP 2160 The Situation Calculus KR and Planning Some final topics in KR.

5

Situation Calculus Ontology

• Actions: terms, such as “forward” and “turn(right))”• Situations: terms; initial situation, say s0, and

all situations that are generated by applying an action to a situation. result(a,s) names the situation resulting when action a is done in situation s.

Page 6: 1 CS 2710, ISSP 2160 The Situation Calculus KR and Planning Some final topics in KR.

6

Situation Calculus Ontology continued

• Fluents: functions and predicates that vary from one situation to the next. By convention, the situation is the last argument of the fluent. ~holding(robot,gold,s0)

• Atemporal or eternal predicates and functions do not change from situation to situation. gold(g1). lastName(wumpus,smith). adjacent(livingRoom,kitchen).

Page 7: 1 CS 2710, ISSP 2160 The Situation Calculus KR and Planning Some final topics in KR.

7

Sequences of Actions

• Also useful to reason about action sequences• All S resultSeq([],S) = S• All A,Se,S resultSeq([A|Se],S) =

resultSeq(Se,result(A,S))resultSeq([a,b,c],so) is

result(c,result(b,result(a,s0)

Page 8: 1 CS 2710, ISSP 2160 The Situation Calculus KR and Planning Some final topics in KR.

8

Modified Wumpus World

• Fluent predicates: at(O,X,S) and holding(O,S) – In our simple world, only the agent can hold a

piece of gold, so for simplicity, only the gold and situation are arguments

• Initial situation: at(agent,[1,1],s0) ^ at(g1,[1,2],s0)

• But we want to exclude possibilities from the initial situation too…

Page 9: 1 CS 2710, ISSP 2160 The Situation Calculus KR and Planning Some final topics in KR.

9

Initial KB

• All O,X (at(O,X,s0) [(O=agent ^ X = [1,1]) v (O=g1 ^ X = [1,2])])

• All O ~holding(O,s0)• Eternals:

– gold(g1) ^ adjacent([1,1],[1,2]) ^ adjacent([1,2],[1,1]) etc.

Page 10: 1 CS 2710, ISSP 2160 The Situation Calculus KR and Planning Some final topics in KR.

10

Goal: g1 is in [1,1]

Planning by answering the query: Exists S at(g1,[1,1],resultSeq(S,s0))

Solution:At(g1,[1,1],resultSeq([go([1,1],[1,2]),grab(g1),go([1,2],

[1,1])],s0))

Let’s look at what has to go in the KB for such queries to be answered...

Page 11: 1 CS 2710, ISSP 2160 The Situation Calculus KR and Planning Some final topics in KR.

11

Possibility and Effect Axioms

• Possibility axioms: – Preconditions poss(A,S)

• Effect axioms:– poss(A,S) changes that result from that action

Page 12: 1 CS 2710, ISSP 2160 The Situation Calculus KR and Planning Some final topics in KR.

12

Axioms for our Wumpus World

• For brevity: we will omit universal quantifies that range over entire sentence. S ranges over situations, A ranges over actions, O over objects (including agents), G over gold, and X,Y,Z over locations.

Page 13: 1 CS 2710, ISSP 2160 The Situation Calculus KR and Planning Some final topics in KR.

13

Possibility Axioms

• The possibility axioms that an agent can – go between adjacent locations, – grab a piece of gold in the current location, and – release gold it is holding

Page 14: 1 CS 2710, ISSP 2160 The Situation Calculus KR and Planning Some final topics in KR.

14

Effect Axioms

• If an action is possible, then certain fluents will hold in the situation that results from executing the action– Going from X to Y results in being at Y– Grabbing the gold results in holding the gold– Releasing the gold results in not holding it

Page 15: 1 CS 2710, ISSP 2160 The Situation Calculus KR and Planning Some final topics in KR.

15

Frame Problem

• We run into the frame problem• Effect axioms say what changes, but don’t say what

stays the same• A real problem, because (in a non-toy domain), each

action affects only a tiny fraction of all fluents

Page 16: 1 CS 2710, ISSP 2160 The Situation Calculus KR and Planning Some final topics in KR.

16

Frame Problem (continued)

• One solution approach is writing explicit frame axioms, such as:

(at(O,X,S) ^ ~(O=agent) ^ ~holding(O,S)) at(O,X,result(Go(Y,Z),S))

If something is at X in S, and it is not the agent, and also it is not something the agent holds, then O is still at X if the agent moves somewhere.

F fluents and A actions: O(FA) axioms neededWe can do something more efficient than this

Page 17: 1 CS 2710, ISSP 2160 The Situation Calculus KR and Planning Some final topics in KR.

17

Frame Problem

• What stays the same?• A actions, F fluents, and E effects/action (worst

case). Typically, E << F• That is, the effects of an action are typically only

a small set of all the things that could change • Want O(AE) versus O(AF) solution

Page 18: 1 CS 2710, ISSP 2160 The Situation Calculus KR and Planning Some final topics in KR.

18

“Solving” the Frame Problem

• For each fluent, have successor-state axioms:• Action is possible

(fluent is true in result state action’s effect made it true v it was true before and action left it alone)

Each of the E effects of each of the A actions is mentioned exactly once, so O(AE) axioms needed

Note: we will return to this point later, after going through the wumpus world example

Page 19: 1 CS 2710, ISSP 2160 The Situation Calculus KR and Planning Some final topics in KR.

19

Initial KB (reminder)

• All O,X at(O,S,s0) [O=agent ^ X = [1,1]) v (O=g1 ^ X = [1,2])]

• All O ~holding(O,s0)• Eternals:

– gold(g1) ^ adjacent([1,1],[1,2]) ^ adjacent([1,2],[1,1]).

Trace through reasoning so far on board;state space handed out

At this point, we are switching to variables being small case, constants upper case, following the

text

Page 20: 1 CS 2710, ISSP 2160 The Situation Calculus KR and Planning Some final topics in KR.

4-5 are Successor-State Axioms

1. At(Agent, x, s) Adjacent(x,y) Poss(Go(x,y),s)2. Gold(g) At(Agent,x,s) At(g, x, s)

Poss(Grab(g),s)3. Holding(g,s) Poss(Release(g),s)4. Poss(a,s) Holding(g,Result(a,s))

a = Grab(g) v (Holding(g,s) a Release(g)))

5. Poss(a,s) (At(o,y,Result(a,s)) (a = Go(x,y) (o = Agent v Holding(o,s))) v (At(o,y,s) ¬(z y z a = Go(y,z) (o = Agent v Holding(o,s))))

20

Page 21: 1 CS 2710, ISSP 2160 The Situation Calculus KR and Planning Some final topics in KR.

More explicit version; Replaced existential with

universal in 51. All x,y,s ((At(Agent, x, s) Adjacent(x,y))

Poss(Go(x,y),s)

2. All g,x,s ((Gold(g) At(Agent,x,s) At(g, x, s)) Poss (Grab(g),s))

3. All g,s (Holding(g,s) Poss(Release(g),s))4. All a,s,g (Poss(a,s) (Holding(g,Result(a,s))

(a = Grab(g) v (Holding(g,s) a Release(g))))

5. All a,s,o,y,z (Poss(a,s) (At(o,y,Result(a,s)) ((a = Go(x,y) (o = Agent v Holding(o,s))) v (At(o,y,s) ¬(a = Go(y,z) y z (o = Agent v Holding(o,s)))))))

6. Justification: previous 5 has ¬(z … the change is justified because this is equivalent to all z ¬…

21

Page 22: 1 CS 2710, ISSP 2160 The Situation Calculus KR and Planning Some final topics in KR.

Same as previous, but without comments

1. All x,y,s ((At(Agent, x, s) Adjacent(x,y)) Poss(Go(x,y),s)

2. All g,x,s ((Gold(g) At(Agent,x,s) At(g, x, s)) Poss (Grab(g),s))

3. All g,s (Holding(g,s) Poss(Release(g),s))4. All a,s,g (Poss(a,s) (Holding(g,Result(a,s))

(a = Grab(g) v (Holding(g,s) a Release(g))))

5. All a,s,o,y,z (Poss(a,s) (At(o,y,Result(a,s)) ((a = Go(x,y) (o = Agent v Holding(o,s))) v (At(o,y,s) ¬(a = Go(y,z) y z (o = Agent v Holding(o,s)))))))

22

Page 23: 1 CS 2710, ISSP 2160 The Situation Calculus KR and Planning Some final topics in KR.

A return to complexity

Each of the E effects of each of the A actions is mentioned exactly once, so O(AE) axioms needed

Notes: – an effect may be to make a fluent true (add it)

or to make it false (delete it)– Counting axioms is a bit arbitrary, since a

single axiom may mention a disjunction of add effects and/or a disjunction of delete effects (see the holding axiom for the blocks world)

– It is true that each of the add or delete effects of each action is mentioned once

23

Page 24: 1 CS 2710, ISSP 2160 The Situation Calculus KR and Planning Some final topics in KR.

A return to complexity

24

Page 25: 1 CS 2710, ISSP 2160 The Situation Calculus KR and Planning Some final topics in KR.

Fall 2014

• In class exercise – the blocks world [handout]

25

Page 26: 1 CS 2710, ISSP 2160 The Situation Calculus KR and Planning Some final topics in KR.

26

Qualification Problem

• Ensuring that all necessary conditions for an action’s success have been specified. No complete solution in logic. KR/planning designers have to decide how much detail to go into.

Page 27: 1 CS 2710, ISSP 2160 The Situation Calculus KR and Planning Some final topics in KR.

What did we see?

• A sophisticated KR scheme• Important Problems in planning:

– Addressed by successor-state axioms (Reiter 1991)• Frame Problem (what stays the same?)• Ramification Problem (implicit effects, such as that gold moves too if the agent moves and it is holding the gold)

– Not addressed completely in logic• Qualification Problem

• Concepts for planning, such as fluents and situations

• Planning as search

27

Page 28: 1 CS 2710, ISSP 2160 The Situation Calculus KR and Planning Some final topics in KR.

Stopped here, Fall 2014

28

Page 29: 1 CS 2710, ISSP 2160 The Situation Calculus KR and Planning Some final topics in KR.

29

Semantic Networks

• Graphical aids for visualizing the knowledge base• Efficient algorithms for inferring properties based

on category membership• Often, correspond to a subset of first-order logic• Many variants• All distinguish among individual objects, categories

of objects and relations among objects

Page 30: 1 CS 2710, ISSP 2160 The Situation Calculus KR and Planning Some final topics in KR.

30

Example

• See figure 12.5 (next slide)• Specify what edges and nodes mean• In Figure 12.5, indivs and categories look the same• memberOf(indiv,category)• sisterOf(indiv,indiv)• subsetOf(category,category)• hasMother(indiv,indiv)

Page 31: 1 CS 2710, ISSP 2160 The Situation Calculus KR and Planning Some final topics in KR.

31

Page 32: 1 CS 2710, ISSP 2160 The Situation Calculus KR and Planning Some final topics in KR.

32

Semantic Networks

• Is hasMother(persons,femalePersons) consistent with the representation?

• Nope: hasMother is a relation between individuals

• cat1-- label cat2 means:• all X (X in cat1 (all Y label(X,Y) Y in cat2))

(Note: this does not say that each person has a mother)

Page 33: 1 CS 2710, ISSP 2160 The Situation Calculus KR and Planning Some final topics in KR.

33

Semantic Networks

• cat – label value• All X (X in cat label(X,value))

Page 34: 1 CS 2710, ISSP 2160 The Situation Calculus KR and Planning Some final topics in KR.

34

Inheritance

• Inheritance is efficient and convenient • Trace paths from individuals to categories,

inheriting properties as you go• In Figure 12.5, how many legs does John have? Most

specific (nearest) information wins

Page 35: 1 CS 2710, ISSP 2160 The Situation Calculus KR and Planning Some final topics in KR.

35

Semantic Networks

• In this type of semantic network, only binary relations are possible

• A richer representation is possible by reifying propositions and events (example: SNePS)

• This forces creation of a rich ontology of reified concepts; many current ideas originated in semantic network systems

Page 36: 1 CS 2710, ISSP 2160 The Situation Calculus KR and Planning Some final topics in KR.

36

Description Logics

http://en.wikipedia.org/wiki/Description_logic

This won’t be tested on the exam, but I want you to know what description logics are

Subset of full first order logic; a family of logics of increasing expressiveness; well studied; most are decidable; good link between theory and practice.

Page 37: 1 CS 2710, ISSP 2160 The Situation Calculus KR and Planning Some final topics in KR.

• We stopped here Fall 2012.

37

Page 38: 1 CS 2710, ISSP 2160 The Situation Calculus KR and Planning Some final topics in KR.

Proof methods• Proof methods divide into (roughly) two kinds:

Application of inference rules:Legitimate (sound) generation of new sentences from old.– Resolution– Forward & Backward chaining

Model checkingSearching through truth assignments.

• Improved backtracking: Davis--Putnam-Logemann-Loveland (DPLL)

• Heuristic search in model space: Walksat.

Page 39: 1 CS 2710, ISSP 2160 The Situation Calculus KR and Planning Some final topics in KR.

Model Checking

Two families of efficient algorithms:

• Complete backtracking search algorithms: DPLL algorithm. You read this on your own for the midterm.

• Incomplete local search algorithms– WalkSAT algorithm

Page 40: 1 CS 2710, ISSP 2160 The Situation Calculus KR and Planning Some final topics in KR.

The DPLL algorithm

Determine if an input propositional logic sentence (in CNF) is

satisfiable. This is just backtracking search for a CSP.

Improvements:1. Early termination

A clause is true if any literal is true.A sentence is false if any clause is false.

2. Pure symbol heuristicPure symbol: always appears with the same "sign" in all

clauses. e.g., In the three clauses (A B), (B C), (C A), A

and B are pure, C is impure. Make a pure symbol literal true

3 Unit clause heuristicUnit clause: only one literal in the clauseThe only literal in a unit clause must be true.

Note: literals can become a pure symbol or a unit clause when other literals obtain truth values. e.g.

( ) ( )A True A B

A pure

Page 41: 1 CS 2710, ISSP 2160 The Situation Calculus KR and Planning Some final topics in KR.

The WalkSAT algorithm

• Incomplete, local search algorithm• Evaluation function: The min-conflict heuristic of minimizing the number of unsatisfied clauses

• Balance between greediness and randomness

• See figure 7.18 (on your own)

Page 42: 1 CS 2710, ISSP 2160 The Situation Calculus KR and Planning Some final topics in KR.

WrapUp: Situation Calculus

• Planning in propositional logic: Section 7.7 through 7.7.2

• Section 10.4.2• Handouts

42

Page 43: 1 CS 2710, ISSP 2160 The Situation Calculus KR and Planning Some final topics in KR.

WrapUp: Other topics in KR

• Semantic Networks: 12.5.1 [not covered Fall 2014]

43


Recommended