Fundamental idea: A change of scale, called **temperature**, allows for faster moves on the surface of the function of $h$ to maximize, whose negative is called **energy**.

It is important to note that if the larger $T$ is, accepting one decreasing is more likely.

Example: To maximize $h(x)=[\cos(50x)+\sin(20x)]^2$.

We can use the following Julia code to solve this problem:

r = 0.5function T(t)return 1/log(t)end# target functionfunction h(x)return (cos(50x) + sin(20x))^2endN = 2500x = ones(N)y = ones(N)for t = 1:(N-1)# step 1at = max(x[t]-r, 0)bt = min(x[t]+r, 1)u = rand() * (bt - at) + at# step 2rho = min(exp( (h(u) - h(x[t])) / T(t) ), 1)if rand() < rhox[t+1] = uy[t+1] = h(u)elsex[t+1] = x[t]y[t+1] = y[t]endend

The trajectory of 2500 pairs $(x^{(t)}, y^{(t)})$ is