Cgl  0.60.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Friends | List of all members
CglSimpleRounding Class Reference

Simple Rounding Cut Generator Class. More...

#include <CglSimpleRounding.hpp>

+ Inheritance diagram for CglSimpleRounding:
+ Collaboration diagram for CglSimpleRounding:

Public Member Functions

Generate Cuts
virtual void generateCuts (const OsiSolverInterface &si, OsiCuts &cs, const CglTreeInfo info=CglTreeInfo())
 Generate simple rounding cuts for the model accessed through the solver interface. More...
 
Constructors and destructors
 CglSimpleRounding ()
 Default constructor. More...
 
 CglSimpleRounding (const CglSimpleRounding &)
 Copy constructor. More...
 
virtual CglCutGeneratorclone () const
 Clone. More...
 
CglSimpleRoundingoperator= (const CglSimpleRounding &rhs)
 Assignment operator. More...
 
virtual ~CglSimpleRounding ()
 Destructor. More...
 
virtual std::string generateCpp (FILE *fp)
 Create C++ lines to get to current state. More...
 
- Public Member Functions inherited from CglCutGenerator
 CglCutGenerator ()
 Default constructor. More...
 
 CglCutGenerator (const CglCutGenerator &)
 Copy constructor. More...
 
CglCutGeneratoroperator= (const CglCutGenerator &rhs)
 Assignment operator. More...
 
virtual ~CglCutGenerator ()
 Destructor. More...
 
virtual void refreshSolver (OsiSolverInterface *)
 This can be used to refresh any information. More...
 
int getAggressiveness () const
 Get Aggressiveness - 0 = neutral, 100 is normal root node. More...
 
void setAggressiveness (int value)
 Set Aggressiveness - 0 = neutral, 100 is normal root node. More...
 
void setGlobalCuts (bool trueOrFalse)
 Set whether can do global cuts. More...
 
bool canDoGlobalCuts () const
 Say whether can do global cuts. More...
 
virtual bool mayGenerateRowCutsInTree () const
 Returns true if may generate Row cuts in tree (rather than root node). More...
 
virtual bool needsOptimalBasis () const
 Return true if needs optimal basis to do cuts. More...
 
virtual int maximumLengthOfCutInTree () const
 Return maximum length of cut in tree. More...
 

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. More...
 
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. More...
 
Greatest common denominators methods
int gcd (int a, int b) const
 Returns the greatest common denominator of two positive integers, a and b. More...
 
int gcdv (int n, const int *const vi) const
 Returns the greatest common denominator of a vector of positive integers, vi, of length n. More...
 

Private Attributes

Private member data
double epsilon_
 A value within an epsilon_ neighborhood of 0 is considered to be 0. More...
 

Friends

void CglSimpleRoundingUnitTest (const OsiSolverInterface *siP, const std::string mpdDir)
 A function that tests the methods in the CglSimpleRounding class. More...
 

Additional Inherited Members

- Public Attributes inherited from CglCutGenerator
int aggressive_
 Aggressiveness - 0 = neutral, 100 is normal root node. More...
 
bool canDoGlobalCuts_
 True if can do global cuts i.e. no general integers. More...
 

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 29 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() 
)
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
inlineprivate

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

Definition at line 132 of file CglSimpleRounding.hpp.

int CglSimpleRounding::gcdv ( int  n,
const int *const  vi 
) const
inlineprivate

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

Definition at line 150 of file CglSimpleRounding.hpp.

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 122 of file CglSimpleRounding.hpp.


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