CSE 4705 Artificial Intelligence Jinbo Bi Department of Computer Science & Engineering http://www.engr.uconn.edu/~jinbo
Informed search strategies
Dominance
Iterative deepening A* and beyond
Iterative deepening A* and beyond
Informed search II When A* fails – hill climbing, simulated annealing Genetic algorithms
Outline
Local search and optimization
Hill climbing
Hill climbing on a surface of states
Hill climbing search
Hill climbing search example 4
Hill climbing search example: n-queens
Hill climbing search example: 8-queens
Hill climbing search space features
Hill climbing (variant) If we only know the function value at a state x, Hill Climbing ( or downhill) If besides the function value, we can compute gradient, Gradient ascent ( or descent)
Hill climbing (variant) If we only know the function value at a state x, and the state space is finite Hill Climbing ( or downhill) If besides the function value, we can compute gradient, and the state space is continuous Gradient ascent ( or descent)
Gradient ascent/descent Requires line search to decide a step size: (1) exact line search, solve a one-dimensional optimization problem (2)inexact line search (Armijo-Goldstein)
Gradient ascent/descent example min f(x,y) = (x-2)2 + (y-3)2 Initial guess is (1,1), find the optimal solution. Compute gradient f’(x,y) = ( 2(x-2), 2(y-3) ) f’(1,1) = (-2, -4) Set x = (1,1) – s * (-2,-4) Do a line search to find s g(s) = (2s-1)2 + (4s-2)2 = 20s2 – 20s + 5 g’(s) = 40s – 20 = 0 s = 0.5 Hence, x = (2, 3) Check if x is the fixed point
Gradient ascent/descent example From wikipedia
Gradient ascent/descent example
Gradient methods vs. Newton’s method
Drawbacks of hill climbing Local Maxima: peaks that are not the highest point in the space Plateaus: the space has a broad flat region that gives the search algorithm no direction (random walk) Ridges: drop-offs to the sides; steps to the North, East, South and West may go down, but a step to the NW may go up.
Example of a local maximum
The Shape of an Easy Problem (Convex)
The Shape of a Harder Problem
The Shape of an even Harder Problem
Random restart – a remedy to the drawbacks
Local beam search
Simulated annealing
Simulated annealing (SA)
Simulated annealing (SA)
Simulated annealing algorithm Example of simulated annealing https://www.youtube.com/watch?v=VWtYLv-4oP0 Example codes http://www.theprojectspot.com/tutorial-post/simulated-annealing-algorithm-for-beginners/6
Simulated annealing example h = 1, t=1, T = T0/2 = 50 Because T ~= 0, so Next = a random move Δ E = E1 – E0 = 1 If Δ E < 0, Current = Next Else compute p = e (- Δ E/T) =0.98 Generate a random number r from a uniform [0,1] Assume r = 0.8 Then, Current = Next Initial state T0 = 100 Annealing schedule is T T/2
Simulated annealing example h = 1, t=1, T = T0/2 = 50 Because T ~= 0, so Next = a random move Δ E = E1 – E0 = 1 If Δ E < 0, Current = Next Else compute p = e (- Δ E/T) =0.98 Generate a random number r from a uniform [0,1] Assume r = 0.8 Then, Current = Next Initial state T0 = 100 Annealing schedule is T T/2
Simulated annealing (variant) Another annealing scheduling
Genetic algorithms
Genetic algorithms
Representation: strings of genes
Encoding of a chromosome
Example: genetic algorithms for drive train
Operations: crossover
Operations: mutation
The basic genetic algorithm A short video explains GA in 3 minutes https://www.youtube.com/watch?v=ejxfTy4lI6I
Genetic algorithm: 8-queens
Questions?