Cbc  2.9.9
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Public Member Functions | Protected Attributes | List of all members
CbcHeuristicDive Class Referenceabstract

Dive class. More...

#include <CbcHeuristicDive.hpp>

+ Inheritance diagram for CbcHeuristicDive:
+ Collaboration diagram for CbcHeuristicDive:

Classes

struct  PriorityType
 Array of priorities. More...
 

Public Member Functions

 CbcHeuristicDive ()
 
 CbcHeuristicDive (CbcModel &model)
 
 CbcHeuristicDive (const CbcHeuristicDive &)
 
 ~CbcHeuristicDive ()
 
virtual CbcHeuristicDiveclone () const =0
 Clone. More...
 
CbcHeuristicDiveoperator= (const CbcHeuristicDive &rhs)
 Assignment operator. 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 void resetModel (CbcModel *model)
 Resets stuff if model changes. More...
 
virtual void setModel (CbcModel *model)
 update model (This is needed if cliques update matrix etc) More...
 
virtual int solution (double &objectiveValue, double *newSolution)
 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 (only if good) This is called after cuts have been added - so can not add cuts This does Fractional Diving More...
 
int solution (double &objectiveValue, int &numberNodes, int &numberCuts, OsiRowCut **cuts, CbcSubProblem **&nodes, double *newSolution)
 inner part of dive More...
 
int fathom (CbcModel *model, int &numberNodes, CbcSubProblem **&nodes)
 returns 0 if no solution, 1 if valid solution with better objective value than one passed in also returns list of nodes This does Fractional Diving More...
 
virtual void validate ()
 Validate model i.e. sets when_ to 0 if necessary (may be NULL) More...
 
void setPriorities ()
 Sets priorities if any. More...
 
void selectBinaryVariables ()
 Select candidate binary variables for fixing. More...
 
void setPercentageToFix (double value)
 Set percentage of integer variables to fix at bounds. More...
 
void setMaxIterations (int value)
 Set maximum number of iterations. More...
 
void setMaxSimplexIterations (int value)
 Set maximum number of simplex iterations. More...
 
int maxSimplexIterations () const
 Get maximum number of simplex iterations. More...
 
void setMaxSimplexIterationsAtRoot (int value)
 Set maximum number of simplex iterations at root node. More...
 
void setMaxTime (double value)
 Set maximum time allowed. More...
 
virtual bool canHeuristicRun ()
 Tests if the heuristic can run. More...
 
virtual bool selectVariableToBranch (OsiSolverInterface *solver, const double *newSolution, int &bestColumn, int &bestRound)=0
 Selects the next variable to branch on Returns true if all the fractional variables can be trivially rounded. More...
 
virtual void initializeData ()
 Initializes any data which is going to be used repeatedly in selectVariableToBranch. More...
 
int reducedCostFix (OsiSolverInterface *solver)
 Perform reduced cost fixing on integer variables. More...
 
virtual int fixOtherVariables (OsiSolverInterface *solver, const double *solution, PseudoReducedCost *candidate, const double *random)
 Fix other variables at bounds. More...
 
- Public Member Functions inherited from CbcHeuristic
 CbcHeuristic ()
 
 CbcHeuristic (CbcModel &model)
 
 CbcHeuristic (const CbcHeuristic &)
 
virtual ~CbcHeuristic ()
 
CbcHeuristicoperator= (const CbcHeuristic &rhs)
 Assignment operator. 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...
 
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 16 bit - needs new solution to run 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 16 bit - needs new solution to run 1024 bit - stop all heuristics on max time 65536 bit and above used for temporary communication. 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...
 
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...
 
int getSeed () const
 Get 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)
 
int whereFrom () const
 
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...
 
OsiSolverInterfacecloneBut (int type)
 Clone, but ... More...
 

Protected Attributes

CoinPackedMatrix matrix_
 
CoinPackedMatrix matrixByRow_
 
unsigned short * downLocks_
 
unsigned short * upLocks_
 
double * downArray_
 Extra down array (number Integers long) More...
 
