Go to the documentation of this file.
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)));
188 double& cutRhs,
const double *elements,
189 const CoinBigIndex *rowStart,
const int *indices,
190 const int *rowLength,
const double *rhs);
194 inline void flip(
double& rowElem,
int rowIndex);
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);
221 int cutNz,
double cutrhs,
const double* xbar);
224 bool checkDynamism(
const double* cutElem,
const int* cutIndex,
232 int& cutNz,
double& cutRhs);
242 bool scaleCut(
double* cutElem,
int* cutIndex,
int cutNz,
243 double& cutRhs,
int scalingType);
251 long& numerator,
long& denominator);
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);
337 #if defined(TRACK_REJECT) || defined (TRACK_REJECT_SIMPLE)
348 int numGeneratedCuts;
361 const std::string mpdDir );
int ncol
Number of structural variables in the current LP.
long computeGcd(long a, long b)
Compute the greatest common divisor.
int getNumberRejectedCuts(RejectionType reason)
Get number of cuts rejected for given reason; see above.
bool computeCutFractionality(double varRhs, double &cutRhs)
Compute the fractionalities involved in the cut, and the cut rhs.
void printvecDBL(const char *vecstr, const double *x, int n) const
print a vector of doubles: dense form
Information about where the cut generator is invoked from.
const double * rowRhs
Righ hand side for constraints (upper bound for ranged constraints).
void packRow(double *row, double *rowElem, int *rowIndex, int &rowNz)
Pack a row of ncol elements.
CglGMIParam param
Object with CglGMIParam members.
void eliminateSlack(double cutElem, int cutIndex, double *cut, double &cutRhs, const double *elements, const CoinBigIndex *rowStart, const int *indices, const int *rowLength, const double *rhs)
Use multiples of the initial inequalities to cancel out the coefficient on a slack variables.
double aboveInteger(double value) const
Compute the fractional part of value, allowing for small error.
void flip(double &rowElem, int rowIndex)
Change the sign of the coefficients of the non basic variables at their upper bound.
bool nearestRational(double val, double maxdelta, long maxdnom, long &numerator, long &denominator)
Compute the nearest rational number; used by scale_row_integral.
RejectionType
Public enum: all possible reasons for cut rejection.
double f0
Fractionality of the cut and related quantities.
const double * xlp
Pointer on point to separate. Reset by each call to generateCuts().
void setParam(const CglGMIParam &source)
CglGMI()
Default constructor.
CglGMI & operator=(const CglGMI &rhs)
Assignment operator.
bool cleanCut(double *cutElem, int *cutIndex, int &cutNz, double &cutRhs, const double *xbar)
Clean the cutting plane; the cleaning procedure does several things like removing small coefficients,...
CglGMIParam getParam() const
int * cstat
Current basis status: columns.
void unflipSlack(double &rowElem, int rowIndex, double &rowRhs, const double *slack_val)
void setTrackRejection(bool value)
Set/get tracking of the rejection of cutting planes.
const CoinPackedMatrix * byCol
Pointer on matrix of coefficient ordered by columns.
virtual CglCutGenerator * clone() const
Clone.
void relaxRhs(double &rhs)
Adjust the rhs by relaxing by a small amount (relative or absolute)
bool removeSmallCoefficients(double *cutElem, int *cutIndex, int &cutNz, double &cutRhs)
Remove small coefficients and adjust the rhs accordingly.
const double * rowUpper
Upper bounds for constraints.
void resetRejectionCounters()
Reset counters for cut rejection tracking; see above.
OsiSolverInterface * solver
Pointer on solver. Reset by each call to generateCuts().
const double * colLower
Lower bounds for structural variables.
Cut Generator Base Class.
const double * colUpper
Upper bounds for structural variables.
const double * rowLower
Lower bounds for constraints.
bool checkViolation(const double *cutElem, const int *cutIndex, int cutNz, double cutrhs, const double *xbar)
Cut cleaning procedures: return true if successfull, false if cut should be discarded by the caller o...
bool * isInteger
Characteristic vectors of structural integer variables or continuous variables currently fixed to int...
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)
int nrow
Number of rows ( = number of slack variables) in the current LP.
bool checkSupport(int cutNz)
Check the support.
bool isIntegerValue(double x, double intEpsAbs=1e-9, double intEpsRel=1e-15)
bool areEqual(double x, double y, double epsAbs=1e-12, double epsRel=1e-12)
bool checkDynamism(const double *cutElem, const int *cutIndex, int cutNz)
Check the dynamism.
void printOptTab(OsiSolverInterface *solver) const
Print the current simplex tableau
int getNumberGeneratedCuts()
Get total number of generated cuts since last resetRejectionCounters()
virtual ~CglGMI()
Destructor.
const double * rowActivity
Pointer on row activity. Reset by each call to generateCuts().
virtual std::string generateCpp(FILE *fp)
Create C++ lines to get to current state.
Class collecting parameters for the GMI cut generator.
bool scaleCut(double *cutElem, int *cutIndex, int cutNz, double &cutRhs, int scalingType)
Scale the cutting plane in different ways; scaling_type possible values: 0 : scale to obtain integral...
void printvecINT(const char *vecstr, const int *x, int n) const
print a vector of integers
void CglGMIUnitTest(const OsiSolverInterface *siP, const std::string mpdDir)
A function that tests the methods in the CglGMI class.
Gomory cut generator with several cleaning procedures, used to test the numerical safety of the resul...
bool scaleCutIntegral(double *cutElem, int *cutIndex, int cutNz, double &cutRhs)
Scale the cutting plane in order to generate integral coefficients.
int factorize(CoinFactorization &factorization, int *colBasisIndex, int *rowBasisIndex)
Recompute the simplex tableau for want of a better accuracy.
double computeCutCoefficient(double rowElem, int index)
Compute the cut coefficient on a given variable.
virtual bool needsOptimalBasis() const
Return true if needs optimal basis to do cuts (will return true)
friend void CglGMIUnitTest(const OsiSolverInterface *siP, const std::string mpdDir)
A function that tests the methods in the CglGMI class.
const CoinPackedMatrix * byRow
Pointer on matrix of coefficient ordered by rows.
void unflipOrig(double &rowElem, int rowIndex, double &rowRhs)
Change the sign of the coefficients of the non basic variables at their upper bound and do the transl...
int * rstat
Current basis status: rows.