16 #include "CoinWarmStartBasis.hpp" 17 #include "CoinFactorization.hpp" 40 const std::string mpdDir);
73 virtual void generateCuts(
const OsiSolverInterface & si, OsiCuts & cs,
84 double epsAbs = 1e-12,
85 double epsRel = 1e-12) {
86 return (fabs((x) - (y)) <=
87 std::max(epsAbs, epsRel * std::max(fabs(x), fabs(y))));
91 inline bool isZero(
double x,
double epsZero = 1e-20) {
92 return (fabs(x) <= epsZero);
98 double intEpsAbs = 1e-9,
99 double intEpsRel = 1e-15) {
100 return (fabs((x) - floor((x)+0.5)) <=
101 std::max(intEpsAbs, intEpsRel * fabs(x)));
121 void printOptTab(OsiSolverInterface *solver)
const;
176 inline double aboveInteger(
double value)
const;
180 inline bool computeCutFractionality(
double varRhs,
double& cutRhs);
183 inline double computeCutCoefficient(
double rowElem,
int index);
187 inline void eliminateSlack(
double cutElem,
int cutIndex,
double*
cut,
188 double& cutRhs,
const double *elements,
189 const int *rowStart,
const int *indices,
190 const int *rowLength,
const double *rhs);
194 inline void flip(
double& rowElem,
int rowIndex);
200 inline void unflipOrig(
double& rowElem,
int rowIndex,
double& rowRhs);
201 inline void unflipSlack(
double& rowElem,
int rowIndex,
double& rowRhs,
202 const double* slack_val);
205 inline void packRow(
double* row,
double* rowElem,
int* rowIndex,
213 bool cleanCut(
double* cutElem,
int* cutIndex,
int& cutNz,
214 double& cutRhs,
const double* xbar);
220 bool checkViolation(
const double* cutElem,
const int* cutIndex,
221 int cutNz,
double cutrhs,
const double* xbar);
224 bool checkDynamism(
const double* cutElem,
const int* cutIndex,
228 bool checkSupport(
int cutNz);
231 bool removeSmallCoefficients(
double* cutElem,
int* cutIndex,
232 int& cutNz,
double& cutRhs);
235 void relaxRhs(
double& rhs);
242 bool scaleCut(
double* cutElem,
int* cutIndex,
int cutNz,
243 double& cutRhs,
int scalingType);
246 bool scaleCutIntegral(
double* cutElem,
int* cutIndex,
int cutNz,
250 bool nearestRational(
double val,
double maxdelta,
long maxdnom,
251 long& numerator,
long& denominator);
254 long computeGcd(
long a,
long b);
257 void printvecINT(
const char *vecstr,
const int *x,
int n)
const;
259 void printvecDBL(
const char *vecstr,
const double *x,
int n)
const;
261 void printvecDBL(
const char *vecstr,
const double *elem,
const int * index,
268 int factorize(CoinFactorization & factorization,
269 int* colBasisIndex,
int* rowBasisIndex);
291 const double *colLower;
294 const double *colUpper;
297 const double *rowLower;
300 const double *rowUpper;
303 const double *rowRhs;
316 OsiSolverInterface *solver;
322 const double *rowActivity;
326 const CoinPackedMatrix *byRow;
330 const CoinPackedMatrix *byCol;
337 #if defined(TRACK_REJECT) || defined (TRACK_REJECT_SIMPLE) 348 int numGeneratedCuts;
361 const std::string mpdDir );
void setTrackRejection(bool value)
Set/get tracking of the rejection of cutting planes.
virtual bool needsOptimalBasis() const
Return true if needs optimal basis to do cuts (will return true)
CglGMI()
Default constructor.
CglGMI & operator=(const CglGMI &rhs)
Assignment operator.
CglGMIParam getParam() const
bool areEqual(double x, double y, double epsAbs=1e-12, double epsRel=1e-12)
Information about where the cut generator is invoked from.
void resetRejectionCounters()
Reset counters for cut rejection tracking; see above.
Class collecting parameters for the GMI cut generator.
RejectionType
Public enum: all possible reasons for cut rejection.
void printOptTab(OsiSolverInterface *solver) const
Print the current simplex tableau.
Gomory cut generator with several cleaning procedures, used to test the numerical safety of the resul...
Cut Generator Base Class.
friend void CglGMIUnitTest(const OsiSolverInterface *siP, const std::string mpdDir)
A function that tests the methods in the CglGMI class.
void setParam(const CglGMIParam &source)
bool isIntegerValue(double x, double intEpsAbs=1e-9, double intEpsRel=1e-15)
virtual void generateCuts(const OsiSolverInterface &si, OsiCuts &cs, const CglTreeInfo info=CglTreeInfo())
Generate Gomory Mixed-Integer cuts for the model of the solver interface si.
bool isZero(double x, double epsZero=1e-20)
virtual ~CglGMI()
Destructor.
int getNumberGeneratedCuts()
Get total number of generated cuts since last resetRejectionCounters()
virtual std::string generateCpp(FILE *fp)
Create C++ lines to get to current state.
int getNumberRejectedCuts(RejectionType reason)
Get number of cuts rejected for given reason; see above.
virtual CglCutGenerator * clone() const
Clone.