chapter 3: solving problems by searching uninformed search

27
Chapter 3: Solving Problems by Searching Uninformed Search Edited by Neng-Fa Zhou

Upload: others

Post on 28-Dec-2021

7 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Chapter 3: Solving Problems by Searching Uninformed Search

Chapter 3:Solving Problems by Searching

Uninformed SearchEdited by Neng-Fa Zhou

Page 2: Chapter 3: Solving Problems by Searching Uninformed Search

Problem‐Solving Agents

• How does an agent can find a sequence of actions that achieves its goals with minimum cost? 

• This is the general task of problem solving and is typically performed by searching through an internally modeled space of world states.

nzhou
Cross-Out
Page 3: Chapter 3: Solving Problems by Searching Uninformed Search

Problem Formulation

• States• The initial state• ACTIONS(s): the set of actions that can be executed in state s

• The transition model: s’ = RESULT(s,a)• The goal test• A path cost function

Page 4: Chapter 3: Solving Problems by Searching Uninformed Search

Problem Solving Task

• Given:– An initial state of the world– A set of possible possible actions or operators that can be performed.

– A goal test that can be applied to a single state of the world to determine if it is a goal state.

• Find:– A solution stated as a path of states and operators that shows how to transform the initial state into one that satisfies the goal test.

• State space– The initial state and set of operators implicitly 

Page 5: Chapter 3: Solving Problems by Searching Uninformed Search

Solution Quality

• Step Cost– Each individual action has an associated cost.

• Path cost– A function that assigns a cost to a path, typically by summing the cost of the individual operators in the path.

• Optimal Solution– Find a lowest‐cost path.

Page 6: Chapter 3: Solving Problems by Searching Uninformed Search

Example Problems:  Route Finding

• Find a route from Arad to Bucharest

Page 7: Chapter 3: Solving Problems by Searching Uninformed Search

Example Problems: The Vacuum World

• States: An environment with n locations has nx2^n states.

• Initial state, actions, transition model, goal test, path cost

Page 8: Chapter 3: Solving Problems by Searching Uninformed Search

Example Problems: 8‐Puzzle

Page 9: Chapter 3: Solving Problems by Searching Uninformed Search

Example Problems: 8‐Queens Problem

Page 10: Chapter 3: Solving Problems by Searching Uninformed Search

Other Example Problems

• Knuth’s Conjecture– Starting with the number 4, a sequence of factorial, square root, and floor operations will reach any desired positive integer.

• Cryptarithmetic– SEND + MORE = MONEY

• Water Jugs Problem• Missionaries and Cannibals Problem

Page 11: Chapter 3: Solving Problems by Searching Uninformed Search

Real‐World Problems

• Route finding• Travelling salesman problem• VLSI layout• Robot navigation• Automatic assembly sequencing• Protein design

Page 12: Chapter 3: Solving Problems by Searching Uninformed Search

Search‐Trees

• A state can be expanded by generating all states that can be reached by applying a legal operator to the state.

• State space can also be defined by a successor function that returns all states produced by applying a single legal operator.

• A search tree is generated by generating search nodes by successively expanding states starting from the initial state as the root.

Page 13: Chapter 3: Solving Problems by Searching Uninformed Search

The Tree‐Node Data Structure

• A search node in the tree can contain– n.STATE: Corresponding state– n.PARENT: Parent node– n.ACTION: Operator applied to reach this node– n.PATH‐COST:  g(n), path cost of path from initial state to node

Page 14: Chapter 3: Solving Problems by Searching Uninformed Search

Expanding Nodes and Search

• Search algorithms all share this basic tructure; they vary in how they choose which state to expand next—the so‐called search strategy. 

Page 15: Chapter 3: Solving Problems by Searching Uninformed Search

Tree‐Search

Page 16: Chapter 3: Solving Problems by Searching Uninformed Search

Graph‐Search

Page 17: Chapter 3: Solving Problems by Searching Uninformed Search

Evaluate Search Algorithm’s Performance

• Completeness (systematic search vs local search)

• Time Complexity• Space Complexity• Optimality

Page 18: Chapter 3: Solving Problems by Searching Uninformed Search

Search Strategies: Uniformed Search 

• Blind, exhaustive, brute force, do not guide the search with any additional information about the problem– Breadth‐first search – Uniform Cost Search– Depth‐First Search– Depth‐limited search 

– Iterative deepening depth‐first search – Bidirectional search

Page 19: Chapter 3: Solving Problems by Searching Uninformed Search

Search Strategies: Informed Search 

• Heuristic, intelligent,  use information about the problem (estimated distance from a state to the goal) to guide the search.– Greedy best‐‐first search – A* search – Iterative deepening A* (IDA*)

Page 20: Chapter 3: Solving Problems by Searching Uninformed Search

Breadth‐first search 

Page 21: Chapter 3: Solving Problems by Searching Uninformed Search

Breadth‐First Complexity

• Assume there are an average of b successors to each node, called the branching factor.

• Therefore, to find a solution path of length d must explore                              nodes.

• Plus need b^d nodes in memory to store leaves in queue.

Page 22: Chapter 3: Solving Problems by Searching Uninformed Search

Uniform Cost Search

• Like breadth‐first except expands the node with lowest path cost, g(n).

Page 23: Chapter 3: Solving Problems by Searching Uninformed Search

Depth‐first Search

• DFS expands the deepest unexpanded node first. Implemented using a stack (LIFO).

Page 24: Chapter 3: Solving Problems by Searching Uninformed Search

DFS

BREADTH-FIRST-SEARCH -> DEPTH-FIRST-SEARCH

FIFO -> LIFO

Page 25: Chapter 3: Solving Problems by Searching Uninformed Search

Depth‐First Properties

• Not guaranteed to be complete• Not guaranteed optimal• Time complexity in worst case is still O(b^d) • Space complexity is only O(bm) where m is maximum depth of the tree.

Page 26: Chapter 3: Solving Problems by Searching Uninformed Search

Iterative Deepening

• Calls depth‐first search with increasing depth limits until a goal is found. 

Page 27: Chapter 3: Solving Problems by Searching Uninformed Search

Bidirectional Search

• We can run two simultaneous searches – one forward from the initial state and the other backward from the goal (hoping that the two searches meet in the middle).

• Rational?