Commit 9cb228ee authored by Antonio Frangioni's avatar Antonio Frangioni 🤖

using native Cplex functions to write LP files

... because otherwise the quadratic objective function, if defined, is not saved
parent bfbb9566
......@@ -1218,8 +1218,20 @@ OSIMPSolver::MPStatus OSIMPSolver::SolveMP( void )
#if( OSIMPSOLVERLOG )
if( osiSlvr && MPLLvl > 1 && nc && nr ) {
std::strstream filename;
filename << "MP_" << FIO->GetNDOSolver()->NrIter() << std::ends;
osiSlvr->writeMps( filename.str() );
filename << "MP_" << FIO->GetNDOSolver()->NrIter() << ".lp" << std::ends;
// use native solver API when possible, because OSI ignores (and,
// therefore, does not print) the quadratic objective, if any
#if WHICH_OSISOLVER == 1
OsiCpxSolverInterface *osiCpx =
dynamic_cast<OsiCpxSolverInterface*>( osiSlvr );
CPXENVptr env = osiCpx->getEnvironmentPtr();
CPXLPptr qp = osiCpx->getLpPtr();
CPXwriteprob( env , lp , filename.str() , "lp" )
#elif WHICH_OSISOLVER == 2
// not implemented yet
#else
osiSlvr->writeLp( filename.str() );
#endif
}
#endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment