Two programs are attached: sa_demo demonstrates how the simualted annealing works for simple functions, while sa_mincon solves a welded beam design problem using simulated annealing, which can easily be used to solve other constrained optimization problems in engineering design.
The code works as expected. Thank you.
The main loop checks the following:
((T > T_min) && (j <= max_rej) && E_new>F_min)
but as far as I can see j is not incremented in any place and is only set back to zero if a solution is accepted. Any easy fix, but something to note if you plan to use this code.
a nice one
Please use the latest version as the update (a more robust version is provided)