CbcCutGenerator Class Reference

Interface between Cbc and Cut Generation Library. More...

#include <CbcCutGenerator.hpp>

Collaboration diagram for CbcCutGenerator:

Collaboration graph
[legend]
List of all members.

Public Member Functions

Generate Cuts
bool generateCuts (OsiCuts &cs, bool fullScan, CbcNode *node)
 Generate cuts for the client model.
Constructors and destructors
 CbcCutGenerator ()
 Default constructor.
 CbcCutGenerator (CbcModel *model, CglCutGenerator *generator, int howOften=1, const char *name=NULL, bool normal=true, bool atSolution=false, bool infeasible=false, int howOftenInsub=-100, int whatDepth=-1, int whatDepthInSub=-1, int switchOffIfLessThan=0)
 Normal constructor.
 CbcCutGenerator (const CbcCutGenerator &)
 Copy constructor.
CbcCutGeneratoroperator= (const CbcCutGenerator &rhs)
 Assignment operator.
 ~CbcCutGenerator ()
 Destructor.
Gets and sets
void refreshModel (CbcModel *model)
 Set the client model.
const char * cutGeneratorName () const
 return name of generator
void setHowOften (int value)
 Set the cut generation interval.
int howOften () const
 Get the cut generation interval.
int howOftenInSub () const
 Get the cut generation interval.in sub tree.
void setWhatDepth (int value)
 Set the cut generation depth.
void setWhatDepthInSub (int value)
 Set the cut generation depth in sub tree.
int whatDepth () const
 Get the cut generation depth criterion.
int whatDepthInSub () const
 Get the cut generation depth criterion.in sub tree.
bool normal () const
 Get whether the cut generator should be called in the normal place.
void setNormal (bool value)
 Set whether the cut generator should be called in the normal place.
bool atSolution () const
 Get whether the cut generator should be called when a solution is found.
void setAtSolution (bool value)
 Set whether the cut generator should be called when a solution is found.
bool whenInfeasible () const
 Get whether the cut generator should be called when the subproblem is found to be infeasible.
void setWhenInfeasible (bool value)
 Set whether the cut generator should be called when the subproblem is found to be infeasible.
bool timing () const
 Get whether the cut generator is being timed.
void setTiming (bool value)
 Set whether the cut generator is being timed.
double timeInCutGenerator () const
 Return time taken in cut generator.
CglCutGeneratorgenerator () const
 Get the CglCutGenerator corresponding to this CbcCutGenerator.
int numberTimesEntered () const
 Number times cut generator entered.
void setNumberTimesEntered (int value)
 Set the client model.
void incrementNumberTimesEntered (int value=1)
 Set the client model.
int numberCutsInTotal () const
 Total number of cuts added.
void setNumberCutsInTotal (int value)
 Set the client model.
void incrementNumberCutsInTotal (int value=1)
 Set the client model.
int numberColumnCuts () const
 Total number of column cuts.
void setNumberColumnCuts (int value)
 Set the client model.
void incrementNumberColumnCuts (int value=1)
 Set the client model.
int numberCutsActive () const
 Total number of cuts active after (at end of n cut passes at each node).
void setNumberCutsActive (int value)
 Set the client model.
void incrementNumberCutsActive (int value=1)
 Set the client model.
void setSwitchOffIfLessThan (int value)
 Set the client model.
int switchOffIfLessThan () const
 Set the client model.
bool needsOptimalBasis () const
 Say if optimal basis needed.
bool mustCallAgain () const
 Whether generator MUST be called again if any cuts (i.e. ignore break from loop).
void setMustCallAgain (bool yesNo)
 Set whether generator MUST be called again if any cuts (i.e. ignore break from loop).
bool switchedOff () const
 Whether generator switched off for moment.
void setSwitchedOff (bool yesNo)
 Set whether generator switched off for moment.

Private Attributes

CbcModelmodel_
 The client model.
CglCutGeneratorgenerator_
int whenCutGenerator_
 Number of nodes between calls to the CglCutGenerator::generateCuts routine.
int whenCutGeneratorInSub_
 Number of nodes between calls to the CglCutGenerator::generateCuts routine in sub tree.
int switchOffIfLessThan_
 If first pass at root produces fewer than this cuts then switch off.
