Skip to content

Instantly share code, notes, and snippets.

@Iron-Ham
Created September 30, 2015 00:45
Show Gist options
  • Save Iron-Ham/b1b079c53f4f12f40455 to your computer and use it in GitHub Desktop.
Save Iron-Ham/b1b079c53f4f12f40455 to your computer and use it in GitHub Desktop.
# schedule = mapping function from time to temperature
func SIMULATED_ANNEALING(problem, schedule)
current <- MAKE_NODE(problem.INITIAL_STATE)
for t = 1 to INF do
T <- schedule(t)
if T = 0 then return current
next <- randomly selected successor of current
deltaE <- next.VALUE - current.VALUE
if deltaE > 0 then current <- next
else current <- next only with probability e^(deltaE/T)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment