Presentation is loading. Please wait.

Presentation is loading. Please wait.

Informed Search and Exploration. COSC 159 - Fundamentals of AI2 Overview Heuristic Search Best-First Search Approach Greedy A* Heuristic Functions Local.

Similar presentations


Presentation on theme: "Informed Search and Exploration. COSC 159 - Fundamentals of AI2 Overview Heuristic Search Best-First Search Approach Greedy A* Heuristic Functions Local."— Presentation transcript:

1 Informed Search and Exploration

2 COSC Fundamentals of AI2 Overview Heuristic Search Best-First Search Approach Greedy A* Heuristic Functions Local Search and Optimization Hill-climbing Simulated Annealing Local Beam Genetic Algorithms

3 COSC Fundamentals of AI3 Informed Searching An informed search strategy uses knowledge beyond the definition of the problem The knowledge is embodied in an evaluation function f(n) Estimates the distance of node n from the goal

4 COSC Fundamentals of AI4 Best-First Search An instance of tree or graph search Fringe is ordered by f(n) Several best-first algorithms Greedy, A*, … Key is the heuristic function h(n) Heuristic measures distance from n to goal based solely on the state at n Problem specific Constraint: h(n) = 0 if n is a goal node

5 COSC Fundamentals of AI5 Greedy Best-First Search Expands node estimated to be closest to the goal f(n) = h(n) Consider the route finding problem. Can we use additional information to avoid costly paths that lead nowhere? Consider using the straight line distance (SLD)

6 COSC Fundamentals of AI6 Route Finding

7 COSC Fundamentals of AI7 Route Finding Arad f(n) = 366 TimisoaraSibiuZerind Arad Rimnicu Vilcea OradeaFagaras BucharestSibiu 0253

8 COSC Fundamentals of AI8 Exercise So is Arad->Sibiu->Fagaras->Bucharest optimal?

9 COSC Fundamentals of AI9 Greedy Best-First Search Not optimal. Not complete. Could go down a path and never return to try another. Time Complexity O(b m ) Space Complexity O(b m )

10 COSC Fundamentals of AI10 A* Search The greedy best-first search does not consider how costly it was to get to a node. Combine g(n), the cost to reach node n, with h(n) f(n) = g(n) + h(n) estimated cost of cheapest solution through n

11 COSC Fundamentals of AI11 Route Finding

12 COSC Fundamentals of AI12 A* Search Arad f(n) = TimisoaraSibiuZerind = Arad Rimnicu Vilcea OradeaFagaras Things are different now!

13 COSC Fundamentals of AI13 A* Search Continued Arad Rimnicu Vilcea OradeaFagaras Sibiu Bucharest 450 PitestiSibiuCraiova Craiova 615 Rimnicu Vilcea 607 Bucharest 418

14 COSC Fundamentals of AI14 A* Search When used with tree search Optimal Yes! If h(n) is an admissible heuristic Complete Yes! Same as above. Time and Space Complexity Depends on h(n) Subexponential if where h*(n) is true cost of getting from n to goal Optimally efficient

15 COSC Fundamentals of AI15 Admissible Heuristics A heuristic function h(n) is admissible if it never overestimates the cost to reach the goal from n Is SLD an admissible heuristic? Another property of heuristic functions is consistency h(n)c(n,a,n’)+h(n’) where c(n,a,n’) is the cost to get to n’ from n using action a. Graph search is optimal if h(n) is consistent. Is SLD consistent?

16 COSC Fundamentals of AI16 Heuristic Functions h1 = number of misplaced tiles h2 = sum of distances of tiles to goal position.

17 COSC Fundamentals of AI17 Heuristic Functions Is h1 admissible? consistent? Is h2 admissible? consistent?

18 COSC Fundamentals of AI18 Heuristic Functions Heuristics are often obtained from relaxed problem Simplify the original problem by removing constraints The cost of an optimal solution to a relaxed problem is an admissible heuristic.

19 COSC Fundamentals of AI19 8-Puzzle Original A tile can move from A to B if A is horizontally or vertically adjacent to B and B is blank. Relaxations Move from A to B if A is adjacent to B h2 by moving each tile in turn to destination Move from A to B if B is blank Move from A to B h1 by simply moving each tile directly to destination.

20 COSC Fundamentals of AI20 8-Puzzle What heuristic is obtained from Move from A to B if B is blank? Gaschnig’s heuristic (1979)

21 COSC Fundamentals of AI21 More Complicated Monkey and Banana Suppose now that the bananas are hung from the ceiling and the monkey needs to climb on a box to get the bananas. In addition, walls exist in the environment. Box, monkey, and bananas placed randomly Monkey can see the entire world. Actions: N,S,E,W,Grab,Drop,Climb,Eat

