Greedy heuristic classes. More...
#include <CbcHeuristicGreedy.hpp>
Public Member Functions | |
CbcHeuristicGreedyCover () | |
CbcHeuristicGreedyCover (CbcModel &model) | |
CbcHeuristicGreedyCover (const CbcHeuristicGreedyCover &) | |
~CbcHeuristicGreedyCover () | |
virtual CbcHeuristic * | clone () const |
Clone. | |
CbcHeuristicGreedyCover & | operator= (const CbcHeuristicGreedyCover &rhs) |
Assignment operator. | |
virtual void | generateCpp (FILE *fp) |
Create C++ lines to get to current state. | |
virtual void | setModel (CbcModel *model) |
update model (This is needed if cliques update matrix etc) | |
virtual int | solution (double &objectiveValue, double *newSolution) |
returns 0 if no solution, 1 if valid solution. | |
virtual void | validate () |
Validate model i.e. sets when_ to 0 if necessary (may be NULL). | |
virtual void | resetModel (CbcModel *model) |
Resets stuff if model changes. | |
int | algorithm () const |
void | setAlgorithm (int value) |
int | numberTimes () const |
void | setNumberTimes (int value) |
CbcHeuristicGreedyCover () | |
CbcHeuristicGreedyCover (CbcModel &model) | |
CbcHeuristicGreedyCover (const CbcHeuristicGreedyCover &) | |
~CbcHeuristicGreedyCover () | |
virtual CbcHeuristic * | clone () const |
Clone. | |
CbcHeuristicGreedyCover & | operator= (const CbcHeuristicGreedyCover &rhs) |
Assignment operator. | |
virtual void | generateCpp (FILE *fp) |
Create C++ lines to get to current state. | |
virtual void | setModel (CbcModel *model) |
update model (This is needed if cliques update matrix etc) | |
virtual int | solution (double &objectiveValue, double *newSolution) |
returns 0 if no solution, 1 if valid solution. | |
virtual void | validate () |
Validate model i.e. sets when_ to 0 if necessary (may be NULL). | |
virtual void | resetModel (CbcModel *model) |
Resets stuff if model changes. | |
int | algorithm () const |
void | setAlgorithm (int value) |
int | numberTimes () const |
void | setNumberTimes (int value) |
Protected Member Functions | |
void | gutsOfConstructor (CbcModel *model) |
Guts of constructor from a CbcModel. | |
void | gutsOfConstructor (CbcModel *model) |
Guts of constructor from a CbcModel. | |
Protected Attributes | |
CoinPackedMatrix | matrix_ |
int | originalNumberRows_ |
int | algorithm_ |
int | numberTimes_ |
Do this many times. |
Greedy heuristic classes.
Definition at line 11 of file CbcHeuristicGreedy.hpp.
CbcHeuristicGreedyCover::CbcHeuristicGreedyCover | ( | ) |
CbcHeuristicGreedyCover::CbcHeuristicGreedyCover | ( | CbcModel & | model | ) |
CbcHeuristicGreedyCover::CbcHeuristicGreedyCover | ( | const CbcHeuristicGreedyCover & | ) |
CbcHeuristicGreedyCover::~CbcHeuristicGreedyCover | ( | ) |
CbcHeuristicGreedyCover::CbcHeuristicGreedyCover | ( | ) |
CbcHeuristicGreedyCover::CbcHeuristicGreedyCover | ( | CbcModel & | model | ) |
CbcHeuristicGreedyCover::CbcHeuristicGreedyCover | ( | const CbcHeuristicGreedyCover & | ) |
CbcHeuristicGreedyCover::~CbcHeuristicGreedyCover | ( | ) |
virtual CbcHeuristic* CbcHeuristicGreedyCover::clone | ( | ) | const [virtual] |
Clone.
Implements CbcHeuristic.
CbcHeuristicGreedyCover& CbcHeuristicGreedyCover::operator= | ( | const CbcHeuristicGreedyCover & | rhs | ) |
Assignment operator.
virtual void CbcHeuristicGreedyCover::generateCpp | ( | FILE * | fp | ) | [virtual] |
Create C++ lines to get to current state.
Reimplemented from CbcHeuristic.
virtual void CbcHeuristicGreedyCover::setModel | ( | CbcModel * | model | ) | [virtual] |
update model (This is needed if cliques update matrix etc)
Reimplemented from CbcHeuristic.
virtual int CbcHeuristicGreedyCover::solution | ( | double & | objectiveValue, | |
double * | newSolution | |||
) | [virtual] |
returns 0 if no solution, 1 if valid solution.
Sets solution values if good, sets objective value (only if good) We leave all variables which are at one at this node of the tree to that value and will initially set all others to zero. We then sort all variables in order of their cost divided by the number of entries in rows which are not yet covered. We randomize that value a bit so that ties will be broken in different ways on different runs of the heuristic. We then choose the best one and set it to one and repeat the exercise.
Implements CbcHeuristic.
virtual void CbcHeuristicGreedyCover::validate | ( | ) | [virtual] |
Validate model i.e. sets when_ to 0 if necessary (may be NULL).
Reimplemented from CbcHeuristic.
virtual void CbcHeuristicGreedyCover::resetModel | ( | CbcModel * | model | ) | [virtual] |
Resets stuff if model changes.
Implements CbcHeuristic.
int CbcHeuristicGreedyCover::algorithm | ( | ) | const [inline] |
Definition at line 61 of file CbcHeuristicGreedy.hpp.
void CbcHeuristicGreedyCover::setAlgorithm | ( | int | value | ) | [inline] |
Definition at line 64 of file CbcHeuristicGreedy.hpp.
int CbcHeuristicGreedyCover::numberTimes | ( | ) | const [inline] |
Definition at line 68 of file CbcHeuristicGreedy.hpp.
void CbcHeuristicGreedyCover::setNumberTimes | ( | int | value | ) | [inline] |
Definition at line 71 of file CbcHeuristicGreedy.hpp.
void CbcHeuristicGreedyCover::gutsOfConstructor | ( | CbcModel * | model | ) | [protected] |
Guts of constructor from a CbcModel.
virtual CbcHeuristic* CbcHeuristicGreedyCover::clone | ( | ) | const [virtual] |
Clone.
Implements CbcHeuristic.
CbcHeuristicGreedyCover& CbcHeuristicGreedyCover::operator= | ( | const CbcHeuristicGreedyCover & | rhs | ) |
Assignment operator.
virtual void CbcHeuristicGreedyCover::generateCpp | ( | FILE * | fp | ) | [virtual] |
Create C++ lines to get to current state.
Reimplemented from CbcHeuristic.
virtual void CbcHeuristicGreedyCover::setModel | ( | CbcModel * | model | ) | [virtual] |
update model (This is needed if cliques update matrix etc)
Reimplemented from CbcHeuristic.
virtual int CbcHeuristicGreedyCover::solution | ( | double & | objectiveValue, | |
double * | newSolution | |||
) | [virtual] |
returns 0 if no solution, 1 if valid solution.
Sets solution values if good, sets objective value (only if good) We leave all variables which are at one at this node of the tree to that value and will initially set all others to zero. We then sort all variables in order of their cost divided by the number of entries in rows which are not yet covered. We randomize that value a bit so that ties will be broken in different ways on different runs of the heuristic. We then choose the best one and set it to one and repeat the exercise.
Implements CbcHeuristic.
virtual void CbcHeuristicGreedyCover::validate | ( | ) | [virtual] |
Validate model i.e. sets when_ to 0 if necessary (may be NULL).
Reimplemented from CbcHeuristic.
virtual void CbcHeuristicGreedyCover::resetModel | ( | CbcModel * | model | ) | [virtual] |
Resets stuff if model changes.
Implements CbcHeuristic.
int CbcHeuristicGreedyCover::algorithm | ( | ) | const [inline] |
Definition at line 61 of file CbcHeuristicGreedy.hpp.
void CbcHeuristicGreedyCover::setAlgorithm | ( | int | value | ) | [inline] |
Definition at line 64 of file CbcHeuristicGreedy.hpp.
int CbcHeuristicGreedyCover::numberTimes | ( | ) | const [inline] |
Definition at line 68 of file CbcHeuristicGreedy.hpp.
void CbcHeuristicGreedyCover::setNumberTimes | ( | int | value | ) | [inline] |
Definition at line 71 of file CbcHeuristicGreedy.hpp.
void CbcHeuristicGreedyCover::gutsOfConstructor | ( | CbcModel * | model | ) | [protected] |
Guts of constructor from a CbcModel.
CoinPackedMatrix CbcHeuristicGreedyCover::matrix_ [protected] |
Definition at line 81 of file CbcHeuristicGreedy.hpp.
int CbcHeuristicGreedyCover::originalNumberRows_ [protected] |
Definition at line 83 of file CbcHeuristicGreedy.hpp.
int CbcHeuristicGreedyCover::algorithm_ [protected] |
Definition at line 89 of file CbcHeuristicGreedy.hpp.
int CbcHeuristicGreedyCover::numberTimes_ [protected] |
Do this many times.
Definition at line 91 of file CbcHeuristicGreedy.hpp.