Figure 1 Simulated annealing pseudocode

establish the control parameter values
generate a random starting configuration
compute the cost, E, of the current configuration
do
  do
    swap two distinct plants
    compute the cost, E2, of the new configuration
    if E2 less than or equal to E
      accept the new configuration
      increment the accept counter
    else
      if the increase is acceptable (Metropolis criterion)
        accept the new configuration
        increment the accept counter
      else
        reject the new configuration and restore the old one
         increment the reject counter
      end-if
    end-if
  until either the accept counter or reject counter is too large
until no improvements have been made for the last few passes