Skip to content

Instantly share code, notes, and snippets.

@dcbark01
Created May 8, 2018 22:44
Show Gist options
  • Save dcbark01/9643f0a6ae5b3b1dd8ce35a0048b0ca0 to your computer and use it in GitHub Desktop.
Save dcbark01/9643f0a6ae5b3b1dd8ce35a0048b0ca0 to your computer and use it in GitHub Desktop.
# Pseudocode for Simulated Annealing Algorithm
while t_new > stopping temp:
for number of runs at each temp:
x_new, y_new = random neighboring value of x_old, y_old
calculate the cost c_new of this neighboring solution
if c_new – c_old >= 0:
This is a better solution, so move to it
else:
Calculate the probability of moving to the new worse solution
Probability moving = 𝑒^((𝑐_𝑛𝑒𝑀 βˆ’ 𝑐_π‘œπ‘™π‘‘)/𝑑_𝑛𝑒𝑀 )
t_new = t_new * cooling_rate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment