[Ipopt] Problems using the intermediate callback in the Optimization Services implementation

Andreas Lundell andreas.lundell at abo.fi
Thu Jan 8 07:24:56 EST 2015


Hi,

Is it possible in some way to use the intermediate callback 
functionality in Ipopt when accessing it through Optimization Services 
in COIN-OR, i.e. the IpoptSolver class defined in OSIpoptSolver.h?

The callback function is accessible but I have so far been unsuccessful 
at overriding it using my own implementation. The code below is the 
relevant part of the program, and everything compiles and executes just 
fine with the exception that the callback function is never executed.

The reason I am asking is that I want to have Ipopt terminating at the 
first feasible solution to an NLP problem, and my hope is that using the 
intermediate callback would be the means to accomplish this. Other 
suggestions are also welcome...

== NLPIpoptSolver.h ==========================

#include "OSIpoptSolver.h"

using namespace Ipopt;

class NLPIpoptSolver : public IpoptSolver
{
public:
     NLPIpoptSolver();
     ~NLPIpoptSolver();

     virtual bool intermediate_callback(AlgorithmMode mode,
         Index iter, Number obj_value,
         Number inf_pr, Number inf_du,
         Number mu, Number d_norm,
         Number regularization_size,
         Number alpha_du, Number alpha_pr,
         Index ls_trials,
         const IpoptData* ip_data,
         IpoptCalculatedQuantities* ip_cq);
};

== NLPIpoptSolver.cpp ========================

#include "NLPIpoptSolver.h"

NLPIpoptSolver::NLPIpoptSolver(){}

NLPIpoptSolver::~NLPIpoptSolver(){}

bool NLPIpoptSolver::intermediate_callback(AlgorithmMode mode,
     Index iter, Number obj_value,
     Number inf_pr, Number inf_du,
     Number mu, Number d_norm,
     Number regularization_size,
     Number alpha_du, Number alpha_pr,
     Index ls_trials,
     const IpoptData* ip_data,
     IpoptCalculatedQuantities* ip_cq)
{
     // Do something...
     return true;
}

==========================================

Regards,

Andreas

-- 

Post doc researcher
Optimization and Systems Engineering Research Group

Process Design and Systems Engineering
Åbo Akademi University
Biskopsgatan 8,
FIN-20500 Turku, Finland

E-mail: andreas.lundell at abo.fi


More information about the Ipopt mailing list