Heuristic base class. More...
#include <CbcHeuristic.hpp>
Public Member Functions | |
CbcHeuristic () | |
CbcHeuristic (CbcModel &model) | |
CbcHeuristic (const CbcHeuristic &) | |
virtual | ~CbcHeuristic () |
virtual CbcHeuristic * | clone () const =0 |
Clone. More... | |
CbcHeuristic & | operator= (const CbcHeuristic &rhs) |
Assignment operator. More... | |
virtual void | setModel (CbcModel *model) |
update model (This is needed if cliques update matrix etc) More... | |
virtual void | resetModel (CbcModel *model)=0 |
Resets stuff if model changes. More... | |
virtual int | solution (double &objectiveValue, double *newSolution)=0 |
returns 0 if no solution, 1 if valid solution with better objective value than one passed in Sets solution values if good, sets objective value This is called after cuts have been added - so can not add cuts More... | |
virtual int | solution2 (double &, double *, OsiCuts &) |
returns 0 if no solution, 1 if valid solution, -1 if just returning an estimate of best possible solution with better objective value than one passed in Sets solution values if good, sets objective value (only if nonzero code) This is called at same time as cut generators - so can add cuts Default is do nothing More... | |
virtual void | validate () |
Validate model i.e. sets when_ to 0 if necessary (may be NULL) More... | |
void | setWhen (int value) |
Sets "when" flag - 0 off, 1 at root, 2 other than root, 3 always. More... | |
int | when () const |
Gets "when" flag - 0 off, 1 at root, 2 other than root, 3 always. More... | |
void | setNumberNodes (int value) |
Sets number of nodes in subtree (default 200) More... | |
int | numberNodes () const |
Gets number of nodes in a subtree (default 200) More... | |
void | setSwitches (int value) |
Switches (does not apply equally to all heuristics) 1 bit - stop once allowable gap on objective reached 2 bit - always do given number of passes 4 bit - weaken cutoff by 5% every 50 passes? 8 bit - if has cutoff and suminf bobbling for 20 passes then first try halving distance to best possible then try keep halving distance to known cutoff 1024 bit - stop all heuristics on max time. More... | |
int | switches () const |
Switches (does not apply equally to all heuristics) 1 bit - stop once allowable gap on objective reached 2 bit - always do given number of passes 4 bit - weaken cutoff by 5% every 50 passes? 8 bit - if has cutoff and suminf bobbling for 20 passes then first try halving distance to best possible then try keep halving distance to known cutoff 1024 bit - stop all heuristics on max time. More... | |
bool | exitNow (double bestObjective) const |
Whether to exit at once on gap. More... | |
void | setFeasibilityPumpOptions (int value) |
Sets feasibility pump options (-1 is off) More... | |
int | feasibilityPumpOptions () const |
Gets feasibility pump options (-1 is off) More... | |
void | setModelOnly (CbcModel *model) |
Just set model - do not do anything else. More... | |
void | setFractionSmall (double value) |
Sets fraction of new(rows+columns)/old(rows+columns) before doing small branch and bound (default 1.0) More... | |
double | fractionSmall () const |
Gets fraction of new(rows+columns)/old(rows+columns) before doing small branch and bound (default 1.0) More... | |
int | numberSolutionsFound () const |
Get how many solutions the heuristic thought it got. More... | |
void | incrementNumberSolutionsFound () |
Increment how many solutions the heuristic thought it got. More... | |
int | smallBranchAndBound (OsiSolverInterface *solver, int numberNodes, double *newSolution, double &newSolutionValue, double cutoff, std::string name) const |
Do mini branch and bound - return 0 not finished - no solution 1 not finished - solution 2 finished - no solution 3 finished - solution (could add global cut if finished) -1 returned on size -2 time or user event. More... | |
virtual void | generateCpp (FILE *) |
Create C++ lines to get to current state. More... | |
void | generateCpp (FILE *fp, const char *heuristic) |
Create C++ lines to get to current state - does work for base class. More... | |
virtual bool | canDealWithOdd () const |
Returns true if can deal with "odd" problems e.g. sos type 2. More... | |
const char * | heuristicName () const |
return name of heuristic More... | |
void | setHeuristicName (const char *name) |
set name of heuristic More... | |
void | setSeed (int value) |
Set random number generator seed. More... | |
void | setDecayFactor (double value) |
Sets decay factor (for howOften) on failure. More... | |
void | setInputSolution (const double *solution, double objValue) |
Set input solution. More... | |
void | setWhereFrom (int value) |
void | setShallowDepth (int value) |
Upto this depth we call the tree shallow and the heuristic can be called multiple times. More... | |
void | setHowOftenShallow (int value) |
How often to invoke the heuristics in the shallow part of the tree. More... | |
void | setMinDistanceToRun (int value) |
How "far" should this node be from every other where the heuristic was run in order to allow the heuristic to run in this node, too. More... | |
virtual bool | shouldHeurRun (int whereFrom) |
Check whether the heuristic should run at all 0 - before cuts at root node (or from doHeuristics) 1 - during cuts at root 2 - after root node cuts 3 - after cuts at other nodes 4 - during cuts at other nodes 8 added if previous heuristic in loop found solution. More... | |
bool | shouldHeurRun_randomChoice () |
Check whether the heuristic should run this time. More... | |
void | debugNodes () |
void | printDistanceToNodes () |
int | numRuns () const |
how many times the heuristic has actually run More... | |
int | numCouldRun () const |
How many times the heuristic could run. More... | |
OsiSolverInterface * | cloneBut (int type) |
Clone but . More... | |
CbcHeuristic () | |
CbcHeuristic (CbcModel &model) | |
CbcHeuristic (const CbcHeuristic &) | |
virtual | ~CbcHeuristic () |
virtual CbcHeuristic * | clone () const =0 |
Clone. More... | |
CbcHeuristic & | operator= (const CbcHeuristic &rhs) |
Assignment operator. More... | |
virtual void | setModel (CbcModel *model) |
update model (This is needed if cliques update matrix etc) More... | |
virtual void | resetModel (CbcModel *model)=0 |
Resets stuff if model changes. More... | |
virtual int | solution (double &objectiveValue, double *newSolution)=0 |
returns 0 if no solution, 1 if valid solution with better objective value than one passed in Sets solution values if good, sets objective value This is called after cuts have been added - so can not add cuts More... | |
virtual int | solution2 (double &, double *, OsiCuts &) |
returns 0 if no solution, 1 if valid solution, -1 if just returning an estimate of best possible solution with better objective value than one passed in Sets solution values if good, sets objective value (only if nonzero code) This is called at same time as cut generators - so can add cuts Default is do nothing More... | |
virtual void | validate () |
Validate model i.e. sets when_ to 0 if necessary (may be NULL) More... | |
void | setWhen (int value) |
Sets "when" flag - 0 off, 1 at root, 2 other than root, 3 always. More... | |
int | when () const |
Gets "when" flag - 0 off, 1 at root, 2 other than root, 3 always. More... | |
void | setNumberNodes (int value) |
Sets number of nodes in subtree (default 200) More... | |
int | numberNodes () const |
Gets number of nodes in a subtree (default 200) More... | |
void | setSwitches (int value) |
Switches (does not apply equally to all heuristics) 1 bit - stop once allowable gap on objective reached 2 bit - always do given number of passes 4 bit - weaken cutoff by 5% every 50 passes? 8 bit - if has cutoff and suminf bobbling for 20 passes then first try halving distance to best possible then try keep halving distance to known cutoff 1024 bit - stop all heuristics on max time. More... | |
int | switches () const |
Switches (does not apply equally to all heuristics) 1 bit - stop once allowable gap on objective reached 2 bit - always do given number of passes 4 bit - weaken cutoff by 5% every 50 passes? 8 bit - if has cutoff and suminf bobbling for 20 passes then first try halving distance to best possible then try keep halving distance to known cutoff 1024 bit - stop all heuristics on max time. More... | |
bool | exitNow (double bestObjective) const |
Whether to exit at once on gap. More... | |
void | setFeasibilityPumpOptions (int value) |
Sets feasibility pump options (-1 is off) More... | |
int | feasibilityPumpOptions () const |
Gets feasibility pump options (-1 is off) More... | |
void | setModelOnly (CbcModel *model) |
Just set model - do not do anything else. More... | |
void | setFractionSmall (double value) |
Sets fraction of new(rows+columns)/old(rows+columns) before doing small branch and bound (default 1.0) More... | |
double | fractionSmall () const |
Gets fraction of new(rows+columns)/old(rows+columns) before doing small branch and bound (default 1.0) More... | |
int | numberSolutionsFound () const |
Get how many solutions the heuristic thought it got. More... | |
void | incrementNumberSolutionsFound () |
Increment how many solutions the heuristic thought it got. More... | |
int | smallBranchAndBound (OsiSolverInterface *solver, int numberNodes, double *newSolution, double &newSolutionValue, double cutoff, std::string name) const |
Do mini branch and bound - return 0 not finished - no solution 1 not finished - solution 2 finished - no solution 3 finished - solution (could add global cut if finished) -1 returned on size -2 time or user event. More... | |
virtual void | generateCpp (FILE *) |
Create C++ lines to get to current state. More... | |
void | generateCpp (FILE *fp, const char *heuristic) |
Create C++ lines to get to current state - does work for base class. More... | |
virtual bool | canDealWithOdd () const |
Returns true if can deal with "odd" problems e.g. sos type 2. More... | |
const char * | heuristicName () const |
return name of heuristic More... | |
void | setHeuristicName (const char *name) |
set name of heuristic More... | |
void | setSeed (int value) |
Set random number generator seed. More... | |
void | setDecayFactor (double value) |
Sets decay factor (for howOften) on failure. More... | |
void | setInputSolution (const double *solution, double objValue) |
Set input solution. More... | |
void | setWhereFrom (int value) |
void | setShallowDepth (int value) |
Upto this depth we call the tree shallow and the heuristic can be called multiple times. More... | |
void | setHowOftenShallow (int value) |
How often to invoke the heuristics in the shallow part of the tree. More... | |
void | setMinDistanceToRun (int value) |
How "far" should this node be from every other where the heuristic was run in order to allow the heuristic to run in this node, too. More... | |
virtual bool | shouldHeurRun (int whereFrom) |
Check whether the heuristic should run at all 0 - before cuts at root node (or from doHeuristics) 1 - during cuts at root 2 - after root node cuts 3 - after cuts at other nodes 4 - during cuts at other nodes 8 added if previous heuristic in loop found solution. More... | |
bool | shouldHeurRun_randomChoice () |
Check whether the heuristic should run this time. More... | |
void | debugNodes () |
void | printDistanceToNodes () |
int | numRuns () const |
how many times the heuristic has actually run More... | |
int | numCouldRun () const |
How many times the heuristic could run. More... | |
OsiSolverInterface * | cloneBut (int type) |
Clone but . More... | |
Protected Attributes | |
CbcModel * | model_ |
Model. More... | |
int | when_ |
When flag - 0 off, 1 at root, 2 other than root, 3 always. More... | |
int | numberNodes_ |
Number of nodes in any sub tree. More... | |
int | feasibilityPumpOptions_ |
Feasibility pump options (-1 is off) More... | |
double | fractionSmall_ |
Fraction of new(rows+columns)/old(rows+columns) before doing small branch and bound. More... | |
CoinThreadRandom | randomNumberGenerator_ |
Thread specific random number generator. More... | |
std::string | heuristicName_ |
Name for printing. More... | |
int | howOften_ |
How often to do (code can change) More... | |
double | decayFactor_ |
How much to increase how often. More... | |
int | switches_ |
Switches (does not apply equally to all heuristics) 1 bit - stop once allowable gap on objective reached 2 bit - always do given number of passes 4 bit - weaken cutoff by 5% every 50 passes? 8 bit - if has cutoff and suminf bobbling for 20 passes then first try halving distance to best possible then try keep halving distance to known cutoff 1024 bit - stop all heuristics on max time. More... | |
int | whereFrom_ |
int | shallowDepth_ |
Upto this depth we call the tree shallow and the heuristic can be called multiple times. More... | |
int | howOftenShallow_ |
How often to invoke the heuristics in the shallow part of the tree. More... | |
int | numInvocationsInShallow_ |
How many invocations happened within the same node when in a shallow part of the tree. More... | |
int | numInvocationsInDeep_ |
How many invocations happened when in the deep part of the tree. More... | |
int | lastRunDeep_ |
After how many deep invocations was the heuristic run last time. More... | |
int | numRuns_ |
how many times the heuristic has actually run More... | |
int | minDistanceToRun_ |
How "far" should this node be from every other where the heuristic was run in order to allow the heuristic to run in this node, too. More... | |
CbcHeuristicNodeList | runNodes_ |
The description of the nodes where this heuristic has been applied. More... | |
int | numCouldRun_ |
How many times the heuristic could run. More... | |
int | numberSolutionsFound_ |
How many solutions the heuristic thought it got. More... | |
double * | inputSolution_ |
Private Member Functions | |
void | gutsOfDelete () |
void | gutsOfCopy (const CbcHeuristic &rhs) |
void | gutsOfDelete () |
void | gutsOfCopy (const CbcHeuristic &rhs) |
Heuristic base class.
Definition at line 75 of file CbcHeuristic.hpp.
CbcHeuristic::CbcHeuristic | ( | ) |
CbcHeuristic::CbcHeuristic | ( | CbcModel & | model) |
CbcHeuristic::CbcHeuristic | ( | const CbcHeuristic & | ) |
|
virtual |
CbcHeuristic::CbcHeuristic | ( | ) |
CbcHeuristic::CbcHeuristic | ( | CbcModel & | model) |
CbcHeuristic::CbcHeuristic | ( | const CbcHeuristic & | ) |
|
virtual |
|
inlineprivate |
Definition at line 77 of file CbcHeuristic.hpp.
|
private |
|
pure virtual |
Clone.
Implemented in CbcHeuristicJustOne, CbcHeuristicJustOne, CbcSerendipity, CbcSerendipity, CbcHeuristicPartial, CbcHeuristicPartial, CbcRounding, CbcRounding, CbcHeuristicDynamic3, CbcHeuristicDynamic3, CbcHeuristicCrossover, CbcHeuristicCrossover, CbcHeuristicGreedyEquality, CbcHeuristicGreedyEquality, CbcHeuristicNaive, CbcHeuristicNaive, CbcHeuristicDive, CbcHeuristicRINS, CbcHeuristicDive, CbcHeuristicRINS, CbcHeuristicFPump, CbcHeuristicFPump, CbcHeuristicGreedyCover, CbcHeuristicLocal, CbcHeuristicPivotAndFix, CbcHeuristicRandRound, CbcHeuristicVND, CbcHeuristicGreedyCover, CbcHeuristicLocal, CbcHeuristicPivotAndFix, CbcHeuristicRandRound, CbcHeuristicVND, CbcHeuristicDiveCoefficient, CbcHeuristicDiveFractional, CbcHeuristicDiveGuided, CbcHeuristicDiveLineSearch, CbcHeuristicDivePseudoCost, CbcHeuristicDiveVectorLength, CbcHeuristicRENS, CbcHeuristicDiveCoefficient, CbcHeuristicDiveFractional, CbcHeuristicDiveGuided, CbcHeuristicDiveLineSearch, CbcHeuristicDivePseudoCost, CbcHeuristicDiveVectorLength, CbcHeuristicRENS, CbcHeuristicDINS, and CbcHeuristicDINS.
CbcHeuristic& CbcHeuristic::operator= | ( | const CbcHeuristic & | rhs) |
Assignment operator.
|
virtual |
update model (This is needed if cliques update matrix etc)
Reimplemented in CbcHeuristicJustOne, CbcHeuristicJustOne, CbcSerendipity, CbcSerendipity, CbcHeuristicPartial, CbcHeuristicPartial, CbcRounding, CbcRounding, CbcHeuristicDynamic3, CbcHeuristicDynamic3, CbcHeuristicCrossover, CbcHeuristicCrossover, CbcHeuristicNaive, CbcHeuristicNaive, CbcHeuristicGreedyEquality, CbcHeuristicGreedyEquality, CbcHeuristicDive, CbcHeuristicDive, CbcHeuristicRINS, CbcHeuristicRINS, CbcHeuristicVND, CbcHeuristicVND, CbcHeuristicLocal, CbcHeuristicPivotAndFix, CbcHeuristicRandRound, CbcHeuristicLocal, CbcHeuristicPivotAndFix, CbcHeuristicRandRound, CbcHeuristicFPump, CbcHeuristicFPump, CbcHeuristicDINS, CbcHeuristicDINS, CbcHeuristicRENS, CbcHeuristicRENS, CbcHeuristicGreedyCover, and CbcHeuristicGreedyCover.
|
pure virtual |
Resets stuff if model changes.
Implemented in CbcHeuristicJustOne, CbcHeuristicJustOne, CbcSerendipity, CbcSerendipity, CbcHeuristicPartial, CbcHeuristicPartial, CbcHeuristicDynamic3, CbcHeuristicDynamic3, CbcRounding, CbcRounding, CbcHeuristicCrossover, CbcHeuristicCrossover, CbcHeuristicGreedyEquality, CbcHeuristicGreedyEquality, CbcHeuristicNaive, CbcHeuristicNaive, CbcHeuristicGreedyCover, CbcHeuristicGreedyCover, CbcHeuristicDive, CbcHeuristicDive, CbcHeuristicRINS, CbcHeuristicRINS, CbcHeuristicVND, CbcHeuristicVND, CbcHeuristicLocal, CbcHeuristicPivotAndFix, CbcHeuristicRandRound, CbcHeuristicLocal, CbcHeuristicPivotAndFix, CbcHeuristicRandRound, CbcHeuristicFPump, CbcHeuristicFPump, CbcHeuristicDINS, CbcHeuristicDINS, CbcHeuristicRENS, and CbcHeuristicRENS.
|
pure virtual |
returns 0 if no solution, 1 if valid solution with better objective value than one passed in Sets solution values if good, sets objective value This is called after cuts have been added - so can not add cuts
Implemented in CbcHeuristicJustOne, CbcHeuristicJustOne, CbcSerendipity, CbcSerendipity, CbcHeuristicPartial, CbcHeuristicPartial, CbcRounding, CbcRounding, CbcHeuristicDynamic3, CbcHeuristicDynamic3, CbcHeuristicCrossover, CbcHeuristicCrossover, CbcHeuristicGreedyEquality, CbcHeuristicGreedyEquality, CbcHeuristicNaive, CbcHeuristicNaive, CbcHeuristicFPump, CbcHeuristicFPump, CbcHeuristicDive, CbcHeuristicDive, CbcHeuristicLocal, CbcHeuristicLocal, CbcHeuristicRINS, CbcHeuristicRINS, CbcHeuristicGreedyCover, CbcHeuristicVND, CbcHeuristicGreedyCover, CbcHeuristicVND, CbcHeuristicPivotAndFix, CbcHeuristicRandRound, CbcHeuristicPivotAndFix, CbcHeuristicRandRound, CbcHeuristicDINS, CbcHeuristicRENS, CbcHeuristicDINS, and CbcHeuristicRENS.
|
inlinevirtual |
returns 0 if no solution, 1 if valid solution, -1 if just returning an estimate of best possible solution with better objective value than one passed in Sets solution values if good, sets objective value (only if nonzero code) This is called at same time as cut generators - so can add cuts Default is do nothing
Definition at line 119 of file CbcHeuristic.hpp.
|
inlinevirtual |
Validate model i.e. sets when_ to 0 if necessary (may be NULL)
Reimplemented in CbcHeuristicJustOne, CbcHeuristicJustOne, CbcHeuristicPartial, CbcHeuristicPartial, CbcRounding, CbcRounding, CbcHeuristicGreedyEquality, CbcHeuristicGreedyEquality, CbcHeuristicDive, CbcHeuristicDive, CbcHeuristicGreedyCover, and CbcHeuristicGreedyCover.
Definition at line 126 of file CbcHeuristic.hpp.
|
inline |
Sets "when" flag - 0 off, 1 at root, 2 other than root, 3 always.
If 10 added then don't worry if validate says there are funny objects as user knows it will be fine
Definition at line 132 of file CbcHeuristic.hpp.
|
inline |
Gets "when" flag - 0 off, 1 at root, 2 other than root, 3 always.
Definition at line 136 of file CbcHeuristic.hpp.
|
inline |
Sets number of nodes in subtree (default 200)
Definition at line 141 of file CbcHeuristic.hpp.
|
inline |
Gets number of nodes in a subtree (default 200)
Definition at line 145 of file CbcHeuristic.hpp.
|
inline |
Switches (does not apply equally to all heuristics) 1 bit - stop once allowable gap on objective reached 2 bit - always do given number of passes 4 bit - weaken cutoff by 5% every 50 passes? 8 bit - if has cutoff and suminf bobbling for 20 passes then first try halving distance to best possible then try keep halving distance to known cutoff 1024 bit - stop all heuristics on max time.
Definition at line 157 of file CbcHeuristic.hpp.
|
inline |
Switches (does not apply equally to all heuristics) 1 bit - stop once allowable gap on objective reached 2 bit - always do given number of passes 4 bit - weaken cutoff by 5% every 50 passes? 8 bit - if has cutoff and suminf bobbling for 20 passes then first try halving distance to best possible then try keep halving distance to known cutoff 1024 bit - stop all heuristics on max time.
Definition at line 169 of file CbcHeuristic.hpp.
bool CbcHeuristic::exitNow | ( | double | bestObjective) | const |
Whether to exit at once on gap.
|
inline |
Sets feasibility pump options (-1 is off)
Definition at line 175 of file CbcHeuristic.hpp.
|
inline |
Gets feasibility pump options (-1 is off)
Definition at line 179 of file CbcHeuristic.hpp.
|
inline |
Just set model - do not do anything else.
Definition at line 183 of file CbcHeuristic.hpp.
|
inline |
Sets fraction of new(rows+columns)/old(rows+columns) before doing small branch and bound (default 1.0)
Definition at line 189 of file CbcHeuristic.hpp.
|
inline |
Gets fraction of new(rows+columns)/old(rows+columns) before doing small branch and bound (default 1.0)
Definition at line 193 of file CbcHeuristic.hpp.
|
inline |
Get how many solutions the heuristic thought it got.
Definition at line 197 of file CbcHeuristic.hpp.
|
inline |
Increment how many solutions the heuristic thought it got.
Definition at line 201 of file CbcHeuristic.hpp.
int CbcHeuristic::smallBranchAndBound | ( | OsiSolverInterface * | solver, |
int | numberNodes, | ||
double * | newSolution, | ||
double & | newSolutionValue, | ||
double | cutoff, | ||
std::string | name | ||
) | const |
Do mini branch and bound - return 0 not finished - no solution 1 not finished - solution 2 finished - no solution 3 finished - solution (could add global cut if finished) -1 returned on size -2 time or user event.
|
inlinevirtual |
Create C++ lines to get to current state.
Reimplemented in CbcHeuristicJustOne, CbcHeuristicJustOne, CbcSerendipity, CbcSerendipity, CbcHeuristicPartial, CbcHeuristicPartial, CbcRounding, CbcRounding, CbcHeuristicCrossover, CbcHeuristicCrossover, CbcHeuristicGreedyEquality, CbcHeuristicGreedyEquality, CbcHeuristicNaive, CbcHeuristicNaive, CbcHeuristicRINS, CbcHeuristicRINS, CbcHeuristicDive, CbcHeuristicDive, CbcHeuristicVND, CbcHeuristicVND, CbcHeuristicLocal, CbcHeuristicPivotAndFix, CbcHeuristicRandRound, CbcHeuristicLocal, CbcHeuristicPivotAndFix, CbcHeuristicRandRound, CbcHeuristicDiveCoefficient, CbcHeuristicDiveFractional, CbcHeuristicDiveGuided, CbcHeuristicDiveLineSearch, CbcHeuristicDivePseudoCost, CbcHeuristicDiveVectorLength, CbcHeuristicFPump, CbcHeuristicDiveCoefficient, CbcHeuristicDiveFractional, CbcHeuristicDiveGuided, CbcHeuristicDiveLineSearch, CbcHeuristicDivePseudoCost, CbcHeuristicDiveVectorLength, CbcHeuristicFPump, CbcHeuristicDINS, CbcHeuristicGreedyCover, CbcHeuristicDINS, and CbcHeuristicGreedyCover.
Definition at line 218 of file CbcHeuristic.hpp.
void CbcHeuristic::generateCpp | ( | FILE * | fp, |
const char * | heuristic | ||
) |
Create C++ lines to get to current state - does work for base class.
|
inlinevirtual |
Returns true if can deal with "odd" problems e.g. sos type 2.
Reimplemented in CbcHeuristicDynamic3, and CbcHeuristicDynamic3.
Definition at line 222 of file CbcHeuristic.hpp.
|
inline |
return name of heuristic
Definition at line 226 of file CbcHeuristic.hpp.
|
inline |
set name of heuristic
Definition at line 230 of file CbcHeuristic.hpp.
void CbcHeuristic::setSeed | ( | int | value) |
Set random number generator seed.
|
inline |
Sets decay factor (for howOften) on failure.
Definition at line 236 of file CbcHeuristic.hpp.
void CbcHeuristic::setInputSolution | ( | const double * | solution, |
double | objValue | ||
) |
Set input solution.
|
inline |
Definition at line 249 of file CbcHeuristic.hpp.
|
inline |
Upto this depth we call the tree shallow and the heuristic can be called multiple times.
That is, the test whether the current node is far from the others where the jeuristic was invoked will not be done, only the frequency will be tested. After that depth the heuristic will can be invoked only once per node, right before branching. That's when it'll be tested whether the heur should run at all.
Definition at line 258 of file CbcHeuristic.hpp.
|
inline |
How often to invoke the heuristics in the shallow part of the tree.
Definition at line 262 of file CbcHeuristic.hpp.
|
inline |
How "far" should this node be from every other where the heuristic was run in order to allow the heuristic to run in this node, too.
Currently this is tested, but we may switch to avgDistanceToRun_ in the future.
Definition at line 268 of file CbcHeuristic.hpp.
|
virtual |
Check whether the heuristic should run at all 0 - before cuts at root node (or from doHeuristics) 1 - during cuts at root 2 - after root node cuts 3 - after cuts at other nodes 4 - during cuts at other nodes 8 added if previous heuristic in loop found solution.
Reimplemented in CbcHeuristicPartial, and CbcHeuristicPartial.
bool CbcHeuristic::shouldHeurRun_randomChoice | ( | ) |
Check whether the heuristic should run this time.
void CbcHeuristic::debugNodes | ( | ) |
void CbcHeuristic::printDistanceToNodes | ( | ) |
|
inline |
how many times the heuristic has actually run
Definition at line 286 of file CbcHeuristic.hpp.
|
inline |
How many times the heuristic could run.
Definition at line 291 of file CbcHeuristic.hpp.
OsiSolverInterface* CbcHeuristic::cloneBut | ( | int | type) |
Clone but .
type 0 clone solver, 1 clone continuous solver Add 2 to say without integer variables which are at low priority Add 4 to say quite likely infeasible so give up easily.
|
inlineprivate |
Definition at line 77 of file CbcHeuristic.hpp.
|
private |
|
pure virtual |
Clone.
Implemented in CbcHeuristicJustOne, CbcHeuristicJustOne, CbcSerendipity, CbcSerendipity, CbcHeuristicPartial, CbcHeuristicPartial, CbcRounding, CbcRounding, CbcHeuristicDynamic3, CbcHeuristicDynamic3, CbcHeuristicCrossover, CbcHeuristicCrossover, CbcHeuristicGreedyEquality, CbcHeuristicGreedyEquality, CbcHeuristicNaive, CbcHeuristicNaive, CbcHeuristicDive, CbcHeuristicRINS, CbcHeuristicDive, CbcHeuristicRINS, CbcHeuristicFPump, CbcHeuristicFPump, CbcHeuristicGreedyCover, CbcHeuristicLocal, CbcHeuristicPivotAndFix, CbcHeuristicRandRound, CbcHeuristicVND, CbcHeuristicGreedyCover, CbcHeuristicLocal, CbcHeuristicPivotAndFix, CbcHeuristicRandRound, CbcHeuristicVND, CbcHeuristicDiveCoefficient, CbcHeuristicDiveFractional, CbcHeuristicDiveGuided, CbcHeuristicDiveLineSearch, CbcHeuristicDivePseudoCost, CbcHeuristicDiveVectorLength, CbcHeuristicRENS, CbcHeuristicDiveCoefficient, CbcHeuristicDiveFractional, CbcHeuristicDiveGuided, CbcHeuristicDiveLineSearch, CbcHeuristicDivePseudoCost, CbcHeuristicDiveVectorLength, CbcHeuristicRENS, CbcHeuristicDINS, and CbcHeuristicDINS.
CbcHeuristic& CbcHeuristic::operator= | ( | const CbcHeuristic & | rhs) |
Assignment operator.
|
virtual |
update model (This is needed if cliques update matrix etc)
Reimplemented in CbcHeuristicJustOne, CbcHeuristicJustOne, CbcSerendipity, CbcSerendipity, CbcHeuristicPartial, CbcHeuristicPartial, CbcRounding, CbcRounding, CbcHeuristicDynamic3, CbcHeuristicDynamic3, CbcHeuristicCrossover, CbcHeuristicCrossover, CbcHeuristicNaive, CbcHeuristicNaive, CbcHeuristicGreedyEquality, CbcHeuristicGreedyEquality, CbcHeuristicDive, CbcHeuristicDive, CbcHeuristicRINS, CbcHeuristicRINS, CbcHeuristicVND, CbcHeuristicVND, CbcHeuristicLocal, CbcHeuristicPivotAndFix, CbcHeuristicRandRound, CbcHeuristicLocal, CbcHeuristicPivotAndFix, CbcHeuristicRandRound, CbcHeuristicFPump, CbcHeuristicFPump, CbcHeuristicDINS, CbcHeuristicDINS, CbcHeuristicRENS, CbcHeuristicRENS, CbcHeuristicGreedyCover, and CbcHeuristicGreedyCover.
|
pure virtual |
Resets stuff if model changes.
Implemented in CbcHeuristicJustOne, CbcHeuristicJustOne, CbcSerendipity, CbcSerendipity, CbcHeuristicPartial, CbcHeuristicPartial, CbcHeuristicDynamic3, CbcHeuristicDynamic3, CbcRounding, CbcRounding, CbcHeuristicCrossover, CbcHeuristicCrossover, CbcHeuristicGreedyEquality, CbcHeuristicGreedyEquality, CbcHeuristicNaive, CbcHeuristicNaive, CbcHeuristicGreedyCover, CbcHeuristicGreedyCover, CbcHeuristicDive, CbcHeuristicDive, CbcHeuristicRINS, CbcHeuristicRINS, CbcHeuristicVND, CbcHeuristicVND, CbcHeuristicLocal, CbcHeuristicPivotAndFix, CbcHeuristicRandRound, CbcHeuristicLocal, CbcHeuristicPivotAndFix, CbcHeuristicRandRound, CbcHeuristicFPump, CbcHeuristicFPump, CbcHeuristicDINS, CbcHeuristicDINS, CbcHeuristicRENS, and CbcHeuristicRENS.
|
pure virtual |
returns 0 if no solution, 1 if valid solution with better objective value than one passed in Sets solution values if good, sets objective value This is called after cuts have been added - so can not add cuts
Implemented in CbcHeuristicJustOne, CbcHeuristicJustOne, CbcSerendipity, CbcSerendipity, CbcHeuristicPartial, CbcHeuristicPartial, CbcRounding, CbcRounding, CbcHeuristicDynamic3, CbcHeuristicDynamic3, CbcHeuristicCrossover, CbcHeuristicCrossover, CbcHeuristicGreedyEquality, CbcHeuristicGreedyEquality, CbcHeuristicNaive, CbcHeuristicNaive, CbcHeuristicFPump, CbcHeuristicFPump, CbcHeuristicDive, CbcHeuristicDive, CbcHeuristicLocal, CbcHeuristicLocal, CbcHeuristicRINS, CbcHeuristicRINS, CbcHeuristicGreedyCover, CbcHeuristicVND, CbcHeuristicGreedyCover, CbcHeuristicVND, CbcHeuristicPivotAndFix, CbcHeuristicRandRound, CbcHeuristicPivotAndFix, CbcHeuristicRandRound, CbcHeuristicDINS, CbcHeuristicRENS, CbcHeuristicDINS, and CbcHeuristicRENS.
|
inlinevirtual |
returns 0 if no solution, 1 if valid solution, -1 if just returning an estimate of best possible solution with better objective value than one passed in Sets solution values if good, sets objective value (only if nonzero code) This is called at same time as cut generators - so can add cuts Default is do nothing
Definition at line 119 of file CbcHeuristic.hpp.
|
inlinevirtual |
Validate model i.e. sets when_ to 0 if necessary (may be NULL)
Reimplemented in CbcHeuristicJustOne, CbcHeuristicJustOne, CbcHeuristicPartial, CbcHeuristicPartial, CbcRounding, CbcRounding, CbcHeuristicGreedyEquality, CbcHeuristicGreedyEquality, CbcHeuristicDive, CbcHeuristicDive, CbcHeuristicGreedyCover, and CbcHeuristicGreedyCover.
Definition at line 126 of file CbcHeuristic.hpp.
|
inline |
Sets "when" flag - 0 off, 1 at root, 2 other than root, 3 always.
If 10 added then don't worry if validate says there are funny objects as user knows it will be fine
Definition at line 132 of file CbcHeuristic.hpp.
|
inline |
Gets "when" flag - 0 off, 1 at root, 2 other than root, 3 always.
Definition at line 136 of file CbcHeuristic.hpp.
|
inline |
Sets number of nodes in subtree (default 200)
Definition at line 141 of file CbcHeuristic.hpp.
|
inline |
Gets number of nodes in a subtree (default 200)
Definition at line 145 of file CbcHeuristic.hpp.
|
inline |
Switches (does not apply equally to all heuristics) 1 bit - stop once allowable gap on objective reached 2 bit - always do given number of passes 4 bit - weaken cutoff by 5% every 50 passes? 8 bit - if has cutoff and suminf bobbling for 20 passes then first try halving distance to best possible then try keep halving distance to known cutoff 1024 bit - stop all heuristics on max time.
Definition at line 157 of file CbcHeuristic.hpp.
|
inline |
Switches (does not apply equally to all heuristics) 1 bit - stop once allowable gap on objective reached 2 bit - always do given number of passes 4 bit - weaken cutoff by 5% every 50 passes? 8 bit - if has cutoff and suminf bobbling for 20 passes then first try halving distance to best possible then try keep halving distance to known cutoff 1024 bit - stop all heuristics on max time.
Definition at line 169 of file CbcHeuristic.hpp.
bool CbcHeuristic::exitNow | ( | double | bestObjective) | const |
Whether to exit at once on gap.
|
inline |
Sets feasibility pump options (-1 is off)
Definition at line 175 of file CbcHeuristic.hpp.
|
inline |
Gets feasibility pump options (-1 is off)
Definition at line 179 of file CbcHeuristic.hpp.
|
inline |
Just set model - do not do anything else.
Definition at line 183 of file CbcHeuristic.hpp.
|
inline |
Sets fraction of new(rows+columns)/old(rows+columns) before doing small branch and bound (default 1.0)
Definition at line 189 of file CbcHeuristic.hpp.
|
inline |
Gets fraction of new(rows+columns)/old(rows+columns) before doing small branch and bound (default 1.0)
Definition at line 193 of file CbcHeuristic.hpp.
|
inline |
Get how many solutions the heuristic thought it got.
Definition at line 197 of file CbcHeuristic.hpp.
|
inline |
Increment how many solutions the heuristic thought it got.
Definition at line 201 of file CbcHeuristic.hpp.
int CbcHeuristic::smallBranchAndBound | ( | OsiSolverInterface * | solver, |
int | numberNodes, | ||
double * | newSolution, | ||
double & | newSolutionValue, | ||
double | cutoff, | ||
std::string | name | ||
) | const |
Do mini branch and bound - return 0 not finished - no solution 1 not finished - solution 2 finished - no solution 3 finished - solution (could add global cut if finished) -1 returned on size -2 time or user event.
|
inlinevirtual |
Create C++ lines to get to current state.
Reimplemented in CbcHeuristicJustOne, CbcHeuristicJustOne, CbcSerendipity, CbcSerendipity, CbcHeuristicPartial, CbcHeuristicPartial, CbcRounding, CbcRounding, CbcHeuristicCrossover, CbcHeuristicCrossover, CbcHeuristicGreedyEquality, CbcHeuristicGreedyEquality, CbcHeuristicNaive, CbcHeuristicNaive, CbcHeuristicRINS, CbcHeuristicRINS, CbcHeuristicDive, CbcHeuristicDive, CbcHeuristicVND, CbcHeuristicVND, CbcHeuristicLocal, CbcHeuristicPivotAndFix, CbcHeuristicRandRound, CbcHeuristicLocal, CbcHeuristicPivotAndFix, CbcHeuristicRandRound, CbcHeuristicDiveCoefficient, CbcHeuristicDiveFractional, CbcHeuristicDiveGuided, CbcHeuristicDiveLineSearch, CbcHeuristicDivePseudoCost, CbcHeuristicDiveVectorLength, CbcHeuristicFPump, CbcHeuristicDiveCoefficient, CbcHeuristicDiveFractional, CbcHeuristicDiveGuided, CbcHeuristicDiveLineSearch, CbcHeuristicDivePseudoCost, CbcHeuristicDiveVectorLength, CbcHeuristicFPump, CbcHeuristicDINS, CbcHeuristicGreedyCover, CbcHeuristicDINS, and CbcHeuristicGreedyCover.
Definition at line 218 of file CbcHeuristic.hpp.
void CbcHeuristic::generateCpp | ( | FILE * | fp, |
const char * | heuristic | ||
) |
Create C++ lines to get to current state - does work for base class.
|
inlinevirtual |
Returns true if can deal with "odd" problems e.g. sos type 2.
Reimplemented in CbcHeuristicDynamic3, and CbcHeuristicDynamic3.
Definition at line 222 of file CbcHeuristic.hpp.
|
inline |
return name of heuristic
Definition at line 226 of file CbcHeuristic.hpp.
|
inline |
set name of heuristic
Definition at line 230 of file CbcHeuristic.hpp.
void CbcHeuristic::setSeed | ( | int | value) |
Set random number generator seed.
|
inline |
Sets decay factor (for howOften) on failure.
Definition at line 236 of file CbcHeuristic.hpp.
void CbcHeuristic::setInputSolution | ( | const double * | solution, |
double | objValue | ||
) |
Set input solution.
|
inline |
Definition at line 249 of file CbcHeuristic.hpp.
|
inline |
Upto this depth we call the tree shallow and the heuristic can be called multiple times.
That is, the test whether the current node is far from the others where the jeuristic was invoked will not be done, only the frequency will be tested. After that depth the heuristic will can be invoked only once per node, right before branching. That's when it'll be tested whether the heur should run at all.
Definition at line 258 of file CbcHeuristic.hpp.
|
inline |
How often to invoke the heuristics in the shallow part of the tree.
Definition at line 262 of file CbcHeuristic.hpp.
|
inline |
How "far" should this node be from every other where the heuristic was run in order to allow the heuristic to run in this node, too.
Currently this is tested, but we may switch to avgDistanceToRun_ in the future.
Definition at line 268 of file CbcHeuristic.hpp.
|
virtual |
Check whether the heuristic should run at all 0 - before cuts at root node (or from doHeuristics) 1 - during cuts at root 2 - after root node cuts 3 - after cuts at other nodes 4 - during cuts at other nodes 8 added if previous heuristic in loop found solution.
Reimplemented in CbcHeuristicPartial, and CbcHeuristicPartial.
bool CbcHeuristic::shouldHeurRun_randomChoice | ( | ) |
Check whether the heuristic should run this time.
void CbcHeuristic::debugNodes | ( | ) |
void CbcHeuristic::printDistanceToNodes | ( | ) |
|
inline |
how many times the heuristic has actually run
Definition at line 286 of file CbcHeuristic.hpp.
|
inline |
How many times the heuristic could run.
Definition at line 291 of file CbcHeuristic.hpp.
OsiSolverInterface* CbcHeuristic::cloneBut | ( | int | type) |
Clone but .
type 0 clone solver, 1 clone continuous solver Add 2 to say without integer variables which are at low priority Add 4 to say quite likely infeasible so give up easily.
|
protected |
Model.
Definition at line 302 of file CbcHeuristic.hpp.
|
protected |
When flag - 0 off, 1 at root, 2 other than root, 3 always.
Definition at line 304 of file CbcHeuristic.hpp.
|
protected |
Number of nodes in any sub tree.
Definition at line 306 of file CbcHeuristic.hpp.
|
protected |
Feasibility pump options (-1 is off)
Definition at line 308 of file CbcHeuristic.hpp.
|
mutableprotected |
Fraction of new(rows+columns)/old(rows+columns) before doing small branch and bound.
Definition at line 310 of file CbcHeuristic.hpp.
|
protected |
Thread specific random number generator.
Definition at line 312 of file CbcHeuristic.hpp.
|
protected |
Name for printing.
Definition at line 314 of file CbcHeuristic.hpp.
|
protected |
How often to do (code can change)
Definition at line 317 of file CbcHeuristic.hpp.
|
protected |
How much to increase how often.
Definition at line 319 of file CbcHeuristic.hpp.
|
mutableprotected |
Switches (does not apply equally to all heuristics) 1 bit - stop once allowable gap on objective reached 2 bit - always do given number of passes 4 bit - weaken cutoff by 5% every 50 passes? 8 bit - if has cutoff and suminf bobbling for 20 passes then first try halving distance to best possible then try keep halving distance to known cutoff 1024 bit - stop all heuristics on max time.
Definition at line 329 of file CbcHeuristic.hpp.
|
protected |
Definition at line 338 of file CbcHeuristic.hpp.
|
protected |
Upto this depth we call the tree shallow and the heuristic can be called multiple times.
That is, the test whether the current node is far from the others where the jeuristic was invoked will not be done, only the frequency will be tested. After that depth the heuristic will can be invoked only once per node, right before branching. That's when it'll be tested whether the heur should run at all.
Definition at line 345 of file CbcHeuristic.hpp.
|
protected |
How often to invoke the heuristics in the shallow part of the tree.
Definition at line 347 of file CbcHeuristic.hpp.
|
protected |
How many invocations happened within the same node when in a shallow part of the tree.
Definition at line 350 of file CbcHeuristic.hpp.
|
protected |
How many invocations happened when in the deep part of the tree.
For every node we count only one invocation.
Definition at line 353 of file CbcHeuristic.hpp.
|
protected |
After how many deep invocations was the heuristic run last time.
Definition at line 355 of file CbcHeuristic.hpp.
|
protected |
how many times the heuristic has actually run
Definition at line 357 of file CbcHeuristic.hpp.
|
protected |
How "far" should this node be from every other where the heuristic was run in order to allow the heuristic to run in this node, too.
Currently this is tested, but we may switch to avgDistanceToRun_ in the future.
Definition at line 361 of file CbcHeuristic.hpp.
|
protected |
The description of the nodes where this heuristic has been applied.
Definition at line 364 of file CbcHeuristic.hpp.
|
protected |
How many times the heuristic could run.
Definition at line 367 of file CbcHeuristic.hpp.
|
protected |
How many solutions the heuristic thought it got.
Definition at line 370 of file CbcHeuristic.hpp.
|
protected |
Definition at line 373 of file CbcHeuristic.hpp.