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

f(x) = x3-39x2 +144x-100 Subject to the condition 0≤x≤31 (iteration number n=50 and the temperature setting is T0=10, Tn=0.99*Tn-1).

Using a normally distributed neighbourhood N(0, 12) with initial value from N(15, 12)

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 T1=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?