I am trying to optimize a function using the mystic library in Python, and have a general question about the gtol parameter.
The parameter space I'm searching in, is of high dimension (30-40), and for this reason, it seemed fitting for me to set gtol = 40000. Strangely, the algorithm seems to stop after 30000 iterations, although I specified the gtol as 40000, which (by my knowledge) means that the algorithm should have 40000 identical iterations before it stops running.
My function call is pretty basic:
stepmon = VerboseLoggingMonitor(1, 1)
result = diffev2(utilss, x0=[1/value]*value, bounds=[(0,0.2)] * value, npop=150, gtol=40000, disp=True, full_output=True, itermon=stepmon
I checked the merit function's evolution, and it is flat around the 29000th iteration. The last 1000 iterations are identical, but it already stops there instead of running the rest of the 39000 required gtol iterations.
Am I misinterpreting the gtol parameter? Or what am I missing here?
Thanks in advance.
I'm the mystic
author. That is the correct interpretation for gtol
, however, you are probably ignoring maxiter
(and maxfun
) which is the maximum number of iterations (and function evaluations) to perform.
If you don't set maxiter
(default is None
), then the I believe that the default setting for diffev2
is 10 * nDim * nPop
. Try setting maxiter=100000
, or something like that.
If the termination message says Warning: Maximum number of iterations has been exceeded
, then maxiter
caused it to stop.