Cbc
2.10.10
|
Interface between Cbc and Cut Generation Library. More...
#include <CbcCutGenerator.hpp>
Public Member Functions | |
Generate Cuts | |
bool | generateCuts (OsiCuts &cs, int fullScan, OsiSolverInterface *solver, CbcNode *node) |
Generate cuts for the client model. More... | |
Constructors and destructors | |
CbcCutGenerator () | |
Default constructor. More... | |
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. More... | |
CbcCutGenerator (const CbcCutGenerator &) | |
Copy constructor. More... | |
CbcCutGenerator & | operator= (const CbcCutGenerator &rhs) |
Assignment operator. More... | |
~CbcCutGenerator () | |
Destructor. More... | |
Gets and sets | |
void | refreshModel (CbcModel *model) |
Set the client model. More... | |
const char * | cutGeneratorName () const |
return name of generator More... | |
void | generateTuning (FILE *fp) |
Create C++ lines to show how to tune. More... | |
void | setHowOften (int value) |
Set the cut generation interval. More... | |
int | howOften () const |
Get the cut generation interval. More... | |
int | howOftenInSub () const |
Get the cut generation interval.in sub tree. More... | |
int | inaccuracy () const |
Get level of cut inaccuracy (0 means exact e.g. cliques) More... | |
void | setInaccuracy (int level) |
Set level of cut inaccuracy (0 means exact e.g. cliques) More... | |
void | setWhatDepth (int value) |
Set the cut generation depth. More... | |
void | setWhatDepthInSub (int value) |
Set the cut generation depth in sub tree. More... | |
int | whatDepth () const |
Get the cut generation depth criterion. More... | |
int | whatDepthInSub () const |
Get the cut generation depth criterion.in sub tree. More... | |
void | setMaximumTries (int value) |
Set maximum number of times to enter. More... | |
int | maximumTries () const |
Get maximum number of times to enter. More... | |
int | switches () const |
Get switches. More... | |
void | setSwitches (int value) |
Set switches (for copying from virgin state) More... | |
bool | normal () const |
Get whether the cut generator should be called in the normal place. More... | |
void | setNormal (bool value) |
Set whether the cut generator should be called in the normal place. More... | |
bool | atSolution () const |
Get whether the cut generator should be called when a solution is found. More... | |
void | setAtSolution (bool value) |
Set whether the cut generator should be called when a solution is found. More... | |
bool | whenInfeasible () const |
Get whether the cut generator should be called when the subproblem is found to be infeasible. More... | |
void | setWhenInfeasible (bool value) |
Set whether the cut generator should be called when the subproblem is found to be infeasible. More... | |
bool | timing () const |
Get whether the cut generator is being timed. More... | |
void | setTiming (bool value) |
Set whether the cut generator is being timed. More... | |
double | timeInCutGenerator () const |
Return time taken in cut generator. More... | |
void | incrementTimeInCutGenerator (double value) |
CglCutGenerator * | generator () const |
Get the CglCutGenerator corresponding to this CbcCutGenerator . More... | |
int | numberTimesEntered () const |
Number times cut generator entered. More... | |
void | setNumberTimesEntered (int value) |
void | incrementNumberTimesEntered (int value=1) |
int | numberCutsInTotal () const |
Total number of cuts added. More... | |
void | setNumberCutsInTotal (int value) |
void | incrementNumberCutsInTotal (int value=1) |
int | numberElementsInTotal () const |
Total number of elements added. More... | |
void | setNumberElementsInTotal (int value) |
void | incrementNumberElementsInTotal (int value=1) |
int | numberColumnCuts () const |
Total number of column cuts. More... | |
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) More... | |
void | setNumberCutsActive (int value) |
void | incrementNumberCutsActive (int value=1) |
void | setSwitchOffIfLessThan (int value) |
int | switchOffIfLessThan () const |
bool | needsOptimalBasis () const |
Say if optimal basis needed. More... | |
void | setNeedsOptimalBasis (bool yesNo) |
Set if optimal basis needed. More... | |
bool | mustCallAgain () const |
Whether generator MUST be called again if any cuts (i.e. ignore break from loop) More... | |
void | setMustCallAgain (bool yesNo) |
Set whether generator MUST be called again if any cuts (i.e. ignore break from loop) More... | |
bool | switchedOff () const |
Whether generator switched off for moment. More... | |
void | setSwitchedOff (bool yesNo) |
Set whether generator switched off for moment. More... | |
bool | ineffectualCuts () const |
Whether last round of cuts did little. More... | |
void | setIneffectualCuts (bool yesNo) |
Set whether last round of cuts did little. More... | |
bool | whetherToUse () const |
Whether to use if any cuts generated. More... | |
void | setWhetherToUse (bool yesNo) |
Set whether to use if any cuts generated. More... | |
bool | whetherInMustCallAgainMode () const |
Whether in must call again mode (or after others) More... | |
void | setWhetherInMustCallAgainMode (bool yesNo) |
Set whether in must call again mode (or after others) More... | |
bool | whetherCallAtEnd () const |
Whether to call at end. More... | |
void | setWhetherCallAtEnd (bool yesNo) |
Set whether to call at end. More... | |
bool | needsRefresh () const |
Whether needs refresh on copy. More... | |
void | setNeedsRefresh (bool yesNo) |
Set whether needs refresh on copy. More... | |
int | numberCutsAtRoot () const |
Number of cuts generated at root. More... | |
void | setNumberCutsAtRoot (int value) |
int | numberActiveCutsAtRoot () const |
Number of cuts active at root. More... | |
void | setNumberActiveCutsAtRoot (int value) |
int | numberShortCutsAtRoot () const |
Number of short cuts at root. More... | |
void | setNumberShortCutsAtRoot (int value) |
void | setModel (CbcModel *model) |
Set model. More... | |
bool | globalCutsAtRoot () const |
Whether global cuts at root. More... | |
void | setGlobalCutsAtRoot (bool yesNo) |
Set whether global cuts at root. More... | |
bool | globalCuts () const |
Whether global cuts. More... | |
void | setGlobalCuts (bool yesNo) |
Set whether global cuts. More... | |
void | addStatistics (const CbcCutGenerator *other) |
Add in statistics from other. More... | |
void | scaleBackStatistics (int factor) |
Scale back statistics by factor. More... | |
Private Attributes | |
Private gets and sets | |
OsiCuts | savedCuts_ |
Saved cuts. More... | |
double | timeInCutGenerator_ |
Time in cut generator. More... | |
CbcModel * | model_ |
The client model. More... | |
CglCutGenerator * | generator_ |
char * | generatorName_ |
Name of generator. More... | |
int | whenCutGenerator_ |
Number of nodes between calls to the CglCutGenerator::generateCuts routine. More... | |
int | whenCutGeneratorInSub_ |
Number of nodes between calls to the CglCutGenerator::generateCuts routine in sub tree. More... | |
int | switchOffIfLessThan_ |
If first pass at root produces fewer than this cuts then switch off. More... | |
int | depthCutGenerator_ |
Depth at which to call the CglCutGenerator::generateCuts routine (If >0 then overrides when and is called if depthdepthCutGenerator==0). More... | |
int | depthCutGeneratorInSub_ |
Depth at which to call the CglCutGenerator::generateCuts routine (If >0 then overrides when and is called if depthdepthCutGenerator==0). More... | |
int | inaccuracy_ |
Level of cut inaccuracy (0 means exact e.g. cliques) More... | |
int | numberTimes_ |
Number times cut generator entered. More... | |
int | numberCuts_ |
Total number of cuts added. More... | |
int | numberElements_ |
Total number of elements added. More... | |
int | numberColumnCuts_ |
Total number of column cuts added. More... | |
int | numberCutsActive_ |
Total number of cuts active after (at end of n cut passes at each node) More... | |
int | numberCutsAtRoot_ |
Number of cuts generated at root. More... | |
int | numberActiveCutsAtRoot_ |
Number of cuts active at root. More... | |
int | numberShortCutsAtRoot_ |
Number of short cuts at root. More... | |
int | switches_ |
Switches - see gets and sets. More... | |
int | maximumTries_ |
Maximum number of times to enter. More... | |
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.
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.
|
inline |
return name of generator
Definition at line 106 of file CbcCutGenerator.hpp.
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.
|
inline |
Get the cut generation interval.
Definition at line 130 of file CbcCutGenerator.hpp.
|
inline |
Get the cut generation interval.in sub tree.
Definition at line 135 of file CbcCutGenerator.hpp.
|
inline |
Get level of cut inaccuracy (0 means exact e.g. cliques)
Definition at line 140 of file CbcCutGenerator.hpp.
|
inline |
Set level of cut inaccuracy (0 means exact e.g. cliques)
Definition at line 145 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.
|
inline |
Get the cut generation depth criterion.
Definition at line 164 of file CbcCutGenerator.hpp.
|
inline |
Get the cut generation depth criterion.in sub tree.
Definition at line 169 of file CbcCutGenerator.hpp.
|
inline |
Set maximum number of times to enter.
Definition at line 174 of file CbcCutGenerator.hpp.
|
inline |
Get maximum number of times to enter.
Definition at line 179 of file CbcCutGenerator.hpp.
|
inline |
Get switches.
Definition at line 185 of file CbcCutGenerator.hpp.
|
inline |
Set switches (for copying from virgin state)
Definition at line 190 of file CbcCutGenerator.hpp.
|
inline |
Get whether the cut generator should be called in the normal place.
Definition at line 195 of file CbcCutGenerator.hpp.
|
inline |
Set whether the cut generator should be called in the normal place.
Definition at line 200 of file CbcCutGenerator.hpp.
|
inline |
Get whether the cut generator should be called when a solution is found.
Definition at line 206 of file CbcCutGenerator.hpp.
|
inline |
Set whether the cut generator should be called when a solution is found.
Definition at line 211 of file CbcCutGenerator.hpp.
|
inline |
Get whether the cut generator should be called when the subproblem is found to be infeasible.
Definition at line 219 of file CbcCutGenerator.hpp.
|
inline |
Set whether the cut generator should be called when the subproblem is found to be infeasible.
Definition at line 226 of file CbcCutGenerator.hpp.
|
inline |
Get whether the cut generator is being timed.
Definition at line 232 of file CbcCutGenerator.hpp.
|
inline |
Set whether the cut generator is being timed.
Definition at line 237 of file CbcCutGenerator.hpp.
|
inline |
Return time taken in cut generator.
Definition at line 244 of file CbcCutGenerator.hpp.
|
inline |
Definition at line 248 of file CbcCutGenerator.hpp.
|
inline |
Get the CglCutGenerator
corresponding to this CbcCutGenerator
.
Definition at line 253 of file CbcCutGenerator.hpp.
|
inline |
Number times cut generator entered.
Definition at line 258 of file CbcCutGenerator.hpp.
|
inline |
Definition at line 262 of file CbcCutGenerator.hpp.
|
inline |
Definition at line 266 of file CbcCutGenerator.hpp.
|
inline |
Total number of cuts added.
Definition at line 271 of file CbcCutGenerator.hpp.
|
inline |
Definition at line 275 of file CbcCutGenerator.hpp.
|
inline |
Definition at line 279 of file CbcCutGenerator.hpp.
|
inline |
Total number of elements added.
Definition at line 284 of file CbcCutGenerator.hpp.
|
inline |
Definition at line 288 of file CbcCutGenerator.hpp.
|
inline |
Definition at line 292 of file CbcCutGenerator.hpp.
|
inline |
Total number of column cuts.
Definition at line 297 of file CbcCutGenerator.hpp.
|
inline |
Definition at line 301 of file CbcCutGenerator.hpp.
|
inline |
Definition at line 305 of file CbcCutGenerator.hpp.
|
inline |
Total number of cuts active after (at end of n cut passes at each node)
Definition at line 310 of file CbcCutGenerator.hpp.
|
inline |
Definition at line 314 of file CbcCutGenerator.hpp.
|
inline |
Definition at line 318 of file CbcCutGenerator.hpp.
|
inline |
Definition at line 322 of file CbcCutGenerator.hpp.
|
inline |
Definition at line 326 of file CbcCutGenerator.hpp.
|
inline |
Say if optimal basis needed.
Definition at line 331 of file CbcCutGenerator.hpp.
|
inline |
Set if optimal basis needed.
Definition at line 336 of file CbcCutGenerator.hpp.
|
inline |
Whether generator MUST be called again if any cuts (i.e. ignore break from loop)
Definition at line 342 of file CbcCutGenerator.hpp.
|
inline |
Set whether generator MUST be called again if any cuts (i.e. ignore break from loop)
Definition at line 347 of file CbcCutGenerator.hpp.
|
inline |
Whether generator switched off for moment.
Definition at line 353 of file CbcCutGenerator.hpp.
|
inline |
Set whether generator switched off for moment.
Definition at line 358 of file CbcCutGenerator.hpp.
|
inline |
Whether last round of cuts did little.
Definition at line 364 of file CbcCutGenerator.hpp.
|
inline |
Set whether last round of cuts did little.
Definition at line 369 of file CbcCutGenerator.hpp.
|
inline |
Whether to use if any cuts generated.
Definition at line 375 of file CbcCutGenerator.hpp.
|
inline |
Set whether to use if any cuts generated.
Definition at line 380 of file CbcCutGenerator.hpp.
|
inline |
Whether in must call again mode (or after others)
Definition at line 386 of file CbcCutGenerator.hpp.
|
inline |
Set whether in must call again mode (or after others)
Definition at line 391 of file CbcCutGenerator.hpp.
|
inline |
Whether to call at end.
Definition at line 397 of file CbcCutGenerator.hpp.
|
inline |
Set whether to call at end.
Definition at line 402 of file CbcCutGenerator.hpp.
|
inline |
Whether needs refresh on copy.
Definition at line 408 of file CbcCutGenerator.hpp.
|
inline |
Set whether needs refresh on copy.
Definition at line 413 of file CbcCutGenerator.hpp.
|
inline |
Number of cuts generated at root.
Definition at line 419 of file CbcCutGenerator.hpp.
|
inline |
Definition at line 423 of file CbcCutGenerator.hpp.
|
inline |
Number of cuts active at root.
Definition at line 428 of file CbcCutGenerator.hpp.
|
inline |
Definition at line 432 of file CbcCutGenerator.hpp.
|
inline |
Number of short cuts at root.
Definition at line 437 of file CbcCutGenerator.hpp.
|
inline |
Definition at line 441 of file CbcCutGenerator.hpp.
|
inline |
Set model.
Definition at line 446 of file CbcCutGenerator.hpp.
|
inline |
Whether global cuts at root.
Definition at line 451 of file CbcCutGenerator.hpp.
|
inline |
Set whether global cuts at root.
Definition at line 456 of file CbcCutGenerator.hpp.
|
inline |
Whether global cuts.
Definition at line 462 of file CbcCutGenerator.hpp.
|
inline |
Set whether global cuts.
Definition at line 467 of file CbcCutGenerator.hpp.
void CbcCutGenerator::addStatistics | ( | const CbcCutGenerator * | other | ) |
Add in statistics from other.
void CbcCutGenerator::scaleBackStatistics | ( | int | factor | ) |
Scale back statistics by factor.
|
private |
Saved cuts.
Definition at line 483 of file CbcCutGenerator.hpp.
|
private |
Time in cut generator.
Definition at line 485 of file CbcCutGenerator.hpp.
|
private |
The client model.
Definition at line 487 of file CbcCutGenerator.hpp.
|
private |
Definition at line 490 of file CbcCutGenerator.hpp.
|
private |
Name of generator.
Definition at line 493 of file CbcCutGenerator.hpp.
|
private |
Number of nodes between calls to the CglCutGenerator::generateCuts routine.
Definition at line 498 of file CbcCutGenerator.hpp.
|
private |
Number of nodes between calls to the CglCutGenerator::generateCuts routine in sub tree.
Definition at line 502 of file CbcCutGenerator.hpp.
|
private |
If first pass at root produces fewer than this cuts then switch off.
Definition at line 505 of file CbcCutGenerator.hpp.
|
private |
Depth at which to call the CglCutGenerator::generateCuts routine (If >0 then overrides when and is called if depthdepthCutGenerator==0).
Definition at line 510 of file CbcCutGenerator.hpp.
|
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 516 of file CbcCutGenerator.hpp.
|
private |
Level of cut inaccuracy (0 means exact e.g. cliques)
Definition at line 519 of file CbcCutGenerator.hpp.
|
private |
Number times cut generator entered.
Definition at line 521 of file CbcCutGenerator.hpp.
|
private |
Total number of cuts added.
Definition at line 523 of file CbcCutGenerator.hpp.
|
private |
Total number of elements added.
Definition at line 525 of file CbcCutGenerator.hpp.
|
private |
Total number of column cuts added.
Definition at line 527 of file CbcCutGenerator.hpp.
|
private |
Total number of cuts active after (at end of n cut passes at each node)
Definition at line 529 of file CbcCutGenerator.hpp.
|
private |
Number of cuts generated at root.
Definition at line 531 of file CbcCutGenerator.hpp.
|
private |
Number of cuts active at root.
Definition at line 533 of file CbcCutGenerator.hpp.
|
private |
Number of short cuts at root.
Definition at line 535 of file CbcCutGenerator.hpp.
|
private |
Switches - see gets and sets.
Definition at line 537 of file CbcCutGenerator.hpp.
|
private |
Maximum number of times to enter.
Definition at line 539 of file CbcCutGenerator.hpp.