double * upArray_
 Extra up array (number Integers long) More...
 
PriorityTypepriority_
 
std::vector< int > binVarIndex_
 
std::vector< int > vbRowIndex_
 
double percentageToFix_
 
double maxTime_
 
double smallObjective_
 
int maxIterations_
 
int maxSimplexIterations_
 
int maxSimplexIterationsAtRoot_
 
- Protected Attributes inherited from CbcHeuristic
CbcModelmodel_
 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 >=0 for feasibility pump itself -2 quick proximity search -3 longer proximity search. 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 16 bit - needs new solution to run 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...
 
int numberNodesDone_
 How many nodes the heuristic did this go. More...
 
double * inputSolution_
 

Detailed Description

Dive class.

Definition at line 21 of file CbcHeuristicDive.hpp.

Constructor & Destructor Documentation

CbcHeuristicDive::CbcHeuristicDive ( )
CbcHeuristicDive::CbcHeuristicDive ( CbcModel model)
CbcHeuristicDive::CbcHeuristicDive ( const CbcHeuristicDive )
CbcHeuristicDive::~CbcHeuristicDive ( )

Member Function Documentation

virtual CbcHeuristicDive* CbcHeuristicDive::clone ( ) const
pure virtual
CbcHeuristicDive& CbcHeuristicDive::operator= ( const CbcHeuristicDive rhs)

Assignment operator.

virtual void CbcHeuristicDive::generateCpp ( FILE *  )
inlinevirtual

Create C++ lines to get to current state.

Reimplemented from CbcHeuristic.

Reimplemented in CbcHeuristicDiveCoefficient, CbcHeuristicDiveFractional, CbcHeuristicDiveGuided, CbcHeuristicDiveLineSearch, CbcHeuristicDivePseudoCost, and CbcHeuristicDiveVectorLength.

Definition at line 43 of file CbcHeuristicDive.hpp.

void CbcHeuristicDive::generateCpp ( FILE *  fp,
const char *  heuristic 
)

Create C++ lines to get to current state - does work for base class.

virtual void CbcHeuristicDive::resetModel ( CbcModel model)
virtual

Resets stuff if model changes.

Implements CbcHeuristic.

virtual void CbcHeuristicDive::setModel ( CbcModel model)
virtual

update model (This is needed if cliques update matrix etc)

Reimplemented from CbcHeuristic.

virtual int CbcHeuristicDive::solution ( double &  objectiveValue,
double *  newSolution 
)
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 (only if good) This is called after cuts have been added - so can not add cuts This does Fractional Diving

Implements CbcHeuristic.

int CbcHeuristicDive::solution ( double &  objectiveValue,
int &  numberNodes,
int &  numberCuts,
OsiRowCut **  cuts,
CbcSubProblem **&  nodes,
double *  newSolution 
)

inner part of dive

int CbcHeuristicDive::fathom ( CbcModel model,
int &  numberNodes,
CbcSubProblem **&  nodes 
)

returns 0 if no solution, 1 if valid solution with better objective value than one passed in also returns list of nodes This does Fractional Diving

virtual void CbcHeuristicDive::validate ( )
virtual

Validate model i.e. sets when_ to 0 if necessary (may be NULL)

Reimplemented from CbcHeuristic.

void CbcHeuristicDive::setPriorities ( )

Sets priorities if any.

void CbcHeuristicDive::selectBinaryVariables ( )

Select candidate binary variables for fixing.

void CbcHeuristicDive::setPercentageToFix ( double  value)
inline

Set percentage of integer variables to fix at bounds.

Definition at line 85 of file CbcHeuristicDive.hpp.

void CbcHeuristicDive::setMaxIterations ( int  value)
inline

Set maximum number of iterations.

Definition at line 90 of file CbcHeuristicDive.hpp.

void CbcHeuristicDive::setMaxSimplexIterations ( int  value)
inline

Set maximum number of simplex iterations.

Definition at line 95 of file CbcHeuristicDive.hpp.

int CbcHeuristicDive::maxSimplexIterations ( ) const
inline

Get maximum number of simplex iterations.

