380 likes | 528 Views
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. Other topics in KR. Semantic Networks: 12.5.1 [Description Logic: 12.5.2: we didn’t cover this ]
E N D
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
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]
Actions, 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,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.
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.
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).
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)
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…
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.
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,2],[1,1]),grab(g1),go([1,1],[1,2])],s0) Let’s look at what has to go in the KB for such queries to be answered...
Possibility and Effect Axioms • Possibility axioms: • Preconditions poss(A,S) • Effect axioms: • poss(A,S) changes that result from that action
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.
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
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
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
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 needed We can do something more efficient than this
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
“Solving” the Frame Problem • For each fluent, have a 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
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
4-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))))
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.
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
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
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)
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)
Semantic Networks • cat – label value • All X (X in cat label(X,value))
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
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
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.
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 checking Searching through truth assignments. • Improved backtracking: Davis--Putnam-Logemann-Loveland (DPLL) • Heuristic search in model space: Walksat.
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
The 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.
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)
WrapUp: Situation Calculus • Planning in propositional logic: Section 7.7 through 7.7.2 • Section 10.4.2 • Handout
WrapUp: Other topics in KR • Semantic Networks: 12.5.1