Chapter 3 Solving Problems by Searching
Abstraction Representing the Real World Want to buy a full-scale model of the Real WorldWant to buy a full-scale model of the Real World Way too complex!Way too complex! Simplify the Problem Throw-out unnecessary information This is where much of the real intelligence happensThis is where much of the real intelligence happens
Problem Solving Agents Goal Formulation What does the agent need to accomplish right now.What does the agent need to accomplish right now. Problem Formulation What States and Actions to considerWhat States and Actions to consider This is where we need abstractionThis is where we need abstraction Search for Solution Given states and actionsGiven states and actions What actions should be taken to achieve goalWhat actions should be taken to achieve goal
Well-defined Problems and Solutions Well-defined Problems Initial StateInitial State ActionsActions Successor Function Goal TestGoal Test Path CostPath Cost Step Cost Well-defined Solution Sequence of ActionsSequence of Actions
How do I get to Bucharest? Problem Formulation State SpaceState Space Map of Romania
Road Map of Romania
How do I get to Bucharest? Problem Formulation State SpaceState Space Map of Romania Initial StateInitial State At(Arad) ActionsActions Go(Arad,Zerind), Go(Iasi,Vaslui), … Goal TestGoal Test At(Bucharest) Path CostPath Cost Sum of individual step costs Well-defined Solution Sequence of ActionsSequence of Actions
8-Puzzle Problem
How do I solve an 8-puzzle? Problem Formulation StatesStates Position of each tile Initial StateInitial State Random Position ActionsActions Move tiles Move empty tile Goal TestGoal Test Are all of the tiles in the correct position Path CostPath Cost step cost is 1 Well-defined Solution Sequence of ActionsSequence of Actions
8-Queens
How do I Solve an n-Queens Problem? Problem Formulation StatesStates Position of each queen Initial StateInitial State Random Position Empty Board ActionsActions Move(Queen,Square) Place(Queen,Square) Goal TestGoal Test No Queen Attacks another Path CostPath Cost None Well-defined Solution Placement of each QueenPlacement of each Queen
Real-World Problems Robot Navigation VLSI Layout Internet Searching
Search Algorithms Simulated Exploration of State Space Off-line Create Search Tree Simple Search Algorithm 1. Start with initial state1. Start with initial state 2. Expand state by applying appropriate actions2. Expand state by applying appropriate actions 3. Check Goal Test3. Check Goal Test If False: Goto 2 4. Return Path From Initial State To Goal4. Return Path From Initial State To Goal
States vs. Nodes State Physical ConfigurationPhysical Configuration Node IncludesIncludes DepthDepth Parent NodeParent Node Etc.Etc.
Road Map of Romania
Representation One possible node representation StateState Parent pointerParent pointer ActionAction Path-CostPath-Cost DepthDepth Child ListChild List
Measuring Performance Completeness Guaranteed to find a solution?Guaranteed to find a solution? Optimality Find an optimal solution?Find an optimal solution? Space complexity How much memory to find a solutionHow much memory to find a solution Time complexity How long to find a solutionHow long to find a solution
Uninformed Search Strategies Breadth-first Search Uniform-cost Search Depth-first Search Depth-limited Search Iterative-deepening Search Bidirectional Search
Breadth-first Search Expand according to tree-depth Complete Non-optimal (optimal if cost related to depth)(optimal if cost related to depth) Space!! All nodes remain in memoryAll nodes remain in memory b d nodes per levelb d nodes per level
Breadth-first Search Time & Memory Requirements DepthNodesTimeMemory sec 1 meg 4111, sec 106 meg min 10 gig hrs 1 T days 101 T
Uniform-cost Search Expand node with lowest path cost Complete Optimal Space Complexity Similar to BFSSimilar to BFS O(b C*/e )O(b C*/e ) C* is memory cost of optimal solution e is the minimal cost of each action If all costs are the sameIf all costs are the same O(b C*/e ) = b d
Depth-first Search Expand deepest node first Implemented with stack Space Complexity Only need a single pathOnly need a single path O(bd)O(bd) Time Complexity O(b d )O(b d ) Not Complete Not Optimal
Depth-limited Search DFS with a predetermined depth limit – ‘L’ Better space and time complexities Space O(bL)Space O(bL) Time O(b L )Time O(b L ) Not Complete Not Optimal
Iterative Deepening DLS with modification Gradually increase depth limit Complete Optimal Space O(bd)O(bd) Time O(b d )O(b d )
Bi-directional Search Both directions From Start and GoalFrom Start and Goal Both Searches use BFS why?why? Complete Optimal Space O(b d/2 )O(b d/2 ) Time O(b d/2 )O(b d/2 ) Requires Predecessor Information
Avoiding Repeated States Issue in all problems with reversible actions Must somehow mark nodes as visited Check expanded nodes in queueCheck expanded nodes in queue Create memory of visited statesCreate memory of visited states Must also check to see if new path to repeated state has lower cost of previous path