title: nloptr optimization stops before maxeval steps even when {x,f}tol_{rel,abs} are all set to 0
body: <p>I am looking at the example given in <a href="https://cran.r-project.org/web/packages/nloptr/nloptr.pdf" rel="nofollow noreferrer">the manual of nloptr</a>.</p>
  
  <p>I replaced the last part of the code by</p>
  
  <pre><code>local_opts &lt;- list( "algorithm" = "NLOPT_LD_MMA",
                      "xtol_rel" = 0.0,
                      "ftol_rel" = 0.0,
                      "ftol_abs" = 0.0,
                      "xtol_abs" = 0.0)
  opts &lt;- list( "algorithm" = "NLOPT_LD_AUGLAG",
                "xtol_rel" = 0.0,
                "ftol_rel" = 0.0,
                "ftol_abs" = 0.0,
                "xtol_abs" = 0.0,
                "maxeval" = 100000,
                "local_opts" = local_opts )
  res &lt;- nloptr( x0=x0,
                 eval_f=eval_f,
                 lb=lb,
                 ub=ub,
                 eval_g_ineq=eval_g_ineq,
                 eval_g_eq=eval_g_eq,
                 opts=opts)
  print( res )
  </code></pre>
  
  <p>That is, I changed xtol/ftol rel/abs to all be 0, for both the main solver and the local solver.Note both of them use gradient based algorithm.  I also increased the max number of steps from 1k to 100k. </p>
  
  <p>However the solver terminates much earlier, at 3k steps.</p>
  
  <blockquote>
    <p>Call: nloptr(x0 = x0, eval_f = eval_f, lb = lb, ub = ub, eval_g_ineq =
    eval_g_ineq, 
        eval_g_eq = eval_g_eq, opts = opts)</p>
    
    <p>Minimization using NLopt version 2.4.2 </p>
    
    <p>NLopt solver status: 3 ( NLOPT_FTOL_REACHED: Optimization stopped
    because ftol_rel or  ftol_abs (above) was reached. )</p>
    
    <p>Number of Iterations....: 3132  Termination conditions:  xtol_rel:
    0 ftol_rel: 0 ftol_abs: 0 xtol_abs: 0 maxeval: 1e+05  Number of
    inequality constraints:  1  Number of equality constraints:    1 
    Optimal value of objective function:  17.0140172891563  Optimal value
    of controls: 1 4.743 3.82115 1.379408</p>
  </blockquote>
  
  <p>Looking at the <a href="https://github.com/stevengj/nlopt/blob/master/util/stop.c#L32" rel="nofollow noreferrer">c++ implementation of nlopt</a>, it seems that this should not happen. The termination conditions given by the various tolerance levels are in terms of strict inequality. So am I missing something about the meaning of the solver status "NLOPT_FTOL_REACHED: Optimization stopped because ftol_rel or ftol_abs (above) was reached." ?</p>
  
  <p>Thanks!
    John</p>