-
Notifications
You must be signed in to change notification settings - Fork 111
Description
Hi, I'm using the newer interface within CppAD to call IPOPT. I need to obtain finite differences at the minimum point. So after I have called IPOPT via CppAD to obtain the minimum solution, I call it twice more, once at a perturbed +eps and perturbed -eps to compute a numerical central finite difference of the solution at the minimum. Since the perturbations are small, from the first solution, I had expected the second two calls to form the finite difference to be quicker, but on inspection of the iterations from IPOPT I see they're basically the same number of iterations, and I effectively call three full optimisation solutions to obtain my derivatives.
To get round this, it would be ideal to call IPOPT as a warm-start for the last two calls that are at perturbed solutions, based on the data from the first call. What would be the best way to explore this at the moment?
My first thought was that currently we're exposed the IPOPT via a function as per the below, albeit behind the scenes a class is built. Would it be sensible to break this function call into the instantiation of a class that we can call solve on, and then from there, the two further solve calls can be called on the class as warm starts?
All of the above is also called in an outer loop for my problem. At the moment within that loop the interface to IPOPT, the function call:
CppAD::ipopt::solve<DVector, Class>(
options, x_i, x_l, x_u, g_l, g_u, *this, soln);
Is constructed on every iteration of the loop, and the loop is large. With an eye on the change suggested above to allow warm starts, an added benefit of not accessing IPOPT via the above function and rather an instantiated class, is that if the use case is correct, I would not need to keep creating and destroying the object within the loop and an additional overhead could be saved.
Could you give some comments to the above to understand, primarily, how to get after warm starts, but also more generally how to interface via CppAD to IPOPT but via a class to minimise repeating work if calling IPOPT many times in a loop?
Many thanks