1 / 27

Solving Problems by Searching

Solving Problems by Searching. CPS 4801-01. Outline. Problem-solving agents Example problems Basic search algorithms. Problem-Solving Agents. Intelligent agents are supposed to maximize their performance measure. If the agent can adopt a goal and aim at satisfying it.

rufina
Download Presentation

Solving Problems by Searching

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Solving Problems by Searching CPS 4801-01

  2. Outline • Problem-solving agents • Example problems • Basic search algorithms

  3. Problem-Solving Agents • Intelligent agents are supposed to maximize their performance measure. • If the agent can adopt a goal and aim at satisfying it.

  4. Problem-Solving Agents • “formulate, search , execute” design

  5. Problem-Solving Agents • Goal formulation, based on the current situation and the agent’s performance measure, is the first step in problem solving. • Problem formulation is the process of deciding what actions and states to consider, given a goal. • The process of looking for a sequence of actions that reaches the goal is search. • Execution phase: once a solution is found, the actions it recommended can be carried out.

  6. Example: Romania • On holiday in Romania; currently in Arad. • Flight leaves tomorrow from Bucharest • Formulate goal: be in Bucharest • Formulate problem: • states: various cities • action: drive between cities • Find solution: • sequence of cities: e.g., Arad, Sibiu, Fagaras, Bucharest

  7. Example: Romania

  8. Problem Formulation • A problem is defined by five components. • Initial state e.g., “at Arad” • Actions (s)  {a1, a2, a3, … } • e.g., {Go(Sibiu), Go(Timisoara), Go(Zerind)} • Transition model: Result (s,a)  s’ • e.g., Result(In(Arad), Go(Timisoara)) = In(Timisoara) • Goal test (s)  T/F e.g., “at Bucharest” • Path cost (sss)  n (additive) • sum of cost of individual steps, e.g., number of miles traveled, number of minutes to get to destination

  9. Example Problems • Toy problems: to illustrate or exercise various problem-solving methods, given a concise, exact description. • Real-world problems: tend not to have a single agreed-upon description.

  10. Example: Vacuum World • states? • initial state? • actions? • transition model? • goal test? • path cost?

  11. states? location and dirt, 2*22=8, n*2n • initial state? any state • actions? Left, Right, Suck (Up, Down) • transition model? • goal test? no dirt at all locations • path cost? 1 per action (0 for NoOp)

  12. Example: The 8-Puzzle • states? • initial state? • actions? • transition model? • goal test? • path cost?

  13. states? A state description specifies the location of the eight tiles and the blank one. • initial state? any state • actions? movement of the blank space: Left, Right, Up, Down • transition model? (s,a)s’ • goal test? goal state (given) • path cost? 1 per move

  14. The 8-Queens Problem • states? • initial state? • actions? • transition model? • goal test? • path cost?

  15. Incremental formulation • states? Any arrangement of 0 to 8 queens • initial state? No queens on the board • actions? Add a queen to any empty square • transition model? Return the board with a queen added • goal test? 8 queens, none attacked • path cost? no interest

  16. The 8-Queens Problem • 64*63*…*57 ~= 1.8*1014 • A better formation: • states: All possible arrangement of n queens, one per column in the leftmost n columns, with no queen attacking another. (0<=n<=8) • actions: Add a queen to any square in the leftmost empty column such that it is not attacked by any other queen.

  17. Donald Knuth (1964): starting with the number 4, a sequence of factorial, square root, and floor operation will reach any desired positive integer. • states? Positive numbers • initial state? 4 • actions? Apply factorial, square root, or floor operation • transition model? definition of the operations • goal test? desired positive integer • path cost? number of operations

  18. Real-World Problems • Route-finding problem • Touring problems • e.g., visit every city in the Romania example at least once, starting and ending in Bucharest. • Traveling salesman problem (TSP) • each city must be visited exactly once • shortest tour

  19. Tree Search Algorithms • search tree: initial state as the root, the branches as actions and the nodes as states. • We expand the current state and generate a new set of states. • parent node, child nodes • leaf node: a node with no children (frontier) • search strategy: how to choose which state to expand next • repeated state, redundant paths

  20. Tree Search Example • The initial state

  21. Tree Search Example • After expanding Arad

  22. Tree Search Example • After expanding Sibiu

  23. Graph Search Algorithm • explored set: remembers every expanded node • Newly generated nodes that are in the explored set are discarded. • The frontier separates the explored region and the unexplored region.

  24. Data Structure • For each node n, • n.State • n.Parent • n.Action: parent generated the node • n.Path-Cost

  25. Data Structure • Frontier: queue • Empty? (queue) : T/F • Pop (queue) • Insert (queue) • FIFO, LIFO, priority • Explored set: hash table

  26. 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:branching factor ormaximum number of successors of any node • d: depth of the least-cost solution • m: maximum length of any path in the state space (may be ∞)

  27. Uninformed Search Strategies • Uninformed search strategies use only the information available in the problem definition. • Breadth-first search Uniform-cost search Depth-first search Depth-limited search

More Related