3 #ifndef CglSimpleRounding_H
4 #define CglSimpleRounding_H
9 #include "CoinPackedMatrix.hpp"
28 const std::string mpdDir );
37 virtual void generateCuts(
const OsiSolverInterface & si, OsiCuts & cs,
74 const OsiSolverInterface & si,
76 const CoinShallowPackedVector & matrixRow,
77 CoinPackedVector & irow,
79 bool * negative)
const;
100 double dataTol )
const;
105 inline int gcd(
int a,
int b)
const;
111 inline int gcdv(
int n,
const int *
const vi)
const;
137 int remainder = b % a;
138 if (remainder == 0)
return a;
139 else return gcd(remainder,a);
155 int retval=
gcd(vi[0], vi[1]);
156 for (
int i=2; i<n; i++){
157 retval=
gcd(retval,vi[i]);
169 const std::string mpdDir );
virtual std::string generateCpp(FILE *fp)
Create C++ lines to get to current state.
void CglSimpleRoundingUnitTest(const OsiSolverInterface *siP, const std::string mpdDir)
A function that tests the methods in the CglSimpleRounding class.
virtual ~CglSimpleRounding()
Destructor.
int gcdv(int n, const int *const vi) const
Returns the greatest common denominator of a vector of positive integers, vi, of length n...
double epsilon_
A value within an epsilon_ neighborhood of 0 is considered to be 0.
friend void CglSimpleRoundingUnitTest(const OsiSolverInterface *siP, const std::string mpdDir)
A function that tests the methods in the CglSimpleRounding class.
virtual void generateCuts(const OsiSolverInterface &si, OsiCuts &cs, const CglTreeInfo info=CglTreeInfo()) const
Generate simple rounding cuts for the model accessed through the solver interface.
CglSimpleRounding & operator=(const CglSimpleRounding &rhs)
Assignment operator.
Simple Rounding Cut Generator Class
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.
virtual CglCutGenerator * clone() const
Clone.
Cut Generator Base Class.
CglSimpleRounding()
Default constructor.
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.
int gcd(int a, int b) const
Returns the greatest common denominator of two positive integers, a and b.
Information about where the cut generator is invoked from.