title: Simulated Annealing in R: GenSA running time
body: <p>I am using simulated annealing, as implemented in R's package <code>GenSa</code> (function <code>GenSA</code>), to search for values of input variables that result in "good values" (compared to some baseline) of a highly dimensional function. I noticed that setting maximum number of calls of the objective function has no effect on the running time. Am I doing something wrong or is this a bug? </p>
  
  <p>Here is a modification of the example given in <code>GenSA</code> help file. </p>
  
  <pre><code>library(GenSA)
  
  Rastrigin &lt;- local({ 
    index &lt;- 0  
    function(x){    
      index &lt;&lt;- index + 1    
      if(index%%1000 == 0){
        cat(index, "   ")
      }    
      sum(x^2 - 10*cos(2*pi*x)) + 10*length(x)    
    }  
  })
  
  set.seed(1234)
  dimension &lt;- 1000
  lower &lt;- rep(-5.12, dimension)
  upper &lt;- rep(5.12, dimension)
  out &lt;- GenSA(lower = lower, upper = upper, fn = Rastrigin, control = list(max.call = 10^4))
  </code></pre>
  
  <p>Even though the <code>max.call</code> is specified to be 10,000, <code>GenSA</code> calls the objective function more than 46,000 times (note that the objective is called within a local environment in order to track the number of calls). The same problem rises when trying to specify the maximum running time via <code>max.time</code>.</p>