- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# CglSimpleRounding Class Reference

Simple Rounding Cut Generator Class
. More...

`#include <CglSimpleRounding.hpp>`

Inheritance diagram for CglSimpleRounding:

[legend]
Collaboration diagram for CglSimpleRounding:

[legend]
List of all members.

## Public Member Functions
Generate Cuts
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.
Constructors and destructors
| CglSimpleRounding ()
| Default constructor.
| CglSimpleRounding (const CglSimpleRounding &)
| Copy constructor.
virtual CglCutGenerator * | clone () const
| Clone.
CglSimpleRounding & | operator= (const CglSimpleRounding &rhs)
| Assignment operator.
virtual | ~CglSimpleRounding ()
| Destructor.
virtual std::string | generateCpp (FILE *fp)
| Create C++ lines to get to current state.
## Private Member Functions
Private methods
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 | 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,.
Greatest common denominators methods
int | gcd (int a, int b) const
| Returns the greatest common denominator of two positive integers, a and b.
int | gcdv (int n, const int *const vi) const
| Returns the greatest common denominator of a vector of positive integers, vi, of length n.
## Private Attributes
Private member data
double | epsilon_
| A value within an epsilon_ neighborhood of 0 is considered to be 0.
## Friends
void | CglSimpleRoundingUnitTest (const OsiSolverInterface *siP, const std::string mpdDir)
| A function that tests the methods in the CglSimpleRounding class.

## Detailed Description

Simple Rounding Cut Generator Class
.

This class generates simple rounding cuts via the following method: For each contraint, attempt to derive a <= inequality in all integer variables by netting out any continuous variables. Divide the resulting integer inequality through by the greatest common denomimator (gcd) of the lhs coefficients. Round down the rhs.

Warning: Use with careful attention to data precision.

(Reference: Nemhauser and Wolsey, Integer and Combinatorial Optimization, 1988, pg 211.)

Definition at line 26 of file CglSimpleRounding.hpp.

## Constructor & Destructor Documentation

CglSimpleRounding::CglSimpleRounding | ( |  | ) |

Default constructor.

CglSimpleRounding::CglSimpleRounding | ( | const CglSimpleRounding & |  | ) |

Copy constructor.

virtual CglSimpleRounding::~CglSimpleRounding | ( |  | ) | `[virtual]`

Destructor.

## Member Function Documentation

virtual void CglSimpleRounding::generateCuts | ( | const OsiSolverInterface & | si,
|  | OsiCuts & | cs,
|  | const CglTreeInfo | info = `CglTreeInfo()` |
| ) |  |  | const`[virtual]`

Generate simple rounding cuts for the model accessed through the solver interface.

Insert generated cuts into the cut set cs.

Implements CglCutGenerator.

virtual CglCutGenerator* CglSimpleRounding::clone | ( |  | ) | const`[virtual]`

Clone.

Implements CglCutGenerator.

CglSimpleRounding& CglSimpleRounding::operator= | ( | const CglSimpleRounding & | rhs | ) |

Assignment operator.

virtual std::string CglSimpleRounding::generateCpp | ( | FILE * | fp | ) | `[virtual]`

Create C++ lines to get to current state.

Reimplemented from CglCutGenerator.

bool CglSimpleRounding::deriveAnIntegerRow | ( | const OsiSolverInterface & | si,
|  | int | rowIndex,
|  | const CoinShallowPackedVector & | matrixRow,
|  | CoinPackedVector & | irow,
|  | double & | b,
|  | bool * | negative |
| ) |  |  | const`[private]`

Derive a <= inequality in integer variables from the rowIndex-th constraint.

int CglSimpleRounding::power10ToMakeDoubleAnInt | ( | int | size,
|  | const double * | x,
|  | double | dataTol |
| ) |  |  | const`[private]`

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.

change of definition of dataTol so that it refers to original data, not to scaled data as that seems to lead to problems.

So if xScaled is x[i]*10**power and xInt is rounded(xScaled) then fabs(xScaled-xInt) <= dataTol*10**power. This means that dataTol should be smaller - say 1.0e-12 rather tahn 1.0e-8

Returns -number of times overflowed if the power is so big that it will cause overflow (i.e. integer stored will be bigger than 2**31). Test in cut generator.

int CglSimpleRounding::gcd | ( | int | a,
|  | int | b |
| ) |  |  | const`[inline, private]`

Returns the greatest common denominator of two positive integers, a and b.

Definition at line 129 of file CglSimpleRounding.hpp.

Referenced by gcdv().

int CglSimpleRounding::gcdv | ( | int | n,
|  | const int *const | vi |
| ) |  |  | const`[inline, private]`

Returns the greatest common denominator of a vector of positive integers, vi, of length n.

Definition at line 147 of file CglSimpleRounding.hpp.

References gcd().

## Friends And Related Function Documentation

void CglSimpleRoundingUnitTest | ( | const OsiSolverInterface * | siP,
|  | const std::string | mpdDir |
| ) |  |  | `[friend]`

A function that tests the methods in the CglSimpleRounding class.

The only reason for it not to be a member method is that this way it doesn't have to be compiled into the library. And that's a gain, because the library should be compiled with optimization on, but this method should be compiled with debugging.

## Member Data Documentation

double CglSimpleRounding::epsilon_`[private]`

A value within an epsilon_ neighborhood of 0 is considered to be 0.

Definition at line 119 of file CglSimpleRounding.hpp.

The documentation for this class was generated from the following file:

- /home/coin/SVN-release/Cgl-0.55.0/Cgl/src/CglSimpleRounding/CglSimpleRounding.hpp