Presentation is loading. Please wait.

Presentation is loading. Please wait.

Problem-solving as search. History Problem-solving as search – early insight of AI. Newell and Simon’s theory of human intelligence and problem-solving.

Similar presentations


Presentation on theme: "Problem-solving as search. History Problem-solving as search – early insight of AI. Newell and Simon’s theory of human intelligence and problem-solving."— Presentation transcript:

1 Problem-solving as search

2 History Problem-solving as search – early insight of AI. Newell and Simon’s theory of human intelligence and problem-solving. Early examples: 1956: Logic Theorist (Allen Newell & Herbert Simon) 1958: Geometry problem solver (Herbert Gelernter) 1959: General Problem Solver (Herbert Simon & Alan Newell) 1971: STRIPS (Stanford Research Institute Problem Solver, Richard Fikes & Nils Nilsson)

3 Real-World Problem-Solving as Search Examples: Route/Path finding: Robots, cars, cell-phone routing, airline routing, characters in video games, … Layout of circuits Job-shop scheduling Game playing (e.g., chess, go) Theorem proving Drug design

4 Classic AI Toy Problem: 8-puzzle initial state goal state Notion of “searching a state space” Pictures from

5 8-puzzle search tree Pictures from

6 What is size of state space?

7 What is size of state space for 8-puzzle? Size of state space  9! = 181,440 Size of 15-puzzle state space?  16! = 2 x Size of 24-puzzle state space?  25! = 1.5 x 10 25

8 What is size of state space for 8-puzzle? Size of state space  9! = 181,440 Size of 15-puzzle state space?  16! = 2 x Size of 24-puzzle state space?  25! = 1.5 x Can’t do exhaustive search!

9 Approximate number of states Tic-Tac-Toe: 3 9 Checkers: Rubik’s cube: Chess:

10 In general, a search problem is formalized as : state space special start and goal state(s) operators that perform allowable transitions between states cost of transitions All these can be either deterministic or probabilistic.

11 State space as a tree/graph Search as tree search Solutions: “winning” state, or path to winning state

12 How to solve a problem by searching 1.Define search space Initial, goal, and intermediate states 2.Define operators for expanding a given state into its possible successor states Defines search tree 3.Apply search algorithm (tree search) to find path from initial to goal state, while avoiding (if possible) repeating a state during the search. 4.Solution is path from initial to goal state (e.g., traveling salesman problem) or, simply a goal state, which might not be initially known (e.g., drug design)

13 Missionaries and cannibals Three missionaries and three cannibals are on the left bank of a river. There is one canoe which can hold one or two people. Find a way to get everyone to the right bank, without ever leaving a group of missionaries in one place outnumbered by cannibals in that place. From

14 Missionaries and cannibals Three missionaries and three cannibals are on the left bank of a river. There is one canoe which can hold one or two people. Find a way to get everyone to the right bank, without ever leaving a group of missionaries in one place outnumbered by cannibals in that place. From How to set this up as a search problem?

15 Missionaries and cannibals State space: Size? Initial state: Goal state: Operators: Cost of transitions: Search tree:

16 Drug design Example: Search for sequence of up to N amino acids that forms protein shape that matches a particular receptor on a pathogen. (Note: There are 20 amino acids to choose from at each locus in the string.)

17 Drug design State space: Size? Initial state: Goal state: Operators: Cost of transitions: Search tree:

18 Search Strategies A strategy is defined by picking the order of node expansion. Strategies are evaluated along the following dimensions: 1.completeness – does it always find a solution if one exists? 2.optimality – does it always find a optimal (least-cost or highest value) solution? 3.time complexity – number of nodes generated/expanded 4.space complexity – maximum number of nodes in memory Time and space complexity are often 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 infinite) Adapted from

19 Search methods Uninformed search: 1.Breadth-first 2.Depth-first 3.Depth-limited 4.Iterative deepening depth-first 5.Bidirectional Informed (or heuristic) search (deterministic or stochastic): 1.Greedy best-first 2.A* (and many variations) 3.Hill climbing 4. Simulated annealing 5. Genetic algorithm 6. Tabu search 7. Ant colony optimization Adversarial search: 1. Minimax with alpha-beta pruning

20 Uninformed strategies Breadth-first: Expand all nodes at depth d before proceeding to depth d+1 Depth-first: Expand deepest unexpanded node Depth-limited: Depth-first search with a cutoff at a specified depth limit Iterative deepening: Repeated depth-limited searches, starting with a limit of zero and incrementing once each time

21 Breadth-first: Complete? Optimal? Time? Space? Depth-first: Complete? Optimal? Time? Space? Depth-limited: Complete? Optimal? Time? Space? Iterative deepening: Complete? Optimal? Time? Space? Uninformed Search Properties

22 Informed (heuristic) Search What is a “heuristic”? Examples: 8 puzzle Missionaries and Cannibals Tic Tac Toe Traveling Salesman Problem Drug design

23 Best-first greedy search 1.current state = initial state 2. Expand current state 3. Evaluate offspring states s with heuristic h(s), which estimates cost of path from s to goal state 4.current state = argmin s h(s) for s  offspring(current state) 5.If current state ≠ goal state, go to step 2. Travellinganimation.htm

24 Search Terminology Completeness solution will be found, if it exists Optimality least cost solution will be found Admissable heuristic h  s, h never overestimates true cost from state s to goal state Best first greedy search: Complete? Optimal? 8-puzzle heuristics: Hamming distance, Manhattan distance: Admissible? Example of non-admissable heuristic for 8-puzzle?

25 A* Search Uses evaluation function f (n)= g(n) + h(n) where n is a node. 1.g is a cost function Total cost incurred so far from initial state at node n 2.h is an heuristic Best first search is A* with g = 0.

26 h 1 (start state) = h 2 (start state) =

27 A* Pseudocode give code and show example on 8-puzzle

28 A* Pseudocode create the open list of nodes, initially containing only our starting node create the closed list of nodes, initially empty while (we have not reached our goal) { consider the best node in the open list (the node with the lowest f value) if (this node is the goal) { then we're done } else { move the current node to the closed list and consider all of its successors for (each successor) { if (this suceessor is in the closed list and our current g value is lower) { update the successor with the new, lower, g value change the sucessor’s parent to our current node } else if (this successor is in the open list and our current g value is lower) { update the suceessor with the new, lower, g value change the sucessor’s parent to our current node } else this sucessor is not in either the open or closed list { add the successor to the open list and set its g value } } } } Adapted from:

29 A* search is complete, and is optimal if h is admissible

30 Proof of Optimality of A* Suppose a suboptimal goal G 2 has been generated and is in the OPEN list. Let n be an unexpanded node on a shortest path to an optimal goal G 1. G1G1 start G2G2 n f(G 2 ) = g(G2) since h(G 2 ) = 0  g(G 1 ) since G 2 is suboptimal f(G 2 )  f(n) since h is admissible Since f(G 2 )  f(n), A* will never select G 2 for expansion

31 Variations of A* IDA* (iterative deepening A*) ARA* (anytime repairing A*) D* (dynamic A*)

32 (From

33

34

35 Example of Simulated Annealing Netlogo simulation

36 Simulated Annealing is complete (if you run it for a long enough time!)

37 Genetic Algorithms Similar to hill-climbing, but with a population of “initial states”, and stochastic mutation and crossover operations for search.


Download ppt "Problem-solving as search. History Problem-solving as search – early insight of AI. Newell and Simon’s theory of human intelligence and problem-solving."

Similar presentations


Ads by Google