Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
while outer_condition()
while inner_condition()
[a, b] = pick2()
delta = swap a, b
if delta < 0 or Math.random() < Math.exp(-(delta + 1) / T)
cost += delta
swap a, b # revert
T *= C
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment