Presentation is loading. Please wait.

Presentation is loading. Please wait.

Problem Spaces & Search

Similar presentations


Presentation on theme: "Problem Spaces & Search"— Presentation transcript:

1 Problem Spaces & Search
CSE 473 A handful of GENERAL SEARCH TECHNIQUES lie at the heart of practically all work in AI We will encounter the SAME PRINCIPLES again and again in this course, whether we are talking about GAMES LOGICAL REASONING MACHINE LEARNING These are principles for SEARCHING THROUGH A SPACE OF POSSIBLE SOLUTIONS to a problems.

2 473 Topics Agents & Environments Problem Spaces
Search & Constraint Satisfaction Knowledge Repr’n & Logical Reasoning Machine Learning Uncertainty: Repr’n & Reasoning Robotics © D. Weld, D. Fox

3 Weak Methods “In the knowledge lies the power…” [Feigenbaum]
But what if no knowledge???? Generate & test: As weak as it gets © D. Weld, D. Fox

4 Example: Fragment of 8-Puzzle Problem Space
© D. Weld, D. Fox

5 Problem Space / State Space
Search thru a Problem Space / State Space Input: Set of states Operators [and costs] (successor function) Start state Goal state [test] Output: Path: start at a state satisfying goal test [May require shortest path] State Space Search is basically a GRAPH SEARCH PROBLEM STATES are whatever you like! OPERATORS are a compact DESCRIPTION of possible STATE TRANSITIONS – the EDGES of the GRAPH May have different COSTS or all be UNIT cost OUTPUT may be specified either as ANY PATH (REACHABILITY), or a SHORTEST PATH © D. Weld, D. Fox

6 Example: Route Planning
Input: Set of states Operators [and costs] Start state Goal state (test) Output: States = cities Start state = starting city Goal state test = is state the destination city? Operators = move to an adjacent city; cost = distance Output: a shortest path from start state to goal state SUPPOSE WE REVERSE START AND GOAL STATES? © D. Weld, D. Fox

7 Example: N Queens Q Input: Set of states Operators [and costs]
Start state Goal state (test) Output: © D. Weld, D. Fox

8 Search Strategies Blind Search Informed Search Constraint Satisfaction
Adversary Search Depth first search Breadth first search Iterative deepening search Iterative broadening search © D. Weld, D. Fox

9 Search Strategies A search strategy is defined by picking the order of node expansion Strategies are evaluated along the following dimensions: completeness: does it always find a solution if one exists? time complexity: number of nodes generated space complexity: maximum number of nodes in memory optimality: does it always find a least-cost solution? Time and space complexity are measured in terms of b: maximum branching factor of the search tree d: depth of the least-cost solution m: maximum depth of the state space (may be ∞) © D. Weld, D. Fox

10 Breadth First Search Maintain queue of nodes to visit Evaluation
Complete? Time Complexity? Space Complexity? Yes a O(b^d) b c O(b^d) g h d e f © D. Weld, D. Fox

11 Memory a Limitation? Suppose: 2 GHz CPU 1 GB main memory
100 instructions / expansion 5 bytes / node 200,000 expansions / sec Memory filled in 100 sec … < 2 minutes © D. Weld, D. Fox

12 Depth First Search Maintain stack of nodes to visit Evaluation
Complete? Time Complexity? Space Complexity? © D. Weld, D. Fox

13 Depth First Search Maintain stack of nodes to visit Evaluation
Complete? Time Complexity? Space Complexity? © D. Weld, D. Fox

14 Depth First Search Maintain stack of nodes to visit Evaluation
Complete? Time Complexity? Space Complexity? © D. Weld, D. Fox

15 Depth First Search Maintain stack of nodes to visit Evaluation
Complete? Time Complexity? Space Complexity? © D. Weld, D. Fox

16 Depth First Search Maintain stack of nodes to visit Evaluation
Complete? Time Complexity? Space Complexity? © D. Weld, D. Fox

17 Depth First Search Maintain stack of nodes to visit Evaluation
Complete? Time Complexity? Space Complexity? © D. Weld, D. Fox

18 Depth First Search Maintain stack of nodes to visit Evaluation
Complete? Time Complexity? Space Complexity? © D. Weld, D. Fox

19 Depth First Search Maintain stack of nodes to visit Evaluation
Complete? Time Complexity? Space Complexity? © D. Weld, D. Fox

20 Depth First Search Maintain stack of nodes to visit Evaluation
Complete? Time Complexity? Space Complexity? © D. Weld, D. Fox

21 Depth First Search Maintain stack of nodes to visit Evaluation
Complete? Time Complexity? Space Complexity? © D. Weld, D. Fox

22 Depth First Search Maintain stack of nodes to visit Evaluation
Complete? Time Complexity? Space Complexity? © D. Weld, D. Fox

23 Depth First Search Maintain stack of nodes to visit Evaluation
Complete? Time Complexity? Space Complexity? © D. Weld, D. Fox

24 Depth First Search Maintain stack of nodes to visit Evaluation
Complete? Time Complexity? Space Complexity? Not for infinite spaces O(b^m) O(bm) © D. Weld, D. Fox

25 Iterative Deepening Search
DFS with limit; incrementally grow limit Evaluation Complete? Time Complexity? Space Complexity? Yes a b e O(b^d) c f d i O(bd) g h j k l © D. Weld, D. Fox

26 Iterative deepening search
Number of nodes generated in a depth-limited search to depth d with branching factor b: NDLS = b0 + b1 + b2 + … + bd-2 + bd-1 + bd Number of nodes generated in an iterative deepening search to depth d with branching factor b: NIDS = (d+1)b0 + d b^1 + (d-1)b^2 + … + 3bd-2 +2bd-1 + 1bd For b = 10, d = 5, NDLS = , , ,000 = 111,111 NIDS = , , ,000 = 123,456 Overhead = (123, ,111)/111,111 = 11% © D. Weld, D. Fox

27 When to Use Iterative Deepening
N Queens? Q Q Q Q © D. Weld, D. Fox

28 Forwards vs. Backwards start end © D. Weld, D. Fox

29 vs. Bidirectional © D. Weld, D. Fox

30 Repeated states Failure to detect repeated states can turn a linear problem into an exponential one! Graph search: Stores expanded nodes in a set called Closed and only adds new nodes to the fringe © D. Weld, D. Fox

31 Problem All these methods are slow (blind)
Solution  add guidance (“heurstic estimate”)  “informed search” © D. Weld, D. Fox

32 Robot Motion Planning

33 Arm with two joints Configuration space
Manipulator Control Arm with two joints Configuration space

34 Manipulator Control Path
State space Configuration space

35 Manipulator Control Path
State space Configuration space


Download ppt "Problem Spaces & Search"

Similar presentations


Ads by Google