Cbc
2.8.12
|
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 (for debug) 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... | |
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... | |
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 108 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 131 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 139 of file CbcCutGenerator.hpp.
|
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.
|
inline |
Get the cut generation depth criterion.
Definition at line 161 of file CbcCutGenerator.hpp.
|
inline |
Get the cut generation depth criterion.in sub tree.
Definition at line 165 of file CbcCutGenerator.hpp.
|
inline |
Set maximum number of times to enter.
Definition at line 169 of file CbcCutGenerator.hpp.
|
inline |
Get maximum number of times to enter.
Definition at line 172 of file CbcCutGenerator.hpp.
|
inline |
Get switches (for debug)
Definition at line 176 of file CbcCutGenerator.hpp.
|
inline |
Get whether the cut generator should be called in the normal place.
Definition at line 180 of file CbcCutGenerator.hpp.
|
inline |
Set whether the cut generator should be called in the normal place.
Definition at line 184 of file CbcCutGenerator.hpp.
|
inline |
Get whether the cut generator should be called when a solution is found.
Definition at line 189 of file CbcCutGenerator.hpp.
|
inline |
Set whether the cut generator should be called when a solution is found.
Definition at line 193 of file CbcCutGenerator.hpp.
|
inline |
Get whether the cut generator should be called when the subproblem is found to be infeasible.
Definition at line 200 of file CbcCutGenerator.hpp.
|
inline |
Set whether the cut generator should be called when the subproblem is found to be infeasible.
Definition at line 206 of file CbcCutGenerator.hpp.
|
inline |
Get whether the cut generator is being timed.
Definition at line 211 of file CbcCutGenerator.hpp.
|
inline |
Set whether the cut generator is being timed.
Definition at line 215 of file CbcCutGenerator.hpp.
|
inline |
Return time taken in cut generator.
Definition at line 221 of file CbcCutGenerator.hpp.
|
inline |
Definition at line 224 of file CbcCutGenerator.hpp.
|
inline |
Get the CglCutGenerator
corresponding to this CbcCutGenerator
.
Definition at line 228 of file CbcCutGenerator.hpp.
|
inline |
Number times cut generator entered.
Definition at line 232 of file CbcCutGenerator.hpp.
|
inline |
Definition at line 235 of file CbcCutGenerator.hpp.
|
inline |
Definition at line 238 of file CbcCutGenerator.hpp.
|
inline |
Total number of cuts added.
Definition at line 242 of file CbcCutGenerator.hpp.
|
inline |
Definition at line 245 of file CbcCutGenerator.hpp.
|
inline |
Definition at line 248 of file CbcCutGenerator.hpp.
|
inline |
Total number of elements added.
Definition at line 252 of file CbcCutGenerator.hpp.
|
inline |
Definition at line 255 of file CbcCutGenerator.hpp.
|
inline |
Definition at line 258 of file CbcCutGenerator.hpp.
|
inline |
Total number of column cuts.
Definition at line 262 of file CbcCutGenerator.hpp.
|
inline |
Definition at line 265 of file CbcCutGenerator.hpp.
|
inline |
Definition at line 268 of file CbcCutGenerator.hpp.
|
inline |
Total number of cuts active after (at end of n cut passes at each node)
Definition at line 272 of file CbcCutGenerator.hpp.
|
inline |
Definition at line 275 of file CbcCutGenerator.hpp.
|
inline |
Definition at line 278 of file CbcCutGenerator.hpp.
|
inline |
Definition at line 281 of file CbcCutGenerator.hpp.
|
inline |
Definition at line 284 of file CbcCutGenerator.hpp.
|
inline |
Say if optimal basis needed.
Definition at line 288 of file CbcCutGenerator.hpp.
|
inline |
Set if optimal basis needed.
Definition at line 292 of file CbcCutGenerator.hpp.
|
inline |
Whether generator MUST be called again if any cuts (i.e. ignore break from loop)
Definition at line 297 of file CbcCutGenerator.hpp.
|
inline |
Set whether generator MUST be called again if any cuts (i.e. ignore break from loop)
Definition at line 301 of file CbcCutGenerator.hpp.
|
inline |
Whether generator switched off for moment.
Definition at line 306 of file CbcCutGenerator.hpp.
|
inline |
Set whether generator switched off for moment.
Definition at line 310 of file CbcCutGenerator.hpp.
|
inline |
Whether last round of cuts did little.
Definition at line 315 of file CbcCutGenerator.hpp.
|
inline |
Set whether last round of cuts did little.
Definition at line 319 of file CbcCutGenerator.hpp.
|
inline |
Whether to use if any cuts generated.
Definition at line 324 of file CbcCutGenerator.hpp.
|
inline |
Set whether to use if any cuts generated.
Definition at line 328 of file CbcCutGenerator.hpp.
|
inline |
Whether in must call again mode (or after others)
Definition at line 333 of file CbcCutGenerator.hpp.
|
inline |
Set whether in must call again mode (or after others)
Definition at line 337 of file CbcCutGenerator.hpp.
|
inline |
Whether to call at end.
Definition at line 342 of file CbcCutGenerator.hpp.
|
inline |
Set whether to call at end.
Definition at line 346 of file CbcCutGenerator.hpp.
|
inline |
Number of cuts generated at root.
Definition at line 351 of file CbcCutGenerator.hpp.
|
inline |
Definition at line 354 of file CbcCutGenerator.hpp.
|
inline |
Number of cuts active at root.
Definition at line 358 of file CbcCutGenerator.hpp.
|
inline |
Definition at line 361 of file CbcCutGenerator.hpp.
|
inline |
Number of short cuts at root.
Definition at line 365 of file CbcCutGenerator.hpp.
|
inline |
Definition at line 368 of file CbcCutGenerator.hpp.
|
inline |
Set model.
Definition at line 372 of file CbcCutGenerator.hpp.
|
inline |
Whether global cuts at root.
Definition at line 376 of file CbcCutGenerator.hpp.
|
inline |
Set whether global cuts at root.
Definition at line 380 of file CbcCutGenerator.hpp.
|
inline |
Whether global cuts.
Definition at line 385 of file CbcCutGenerator.hpp.
|
inline |
Set whether global cuts.
Definition at line 389 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.