On Sep 24, 2012, at 12:11 PM, simon wrote:
Hello all,
I am in the process of evaluating SLSQP implementations from the
scipy and NLOpt
libraries for use in a python system I am working on.
We would like to be able to view the internal state of the SLSQP
method as
iterations are completed (mainly to let us do post mortems when long
running
optimisations fail or to let us pause/resume exactly).
I see that the NLOpt SLSQP imp. has methods added to save/restore
the internal
state so:
1) how hard would it be to pass that information back up to the
python layer
(I've not used SWIG before but I imagine its not too tricky)?
It shouldn't be too hard; you could do it in a variety of ways, e.g.
modify the objective function to take an extra parameter which is a
bunch of state. You'd have to be a little careful in converting
pointers to and from Python arrays or similar.
2) would such a patch stand a chance of making it into the NLOpt
mainline or
would this approach 'break' the general nlopt api?
I'd prefer not to change the current API.
If there were some way to supplement the API with additional functions
to save/restore state (which would only work with some algorithms),
without changing the rest of the API, that might be something I'd
consider if it could be done cleanly. For example, if there were an
nlopt_get_state(opt, ....)
nlopt_set_state(opt, ....)
of some kind that you could call to get/set the state in an opaque
way, that might be reasonable. But then it is tricky to figure out
where such a function could be called in general. You could call it
from your objective function, but setting the state might change where
it wants you to evaluate the function, and this gets hairy quickly.
3) I assume here that the state being saved (together with the
original problem
specification) is all you need to resume a SLSQP optimisation exactly?
The state, plus the current point and stopping information (e.g. fcur,
xcur, fprev, and xprev in nlopt_slsqp).
The other alternative is not to modify NLopt at all, and instead to
use some software checkpointing library to save and restore the state
of your whole program. See e.g.
http://en.wikipedia.org/wiki/Application_checkpointing
Steven
_______________________________________________
NLopt-discuss mailing list
[email protected]
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/nlopt-discuss