26
Reasoning as Search

Reasoning as Search

  • Upload
    sevita

  • View
    19

  • Download
    1

Embed Size (px)

DESCRIPTION

Reasoning as Search. Reasoning. We can describe reasoning as search in a space of possible situations. 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). - PowerPoint PPT Presentation

Citation preview

Page 1: Reasoning as Search

Reasoning as Search

Page 2: Reasoning as Search

Reasoning

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

Page 3: Reasoning as Search

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)

Page 4: Reasoning as Search

Recall the 8-Puzzle

What are the states?

http://www.javaonthebrain.com/java/puzz15/

Page 5: Reasoning as Search

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:

Page 6: Reasoning as Search

School Lunch Planning

States:

Start state:

Operators:

Goal state:

Page 7: Reasoning as Search

Criminal Defense Lawyer

States:

Start state:

Operators:

Goal state:

Page 8: Reasoning as Search

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/

Page 9: Reasoning as Search

Performance Criteria

•Completeness

•Optimality

•How good is the solution?

•How efficient is the search algorithm at finding the solution?

Page 10: Reasoning as Search

Breadth-First Search

Page 11: Reasoning as Search

Depth-First Search

Page 12: Reasoning as Search

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

Page 13: Reasoning as Search

A Version of Depth-First Search:Branch and Bound

Consider the problem of planning a ski vacation.

Fly to A $600 Fly to B $800 Fly to C $2000

Stay D $200

(800)

Stay E $250

(850)

Total cost

(1200)

Page 14: Reasoning as Search

Problem Reduction

Goal: Acquire TV

Steal TV Earn Money Buy TV

Or another one: Theorem proving in which we reason backwards from the theorem we’re trying to prove.

Page 15: Reasoning as Search

What is a Heuristic?

Page 16: Reasoning as Search

What is a Heuristic?

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 that the volume of water displaced in the bath equals the volume of whatever (him) got put in the water. This could be used as a method for determining the purity of gold.

Page 17: Reasoning as Search

What is a Heuristic?

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 that the volume of water displaced in the bath equals the volume of whatever (him) got put in the water. This could be used as a method for determining the purity of gold.

A heuristic is a rule that helps us find something.

Page 18: Reasoning as Search

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), whereg(n) = the cost to get to n, andh(n) = an estimate of the cost to get from n to a goal

Page 19: Reasoning as Search

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

Page 20: Reasoning as Search

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

Page 21: Reasoning as Search

Hill Climbing

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

Page 22: Reasoning as Search

Hill Climbing – Some Problems

Page 23: Reasoning as Search

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.

Page 24: Reasoning as Search

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.

Page 25: Reasoning as Search

Hill Climbing – Is Close Good Enough?

AB

Is A good enough?• Choose winning lottery numbers

Page 26: Reasoning as Search

Hill Climbing – Is Close Good Enough?

AB

Is A good enough?• Choose winning lottery numbers• Get the cheapest travel itinerary• Clean the house