Download presentation

Presentation is loading. Please wait.

Published byIrene Atkinson Modified over 2 years ago

1
CMPT 463

2
What will be covered A* search Local search Game tree Constraint satisfaction problems (CSP)

3
Types of Questions T or F Short answers Homework questions (A*, MiniMax, pruning..)

4
A * search Best-known form of best-first search. Idea: avoid expanding paths that are already expensive Evaluation function f(n) = g(n) + h(n) g(n) = cost so far to reach n h(n) = estimated cost from n to goal f(n) = estimated total cost of path through n to goal

5
Admissible heuristics A heuristic h(n) is admissible if for every node n, h(n) ≤ h * (n), where h * (n) is the true cost to reach the goal state from n. An admissible heuristic never overestimates the cost to reach the goal Example: h SLD (n) (never overestimates the actual road distance)

6
A* Search Complete Yes, unless there are infinitely many nodes with f <= f(G) Time Exponential in [relative error of h x length of soln] The better the heuristic, the better the time Best case h is perfect, O(d) Worst case h = 0, O(b d ) same as BFS Space Keeps all nodes in memory and save in case of repetition This is O(b d ) or worse A* usually runs out of space before it runs out of time Optimal Yes, cannot expand f i+1 unless f i is finished

7
Manhattan distances

8
Heuristic Function Function h(N) that estimate the cost of the cheapest path from node N to goal node. Example: 8-puzzle 123 456 78 12 3 4 5 67 8 N goal h 2 (N) = sum of the distances of every tile to its goal position = 2 + 3 + 0 + 1 + 3 + 0 + 3 + 1 = 13

9
Local search algorithms In many optimization problems, the path to the goal is irrelevant; the goal state itself is the solution. e.g., n-queens. We can use local search algorithms: keep a single "current" state, try to improve it generally move to neighbors The paths are not retained 9

10
Hill-climbing search Problem: depending on initial state, can get stuck in local maxima.

11
Some solutions allow a sideways move shoulder flat local maximum, that is not a shoulder 11

12
Some solutions Solution: a limit on the number of consecutive sideway moves E.g., 100 consecutive sideways movies in the 8-queens problem successful rate: raises from14% to 94% cost: 21 steps on average for each successful instance, 64 for each failure 12

13
Some more solutions (Variants of hill climbing ) Stochastic hill climbing chooses at random from among the uphill moves converge more slowly, but finds better solutions Random-restart hill climbing “If you don’t succeed, try, try again.” Keep restarting from randomly generated initial states, stopping when goal is found

14
Simulated Annealing Picks a random move (instead of the best) If “good move” accepted; else accepted with some probability The probability decreases exponentially with the “badness” of the move It also decreases as temperature “T” goes down

15
Local Beam Search Idea: keep k states instead of 1; choose top k of all their successors Not the same as k searches run in parallel! Searches that find good states recruit other searches to join them moves the resources to where the most progress is being made

16
Minimax The minimax value of a node is the utility (for Max) of being in the corresponding state, assuming that both players play optimally. Minimax(s) = Utility (s)if Terminal-test(s) max of Minimax(Result(s,a)) if Player(s) = Max min of Minimax(Result(s,a))if Player(s) = Min

17
Optimal Play MAX MIN This is the optimal play 271 8 271 8 2 271 8 21 271 8 21 2 271 8

18
Alpha-Beta Example [-∞, +∞] Range of possible values Do DFS until first leaf

19
Alpha-Beta Example (continued) [-∞,3] [-∞,+∞]

20
Alpha-Beta Example (continued) [-∞,3] [-∞,+∞]

21
Alpha-Beta Example (continued) [3,+∞] [3,3]

22
Alpha-Beta Example (continued) [-∞,2] [3,+∞] [3,3] This node is worse for MAX

23
Alpha-Beta Example (continued) [-∞,2] [3,14] [3,3][-∞,14],

24
Alpha-Beta Example (continued) [−∞,2] [3,5] [3,3][-∞,5],

25
Alpha-Beta Example (continued) [2,2] [−∞,2] [3,3]

26
Alpha-Beta Example (continued) [2,2] [-∞,2] [3,3]

27
27 Example: Map-Coloring Variables WA, NT, Q, NSW, V, SA, T Domains D i = {red, green, blue} Constraints: adjacent regions must have different colors e.g., WA ≠ NT, or (WA,NT) in {(red,green),(red,blue),(green,red), (green,blue),(blue,red),(blue,green)}

28
28 Example: Map-Coloring Solutions are complete and consistent assignments, e.g., WA = red, NT = green, Q = red, NSW = green, V = red, SA = blue, T = green

29
29 Varieties of constraints Unary constraints involve a single variable, e.g., SA ≠ green Binary constraints involve pairs of variables, e.g., SA ≠ WA Higher-order constraints involve 3 or more variables, e.g., cryptarithmetic column constraints

30
30 Example: Cryptarithmetic Variables: F T U W R O X 1 X 2 X 3 Domains: {0,1,2,3,4,5,6,7,8,9} Constraints: Alldiff (F,T,U,W,R,O) O + O = R + 10 · X 1 X 1 + W + W = U + 10 · X 2 X 2 + T + T = O + 10 · X 3 X 3 = F, T ≠ 0, F ≠ 0

31
Sudoku 93 26159 35824 948 6291 523 97153 38741 58

32
Example: Sudoku CSP variables: X 11, …, X 99 domains: {1,…,9} constraints: row constraint: X 11 X 12, …, X 11 X 19 col constraint: X 11 X 12, …, X 11 X 19 block constraint: X 11 X 12, …, X 11 X 33 Goal: Assign a value to every variable such that all constraints are satisfied

33
33 Most constrained variable Most constrained variable: choose the variable with the fewest legal values a.k.a. minimum remaining values (MRV) heuristic

34
34 Most constraining variable Tie-breaker among most constrained variables Most constraining variable (degree heuristics): choose the variable with the most constraints on remaining variables

35
35 Least constraining value Given a variable, choose the least constraining value: the one that rules out the fewest values in the remaining variables Combining these heuristics makes 1000 queens feasible

36
36 Forward checking Idea: Keep track of remaining legal values for unassigned variables Terminate search when any variable has no legal values

37
37 Forward checking Idea: Keep track of remaining legal values for unassigned variables Terminate search when any variable has no legal values

38
38 Forward checking Idea: Keep track of remaining legal values for unassigned variables Terminate search when any variable has no legal values

39
39 Forward checking Idea: Keep track of remaining legal values for unassigned variables Terminate search when any variable has no legal values

Similar presentations

OK

Informed search algorithms Chapter 4. Best-first search Idea: use an evaluation function f(n) for each node –estimate of "desirability" Expand most.

Informed search algorithms Chapter 4. Best-first search Idea: use an evaluation function f(n) for each node –estimate of "desirability" Expand most.

© 2018 SlidePlayer.com Inc.

All rights reserved.

To make this website work, we log user data and share it with processors. To use this website, you must agree to our Privacy Policy, including cookie policy.

Ads by Google

Ppt on pricing policy document Ppt on indian primary resources Ppt on area of parallelogram and triangles class 9 Ppt on creativity and innovation management syllabus Ppt on milk products for students Html tutorial free download ppt on pollution Ppt on remote operated spy robot controller Lecture ppt on digital image processing Ppt on structures in civil engineering Ppt on applied operational research definition