int depthCutGenerator_
 Depth at which to call the CglCutGenerator::generateCuts routine (If >0 then overrides when and is called if depthdepthCutGenerator==0).
int depthCutGeneratorInSub_
 Depth at which to call the CglCutGenerator::generateCuts routine (If >0 then overrides when and is called if depthdepthCutGenerator==0).
char * generatorName_
 Name of generator.
bool normal_
 Whether to call the generator in the normal place.
bool atSolution_
 Whether to call the generator when a new solution is found.
bool whenInfeasible_
 Whether to call generator when a subproblem is found to be infeasible.
bool mustCallAgain_
 Whether generator MUST be called again if any cuts (i.e. ignore break from loop).
bool switchedOff_
 Temporary switch off marker.
bool timing_
 Whether call generator being timed.
double timeInCutGenerator_
 Time in cut generator.
int numberTimes_
 Number times cut generator entered.
int numberCuts_
 Total number of cuts added.
int numberColumnCuts_
 Total number of column cuts added.
int numberCutsActive_
 Total number of cuts active after (at end of n cut passes at each node).

Detailed Description

Interface between Cbc and Cut Generation Library.

CbcCutGenerator is intended to provide an intelligent interface between Cbc and the cutting plane algorithms in the CGL. A CbcCutGenerator is bound to a CglCutGenerator and to an CbcModel. It contains parameters which control when and how the generateCuts method of the CglCutGenerator will be called.

The builtin decision criteria available to use when deciding whether to generate cuts are limited: every X nodes, when a solution is found, and when a subproblem is found to be infeasible. The idea is that the class will grow more intelligent with time.

Todo:
Add a pointer to function member which will allow a client to install their own decision algorithm to decide whether or not to call the CGL generateCuts method. Create a default decision method that looks at the builtin criteria.
Todo:
It strikes me as not good that generateCuts contains code specific to individual CGL algorithms. Another set of pointer to function members, so that the client can specify the cut generation method as well as pre- and post-generation methods? Taken a bit further, should this class contain a bunch of pointer to function members, one for each of the places where the cut generator might be referenced? Initialization, root node, search tree node, discovery of solution, and termination all come to mind. Initialization and termination would also be useful for instrumenting cbc.

Definition at line 45 of file CbcCutGenerator.hpp.


Constructor & Destructor Documentation

CbcCutGenerator::CbcCutGenerator (  ) 

Default constructor.

CbcCutGenerator::CbcCutGenerator ( CbcModel model,
CglCutGenerator generator,
int  howOften = 1,
const char *  name = NULL,
bool  normal = true,
bool  atSolution = false,
bool  infeasible = false,
int  howOftenInsub = -100,
int  whatDepth = -1,
int  whatDepthInSub = -1,
int  switchOffIfLessThan = 0 
)

Normal constructor.

CbcCutGenerator::CbcCutGenerator ( const CbcCutGenerator  ) 

Copy constructor.

CbcCutGenerator::~CbcCutGenerator (  ) 

Destructor.


Member Function Documentation

bool CbcCutGenerator::generateCuts ( OsiCuts cs,
bool  fullScan,
CbcNode node 
)

Generate cuts for the client model.

Evaluate the state of the client model and decide whether to generate cuts. The generated cuts are inserted into and returned in the collection of cuts cs.

If fullScan is true, the generator is obliged to call the CGL generateCuts routine. Otherwise, it is free to make a local decision. The current implementation uses whenCutGenerator_ to decide.

The routine returns true if reoptimisation is needed (because the state of the solver interface has been modified).

If node then can find out depth

CbcCutGenerator& CbcCutGenerator::operator= ( const CbcCutGenerator rhs  ) 

Assignment operator.

void CbcCutGenerator::refreshModel ( CbcModel model  ) 

Set the client model.

In addition to setting the client model, refreshModel also calls the refreshSolver method of the CglCutGenerator object.

const char* CbcCutGenerator::cutGeneratorName (  )  const [inline]

return name of generator

Definition at line 102 of file CbcCutGenerator.hpp.

References generatorName_.

void CbcCutGenerator::setHowOften ( int  value  ) 

Set the cut generation interval.

Set the number of nodes evaluated between calls to the Cgl object's generateCuts routine.

If value is positive, cuts will always be generated at the specified interval. If value is negative, cuts will initially be generated at the specified interval, but Cbc may adjust the value depending on the success of cuts produced by this generator.

A value of -100 disables the generator, while a value of -99 means just at root.

int CbcCutGenerator::howOften (  )  const [inline]

Get the cut generation interval.

Definition at line 122 of file CbcCutGenerator.hpp.

References whenCutGenerator_.

int CbcCutGenerator::howOftenInSub (  )  const [inline]

Get the cut generation interval.in sub tree.

Definition at line 125 of file CbcCutGenerator.hpp.

References whenCutGeneratorInSub_.

void CbcCutGenerator::setWhatDepth ( int  value  ) 

Set the cut generation depth.

Set the depth criterion for calls to the Cgl object's generateCuts routine. Only active if > 0.

If whenCutGenerator is positive and this is positive then this overrides. If whenCutGenerator is -1 then this is used as criterion if any cuts were generated at root node. If whenCutGenerator is anything else this is ignored.

void CbcCutGenerator::setWhatDepthInSub ( int  value  ) 

Set the cut generation depth in sub tree.

int CbcCutGenerator::whatDepth (  )  const [inline]

Get the cut generation depth criterion.

Definition at line 142 of file CbcCutGenerator.hpp.

References depthCutGenerator_.

int CbcCutGenerator::whatDepthInSub (  )  const [inline]

Get the cut generation depth criterion.in sub tree.

Definition at line 145 of file CbcCutGenerator.hpp.

References depthCutGeneratorInSub_.

bool CbcCutGenerator::normal (  )  const [inline]

Get whether the cut generator should be called in the normal place.

Definition at line 149 of file CbcCutGenerator.hpp.

References normal_.

void CbcCutGenerator::setNormal ( bool  value  )  [inline]

Set whether the cut generator should be called in the normal place.

Definition at line 152 of file CbcCutGenerator.hpp.

References normal_.

bool CbcCutGenerator::atSolution (  )  const [inline]

Get whether the cut generator should be called when a solution is found.

Definition at line 155 of file CbcCutGenerator.hpp.

References atSolution_.

void CbcCutGenerator::setAtSolution ( bool  value  )  [inline]

Set whether the cut generator should be called when a solution is found.

Definition at line 158 of file CbcCutGenerator.hpp.

References atSolution_.

bool CbcCutGenerator::whenInfeasible (  )  const [inline]

Get whether the cut generator should be called when the subproblem is found to be infeasible.

Definition at line 163 of file CbcCutGenerator.hpp.

References whenInfeasible_.

void CbcCutGenerator::setWhenInfeasible ( bool  value  )  [inline]

Set whether the cut generator should be called when the subproblem is found to be infeasible.

Definition at line 168 of file CbcCutGenerator.hpp.

References whenInfeasible_.

bool CbcCutGenerator::timing (  )  const [inline]

Get whether the cut generator is being timed.

Definition at line 171 of file CbcCutGenerator.hpp.

References timing_.

void CbcCutGenerator::setTiming ( bool  value  )  [inline]

Set whether the cut generator is being timed.

Definition at line 174 of file CbcCutGenerator.hpp.

References timeInCutGenerator_, and timing_.

double CbcCutGenerator::timeInCutGenerator (  )  const [inline]

Return time taken in cut generator.

Definition at line 177 of file CbcCutGenerator.hpp.

References timeInCutGenerator_.

CglCutGenerator* CbcCutGenerator::generator (  )  const [inline]

Get the CglCutGenerator corresponding to this CbcCutGenerator.

Definition at line 180 of file CbcCutGenerator.hpp.

References generator_.

int CbcCutGenerator::numberTimesEntered (  )  const [inline]

Number times cut generator entered.

Definition at line 183 of file CbcCutGenerator.hpp.

References numberTimes_.

void CbcCutGenerator::setNumberTimesEntered ( int  value  )  [inline]

Set the client model.

In addition to setting the client model, refreshModel also calls the refreshSolver method of the CglCutGenerator object.

Definition at line 185 of file CbcCutGenerator.hpp.

References numberTimes_.

void CbcCutGenerator::incrementNumberTimesEntered ( int  value = 1  )  [inline]

Set the client model.

In addition to setting the client model, refreshModel also calls the refreshSolver method of the CglCutGenerator object.

Definition at line 187 of file CbcCutGenerator.hpp.

References numberTimes_.

int CbcCutGenerator::numberCutsInTotal (  )  const [inline]

Total number of cuts added.

Definition at line 190 of file CbcCutGenerator.hpp.

References numberCuts_.

void CbcCutGenerator::setNumberCutsInTotal ( int  value  )  [inline]

Set the client model.

In addition to setting the client model, refreshModel also calls the refreshSolver method of the CglCutGenerator object.

Definition at line 192 of file CbcCutGenerator.hpp.

References numberCuts_.

void CbcCutGenerator::incrementNumberCutsInTotal ( int  value = 1  )  [inline]

Set the client model.

In addition to setting the client model, refreshModel also calls the refreshSolver method of the CglCutGenerator object.

Definition at line 194 of file CbcCutGenerator.hpp.

References numberCuts_.

int CbcCutGenerator::numberColumnCuts (  )  const [inline]

Total number of column cuts.

Definition at line 197 of file CbcCutGenerator.hpp.

References numberColumnCuts_.

void CbcCutGenerator::setNumberColumnCuts ( int  value  )  [inline]

Set the client model.

In addition to setting the client model, refreshModel also calls the refreshSolver method of the CglCutGenerator object.

Definition at line 199 of file CbcCutGenerator.hpp.

References numberColumnCuts_.

void CbcCutGenerator::incrementNumberColumnCuts ( int  value = 1  )  [inline]

Set the client model.

In addition to setting the client model, refreshModel also calls the refreshSolver method of the CglCutGenerator object.

Definition at line 201 of file CbcCutGenerator.hpp.

References numberColumnCuts_.

int CbcCutGenerator::numberCutsActive (  )  const [inline]

Total number of cuts active after (at end of n cut passes at each node).

Definition at line 204 of file CbcCutGenerator.hpp.

References numberCutsActive_.

void CbcCutGenerator::setNumberCutsActive ( int  value  )  [inline]

Set the client model.

In addition to setting the client model, refreshModel also calls the refreshSolver method of the CglCutGenerator object.

Definition at line 206 of file CbcCutGenerator.hpp.

References numberCutsActive_.

void CbcCutGenerator::incrementNumberCutsActive ( int  value = 1  )  [inline]

Set the client model.

In addition to setting the client model, refreshModel also calls the refreshSolver method of the CglCutGenerator object.

Definition at line 208 of file CbcCutGenerator.hpp.

References numberCutsActive_.

void CbcCutGenerator::setSwitchOffIfLessThan ( int  value  )  [inline]

Set the client model.

In addition to setting the client model, refreshModel also calls the refreshSolver method of the CglCutGenerator object.

Definition at line 210 of file CbcCutGenerator.hpp.

References switchOffIfLessThan_.

int CbcCutGenerator::switchOffIfLessThan (  )  const [inline]

Set the client model.

In addition to setting the client model, refreshModel also calls the refreshSolver method of the CglCutGenerator object.

Definition at line 212 of file CbcCutGenerator.hpp.

References switchOffIfLessThan_.

bool CbcCutGenerator::needsOptimalBasis (  )  const [inline]

Say if optimal basis needed.

Definition at line 215 of file CbcCutGenerator.hpp.

References generator_, and CglCutGenerator::needsOptimalBasis().

bool CbcCutGenerator::mustCallAgain (  )  const [inline]

Whether generator MUST be called again if any cuts (i.e. ignore break from loop).

Definition at line 218 of file CbcCutGenerator.hpp.

References mustCallAgain_.

void CbcCutGenerator::setMustCallAgain ( bool  yesNo  )  [inline]

Set whether generator MUST be called again if any cuts (i.e. ignore break from loop).

Definition at line 221 of file CbcCutGenerator.hpp.

References mustCallAgain_.

bool CbcCutGenerator::switchedOff (  )  const [inline]

Whether generator switched off for moment.

Definition at line 224 of file CbcCutGenerator.hpp.

References switchedOff_.

void CbcCutGenerator::setSwitchedOff ( bool  yesNo  )  [inline]

Set whether generator switched off for moment.

Definition at line 227 of file CbcCutGenerator.hpp.


Member Data Documentation

CbcModel* CbcCutGenerator::model_ [private]

The client model.

Definition at line 228 of file CbcCutGenerator.hpp.

CglCutGenerator* CbcCutGenerator::generator_ [private]

