6 #ifndef CglSimpleRounding_H
7 #define CglSimpleRounding_H
31 const std::string mpdDir );
82 bool * negative)
const;
103 double dataTol )
const;
108 inline int gcd(
int a,
int b)
const;
114 inline int gcdv(
int n,
const int *
const vi)
const;
140 int remainder = b % a;
141 if (remainder == 0)
return a;
142 else return gcd(remainder,a);
158 int retval=
gcd(vi[0], vi[1]);
159 for (
int i=2; i<n; i++){
160 retval=
gcd(retval,vi[i]);
172 const std::string mpdDir );
virtual std::string generateCpp(FILE *fp)
Create C++ lines to get to current state.
CglSimpleRounding & operator=(const CglSimpleRounding &rhs)
Assignment operator.
virtual void generateCuts(const OsiSolverInterface &si, OsiCuts &cs, const CglTreeInfo info=CglTreeInfo())
Generate simple rounding cuts for the model accessed through the solver interface.
int gcd(int a, int b) const
Returns the greatest common denominator of two positive integers, a and b.
int power10ToMakeDoubleAnInt(int size, const double *x, double dataTol) const
Given a vector of doubles, x, with size elements and a positive tolerance, dataTol, this method returns the smallest power of 10 needed so that x[i]*10**power "is integer" for all i=0,...,size-1.
Simple Rounding Cut Generator Class.
CglSimpleRounding()
Default constructor.
Information about where the cut generator is invoked from.
Collections of row cuts and column cuts.
friend void CglSimpleRoundingUnitTest(const OsiSolverInterface *siP, const std::string mpdDir)
A function that tests the methods in the CglSimpleRounding class.
Abstract Base Class for describing an interface to a solver.
virtual CglCutGenerator * clone() const
Clone.
void CglSimpleRoundingUnitTest(const OsiSolverInterface *siP, const std::string mpdDir)
A function that tests the methods in the CglSimpleRounding class.
Cut Generator Base Class.
virtual ~CglSimpleRounding()
Destructor.
double epsilon_
A value within an epsilon_ neighborhood of 0 is considered to be 0.
bool deriveAnIntegerRow(const OsiSolverInterface &si, int rowIndex, const CoinShallowPackedVector &matrixRow, CoinPackedVector &irow, double &b, bool *negative) const
Derive a <= inequality in integer variables from the rowIndex-th constraint.
int gcdv(int n, const int *const vi) const
Returns the greatest common denominator of a vector of positive integers, vi, of length n...