Definition at line 99 of file CbcHeuristicDive.hpp.

void CbcHeuristicDive::setMaxSimplexIterationsAtRoot ( int  value)
inline

Set maximum number of simplex iterations at root node.

Definition at line 104 of file CbcHeuristicDive.hpp.

void CbcHeuristicDive::setMaxTime ( double  value)
inline

Set maximum time allowed.

Definition at line 109 of file CbcHeuristicDive.hpp.

virtual bool CbcHeuristicDive::canHeuristicRun ( )
virtual

Tests if the heuristic can run.

Reimplemented in CbcHeuristicDiveGuided.

virtual bool CbcHeuristicDive::selectVariableToBranch ( OsiSolverInterface solver,
const double *  newSolution,
int &  bestColumn,
int &  bestRound 
)
pure virtual

Selects the next variable to branch on Returns true if all the fractional variables can be trivially rounded.

Returns false, if there is at least one fractional variable that is not trivially roundable. In this case, the bestColumn returned will not be trivially roundable.

Implemented in CbcHeuristicDiveGuided, CbcHeuristicDiveCoefficient, CbcHeuristicDiveFractional, CbcHeuristicDiveLineSearch, CbcHeuristicDivePseudoCost, and CbcHeuristicDiveVectorLength.

virtual void CbcHeuristicDive::initializeData ( )
inlinevirtual

Initializes any data which is going to be used repeatedly in selectVariableToBranch.

Reimplemented in CbcHeuristicDivePseudoCost.

Definition at line 128 of file CbcHeuristicDive.hpp.

int CbcHeuristicDive::reducedCostFix ( OsiSolverInterface solver)

Perform reduced cost fixing on integer variables.

virtual int CbcHeuristicDive::fixOtherVariables ( OsiSolverInterface solver,
const double *  solution,
PseudoReducedCost candidate,
const double *  random 
)
virtual

Fix other variables at bounds.

Reimplemented in CbcHeuristicDivePseudoCost.

Member Data Documentation

CoinPackedMatrix CbcHeuristicDive::matrix_
protected

Definition at line 142 of file CbcHeuristicDive.hpp.

CoinPackedMatrix CbcHeuristicDive::matrixByRow_
protected

Definition at line 145 of file CbcHeuristicDive.hpp.

unsigned short* CbcHeuristicDive::downLocks_
protected

Definition at line 148 of file CbcHeuristicDive.hpp.

unsigned short* CbcHeuristicDive::upLocks_
protected

Definition at line 151 of file CbcHeuristicDive.hpp.

double* CbcHeuristicDive::downArray_
protected

Extra down array (number Integers long)

Definition at line 154 of file CbcHeuristicDive.hpp.

double* CbcHeuristicDive::upArray_
protected

Extra up array (number Integers long)

Definition at line 157 of file CbcHeuristicDive.hpp.

PriorityType* CbcHeuristicDive::priority_
protected

Definition at line 164 of file CbcHeuristicDive.hpp.

std::vector<int> CbcHeuristicDive::binVarIndex_
protected

Definition at line 167 of file CbcHeuristicDive.hpp.

std::vector<int> CbcHeuristicDive::vbRowIndex_
protected

Definition at line 170 of file CbcHeuristicDive.hpp.

double CbcHeuristicDive::percentageToFix_
protected

Definition at line 173 of file CbcHeuristicDive.hpp.

double CbcHeuristicDive::maxTime_
protected

Definition at line 176 of file CbcHeuristicDive.hpp.

double CbcHeuristicDive::smallObjective_
protected

Definition at line 179 of file CbcHeuristicDive.hpp.

int CbcHeuristicDive::maxIterations_
protected

Definition at line 182 of file CbcHeuristicDive.hpp.

int CbcHeuristicDive::maxSimplexIterations_
protected

Definition at line 185 of file CbcHeuristicDive.hpp.

int CbcHeuristicDive::maxSimplexIterationsAtRoot_
protected

Definition at line 188 of file CbcHeuristicDive.hpp.


The documentation for this class was generated from the following file: