Local Search, Hill Climbing, Minimax




CS156

Chris Pollett

Sep 21, 2022

Outline

Local Search

Hill Climbing

function HILL_CLIMBING(problem) returns a state that is a local maximum
    current := MAKE_NODE(problem, INITIAL-STATE)
    loop do
        neighbor := a highest-valued successor of current
        if(neighbor.value ≤ current.value) return current.state
        current := neighbor

Hill Climbing

two 8-queens boards, one with h=17, one with h=1

Variants of Hill-Climbing

In-Class Exercise

987
654
321 @

Simulated Annealing

Simulated Annealing Algorithm

function SIMULATED-ANNEALING(problem, schedule) returns a solution state
    inputs: problem, a problem
            schedule, a mapping from time "temperature"
    current := MAKE-NODE(problem.INITIAL_STATE)
    for t = 1 to infty do
        T := schedule(t) //typically as t gets larger schedule(t) is smaller
        if(T == 0) return current //when Temperature is 0 return state
        next := a randomly selected successor of current
        DeltaE := next.value - current.value //estimated change in energy
        if(DeltaE < 0) current := next 
        else current := next with probability e^(-DeltaE/T)

Local Beam Search

Local Search via Genetic Algorithms

8-queen GA example