Definition at line 236 of file CbcCutGenerator.hpp.

Referenced by generator(), and needsOptimalBasis().

int CbcCutGenerator::whenCutGenerator_ [private]

Number of nodes between calls to the CglCutGenerator::generateCuts routine.

Definition at line 241 of file CbcCutGenerator.hpp.

Referenced by howOften().

int CbcCutGenerator::whenCutGeneratorInSub_ [private]

Number of nodes between calls to the CglCutGenerator::generateCuts routine in sub tree.

Definition at line 245 of file CbcCutGenerator.hpp.

Referenced by howOftenInSub().

int CbcCutGenerator::switchOffIfLessThan_ [private]

If first pass at root produces fewer than this cuts then switch off.

Definition at line 248 of file CbcCutGenerator.hpp.

Referenced by setSwitchOffIfLessThan(), and switchOffIfLessThan().

int CbcCutGenerator::depthCutGenerator_ [private]

Depth at which to call the CglCutGenerator::generateCuts routine (If >0 then overrides when and is called if depthdepthCutGenerator==0).

Definition at line 253 of file CbcCutGenerator.hpp.

Referenced by whatDepth().

int CbcCutGenerator::depthCutGeneratorInSub_ [private]

Depth at which to call the CglCutGenerator::generateCuts routine (If >0 then overrides when and is called if depthdepthCutGenerator==0).

In sub tree.

Definition at line 259 of file CbcCutGenerator.hpp.

Referenced by whatDepthInSub().

char* CbcCutGenerator::generatorName_ [private]

Name of generator.

Definition at line 262 of file CbcCutGenerator.hpp.

Referenced by cutGeneratorName().

bool CbcCutGenerator::normal_ [private]

Whether to call the generator in the normal place.

Definition at line 265 of file CbcCutGenerator.hpp.

Referenced by normal(), and setNormal().

bool CbcCutGenerator::atSolution_ [private]

Whether to call the generator when a new solution is found.

Definition at line 268 of file CbcCutGenerator.hpp.

Referenced by atSolution(), and setAtSolution().

bool CbcCutGenerator::whenInfeasible_ [private]

Whether to call generator when a subproblem is found to be infeasible.

Definition at line 271 of file CbcCutGenerator.hpp.

Referenced by setWhenInfeasible(), and whenInfeasible().

bool CbcCutGenerator::mustCallAgain_ [private]

Whether generator MUST be called again if any cuts (i.e. ignore break from loop).

Definition at line 273 of file CbcCutGenerator.hpp.

Referenced by mustCallAgain(), and setMustCallAgain().

bool CbcCutGenerator::switchedOff_ [private]

Temporary switch off marker.

Definition at line 275 of file CbcCutGenerator.hpp.

Referenced by switchedOff().

bool CbcCutGenerator::timing_ [private]

Whether call generator being timed.

Definition at line 277 of file CbcCutGenerator.hpp.

Referenced by setTiming(), and timing().

double CbcCutGenerator::timeInCutGenerator_ [private]

Time in cut generator.

Definition at line 279 of file CbcCutGenerator.hpp.

Referenced by setTiming(), and timeInCutGenerator().

int CbcCutGenerator::numberTimes_ [private]

Number times cut generator entered.

Definition at line 282 of file CbcCutGenerator.hpp.

Referenced by incrementNumberTimesEntered(), numberTimesEntered(), and setNumberTimesEntered().

int CbcCutGenerator::numberCuts_ [private]

Total number of cuts added.

Definition at line 284 of file CbcCutGenerator.hpp.

Referenced by incrementNumberCutsInTotal(), numberCutsInTotal(), and setNumberCutsInTotal().

int CbcCutGenerator::numberColumnCuts_ [private]

Total number of column cuts added.

Definition at line 286 of file CbcCutGenerator.hpp.

Referenced by incrementNumberColumnCuts(), numberColumnCuts(), and setNumberColumnCuts().

int CbcCutGenerator::numberCutsActive_ [private]

Total number of cuts active after (at end of n cut passes at each node).

Definition at line 288 of file CbcCutGenerator.hpp.

Referenced by incrementNumberCutsActive(), numberCutsActive(), and setNumberCutsActive().


The documentation for this class was generated from the following file:
Generated on Thu May 15 21:59:54 2008 by  doxygen 1.4.7