#include <CbcHeuristic.hpp>
Inheritance diagram for CbcHeuristic:
Public Member Functions | |
CbcHeuristic () | |
CbcHeuristic (CbcModel &model) | |
CbcHeuristic (const CbcHeuristic &) | |
virtual | ~CbcHeuristic () |
virtual CbcHeuristic * | clone () const =0 |
Clone. | |
CbcHeuristic & | operator= (const CbcHeuristic &rhs) |
Assignment operator. | |
virtual void | setModel (CbcModel *model) |
update model (This is needed if cliques update matrix etc) | |
virtual void | resetModel (CbcModel *model)=0 |
Resets stuff if model changes. | |
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 | |
virtual int | solution (double &objectiveValue, double *newSolution, OsiCuts &cs) |
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 | |
virtual void | validate () |
Validate model i.e. sets when_ to 0 if necessary (may be NULL). | |
void | setWhen (int value) |
Sets "when" flag - 0 off, 1 at root, 2 other than root, 3 always. | |
int | when () const |
Gets "when" flag - 0 off, 1 at root, 2 other than root, 3 always. | |
void | setNumberNodes (int value) |
Sets number of nodes in subtree (default 200). | |
int | numberNodes () const |
Gets number of nodes in a subtree (default 200). | |
void | setModelOnly (CbcModel *model) |
Just set model - do not do anything else. | |
void | setFractionSmall (double value) |
Sets fraction of new(rows+columns)/old(rows+columns) before doing small branch and bound (default 1.0). | |
double | fractionSmall () const |
Gets fraction of new(rows+columns)/old(rows+columns) before doing small branch and bound (default 1.0). | |
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). | |
virtual void | generateCpp (FILE *fp) |
Create C++ lines to get to current state. | |
void | generateCpp (FILE *fp, const char *heuristic) |
Create C++ lines to get to current state - does work for base class. | |
virtual bool | canDealWithOdd () const |
Returns true if can deal with "odd" problems e.g. sos type 2. | |
const char * | heuristicName () const |
return name of heuristic | |
void | setHeuristicName (const char *name) |
set name of heuristic | |
Protected Attributes | |
CbcModel * | model_ |
Model. | |
int | when_ |
When flag - 0 off, 1 at root, 2 other than root, 3 always. | |
int | numberNodes_ |
Number of nodes in any sub tree. | |
double | fractionSmall_ |
Fraction of new(rows+columns)/old(rows+columns) before doing small branch and bound. | |
std::string | heuristicName_ |
Name for printing. |
Definition at line 18 of file CbcHeuristic.hpp.
CbcHeuristic::CbcHeuristic | ( | ) |
CbcHeuristic::CbcHeuristic | ( | CbcModel & | model | ) |
CbcHeuristic::CbcHeuristic | ( | const CbcHeuristic & | ) |
virtual CbcHeuristic::~CbcHeuristic | ( | ) | [virtual] |
virtual CbcHeuristic* CbcHeuristic::clone | ( | ) | const [pure virtual] |
Clone.
Implemented in CbcRounding, CbcSerendipity, CbcHeuristicFPump, CbcHeuristicGreedyCover, CbcHeuristicGreedyEquality, CbcHeuristicLocal, CbcHeuristicRINS, and CbcHeuristicDynamic3.
CbcHeuristic& CbcHeuristic::operator= | ( | const CbcHeuristic & | rhs | ) |
Assignment operator.
virtual void CbcHeuristic::setModel | ( | CbcModel * | model | ) | [virtual] |
update model (This is needed if cliques update matrix etc)
Reimplemented in CbcRounding, CbcSerendipity, CbcHeuristicFPump, CbcHeuristicGreedyCover, CbcHeuristicGreedyEquality, CbcHeuristicLocal, CbcHeuristicRINS, and CbcHeuristicDynamic3.
virtual void CbcHeuristic::resetModel | ( | CbcModel * | model | ) | [pure virtual] |
Resets stuff if model changes.
Implemented in CbcRounding, CbcSerendipity, CbcHeuristicFPump, CbcHeuristicGreedyCover, CbcHeuristicGreedyEquality, CbcHeuristicLocal, CbcHeuristicRINS, and CbcHeuristicDynamic3.
virtual int CbcHeuristic::solution | ( | double & | objectiveValue, | |
double * | newSolution | |||
) | [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 CbcRounding, CbcSerendipity, CbcHeuristicFPump, CbcHeuristicGreedyCover, CbcHeuristicGreedyEquality, CbcHeuristicLocal, CbcHeuristicRINS, and CbcHeuristicDynamic3.
virtual int CbcHeuristic::solution | ( | double & | objectiveValue, | |
double * | newSolution, | |||
OsiCuts & | cs | |||
) | [inline, virtual] |
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 58 of file CbcHeuristic.hpp.
virtual void CbcHeuristic::validate | ( | ) | [inline, virtual] |
Validate model i.e. sets when_ to 0 if necessary (may be NULL).
Reimplemented in CbcRounding, CbcHeuristicGreedyCover, and CbcHeuristicGreedyEquality.
Definition at line 63 of file CbcHeuristic.hpp.
void CbcHeuristic::setWhen | ( | int | value | ) | [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 69 of file CbcHeuristic.hpp.
References when_.
int CbcHeuristic::when | ( | ) | const [inline] |
Gets "when" flag - 0 off, 1 at root, 2 other than root, 3 always.
Definition at line 72 of file CbcHeuristic.hpp.
References when_.
void CbcHeuristic::setNumberNodes | ( | int | value | ) | [inline] |
Sets number of nodes in subtree (default 200).
Definition at line 76 of file CbcHeuristic.hpp.
References numberNodes_.
int CbcHeuristic::numberNodes | ( | ) | const [inline] |
Gets number of nodes in a subtree (default 200).
Definition at line 79 of file CbcHeuristic.hpp.
References numberNodes_.
void CbcHeuristic::setModelOnly | ( | CbcModel * | model | ) | [inline] |
Just set model - do not do anything else.
Definition at line 82 of file CbcHeuristic.hpp.
References model_.
void CbcHeuristic::setFractionSmall | ( | double | value | ) | [inline] |
Sets fraction of new(rows+columns)/old(rows+columns) before doing small branch and bound (default 1.0).
Definition at line 87 of file CbcHeuristic.hpp.
References fractionSmall_.
double CbcHeuristic::fractionSmall | ( | ) | const [inline] |
Gets fraction of new(rows+columns)/old(rows+columns) before doing small branch and bound (default 1.0).
Definition at line 90 of file CbcHeuristic.hpp.
References fractionSmall_.
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).
virtual void CbcHeuristic::generateCpp | ( | FILE * | fp | ) | [inline, virtual] |
Create C++ lines to get to current state.
Reimplemented in CbcRounding, CbcSerendipity, CbcHeuristicFPump, CbcHeuristicGreedyCover, CbcHeuristicGreedyEquality, CbcHeuristicLocal, and CbcHeuristicRINS.
Definition at line 104 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.
virtual bool CbcHeuristic::canDealWithOdd | ( | ) | const [inline, virtual] |
Returns true if can deal with "odd" problems e.g. sos type 2.
Reimplemented in CbcHeuristicDynamic3.
Definition at line 108 of file CbcHeuristic.hpp.
const char* CbcHeuristic::heuristicName | ( | ) | const [inline] |
return name of heuristic
Definition at line 111 of file CbcHeuristic.hpp.
References heuristicName_.
void CbcHeuristic::setHeuristicName | ( | const char * | name | ) | [inline] |
CbcModel* CbcHeuristic::model_ [protected] |
int CbcHeuristic::when_ [protected] |
When flag - 0 off, 1 at root, 2 other than root, 3 always.
Definition at line 122 of file CbcHeuristic.hpp.
int CbcHeuristic::numberNodes_ [protected] |
Number of nodes in any sub tree.
Definition at line 124 of file CbcHeuristic.hpp.
Referenced by numberNodes(), and setNumberNodes().
double CbcHeuristic::fractionSmall_ [protected] |
Fraction of new(rows+columns)/old(rows+columns) before doing small branch and bound.
Definition at line 126 of file CbcHeuristic.hpp.
Referenced by fractionSmall(), and setFractionSmall().
std::string CbcHeuristic::heuristicName_ [protected] |
Name for printing.
Definition at line 128 of file CbcHeuristic.hpp.
Referenced by heuristicName(), and setHeuristicName().