I am trying to create the Simulated Annealing algorithm in excel to maximise:

f(x) = x^{3}-39x^{2}+144x-100 Subject to the condition 0≤x≤31 (iteration number n=50 and the temperature setting is T_{0}=10, T_{n}=0.99*T_{n-1}).

Using a normally distributed neighbourhood N(0, 1^{2}) with initial value from N(15, 1^{2})

To start, I have Zc = f(15) = -3340

I have then randomly generated a value using =NORMINV(RAND(),K5,K6) where K5=15 (the mean) and K6=5.167 (standard deviation=(31-0)/6*1). This value is then added to Zc to get Zn.

For T_{1}=0.99*10=9.9

(Zn-Zc)/T is then calculated, from which e^{(Zn-Zc)/T} is calculated. Now if Zn < Zc then we accept the new value Zn with probability, if Zn > Zc we accept the new Zn only.

What do i do now? Am i supposed to have 50 iterations? How will i do the next iterations?