Top Banner
Problem Solving and Search Andrea Danyluk September 11, 2013
22

Problem Solving and Search

Feb 23, 2016

Download

Documents

kelda

Problem Solving and Search. Andrea Danyluk September 11, 2013. Announcements. Progamming Assignment 0: Python Tutorial Due now Thanks for your patience with account set-up, turnin , etc. Assignment 1: Search Now posted on web site Due Fri, Sep 20 Team project! (35 students) - PowerPoint PPT Presentation
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Problem Solving and Search

Problem Solving and Search

Andrea DanylukSeptember 11, 2013

Page 2: Problem Solving and Search

Announcements

• Progamming Assignment 0: Python Tutorial– Due now– Thanks for your patience with account set-up, turnin,

etc.• Assignment 1: Search– Now posted on web site– Due Fri, Sep 20– Team project! (35 students)– First few parts straightforward. Don’t be fooled. It gets

harder.

Page 3: Problem Solving and Search

Today’s Lecture

• More on Uninformed search– Breadth-first– Depth-first– Uniform-cost search New

• Informed (Heuristic) search– Greedy best-first

Page 4: Problem Solving and Search

Formalizing State Space Search

• A node in a search tree typically contains:– A state description– A reference to the parent node– The name of the operator that generated it from

its parent– The cost of the path from the initial state to itself– Might also include its depth in the tree

• The node that is the root of the search tree typically represents the initial state

Page 5: Problem Solving and Search

Formalizing State Space Search

• Child nodes are generated by applying legal operators to a node– The process of expanding a node means to

generate all of its successor nodes and to add them to the frontier.

• A goal test is a function applied to a state to determine whether its associated node is a goal node

Page 6: Problem Solving and Search

Formalizing State Space Search

• A solution is either– A sequence of operators that is associated with a

path from start state to goal or– A state that satisfies the goal test

• The cost of a solution is the sum of the arc costs on the solution path– If all arcs have the same (unit) cost, then the

solution cost is just the length of the solution (i.e., the length of the path)

Page 7: Problem Solving and Search

Evaluating Search Strategies

• Completeness– Is the strategy guaranteed to find a solution when there is

one?• Optimality– Does the strategy find the highest-quality solution when

there are several solutions?• Time Complexity– How long does it take (in the worst case) to find a solution?

• Space Complexity– How much memory is required (in the worst case)?

Page 8: Problem Solving and Search

Evaluating BFS

• Complete?– Yes (if the number of possible actions is finite)

• Optimal?– Not in general. When is it optimal?• When costs of all actions are the same

• Time Complexity?– How do we measure it?

• Space Complexity?

Page 9: Problem Solving and Search

Time and Space Complexity

Let• b = branching factor (i.e., max number of

successors)• m = maximum depth of the search tree• d = depth of shallowest solutionFor BFSTime: O(bd) If we check for goal as we generate a

node! Not if we check as we get ready to expand!Space: O(bd)

Page 10: Problem Solving and Search

Evaluating DFS

• Complete?– Not in general– Yes if state space is finite and we modify tree search to

account for loops• Optimal?– No

• Time Complexity?– O(bm)

• Space Complexity?– O(mb)

Page 11: Problem Solving and Search

Depth-Limited DFS?

Let l be the depth limit• Complete?– No

• Optimal?– No

• Time Complexity?– O(bl)

• Space Complexity?– O(ml)

Page 12: Problem Solving and Search

Iterative Deepening?

• Complete?– Yes (if b is finite)

• Optimal?– Yes (if costs of all actions are the same)

• Time Complexity?– O(bd)

• Space Complexity?– O(bd)

Page 13: Problem Solving and Search

Costs on Actions

Page 14: Problem Solving and Search

Costs on Actions

Cost of moving a truck = 2x the cost of moving a car that isn’t a sports car.Cost of moving a sports car is 4x the cost of moving any other vehicle.

Page 15: Problem Solving and Search

Uniform Cost Search

ab

h

g

c

f

e

d

i

2

3

11

11

2

3

3.5

4

5

33.75

3

Fringe is a Priority Queue

Priority = cost so far

Similar to anotheralgorithm you know?

Page 16: Problem Solving and Search

Evaluating Uniform Cost Search

• Complete?– Yes (if b is finite and step cost ≥ e for positive e )

• Optimal?– Yes

• Time Complexity?– O(b 1+C*/e) Can’t check for goal until coming out

of PQ!• Space Complexity?– O(b1+C*/e)

Page 17: Problem Solving and Search

So we’re done, right?

Our search spaces are big.

Page 18: Problem Solving and Search

Informed (Heuristic) Search Strategies

• Use problem-specific knowledge to find solutions more efficiently

Page 19: Problem Solving and Search

Best-first Search

• Choose a node from the frontier based on its “desirability”– Frontier is a priority queue

• Requires a search heuristic– Any estimate of how close a state is to a goal– Examples:• Euclidean distance• Manhattan distance• For the “rush hour” problem?

Page 20: Problem Solving and Search

Greedy Best-first Search

h(n) = estimate of cost from n to the closest goal

Expand the node with lowest h value- i.e., the node that appears to be closest to the goal

Page 21: Problem Solving and Search

Greedy Search with hSLD

ab

h

g

c

f

e

d

i

2

3

11

11

2

3

3.5

4

5

33.75

3

a 6

b 2.5

c 6

d 3

e 1.5

f 3

g 0

h 3.5

i 6.5

black 4.5

red 3.5

yellow 2.5

This time gis the goal.

Page 22: Problem Solving and Search

Problems with Greedy Search?

Can be quite good with a high-quality heuristic, but

• Not optimal

• Time and space complexity: O(bm)