22 COSC Fundamentals of AI22 Monkey and Banana Describe the problem as a search problem. Initial state, successor function, goal, path cost In what way(s) can we relax the problem to obtain a heuristic?

23 COSC Fundamentals of AI23 Dominating Heuristics If h 2 (n)  h 1 (n) for all n, then h 2 dominates h 1 h 2 is better for use with searching For the 8-puzzle, h 2 does dominate h 1 If a tile is out of place, it is at least a distance of 1 away from its correct position. Since h 1 counts the number of out of place tiles, and h 2 totals all of the distances, h 2 (n)  h 1 (n) for all n.

24 COSC Fundamentals of AI24 Optimization Problems Idea is to find the best state. We don’t really care how to get to the best state, just that we get there. The best state is defined according to an objective function Measures the “fitness” of a state. Problem: Find the optimal state The one that maximizes (or minimizes) the objective function.

25 COSC Fundamentals of AI25 State Space Landscapes Objective Function State Space shoulder global max local max

26 COSC Fundamentals of AI26 State Space Landscapes

27 COSC Fundamentals of AI27 Problem Formulation Complete-state formulation Start with an approximate solution and perturb n-queens problem Place n queens on a board so that no queen is attacking another queen.

28 COSC Fundamentals of AI28 Problem Formulation Initial State: n queens placed randomly on the board, one per column. Successor function: States that obtained by moving one queen to a new location in its column. Heuristic/objective function: The number of pairs of attacking queens.

29 COSC Fundamentals of AI29 n-Queens

30 COSC Fundamentals of AI30 Phasor Measurement Unit Problem formulation?

31 COSC Fundamentals of AI31 Local Search Algorithms Hill climbing Simulated annealing Local beam search Genetic Algorithms

32 COSC Fundamentals of AI32 Hill Climbing (or Descent) Objective Function State Space

33 COSC Fundamentals of AI33 Hill Climbing Pseudo-code

34 COSC Fundamentals of AI34 Hill Climbing Problems Objective Function State Space

35 COSC Fundamentals of AI35 Other Problematic Spaces

36 COSC Fundamentals of AI36 n-Queens What happens if we move 3rd queen?

37 COSC Fundamentals of AI37 Possible Improvements Stochastic hill climbing Choose at random from uphill moves Probability of move could be influenced by steepness First-choice hill climbing Generate successors at random until one is better than current. Random-restart Execute hill climbing several times, choose best result. If p is probability of a search succeeding, then expected number of restarts is 1/p.

38 COSC Fundamentals of AI38 Simulated Annealing Similar to stochastic hill climbing Moves are selected at random If a move is an improvement, accept Otherwise, accept with probability less than 1. Probability gets smaller as time passes and by the amount of “badness” of the move.

39 COSC Fundamentals of AI39 Simulated Annealing Algorithm Success

40 COSC Fundamentals of AI40 Traveling Salesperson Problem (TSP) Tour of cities Visit each one exactly once Minimize distance/cost/etc.

41 COSC Fundamentals of AI41 TSP State: Permutation of cities Successors: Any permutation reached by swapping two cities Could be others. Objective function: Total distance/cost/etc.

42 COSC Fundamentals of AI42 TSP By Simulated Annealing Key is identifying proper schedule Requires experimentation One possible schedule Start T at some value k After 1000*N successes, let T=.90*T, where N is the number of cities.

43 COSC Fundamentals of AI43 Local Beam Search Keep k states in memory instead of just one Generate successors of all k states If one is a goal, return the goal Otherwise, take k best successors and repeat.

44 COSC Fundamentals of AI44 Local Beam Search Concentrates on promising paths

45 COSC Fundamentals of AI45 Local Beam Search Initial k states may not be diverse enough Could have clustered around a local max. Improvement is stochastic beam search Choose k states at random, with probability of choice an increasing function of its value.

46 COSC Fundamentals of AI46 Genetic Algorithms Variant of stochastic beam search Successor states are generated by combining two parent states Hopefully improves diversity Start with k states, the population Each state, or individual, represented as a string over a finite alphabet (e.g. DNA) Each state is rated by a fitness function Select parents for reproduction using the fitness function

47 COSC Fundamentals of AI47 Genetic Algorithms Taken from

48 COSC Fundamentals of AI48 A Genetic Algorithm

49 COSC Fundamentals of AI49 Genetic Algorithm for PMU Each state is represented as a binary string 1 in location n represents PMU on node n Fitness function (nodes+edges observed)/# of PMUs

50 COSC Fundamentals of AI50 Just Some Chess Pieces


Download ppt "Informed Search and Exploration. COSC 159 - Fundamentals of AI2 Overview Heuristic Search Best-First Search Approach Greedy A* Heuristic Functions Local."

Similar presentations


Ads by Google