Skip to content

Commit

Permalink
looks as if stored cuts safer with this
Browse files Browse the repository at this point in the history
  • Loading branch information
jjhforrest committed Aug 31, 2023
1 parent 3ea7bff commit a2437bf
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/CglCommon/CglStored.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,13 +198,19 @@ void CglStored::addCut(const OsiCuts &cs)
{
int numberRowCuts = cs.sizeRowCuts();
for (int i = 0; i < numberRowCuts; i++) {
int numberCuts = cuts_.sizeRowCuts();
cuts_.insert(*cs.rowCutPtr(i));
// Keep when diving
cuts_.rowCutPtr(numberCuts)->setEffectiveness(COIN_DBL_MAX);
}
}
// Add a row cut
void CglStored::addCut(const OsiRowCut &cut)
{
int numberCuts = cuts_.sizeRowCuts();
cuts_.insert(cut);
// Keep when diving
cuts_.rowCutPtr(numberCuts)->setEffectiveness(COIN_DBL_MAX);
}
// Add a row cut from a packed vector
void CglStored::addCut(double lb, double ub, const CoinPackedVector &vector)
Expand All @@ -214,7 +220,10 @@ void CglStored::addCut(double lb, double ub, const CoinPackedVector &vector)
rc.mutableRow().setTestForDuplicateIndex(false);
rc.setLb(lb);
rc.setUb(ub);
int numberCuts = cuts_.sizeRowCuts();
cuts_.insert(rc);
// Keep when diving
cuts_.rowCutPtr(numberCuts)->setEffectiveness(COIN_DBL_MAX);
}
// Add a row cut from elements
void CglStored::addCut(double lb, double ub, int size, const int *colIndices, const double *elements)
Expand All @@ -223,7 +232,10 @@ void CglStored::addCut(double lb, double ub, int size, const int *colIndices, co
rc.setRow(size, colIndices, elements, false);
rc.setLb(lb);
rc.setUb(ub);
int numberCuts = cuts_.sizeRowCuts();
cuts_.insert(rc);
// Keep when diving
cuts_.rowCutPtr(numberCuts)->setEffectiveness(COIN_DBL_MAX);
}

//-------------------------------------------------------------------
Expand Down

0 comments on commit a2437bf

Please sign in to comment.