Skip to content

Commit

Permalink
change row bnd rounding rule to tolerance based
Browse files Browse the repository at this point in the history
  • Loading branch information
yuxies authored and tkralphs committed Oct 26, 2023
1 parent 797ee51 commit ca1d6f4
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/MibSBilevel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -919,8 +919,8 @@ MibSBilevel::setUpModel(OsiSolverInterface * oSolver, bool newOsi,
/** Set the row bounds **/
for(i = 0; i < lRows; i++){
index1 = lRowIndices[i];
rowLb[i] = floor(origRowLb[index1] + 0.5);
rowUb[i] = floor(origRowUb[index1] + 0.5);
rowLb[i] = origRowLb[index1];
rowUb[i] = origRowUb[index1];
}

if (feasCheckSolver == "Cbc"){
Expand Down Expand Up @@ -1224,8 +1224,16 @@ MibSBilevel::setUpModel(OsiSolverInterface * oSolver, bool newOsi,
/** Correct the row bounds to account for fixed upper-level vars **/

for(i = 0; i < lRows; i++){
nSolver->setRowLower(i, floor(rowLb[i] - upComp[i] + 0.5));
nSolver->setRowUpper(i, floor(rowUb[i] - upComp[i] + 0.5));
if(fabs(rowLb[i] - upComp[i] - floor(rowLb[i] - upComp[i] + 0.5)) < etol){
nSolver->setRowLower(i, floor(rowLb[i] - upComp[i] + 0.5));
}else{
nSolver->setRowLower(i, rowLb[i] - upComp[i]);
}
if(fabs(rowUb[i] - upComp[i] - floor(rowUb[i] - upComp[i] + 0.5)) < etol){
nSolver->setRowUpper(i, floor(rowUb[i] - upComp[i] + 0.5));
}else{
nSolver->setRowUpper(i, rowUb[i] - upComp[i]);
}
}

delete [] upComp;
Expand Down

0 comments on commit ca1d6f4

Please sign in to comment.