Skip to content

Commit

Permalink
make Cgl safer without Clp
Browse files Browse the repository at this point in the history
  • Loading branch information
jjhforrest committed Aug 8, 2023
1 parent 33d8713 commit 3ea7bff
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/CglGomory/CglGomory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@
#endif
#include "CoinRational.hpp"
#endif
#ifdef CBC_HAS_CLP
#define CGL_HAS_CLP_GOMORY
#endif
#ifdef CGL_HAS_CLP_GOMORY
#include "OsiClpSolverInterface.hpp"
#endif
Expand Down Expand Up @@ -336,6 +338,7 @@ void CglGomory::generateCuts(const OsiSolverInterface & si, OsiCuts & cs,
cs.rowCutPtr(i)->setGloballyValid();
}
}
#ifdef CGL_HAS_CLP_GOMORY
if ((gomoryType_%10)==2) {
// back to original
assert(clpSolver);
Expand All @@ -349,6 +352,7 @@ void CglGomory::generateCuts(const OsiSolverInterface & si, OsiCuts & cs,
delete [] delRow;
}
}
#endif
}

// Returns value - floor but allowing for small errors
Expand Down
4 changes: 4 additions & 0 deletions src/CglPreProcess/CglPreProcess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@
#include "CoinBuild.hpp"
#include "CoinHelperFunctions.hpp"
#include "CoinWarmStartBasis.hpp"
#ifdef CBC_HAS_CLP
#include "OsiClpSolverInterface.hpp"
#endif
#include "CglProbing.hpp"
#include "CglDuplicateRow.hpp"
#include "CglClique.hpp"
Expand Down Expand Up @@ -3598,6 +3600,7 @@ CglPreProcess::preProcessNonDefault(OsiSolverInterface &model,
int change = tightenPrimalBounds(*newModel,true,scBound);
if (change > 0)
numberChanges += change;
#ifdef CBC_HAS_CLP
OsiClpSolverInterface * clpSolver = dynamic_cast<OsiClpSolverInterface *>(newModel);
if (clpSolver) {
change = clpSolver->tightenBounds();
Expand All @@ -3606,6 +3609,7 @@ CglPreProcess::preProcessNonDefault(OsiSolverInterface &model,
//printf("Clp tightenBounds tightened %d\n",change);
}
}
#endif
}
#if DEBUG_PREPROCESS > 1
if (debugger)
Expand Down
2 changes: 2 additions & 0 deletions src/CglTwomir/CglTwomir.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@
#include "CoinWarmStartBasis.hpp"
#include "CglTwomir.hpp"
class CoinWarmStartBasis;
#ifdef CBC_HAS_CLP
#define CGL_HAS_CLP_TWOMIR
#endif
#ifdef CGL_HAS_CLP_TWOMIR
#include "OsiClpSolverInterface.hpp"
#endif
Expand Down

0 comments on commit 3ea7bff

Please sign in to comment.