23
Problem-Solving by Search CSCI 5582, Fall 2007

Problem-Solving by Search - Semantic Scholar

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Problem-Solving by Search - Semantic Scholar

Problem-Solving by Search

CSCI 5582, Fall 2007

Page 2: Problem-Solving by Search - Semantic Scholar

Administrivia

• Reading for this week: R+N Chapter 3,sections 1-5

• Problem Set 1 to be posted Sept. 9, due Sept.25

Page 3: Problem-Solving by Search - Semantic Scholar

SEND+MORE____MONEY

Page 4: Problem-Solving by Search - Semantic Scholar

Visualizing Problems as“Spaces”

• The idea of a “problem space”• Some tractable examples• Search strategies: the essential arsenal• Crucial issues in evaluating search

algorithms• On beyond puzzles

Page 5: Problem-Solving by Search - Semantic Scholar

Problem Spaces

• A set of states• Special states: initial state(s), goal state(s)

[Or perhaps a goal test]• Successor function (also called operators in

the cognitive science literature)• In combination, these create a graph to

search

Page 6: Problem-Solving by Search - Semantic Scholar
Page 7: Problem-Solving by Search - Semantic Scholar
Page 8: Problem-Solving by Search - Semantic Scholar
Page 9: Problem-Solving by Search - Semantic Scholar

What Else Might We KnowAbout A Problem?

• Constraints on operators• Costs of operators• Reversibility• Metrics for how close we might be to a

solution

Page 10: Problem-Solving by Search - Semantic Scholar

Analyzing Search Algorithms

• Completeness (will we solve the problem?)• Optimality(how good is our solution?)• Time (how long will it take us to find a

solution?)• Space (how much memory will it take?)

Page 11: Problem-Solving by Search - Semantic Scholar

Uninformed Search: the BasicRepertoire

• Depth-first search• Breadth-first search• Iterative-deepening depth-first search• Bidirectional search

Page 12: Problem-Solving by Search - Semantic Scholar

Depth-First Search

Depth-First-Search [Nodes]

IF there are no more nodes

THEN FAIL

ELSE ThisNode First (Nodes)

IF ThisNode is the goal

THEN Return ThisNode

ELSE

ChildNodes Children (ThisNode)

Depth-First-Search

(Append-to-Front ChildNodes

Rest (Nodes))

Page 13: Problem-Solving by Search - Semantic Scholar

Breadth-First Search

Breadth-First-Search [Nodes]

IF there are no more nodes

THEN FAIL

ELSE ThisNode First (Nodes)

IF ThisNode is the goal

THEN Return ThisNode

ELSE

ChildNodes Children (ThisNode)

Breadth-First-Search

(Append-to-Front Rest (Nodes)

ChildNodes )

Page 14: Problem-Solving by Search - Semantic Scholar

What could we do with moreinformation?

• Search from the most “promising” node(greedy best-first search)

• Combine cost-so-far and future promise(A*)

• Simple (local) strategies: hill-climbing,beam search

Page 15: Problem-Solving by Search - Semantic Scholar

What could we do with moreinformation?

• Search from the most “promising” node(greedy best-first search)

• Combine cost-so-far and future promise(A*)

• Simple (local) strategies: hill-climbing,beam search

Page 16: Problem-Solving by Search - Semantic Scholar

Best-First-Search [Nodes]IF there are no more nodes THEN FAILThisNode <-- First(Nodes)IF ThisNode is the goal

THEN return ThisNodeELSEChildNodes <-- Children(ThisNode)Best-First-Search

(Sort-by-QualityChildNodesRemove-Node(ThisNode Nodes))

Page 17: Problem-Solving by Search - Semantic Scholar

How do we measure the "quality" of astate in our search?

• Least cost so far (uniform cost search)• Apparently closest to goal (greedy search)• Combine least cost and (apparent) nearness

to goal (A* search)

Page 18: Problem-Solving by Search - Semantic Scholar

The Basic Idea Behind A* Search

1) Devise an "estimation" function, h, that gives you a plausibleunderestimate of the distance from a given state to the goal.

2) Call the cost of getting from the initial state to the current state g.3) To measure the quality of a given state s, sum the cost (g) of arriving

at this state and the estimate (h) of the cost required to get from s tothe goal.

4) Use best-first search, where g+h is the overall quality function.

Page 19: Problem-Solving by Search - Semantic Scholar

Try to find a metric that will be a close (informative) one,butthat won’t overestimate (it should be optimistic).Example: 8-9 puzzle

Number of misplaced tilesSum of Manhattan distance of misplaced tiles (better)Best solution length for (say) tiles 1-4

Example: Choosing a path on a map from city A to BEuclidean distance to B.

How do you estimate distance to the goal? (Or: What’s that “h” function?)

Page 20: Problem-Solving by Search - Semantic Scholar

AStar-Best-First-Search [Nodes]IF there are no more nodes THEN FAILThisNode <-- First(Nodes)IF ThisNode is the goal

THEN return ThisNodeELSEChildNodes <-- Children(ThisNode)Astar-Best-First-Search

(Sort-by-Lowest-Cost-plus-EstimateChildNodesRemove-Node(ThisNode Nodes))

Page 21: Problem-Solving by Search - Semantic Scholar

How hard is a (search) problem?

• How big is the problem space?• How long is the best solution path? (the

“optimality” issue)• How long does it take to find the best

solution (the time-of-search issue)• What, if any, kinds of special knowledge or

heuristics do we have?

Page 22: Problem-Solving by Search - Semantic Scholar

The “optimal” path is awful: Towers of Hanoi

Page 23: Problem-Solving by Search - Semantic Scholar

The optimal path is (relatively) short, but finding the solutioncan take eons: the traveling salesman problem