Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction to Situation Calculus

Similar presentations


Presentation on theme: "Introduction to Situation Calculus"— Presentation transcript:

1 Introduction to Situation Calculus
Chapter 10.3- Introduction, Basics, Ontology Representing Actions & Effect Axioms The Frame Problem (FP) & Frame Axioms Solving the Representational FP & Successor-State Axioms Additional Concerns for Proving a Plan Solving the Inferential FP 1/1/2019 © James D. Skrentny from notes by C. Dyer, et. al.

2 Situation Calculus: Introduction
Consider the following simple problem: A hungry mechanical mouse wants to eat a wedge of cheese that is somewhere in a three room maze. Room 1 Room 2 Room 3 How might an AI super mouse achieve the goal? 1/1/2019 © James D. Skrentny from notes by C. Dyer, et. al.

3 Situation Calculus: Introduction
1,3,f start Use a search based agent. state representation <location of mouse {1,2,3}, location of cheese {1,2,3}, mouse ate cheese {t,f}> a start state: 1, 3, false a goal state: 3, 3, true set of atomic actions move from room 1 to 2 move from room 2 to 1 move from room 2 to 3 move from room 3 to 2 eat cheese search for a sequence of actions that reaches a goal 2,3,f move from 1 to 2 3,3,f move from 2 to 3 eat cheese 3,3,t goal 1/1/2019 © James D. Skrentny from notes by C. Dyer, et. al.

4 Situation Calculus: Introduction
What are limitations of using search for real-world problems? the search tree may be prohibitively large real world problems may require hundreds or thousands of possible actions representing the real world in sufficient detail may require a large number of variables in the state description search only weakly uses knowledge to solve a problem search doesn’t consider the independence of sub-goals A key problem with search is that the effects of actions are not taken into account when choosing which action to take next. buy groceries, water the plants, do the dishes are independent sub-goals recipes, for example, are order dependent 1/1/2019 © James D. Skrentny from notes by C. Dyer, et. al.

5 Situation Calculus: Introduction
Use a logical agent. Agent Sensors Effectors Reasoning & Decisions Making Model of World (being updated) List of Possible Actions Prior Knowledge about the World Goals/Utility Environment 1/1/2019 © James D. Skrentny from notes by C. Dyer, et. al.

6 Situation Calculus: Introduction
What are limitations of using FOL for real-world problems? the FOL proof tree may be large real world problems may require hundreds or thousands of possible FOL sentences describing actions representing the real world in sufficient detail may require a large number of objects in the domain A key problem with FOL is that it does not provide a good way for expressing change, such as that which results from the agent’s actions. 1/1/2019 © James D. Skrentny from notes by C. Dyer, et. al.

7 Situation Calculus: Basics
Goal: Enable a knowledge based agent to reason about the way in which predicates change over time as a result of actions. Main uses: Projection: deducing the outcome of a given sequence of actions, e.g. prove a plan works (requires a theorem prover or other inference algo.) Planning: finding a sequence of actions that achieves a desired effect (requires a suitable constructive inference algo. – next topic) 1/1/2019 © James D. Skrentny from notes by C. Dyer, et. al.

8 Situation Calculus: Basics
Assumptions: one agent is sole cause of change in the world (for cs540) actions are atomic (discrete, instantaneous, indivisible) if actions have a duration, overlap, etc. situation calc. is awkward then use a different formalism, e.g. event calculus Based on an augmented FOL representation quantify over time: "t such and such is a result at t+1 of doing action at t but concentrate on situations rather than explicit times unquantified variables assumed to be universally quantified 1/1/2019 © James D. Skrentny from notes by C. Dyer, et. al.

9 Situation Calculus: Ontology
Actions: logical terms referring to things that can change the world situation e.g. Forward, Turn(Right) sequence of actions: [Forward, Turn(Right), Forward, Forward] empty sequence: [ ] Situations: logical terms referring to a "snapshot" of the world, i.e., when nothing is changing situation variables initial situation: S0 situation at step t: St situation function, Result(a, s) returns situation resulting from action a occurring in situation s e.g. Result([ ], s) = s Result([a | seq], s) = Result(seq, Result(a,s)) The word "ontology" in philosophy refers to the subject of existence. It is often confused with epistemology, which is about knowledge and knowing. In this context ontology is a formal description of the concepts and relationships that can exist for an agent(s). 1/1/2019 © James D. Skrentny from notes by C. Dyer, et. al.

10 Situation Calculus: Ontology
Fluents: predicates and functions that vary from one situation to the next e.g. At(o,x,Result(a,s)) Holding(g,S0) a situation variable is always the last argument of fluents and is used as a "timestamp" fluents are true/false with respect to a particular situation Eternals/Atemporals: predicates and functions that never vary from situation to situation e.g. Block(A) Gold(g) 1/1/2019 © James D. Skrentny from notes by C. Dyer, et. al.

