CS156
Chris Pollett
Sep 21, 2022
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
| 9 | 8 | 7 |
| 6 | 5 | 4 |
| 3 | 2 | 1 @ |
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)