10/6/2003 CSE 571 Notes Ryan Weddle [1] Projects: -------------- Dr. Baral will put up links regarding some of the projects. Everyone needs to discuss their project ideas with him. Deadline is next week. Probabilistic Smodels - add probability to smodels - Bayes Nets for instance are probabilistic, but only propositional (no relations/predicates) - Dr. Baral will post a paper online [2] Chapter 5: --------------- [2.1] Introduction: This chapter combines everything we have studied so far into a single application. - Reasoning normative, etc. - Problem Solving - etc. [2.2] Example: Imagine we want to reason about a dynamic world where there are actions that change the state of the world. For instance, we might have the following actions: load - causes loaded shoot - causes -alive if loaded Reasoning about this world will require us to use all of the reasoning and problem solving paradigms we have learned so far. [2.3] Types of Reasoning: What kinds of reasoning can we do with this? * Prediction * Hypothetical Reasoning * Counterfactual Reasoning * Explaining Observations * Planning from the Initial State * Planning from the Current State * Diagnosis (I) Prediction: Suppose we are given the following description of the initial state: initially loaded. initially alive. Question: What happens to the turkey after we shoot? Answer: Clearly, the answer is -alive. MetaQuestion: How do we do that reasoning with AnsProlog? The desired conclusion is -alive after shoot. To write rules for this we need a model to take into account time, or at least some concept of before and after. Example: loaded(X+1) <- load(X). -alive(X+1) <- shoot(X), loaded(X). loaded(0). alive(0). shoot(0). Question: How do we ensure that things stay the same by default? Answer: This is the FRAME PROBLEM, which we will get to later. We could try the following: loaded(X+1) <- loaded(X), not -loaded(X+1). -loaded(X+1) <- -loaded(X), not loaded(X+1). But it would give us multiple models (which we do not want). The proper formulation of the answer to this problem took decades, so don't worry if we don't address it immediately. (II) Hypothetical Reasoning: Question: What happens to the turkey if we shoot? MetaQuestion: How do we do that reasoning with AnsProlog? Answer: Naively, we could just add the fact shoot(0) to our model, but this is an inadequate solution. We need to formulate some way to reason about hypothetical situations in AnsProlog, without changing our existing model of the world. (III) Counterfactual Reasoning: Question: What would have happened to the turkey if the gun had not been loaded when we shot? MetaQuestion: How do we do that reasoning with AnsProlog? Answer: This is very similar to hypothetical reasoning, although the imperative of not just adding facts to the model here is clearer, as the necessary facts could (would) make the program inconsistent (by introducing contradictions). (IV) Explaining Observations: Question: We observe the turkey to be -alive at time 1. Explain what happened. MetaQuestion: How do we do that reasoning with AnsProlog? Answer: We can write an AnsProlog program to answer this question by defining a constraint (in this case, that the turkey is -alive at time 1), the "world model", and an enumeration of the possible actions in the world. The enumerative aspect of this solution should remind us of the problem solving paradigm we have already seen. Program: Initial State: loaded(0). alive(0). Constraint: :- not -alive(1). 0 { load(0), shoot(0), pull(0) } 1. This program, when added to our program modeling the results of actions in the dynamic world, will give us the result: shoot(0). Question: We observe the turkey to be -alive at time 1. What can be said about the gun being loaded at time zero? Answer: Similarly to the program above, we can answer this question via problem solving by combining enumeration and a constraint: Program: Initial State: alive(0). Constraint: :- not -alive(1). 1 { loaded(0), -loaded(0) } 1. Whereas, in the previous question we allowed zero or one actions to take place, in this case we specify that in any answer set, exactly one of either loaded(0) or -loaded(0) may be true. In this case, the result we get is: loaded(0). (V) Planning from an Initial State: Question: What do I need to do to make the turkey -alive at time 1? MetaQuestion: How do we do that reasoning with AnsProlog? Answer: In smodels, we are constrained to looking at plans of up to a certain finit length. Subject to that constraint, however we can formulate the solution as follows: Program: Initial State: -loaded(0). alive(0). Planning Constraints: goal :- -alive(5). (in this case, we are looking at plans of up to 5 steps in length) :- not goal. 0 { load(X), shoot(X) } 1 :- time(X). This program, when added to our program modeling the results of actions in the dynamic world, will give us answer sets which are sequences of actions that satisfy the constraints of the goal. (VI) Planning from the Current State: This is significantly different and more complicated than planning from the initial state, as we must take into account the possibility that the plan we formulate initially will no longer be the best plan (or a possible plan) at some later point in time. (VII) Diagnostics: Diagnostics involves reasoning about abnormal situations to find the cause(s) of a failure. The typical implementation would be to specify the possibility of any given object or process being abnormal, for instance with the arity one predicate ab(X). e.g: ab(switch). ab(light). Rules about the system modeled are then written contingent upon the involved processes and objects not being abnormal. The idea then is to assume initially that nothing is abnormal, and in the case of failure to determine the minimal set(s) of abnormal things which could account for it.