Skip to content

Commit

Permalink
allow more checking for long cuts
Browse files Browse the repository at this point in the history
  • Loading branch information
jjhforrest committed Dec 16, 2023
1 parent 745abaa commit 49a131d
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/CglGomory/CglGomory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -873,6 +873,9 @@ CglGomory::generateCuts(
printf("Gomory limit changed from %d to %d, inTree %c, pass %d, r %d,c %d,e %d\n",
saveLimit,limit,info.inTree ? 'Y' : 'N',info.pass,
numberRows,numberColumns,numberElements);
#endif
#if CBC_CHECK_CUT_LENGTH
limit = CoinMin(limit,CBC_CHECK_CUT_LENGTH*numberRows);
#endif
int nCandidates=0;
for (iColumn=0;iColumn<numberColumns;iColumn++) {
Expand Down Expand Up @@ -1598,6 +1601,9 @@ CglGomory::generateCuts(
bounds[1]=rhs;
if (number>50&&numberNonInteger)
bounds[1] = rhs+tolerance6+1.0e-8*fabs(rhs); // weaken
#ifndef GOMORY_RELAX_NUMBER
#define GOMORY_RELAX_NUMBER 5
#endif
#if GOMORY_RELAX_NUMBER
else if (number>GOMORY_RELAX_NUMBER&&numberNonInteger>1)
bounds[1] = rhs+tolerance6+1.0e-8*fabs(rhs); // weaken
Expand Down
8 changes: 8 additions & 0 deletions src/CglMixedIntegerRounding2/CglMixedIntegerRounding2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -855,6 +855,14 @@ CglMixedIntegerRounding2::generateMirCuts(
#endif

// if a cut was found, insert it into cs
#if CBC_CHECK_CUT_LENGTH
{
const CoinPackedVector & row = cMirCut.row();
int n=row.getNumElements();
if (n>CBC_CHECK_CUT_LENGTH*numRows_)
hasCut = false;
}
#endif
if (hasCut) {
// look at cut to see if unstable
const CoinPackedVector & row = cMirCut.row();
Expand Down
1 change: 1 addition & 0 deletions src/CglPreProcess/CglPreProcess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#endif
#include "CglProbing.hpp"
#include "CglDuplicateRow.hpp"
#include "CoinPresolveDupcol.hpp"
#include "CglClique.hpp"
//#define PRINT_DEBUG 1
//#define COIN_DEVELOP 1
Expand Down
3 changes: 3 additions & 0 deletions src/CglProbing/CglProbing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
//#define PRINT_DEBUG
//#define CGL_DEBUG 1
//#undef NDEBUG
#ifndef FIXED_BOTH_WAYS
#define FIXED_BOTH_WAYS 1
#endif
#include "CoinPragma.hpp"
#include "CoinHelperFunctions.hpp"
#include "CoinPackedVector.hpp"
Expand Down
6 changes: 5 additions & 1 deletion src/CglRedSplit2/CglRedSplit2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2092,7 +2092,9 @@ int CglRedSplit2::generateCuts(OsiCuts* cs, int maxNumCuts, int* lambda)
}
// now, add cut to the collection if needed
if (cs != NULL){
if (card_row<300) {
#if CBC_CHECK_CUT_LENGTH
if (card_row<CBC_CHECK_CUT_LENGTH*nrow) {
#endif
OsiRowCut rc;
rc.setRow(card_row, rowind, rowelem);
rc.setLb(-param.getINFINIT());
Expand All @@ -2104,7 +2106,9 @@ int CglRedSplit2::generateCuts(OsiCuts* cs, int maxNumCuts, int* lambda)
// relax the constraint slightly
buffcs->insertIfNotDuplicate(rc, CoinAbsFltEq(param.getEPS()));
numCuts = buffcs->sizeRowCuts() - initNumCuts;
#if CBC_CHECK_CUT_LENGTH
}
#endif
}
else{
numCuts++;
Expand Down

0 comments on commit 49a131d

Please sign in to comment.