Set S to a random state
Set T to starting temperature
while T > 0
  select S' in neighborhood of S by random
  if h(S') >= h(S)
     then S = S'
     else S = S' with probability e^(h(S')-h(S))/T
  adjust T
endwhile
simulated annealing algorithm

The adjust T could decrease the temperature each step. Another version is to keep T the same until h(S) does not change more than epsilon for n steps, then decrease T. Another version is there is table of temperature based on the step number.

The selection of S' could be random across the space of interest. It can also be based on the current point S. For this assume a function, will call arm, to give the length of search. This function will be based on T. The select then becomes

  theta = 360 *random(0,1)
  distance = arm(T) * random(0,1)
  move distance from S in direction theta