Commit 22371c09 authored by Antonio Frangioni's avatar Antonio Frangioni 🤖

fixed bug in handling errors from the OSISolver

parent e078701a
......@@ -1594,20 +1594,22 @@ void Bundle::FormD( void )
// the last *removable* item in Base is eliminated - - - - - - - - - - - -
if( MBse ) {
for( ; MBDm-- ; )
if( ( OOBase[ MBse[ MBDm ] ] >= 0 ) &&
( Mlt[ MBDm ] >= Eps<HpNum>() ) ) {
i = MBse[ MBDm ];
break;
}
if( MBDm ) { // if any
if( MBse ) {
for( ; MBDm-- ; )
if( ( OOBase[ MBse[ MBDm ] ] >= 0 ) &&
( Mlt[ MBDm ] >= Eps<HpNum>() ) ) {
i = MBse[ MBDm ];
break;
}
}
else
for( ; MBDm-- ; )
if( ( OOBase[ MBDm ] >= 0 ) && ( Mlt[ MBDm ] >= Eps<HpNum>() ) ) {
i = MBDm;
break;
}
}
else
for( ; MBDm-- ; )
if( ( OOBase[ MBDm ] >= 0 ) && ( Mlt[ MBDm ] >= Eps<HpNum>() ) ) {
i = MBDm;
break;
}
if( i == InINF ) // there are no *removable* items in Base - - - -
for( Index j = Master->MaxName() ; j-- ; ) // pick any removable item
......
......@@ -1298,6 +1298,23 @@ OSIMPSolver::MPStatus OSIMPSolver::SolveMP( void )
MPsts = kOK;
#if( PRESERVE_OSI_SOLS )
// note: do this independently from the return code of the MPSolver to
// ensure that csol and rcst are well-defined even under error
if( nc > csols ) {
delete[] csol;
delete[] rcst;
csols = nc;
csol = new double[ csols ];
rcst = new double[ csols ];
// csol[ comp_col[ 0 ] ] is checked by ReadMult(), so ensure it it
// properly initialized in any case
csol[ comp_col[ 0 ] ] = 0;
}
#endif
if( osiSlvr->isProvenDualInfeasible() ) { // the feasible set is empty
MSG( 0 , "MP is dual infeasible" << std::endl );
MPsts = kUnfsbl;
......@@ -1350,14 +1367,6 @@ OSIMPSolver::MPStatus OSIMPSolver::SolveMP( void )
// getReducedCost() and getRowPrice(), as Cplex uses the same functions
// as in the LP case (and precisely CPXgetx, CPXgetdj and CPXgetpi)
if( nc > csols ) {
delete[] csol;
delete[] rcst;
csols = nc;
csol = new double[ csols ];
rcst = new double[ csols ];
}
VectAssign( csol , osiSlvr->getColSolution() , nc );
VectAssign( rcst , osiSlvr->getReducedCost() , nc );
......
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