11 Situation Calculus: Example
Given: Block(A), Block(B), OnTable(A), OnTable(B) So S1 S2 A B A B A B Pickup(A) Stack(A,B) action: Pickup() situation: eternal: Block(x) fluent: OnTable(x) Result(Pickup(A), So) Result(Stack(A,B), Result(Pickup(A),So) ) Result: Block(A), Block(B), OnTable(B), OnTop(A,B) 1/1/2019 © James D. Skrentny from notes by C. Dyer, et. al.

12 Representing Actions: Proving a Simple Plan
Example: Wumpus World plan in AIMA, pp Goal: prove a plan achieves its aim. What must be provided in the knowledge base? what is true in S0 what isn't true in S0 description of how the world works, e.g. Adjacent() descriptions of actions… 1/1/2019 © James D. Skrentny from notes by C. Dyer, et. al.

13 Representing Actions: Axioms
Possibility Axioms: Preconditions Þ Poss(a,s) specifies under what conditions it’s possible to execute action a in state s e.g. At(Agent,x,s) Ù Adjacent(x,y) Þ Poss(Go(x,y),s) Effect Axioms: Poss(a,s) Þ Changes resulting from taking action specifies changes that result when action a is executed in state s e.g. Poss(Go(x,y),s) Þ At(Agent,y,Result(Go(x,y),s)) 1/1/2019 © James D. Skrentny from notes by C. Dyer, et. al.

14 ©2001-2004 James D. Skrentny from notes by C. Dyer, et. al.
The Frame Problem Can a plan be proved? No! Key problem: Effect axioms are too simple. They say what changes, but not what stays the same. The Frame Problem: Representing all that stays the same must be done in addition to describing what changes when an action is applied. Since almost everything stays the same from one situation to the next, you must find an efficient solution for stating what doesn't change. 1/1/2019 © James D. Skrentny from notes by C. Dyer, et. al.

15 The Frame Problem: A Solution?
What must we add to the knowledge base to address the frame problem? Add frame axioms that explicitly say what stays the same. e.g. the action Go only affects the fluent At for some things At(o,x,s) Ù (o ¹ Agent) Ù ØHolding(o,s) Þ At(o,x,Result(Go(y,z),s)) About how many frame axioms would this require given A actions and F fluents? O(A*F) frame axioms 1/1/2019 © James D. Skrentny from notes by C. Dyer, et. al.

16 ©2001-2004 James D. Skrentny from notes by C. Dyer, et. al.
The Frame Problem Requiring O(A*F) frame axioms is too many where A is number of actions and F is number of fluents Does this mean that situation calculus fails? No! It is not this bad. Typically the number of effects for an action is far fewer than the number of fluents in the system. e.g. Go affects where things are At but not which thing the agent is Holding Should be able to represent what happens with size O(A*E) where A is number of actions and E is number of effects there are volumes of papers on the Frame Problem and it was thought by some to be a symptom of the inevitable failure of AI 1/1/2019 © James D. Skrentny from notes by C. Dyer, et. al.

17 ©2001-2004 James D. Skrentny from notes by C. Dyer, et. al.
The Frame ProblemS Representational Frame Problem: concerns space efficiency avoiding the proliferation of frame axioms finding an O(A*E) representation where there are A actions, and E effects Inferential Frame Problem: concerns time efficiency projecting results of a t-step sequence of actions in O(Et) time rather than O(Ft) or O(AEt) where there are A actions, E effects, and F fluents 1/1/2019 © James D. Skrentny from notes by C. Dyer, et. al.

18 Solving the Representational Frame Problem
Let’s consider how each fluent evolves over time instead of writing the effects of each action. action is possible Þ (fluent is true in result state Û action's effect made it true Ú it was true before the action left it alone) axioms used are called successor-state axioms specifies truth value of fluent in the next state as a function of the action and truth value in the current state next state is completely specified from the current state so no frame axioms are required 1/1/2019 © James D. Skrentny from notes by C. Dyer, et. al.

19 Solving the Representational Frame Problem
For Example: action is possible Þ (fluent is true in result state Û action's effect made it true Ú it was true before the action left it alone) Poss(a,s) Þ (At(Agent,y,Result(a,s)) Û a=Go(x,y) Ú (At(Agent,y,s) Ù a ¹ Go(y,z)) ) (Holding(g,Result(a,s)) Û a=Grab(g) Ú (Holding(g,s) Ù a ¹ Release(g)) ) agent is at y in the resulting state iff the action was to go to y or the agent was already at y and didn't go somewhere else agent is holding g in the resulting state iff the action was to grab g or the agent was already holding g and didn't release it 1/1/2019 © James D. Skrentny from notes by C. Dyer, et. al.

20 Solving the Representational Frame Problem
Now how many axioms are needed? F axioms one for each fluent each of E effects for A actions is only mentioned once total size of the axioms O(A*E) literals, which solves the representational frame problem literals are spread over F axioms giving an average axiom size of A*E/F Now can a plan now be proved? No! 1/1/2019 © James D. Skrentny from notes by C. Dyer, et. al.

21 The Ramification Problem
Poss(a,s) Þ (At(Agent,y,Result(a,s)) Û a=Go(x,y) Ú (At(Agent,y,s) Ù a ¹ Go(y,z)) ) When the Agent moves what happens to what it is holding? It moves too. The axiom doesn't state what the agent is holding also moves. Many actions have implicit effects, which must be handled. Dealing with implicit effects is called the Ramification Problem. 1/1/2019 © James D. Skrentny from notes by C. Dyer, et. al.

22 The Ramification Problem
A solution is to write a more general axiom that includes implicit effects: Poss(a,s) Þ (At(o,y,Result(a,s)) Û (a=Go(x,y) Ù (o=Agent Ú Holding(o,s))) Ú (At(o,y,s) Ù Ø ( $z y ¹ z Ù a=Go(y,z) Ù (o=Agent Ú Holding(o,s)) ) ) Now can a plan now be proved? No! object o is at y in the resulting state iff the action was to go to y and o is the agent or an object being held by the agent or the object was already at y and the agent didn't go somewhere else with o being the agent or an object held by the agent 1/1/2019 © James D. Skrentny from notes by C. Dyer, et. al.

23 ©2001-2004 James D. Skrentny from notes by C. Dyer, et. al.
Uniqueness Axioms must be able to prove non-identities: e.g. o ¹ Agent y ¹ z BUT FOL allows different constants to refer to the same objects To prevent this either: provide a Unique Names Axiom that states a disequality for every pair of constants in the KB OR use a theorem prover with the unique names assumption that assumes names are unique Now can a plan now be proved? No! 1/1/2019 © James D. Skrentny from notes by C. Dyer, et. al.

24 ©2001-2004 James D. Skrentny from notes by C. Dyer, et. al.
Uniqueness Must also state disequality of action terms: e.g. a ¹ Go(x,y) Two more things required to be stated: each type of action is distinct: A(x1, …, xm) ¹ B(y1, …, yn) actions are the same only if the have the same name and involve the exact same objects: A(x1, …, xm) = A(y1, …, ym) Ù x1 = y1 Ù … Ù xm = ym Now can a plan now be proved? Yes, finally! Well there's also the qualification problem… 1/1/2019 © James D. Skrentny from notes by C. Dyer, et. al.

25 The Qualification Problem
In the real world it is difficult to define the circumstances under which a given action is guaranteed to work. This is the qualification problem. e.g. grabbing an object may not work if it is slippery, glued down, a holographic projection, or the gripper fails, or the agent is struck by lightning… if some conditions are left out the agent is in danger of generating false beliefs must understand that the generation of false beliefs is possible 1/1/2019 © James D. Skrentny from notes by C. Dyer, et. al.

26 Solving the Inferential Frame Problem
To do projection an agent must decide which fluents are true after a t-step sequence of actions each of the F axioms (one for each fluent) must be considered on each of the t steps in the sequence since each axiom has an average size of AE/F this gives O((F*AE/F)*t) = O(AEt) inferential work most of this work is copying fluents that don't change Solutions? discard situation calculus for another (e.g. fluent calculus) alter the inference mechanism to efficiently handle axioms O(AEt) but we know which action is executed at each step 1/1/2019 © James D. Skrentny from notes by C. Dyer, et. al.

27 Solving the Inferential Frame Problem
Rewrite axioms each axiom mentions actions that can make a fluent true and actions that can make the fluent false Poss(a,s) Þ (Fluenti(…,Result(a,s)) Û PosEffect(a,Fluenti) Ú (Fluenti(…,s) Ù ØNegEffect(a, Fluenti)) PosEffect(Action1, Fluenti) Ù ... Ù PosEffect(Actionn, Fluenti) NegEffect(Actionn+1, Fluenti) Ù ... Ù NegEffect(Actionn+m, Fluenti) Now make an efficient inference procedure using this kind of axiom. 1/1/2019 © James D. Skrentny from notes by C. Dyer, et. al.

28 Solving the Inferential Frame Problem
Each time step: look at the current action, i.e. next step in sequence fetch its effects, which can be fast O(1) if positive and negative effects are indexed by their action axioms are indexed by their fluents update the set of fluents represent each situation as the prev. situation + D fluents assumed to stay the same unless changed by update This solves the inferential frame problem since each time step has an average of E of these updates making the inferential work O(Et) 1/1/2019 © James D. Skrentny from notes by C. Dyer, et. al.

29 ©2001-2004 James D. Skrentny from notes by C. Dyer, et. al.
Summary Situation calculus enables a KB agent to reason about the results of actions projecting future results finding a plan Proving a plan achieves a goal requires: a goal to prove an initial state description that says what is and isn't true successor-state axioms, which take into consideration implicit effects unique names axiom or unique names assumption unique action axioms 1/1/2019 © James D. Skrentny from notes by C. Dyer, et. al.


Download ppt "Introduction to Situation Calculus"

Similar presentations


Ads by Google