Download presentation

Presentation is loading. Please wait.

1
**Informed Search and Exploration**

2
**COSC 159 - Fundamentals of AI**

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

3
**COSC 159 - Fundamentals of AI**

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 COSC Fundamentals of AI

4
**COSC 159 - Fundamentals of AI**

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 COSC Fundamentals of AI

5
**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) The evaluation function is just the heuristic function. Thus, the evaluation function is based solely on the state at n. COSC Fundamentals of AI

6
**COSC 159 - Fundamentals of AI**

Route Finding 374 253 366 329 This shows the difference between straight line distances and other distances… COSC Fundamentals of AI

7
**COSC 159 - Fundamentals of AI**

Route Finding Arad f(n) = 366 Timisoara Sibiu Zerind 374 329 253 Arad Rimnicu Vilcea Oradea Fagaras 366 176 380 193 How many expansions do we do? 3 How many goal tests? 4 Bucharest Sibiu 253 COSC Fundamentals of AI

8
**COSC 159 - Fundamentals of AI**

Exercise No. Arad->Sibiu->Rimnicu Vilcea->Pitesti->Bucharest is shorter. So is Arad->Sibiu->Fagaras->Bucharest optimal? COSC Fundamentals of AI

9
**Greedy Best-First Search**

Not optimal. Not complete. Could go down a path and never return to try another. Time Complexity O(bm) Space Complexity COSC Fundamentals of AI

10
**COSC 159 - Fundamentals of AI**

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 COSC Fundamentals of AI

11
**COSC 159 - Fundamentals of AI**

Route Finding COSC Fundamentals of AI

12
**A* Search Arad Timisoara Sibiu Zerind Arad Oradea Fagaras**

f(n) = Timisoara Sibiu Zerind 449 447 393 = Arad Rimnicu Vilcea Oradea Fagaras 646 415 671 413 Things are different now! COSC Fundamentals of AI

13
**COSC 159 - Fundamentals of AI**

A* Search Continued Arad Fagaras Oradea Rimnicu Vilcea 646 415 671 413 591 Sibiu Bucharest 450 Pitesti Sibiu Craiova 526 417 553 Only Bucharest with f(n) = 418 is tested to be a goal state. Craiova 615 Rimnicu Vilcea 607 Bucharest 418 COSC Fundamentals of AI

14
**COSC 159 - Fundamentals of AI**

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 COSC Fundamentals of AI

15
**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? COSC Fundamentals of AI

16
**COSC 159 - Fundamentals of AI**

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

17
**COSC 159 - Fundamentals of AI**

Heuristic Functions Is h1 admissible? consistent? Is h2 COSC Fundamentals of AI

18
**COSC 159 - Fundamentals of AI**

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. COSC Fundamentals of AI

19
**COSC 159 - Fundamentals of AI**

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. COSC Fundamentals of AI

20
**COSC 159 - Fundamentals of AI**

8-Puzzle What heuristic is obtained from Move from A to B if B is blank? Gaschnig’s heuristic (1979) Smallest number of moves it would take to rearrange tiles to goal configuration. For this start state, it’s 6. COSC Fundamentals of AI

21
**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 COSC Fundamentals of AI

22
**COSC 159 - Fundamentals of AI**

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? The easiest way to relax the problem is to ignore the fact that walls are there. COSC Fundamentals of AI

23
**Dominating Heuristics**

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

24
**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. COSC Fundamentals of AI

25
**State Space Landscapes**

Objective Function global max local max This is a visualization of a state space. Of course, real state space landscapes have much higher dimension. shoulder State Space COSC Fundamentals of AI

26
**State Space Landscapes**

COSC Fundamentals of AI

27
**COSC 159 - Fundamentals of AI**

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. COSC Fundamentals of AI

28
**COSC 159 - Fundamentals of AI**

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. COSC Fundamentals of AI

29
**COSC 159 - Fundamentals of AI**

n-Queens 4 4 4 4 5 4 3 5 2 5 2 5 3 3 3 2 3 2 3 2 3 2 4 1 COSC Fundamentals of AI

30
**Phasor Measurement Unit**

Problem formulation? COSC Fundamentals of AI

31
**Local Search Algorithms**

Hill climbing Simulated annealing Local beam search Genetic Algorithms COSC Fundamentals of AI

32
**Hill Climbing (or Descent)**

Objective Function State Space COSC Fundamentals of AI

33
**Hill Climbing Pseudo-code**

COSC Fundamentals of AI

34
**Hill Climbing Problems**

Objective Function State Space COSC Fundamentals of AI

35
**Other Problematic Spaces**

COSC Fundamentals of AI

36
**COSC 159 - Fundamentals of AI**

n-Queens 4 4 4 4 5 4 3 5 2 5 2 5 3 3 3 2 3 2 3 2 3 2 4 1 What happens if we move 3rd queen? COSC Fundamentals of AI

37
**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. COSC Fundamentals of AI

38
**COSC 159 - Fundamentals of AI**

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. COSC Fundamentals of AI

39
**Simulated Annealing Algorithm**

Success COSC Fundamentals of AI

40
**Traveling Salesperson Problem (TSP)**

Tour of cities Visit each one exactly once Minimize distance/cost/etc. COSC Fundamentals of AI

41
**COSC 159 - Fundamentals of AI**

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

42
**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. COSC Fundamentals of AI

43
**COSC 159 - Fundamentals of AI**

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. COSC Fundamentals of AI

44
**Local Beam Search Concentrates on promising paths**

COSC Fundamentals of AI

45
**COSC 159 - Fundamentals of AI**

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. COSC Fundamentals of AI

46
**COSC 159 - Fundamentals of AI**

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 COSC Fundamentals of AI

47
**COSC 159 - Fundamentals of AI**

Genetic Algorithms Taken from Taken from COSC Fundamentals of AI

48
**COSC 159 - Fundamentals of AI**

A Genetic Algorithm COSC Fundamentals of AI

49
**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 COSC Fundamentals of AI

50
**COSC 159 - Fundamentals of AI**

Just Some Chess Pieces COSC Fundamentals of AI

Similar presentations

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google