Title: CS 2710, ISSP 2160
1CS 2710, ISSP 2160
- The Situation Calculus
- KR and Planning
- Some final topics in KR
2Situation Calculus
- Planning in propositional logic Section 7.7
through 7.7.2 - Section 10.4.2
- Handouts
- Note Fall 2015 you are only responsible for
some of these notes, specifically what we covered
11/3/2015
3Other topics in KR
- Semantic Networks 12.5.1
- Description Logic 12.5.2 we didnt cover this
- Satisfiability and WalkSat Intro to Section
7.6 7.6.2 we didnt cover this
4Actions, Situations, and EventsThe Situation
Calculus
- The robot is in the kitchen.
- in(robot,kitchen)
- He walks into the living room.
- in(robot,livingRoom)
- in(robot,kitchen,202pm)
- in(robot,livingRoom,217pm)
- 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.
5Situation 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.
6Situation 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).
7Sequences of Actions
- Also useful to reason about action sequences
- All S resultSeq(,S) S
- All A,Se,S resultSeq(ASe,S)
resultSeq(Se,result(A,S)) - resultSeq(a,b,c,so) is
- result(c,result(b,result(a,s0)
8Modified 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
9Initial KB
- All O,X (at(O,X,s0) ?? (Oagent X 1,1) v
(Og1 X 1,2)) - All O holding(O,s0)
- Eternals
- gold(g1) adjacent(1,1,1,2)
adjacent(1,2,1,1) etc.
10Goal 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)) - The situation designated by the second term
- result(go(1,1,1,2),result(grab(g1),result(go(
1,1,1,2),s0))) - Lets look at what has to go in the KB for such
queries to be answered...
11Possibility and Effect Axioms
- Possibility axioms
- Preconditions ? poss(A,S)
- Effect axioms
- poss(A,S) ? changes that result from that action
12Axioms 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.
13Possibility 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
14Effect 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
15Frame Problem
- We run into the frame problem
- Effect axioms say what changes, but dont say
what stays the same - A real problem, because (in a non-toy domain),
each action affects only a tiny fraction of all
fluents
16Frame Problem (continued)
- One solution approach is writing explicit frame
axioms, such as - (at(O,X,S) (Oagent) 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 needed
- We can do something more efficient than this
17Frame Problem
- What stays the same?
- A actions, F fluents, and E effects/action (worst
case). Typically, E ltlt 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
18Solving the Frame Problem
- For each fluent, have successor-state axioms
- Action is possible ?
- (fluent is true in result state ??
- actions 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
19Initial KB (reminder)
- All O,X at(O,S,s0) ?? Oagent X 1,1) v
(Og1 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
204-5 are Successor-State Axioms
- At(Agent, x, s) ? Adjacent(x,y) ? Poss(Go(x,y),s)
- Gold(g) ? At(Agent,x,s) ? At(g, x, s) ?
Poss(Grab(g),s) - Holding(g,s) ? Poss(Release(g),s)
- Poss(a,s) ? Holding(g,Result(a,s)) ?
a Grab(g) v
(Holding(g,s) ? a ? Release(g))) - 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))))
21More explicit version Replaced existential with
universal in 5
- All x,y,s ((At(Agent, x, s) ? Adjacent(x,y)) ?
Poss(Go(x,y),s) - All g,x,s ((Gold(g) ? At(Agent,x,s) ? At(g, x,
s)) ? Poss (Grab(g),s)) - All g,s (Holding(g,s) ? Poss(Release(g),s))
- All a,s,g (Poss(a,s) ? (Holding(g,Result(a,s)) ?
(a
Grab(g) v (Holding(g,s) ? a ? Release(g)))) - 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))))))) - Justification previous 5 has (?z the change
is justified because this is equivalent to all z
22Same as previous, but without comments
- All x,y,s ((At(Agent, x, s) ? Adjacent(x,y)) ?
Poss(Go(x,y),s) - All g,x,s ((Gold(g) ? At(Agent,x,s) ? At(g, x,
s)) ? Poss (Grab(g),s)) - All g,s (Holding(g,s) ? Poss(Release(g),s))
- All a,s,g (Poss(a,s) ? (Holding(g,Result(a,s)) ?
(a
Grab(g) v (Holding(g,s) ? a ? Release(g)))) - 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)))))))
23A 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
24A return to complexity
- Each of the E effects of each of the A actions is
mentioned exactly once, so O(AE) axioms needed
total action mentions - Another schema for successor state axioms
- Action is possible ?
- (fluent is true in result state ??
- (action is one of the actions that makes it
true (add effect) v - it was true before and action is not one of
the actions that makes it false (delete effect)) - Thus, for each fluent (possible effect), we
mention exactly once each action that has it as
an effect (either making it true or making it
false) - Or, for each action, it is mentioned exactly once
in a successor state axiom for each of its
effects -
25Fall 2014
- In class exercise the blocks world handout
26Qualification Problem
- Ensuring that all necessary conditions for an
actions success have been specified. No
complete solution in logic. KR/planning
designers have to decide how much detail to go
into.
27What 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
28Stopped here, Fall 2014
29Semantic 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
30Example
- 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)
31(No Transcript)
32Semantic 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)
33Semantic Networks
- cat label ? value
- All X (X in cat ? label(X,value))
34Inheritance
- 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
35Semantic 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
36Description Logics
- http//en.wikipedia.org/wiki/Description_logic
- This wont 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.
37- We stopped here Fall 2012.
38Proof 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 checking
- Searching through truth assignments.
- Improved backtracking Davis--Putnam-Logemann-Love
land (DPLL) - Heuristic search in model space Walksat.
-
39Model 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
40The DPLL algorithm
- Determine if an input propositional logic
sentence (in CNF) is - satisfiable. This is just backtracking search for
a CSP. - Improvements
- Early termination
- A clause is true if any literal is true.
- A sentence is false if any clause is false.
- Pure symbol heuristic
- Pure 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 heuristic
- Unit clause only one literal in the clause
- The 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.
41The 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)
42WrapUp Situation Calculus
- Planning in propositional logic Section 7.7
through 7.7.2 - Section 10.4.2
- Handouts
43WrapUp Other topics in KR
- Semantic Networks 12.5.1 not covered Fall
2014