Presentation is loading. Please wait.

Presentation is loading. Please wait.

Reasoning as Search. Reasoning We can describe reasoning as search in a space of possible situations.

Similar presentations


Presentation on theme: "Reasoning as Search. Reasoning We can describe reasoning as search in a space of possible situations."— Presentation transcript:

1 Reasoning as Search

2 Reasoning We can describe reasoning as search in a space of possible situations.

3 State Space Search We need: A set of states A start state A set of operators (a successor function), possibly with costs attached. A set of goal states (or a way to test for goal)

4 Recall the 8-Puzzle What are the states? http://www.javaonthebrain.com/java/puzz15/

5 A Water Jug Problem You are given two jugs, a 4-gallon one and a 3-gallon one. Neither has any measuring markers on it. There is a pump that can be used to fill the jugs with water. How can you get exactly 2 gallons of water into the 4-gallon jug? States: Start state: Operators: Goal state:

6 School Lunch Planning States: Start state: Operators: Goal state:

7 Criminal Defense Lawyer States: Start state: Operators: Goal state:

8 Search Two key decisions: Use a tree or a graph How to choose which node to expand next Example: http://www.javaonthebrain.com/java/puzz15/

9 Performance Criteria Completeness Optimality How good is the solution? How efficient is the search algorithm at finding the solution?

10 Breadth-First Search

11 Depth-First Search

12 The British Museum Algorithm A simple algorithm: Generate and test When done systematically, it is basic depth-first search. But suppose that each time we end a path, we start over at the top and choose the next path randomly. If we try this long enough, we may eventually hit a solution. We’ll call this The British Museum Algorithm or The Monkeys and Typewriters Algorithm http://www.arn.org/docs2/news/monkeysandtypewriters051103.htm

13 A Version of Depth-First Search: Branch and Bound Consider the problem of planning a ski vacation. Fly to A $600Fly to B $800Fly to C $2000 Stay D $200 (800) Stay E $250 (850) Total cost (1200)

14 Problem Reduction Goal: Acquire TV Steal TVEarn MoneyBuy TV Or another one: Theorem proving in which we reason backwards from the theorem we’re trying to prove.

15 Heuristics The word heuristic comes from the Greek word  (heuriskein), meaning “to discover”, which is also the origin of eureka, derived from Archimedes’ reputed exclamation, heurika (“I have found”), uttered when he had discovered a method for determining the purity of gold. We typically use the term heuristic to refer to a technique that is likely, but not guaranteed, to produce a good (but not necessarily best) answer or the best answer with a good but not necessarily best expenditure of effort.

16 Heuristic Functions The job of a heuristic function f(n) is to evaluate a node n in a search tree so that the “best” node can be selected for expansion. Two approaches to defining f: f measures the value of the state contained in the node. f measures the cost of the state (and possibly the path to it). Often, in this case, we decompose f: f(n) = g(n) + h(n), where g(n) = the cost to get to n, and h(n) = an estimate of the cost to get from n to a goal

17 Examples - f Measures the Value Often, in these cases, f is the weighted sum of a set of component values: Chess School lunch planning Autonomous Mars rover Perry Mason defense lawyer

18 Examples – f Measures the Cost to a Goal In many problems, all goal states are equally good. Then all we care about is the cost of getting to one. So a state is good if the estimated cost of getting from it to a goal is low. Or we may also want to take into account the cost, so far, of getting to it. 8–Puzzle Water jug Route planning

19 Hill Climbing Problem: You have just arrived in Washington, D.C. You’re in your car, trying to get downtown to the Washington Monument.

20 Hill Climbing – Some Problems

21 Sometimes the Problem is f From the initial state, move A to the table. Three choices for what to do next. A local heuristic function: Add one point for every block that is resting on the thing it is supposed to be resting on. Subtract one point for every block that is sitting on the wrong thing.

22 Sometimes the Problem is f From the initial state, move A to the table. Three choices for what to do next. A global heuristic function: For each block that has the correct support structure (i. e., the complete structure underneath it is exactly as it should be), add one point for every block in the support structure. For each block that has an incorrect support structure, subtract one point for every block in the existing support structure.

23 Hill Climbing – Is Close Good Enough? A B Is A good enough? Choose winning lottery numbers

24 Hill Climbing – Is Close Good Enough? A B Is A good enough? Choose winning lottery numbers Get the cheapest travel itinerary Clean the house


Download ppt "Reasoning as Search. Reasoning We can describe reasoning as search in a space of possible situations."

Similar presentations


Ads by Google