#include <CbcCutGenerator.hpp>
Collaboration diagram for CbcCutGenerator:
Public Member Functions | |
Generate Cuts | |
bool | generateCuts (OsiCuts &cs, int fullScan, OsiSolverInterface *solver, 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. | |
CbcCutGenerator & | operator= (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 | generateTuning (FILE *fp) |
Create C++ lines to show how to tune. | |
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. | |
int | inaccuracy () const |
Get level of cut inaccuracy (0 means exact e.g. cliques). | |
void | setInaccuracy (int level) |
Set level of cut inaccuracy (0 means exact e.g. cliques). | |
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. | |
int | switches () const |
Get switches (for debug). | |
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. | |
void | incrementTimeInCutGenerator (double value) |
CglCutGenerator * | generator () const |
Get the CglCutGenerator corresponding to this CbcCutGenerator . | |
int | numberTimesEntered () const |
Number times cut generator entered. | |
void | setNumberTimesEntered (int value) |
void | incrementNumberTimesEntered (int value=1) |
int | numberCutsInTotal () const |
Total number of cuts added. | |
void | setNumberCutsInTotal (int value) |
void | incrementNumberCutsInTotal (int value=1) |
int | numberElementsInTotal () const |
Total number of elements added. | |
void | setNumberElementsInTotal (int value) |
void | incrementNumberElementsInTotal (int value=1) |
int | numberColumnCuts () const |
Total number of column cuts. | |
void | setNumberColumnCuts (int value) |
void | incrementNumberColumnCuts (int value=1) |
int | numberCutsActive () const |
Total number of cuts active after (at end of n cut passes at each node). | |
void | setNumberCutsActive (int value) |
void | incrementNumberCutsActive (int value=1) |
void | setSwitchOffIfLessThan (int value) |
int | switchOffIfLessThan () const |
bool | needsOptimalBasis () const |
Say if optimal basis needed. | |
void | setNeedsOptimalBasis (bool yesNo) |
Set 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. | |
bool | ineffectualCuts () const |
Whether last round of cuts did little. | |
void | setIneffectualCuts (bool yesNo) |
Set whether last round of cuts did little. | |
bool | whetherToUse () const |
Whether to use if any cuts generated. | |
void | setWhetherToUse (bool yesNo) |
Set whether to use if any cuts generated. | |
bool | whetherInMustCallAgainMode () const |
Whether in must call again mode (or after others). | |
void | setWhetherInMustCallAgainMode (bool yesNo) |
Set whether in must call again mode (or after others). | |
bool | whetherCallAtEnd () const |
Whether to call at end. | |
void | setWhetherCallAtEnd (bool yesNo) |
Set whether to call at end. | |
int | numberCutsAtRoot () const |
Number of cuts generated at root. | |
void | setNumberCutsAtRoot (int value) |
int | numberActiveCutsAtRoot () const |
Number of cuts active at root. | |
void | setNumberActiveCutsAtRoot (int value) |
int | numberShortCutsAtRoot () const |
Number of short cuts at root. | |
void | setModel (CbcModel *model) |
Set model. | |
bool | globalCutsAtRoot () const |
Whether global cuts at root. | |
void | setGlobalCutsAtRoot (bool yesNo) |
Set whether global cuts at root. | |
bool | globalCuts () const |
Whether global cuts. | |
void | setGlobalCuts (bool yesNo) |
Set whether global cuts. | |
Private Attributes | |
OsiCuts | savedCuts_ |
Saved cuts. | |
double | timeInCutGenerator_ |
Time in cut generator. | |
CbcModel * | model_ |
The client model. | |
CglCutGenerator * | generator_ |
char * | generatorName_ |
Name of generator. | |
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). | |
int | inaccuracy_ |
Level of cut inaccuracy (0 means exact e.g. cliques). | |
int | numberTimes_ |
Number times cut generator entered. | |
int | numberCuts_ |
Total number of cuts added. | |
int | numberElements_ |
Total number of elements 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). | |
int | numberCutsAtRoot_ |
Number of cuts generated at root. | |
int | numberActiveCutsAtRoot_ |
Number of cuts active at root. | |
int | numberShortCutsAtRoot_ |
Number of short cuts at root. | |
int | switches_ |
Switches - see gets and sets. |
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.
generateCuts
method. Create a default decision method that looks at the builtin criteria.
Definition at line 49 of file CbcCutGenerator.hpp.
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.
bool CbcCutGenerator::generateCuts | ( | OsiCuts & | cs, | |
int | fullScan, | |||
OsiSolverInterface * | solver, | |||
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 !=0, the generator is obliged to call the CGL generateCuts
routine. Otherwise, it is free to make a local decision. Negative fullScan says things like at integer solution 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] |
void CbcCutGenerator::generateTuning | ( | FILE * | fp | ) |
Create C++ lines to show how to tune.
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] |
int CbcCutGenerator::howOftenInSub | ( | ) | const [inline] |
int CbcCutGenerator::inaccuracy | ( | ) | const [inline] |
Get level of cut inaccuracy (0 means exact e.g. cliques).
Definition at line 139 of file CbcCutGenerator.hpp.
void CbcCutGenerator::setInaccuracy | ( | int | level | ) | [inline] |
Set level of cut inaccuracy (0 means exact e.g. cliques).
Definition at line 143 of file CbcCutGenerator.hpp.
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] |
int CbcCutGenerator::whatDepthInSub | ( | ) | const [inline] |
Get the cut generation depth criterion.in sub tree.
Definition at line 165 of file CbcCutGenerator.hpp.
int CbcCutGenerator::switches | ( | ) | const [inline] |
bool CbcCutGenerator::normal | ( | ) | const [inline] |
Get whether the cut generator should be called in the normal place.
Definition at line 174 of file CbcCutGenerator.hpp.
void CbcCutGenerator::setNormal | ( | bool | value | ) | [inline] |
Set whether the cut generator should be called in the normal place.
Definition at line 178 of file CbcCutGenerator.hpp.
bool CbcCutGenerator::atSolution | ( | ) | const [inline] |
Get whether the cut generator should be called when a solution is found.
Definition at line 183 of file CbcCutGenerator.hpp.
void CbcCutGenerator::setAtSolution | ( | bool | value | ) | [inline] |
Set whether the cut generator should be called when a solution is found.
Definition at line 187 of file CbcCutGenerator.hpp.
bool CbcCutGenerator::whenInfeasible | ( | ) | const [inline] |
Get whether the cut generator should be called when the subproblem is found to be infeasible.
Definition at line 194 of file CbcCutGenerator.hpp.
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 200 of file CbcCutGenerator.hpp.
bool CbcCutGenerator::timing | ( | ) | const [inline] |
void CbcCutGenerator::setTiming | ( | bool | value | ) | [inline] |
double CbcCutGenerator::timeInCutGenerator | ( | ) | const [inline] |
void CbcCutGenerator::incrementTimeInCutGenerator | ( | double | value | ) | [inline] |
Definition at line 218 of file CbcCutGenerator.hpp.
CglCutGenerator* CbcCutGenerator::generator | ( | ) | const [inline] |
Get the CglCutGenerator
corresponding to this CbcCutGenerator
.
Definition at line 222 of file CbcCutGenerator.hpp.
int CbcCutGenerator::numberTimesEntered | ( | ) | const [inline] |
void CbcCutGenerator::setNumberTimesEntered | ( | int | value | ) | [inline] |
Definition at line 229 of file CbcCutGenerator.hpp.
void CbcCutGenerator::incrementNumberTimesEntered | ( | int | value = 1 |
) | [inline] |
Definition at line 232 of file CbcCutGenerator.hpp.
int CbcCutGenerator::numberCutsInTotal | ( | ) | const [inline] |
void CbcCutGenerator::setNumberCutsInTotal | ( | int | value | ) | [inline] |
Definition at line 239 of file CbcCutGenerator.hpp.
void CbcCutGenerator::incrementNumberCutsInTotal | ( | int | value = 1 |
) | [inline] |
Definition at line 242 of file CbcCutGenerator.hpp.
int CbcCutGenerator::numberElementsInTotal | ( | ) | const [inline] |
void CbcCutGenerator::setNumberElementsInTotal | ( | int | value | ) | [inline] |
Definition at line 249 of file CbcCutGenerator.hpp.
void CbcCutGenerator::incrementNumberElementsInTotal | ( | int | value = 1 |
) | [inline] |
Definition at line 252 of file CbcCutGenerator.hpp.
int CbcCutGenerator::numberColumnCuts | ( | ) | const [inline] |
void CbcCutGenerator::setNumberColumnCuts | ( | int | value | ) | [inline] |
Definition at line 259 of file CbcCutGenerator.hpp.
void CbcCutGenerator::incrementNumberColumnCuts | ( | int | value = 1 |
) | [inline] |
Definition at line 262 of file CbcCutGenerator.hpp.
int CbcCutGenerator::numberCutsActive | ( | ) | const [inline] |
Total number of cuts active after (at end of n cut passes at each node).
Definition at line 266 of file CbcCutGenerator.hpp.
void CbcCutGenerator::setNumberCutsActive | ( | int | value | ) | [inline] |
Definition at line 269 of file CbcCutGenerator.hpp.
void CbcCutGenerator::incrementNumberCutsActive | ( | int | value = 1 |
) | [inline] |
Definition at line 272 of file CbcCutGenerator.hpp.
void CbcCutGenerator::setSwitchOffIfLessThan | ( | int | value | ) | [inline] |
Definition at line 275 of file CbcCutGenerator.hpp.
int CbcCutGenerator::switchOffIfLessThan | ( | ) | const [inline] |
Definition at line 278 of file CbcCutGenerator.hpp.
bool CbcCutGenerator::needsOptimalBasis | ( | ) | const [inline] |
void CbcCutGenerator::setNeedsOptimalBasis | ( | bool | yesNo | ) | [inline] |
bool CbcCutGenerator::mustCallAgain | ( | ) | const [inline] |
Whether generator MUST be called again if any cuts (i.e. ignore break from loop).
Definition at line 291 of file CbcCutGenerator.hpp.
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 295 of file CbcCutGenerator.hpp.
bool CbcCutGenerator::switchedOff | ( | ) | const [inline] |
void CbcCutGenerator::setSwitchedOff | ( | bool | yesNo | ) | [inline] |
bool CbcCutGenerator::ineffectualCuts | ( | ) | const [inline] |
void CbcCutGenerator::setIneffectualCuts | ( | bool | yesNo | ) | [inline] |
bool CbcCutGenerator::whetherToUse | ( | ) | const [inline] |
void CbcCutGenerator::setWhetherToUse | ( | bool | yesNo | ) | [inline] |
bool CbcCutGenerator::whetherInMustCallAgainMode | ( | ) | const [inline] |
Whether in must call again mode (or after others).
Definition at line 327 of file CbcCutGenerator.hpp.
void CbcCutGenerator::setWhetherInMustCallAgainMode | ( | bool | yesNo | ) | [inline] |
Set whether in must call again mode (or after others).
Definition at line 331 of file CbcCutGenerator.hpp.
bool CbcCutGenerator::whetherCallAtEnd | ( | ) | const [inline] |
void CbcCutGenerator::setWhetherCallAtEnd | ( | bool | yesNo | ) | [inline] |
int CbcCutGenerator::numberCutsAtRoot | ( | ) | const [inline] |
void CbcCutGenerator::setNumberCutsAtRoot | ( | int | value | ) | [inline] |
Definition at line 348 of file CbcCutGenerator.hpp.
int CbcCutGenerator::numberActiveCutsAtRoot | ( | ) | const [inline] |
void CbcCutGenerator::setNumberActiveCutsAtRoot | ( | int | value | ) | [inline] |
Definition at line 355 of file CbcCutGenerator.hpp.
int CbcCutGenerator::numberShortCutsAtRoot | ( | ) | const [inline] |
void CbcCutGenerator::setModel | ( | CbcModel * | model | ) | [inline] |
bool CbcCutGenerator::globalCutsAtRoot | ( | ) | const [inline] |
void CbcCutGenerator::setGlobalCutsAtRoot | ( | bool | yesNo | ) | [inline] |
bool CbcCutGenerator::globalCuts | ( | ) | const [inline] |
void CbcCutGenerator::setGlobalCuts | ( | bool | yesNo | ) | [inline] |
OsiCuts CbcCutGenerator::savedCuts_ [private] |
double CbcCutGenerator::timeInCutGenerator_ [private] |
CbcModel* CbcCutGenerator::model_ [private] |
CglCutGenerator* CbcCutGenerator::generator_ [private] |
Definition at line 398 of file CbcCutGenerator.hpp.
char* CbcCutGenerator::generatorName_ [private] |
int CbcCutGenerator::whenCutGenerator_ [private] |
Number of nodes between calls to the CglCutGenerator::generateCuts routine.
Definition at line 406 of file CbcCutGenerator.hpp.
int CbcCutGenerator::whenCutGeneratorInSub_ [private] |
Number of nodes between calls to the CglCutGenerator::generateCuts routine in sub tree.
Definition at line 410 of file CbcCutGenerator.hpp.
int CbcCutGenerator::switchOffIfLessThan_ [private] |
If first pass at root produces fewer than this cuts then switch off.
Definition at line 413 of file CbcCutGenerator.hpp.
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 418 of file CbcCutGenerator.hpp.
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 424 of file CbcCutGenerator.hpp.
int CbcCutGenerator::inaccuracy_ [private] |
Level of cut inaccuracy (0 means exact e.g. cliques).
Definition at line 427 of file CbcCutGenerator.hpp.
int CbcCutGenerator::numberTimes_ [private] |
int CbcCutGenerator::numberCuts_ [private] |
int CbcCutGenerator::numberElements_ [private] |
int CbcCutGenerator::numberColumnCuts_ [private] |
int CbcCutGenerator::numberCutsActive_ [private] |
Total number of cuts active after (at end of n cut passes at each node).
Definition at line 437 of file CbcCutGenerator.hpp.
int CbcCutGenerator::numberCutsAtRoot_ [private] |
int CbcCutGenerator::numberActiveCutsAtRoot_ [private] |
int CbcCutGenerator::numberShortCutsAtRoot_ [private] |
int CbcCutGenerator::switches_ [private] |