SimulatedAnnealing (and SAMIN) claims "Status Failure", but output seems to be OK?

This seems to be a problem of SAMIN not fitting into Optim’s general scheme for checking convergence. SAMIN does not use gradients, so the gradient check failing may be normal, as SAMIN does not compute or return a gradient. However, its internal convergence criteria do require that the change in the parameter vector and the change in the function value lie within tolerances (either default or user provided). The source code has the lines

            # last value close enough to last neps values?
            fstar[1] = f_old
            test = 0
            for i=1:neps
                test += (abs(f_old - fstar[i]) > f_tol)
            end
            test = (test > 0) # if different from zero, function conv. has failed
            # last value close enough to overall best?
            if (((fopt - f_old) <= f_tol) && (!test))
                # check for bound narrow enough for parameter convergence
                for i = 1:n
                    if (bounds[i] > x_tol)
                        converge = 0 # no conv. if bounds too wide
                        break
                    else
                        converge = 1
                    end
                end
            end

which check for convergence. So, I think that the problem is that SAMIN’s output must not be providing enough information to allow Optim’s general method of checking convergence to work properly.

However, SAMIN has converged to a point inside the bounds if you see

==> Normal convergence <==

The only remaining concern is that the temperature reduction (rt) may be too low, which could cause SAMIN to skip over local minima which may be better than the one that is reported. If in doubt, set rt to a number closer to but less than 1.0. This will increase the time spent, but is safer for irregular objective functions.

1 Like