52 const double threshold)
const;
62 std::vector< CbcHeuristicNode * >
nodes_;
78 return static_cast< int >(
nodes_.size());
119 virtual int solution(
double &objectiveValue,
194 bool exitNow(
double bestObjective)
const;
242 double *newSolution,
double &newSolutionValue,
243 double cutoff, std::string name)
const;
448 double *lowerBoundLastNode_;
451 double *upperBoundLastNode_;
491 virtual int solution(
double &objectiveValue,
492 double *newSolution);
499 virtual int solution(
double &objectiveValue,
501 double solutionValue);
584 virtual int solution(
double &objectiveValue,
585 double *newSolution);
646 virtual int solution(
double &objectiveValue,
647 double *newSolution);
686 virtual int solution(
double &objectiveValue,
687 double *newSolution);
void incrementNumberSolutionsFound()
Increment how many solutions the heuristic thought it got.
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 sol...
double decayFactor_
How much to increase how often.
int howOftenShallow_
How often to invoke the heuristics in the shallow part of the tree.
int when_
When flag - 0 off, 1 at root, 2 other than root, 3 always.
virtual bool shouldHeurRun(int whereFrom)
Check whether the heuristic should run at all.
int numberNodesDone_
How many nodes the heuristic did this go.
virtual CbcHeuristic * clone() const
Clone.
CbcHeuristicJustOne & operator=(const CbcHeuristicJustOne &rhs)
Assignment operator.
double fractionSmall_
Fraction of new(rows+columns)/old(rows+columns) before doing small branch and bound.
const char * heuristicName() const
return name of heuristic
void gutsOfCopy(const CbcHeuristic &rhs)
CoinThreadRandom randomNumberGenerator_
Thread specific random number generator.
virtual CbcHeuristicJustOne * clone() const
Clone.
void setFixPriority(int value)
Set priority level.
CbcHeuristic & operator=(const CbcHeuristic &rhs)
Assignment operator.
double distance(const CbcHeuristicNode *node) const
virtual void setModel(CbcModel *model)
update model (This is needed if cliques update matrix etc)
int lastRunDeep_
After how many deep invocations was the heuristic run last time.
void setFeasibilityPumpOptions(int value)
Sets feasibility pump options (-1 is off)
int switches_
Switches (does not apply equally to all heuristics) 1 bit - stop once allowable gap on objective reac...
virtual void setModel(CbcModel *model)
update model (This is needed if cliques update matrix etc)
virtual void generateCpp(FILE *fp)
Create C++ lines to get to current state.
int feasibilityPumpOptions() const
Gets feasibility pump options (-1 is off)
void setSeed(int value)
Set seed.
OsiSolverInterface * cloneBut(int type)
Clone, but ...
int numInvocationsInShallow_
How many invocations happened within the same node when in a shallow part of the tree.
double minDistance(const CbcHeuristicNodeList &nodeList) const
virtual void resetModel(CbcModel *model)
Resets stuff if model changes.
void gutsOfCopy(const CbcHeuristicNodeList &rhs)
void setShallowDepth(int value)
Upto this depth we call the tree shallow and the heuristic can be called multiple times...
bool isHeuristicInteger(const OsiSolverInterface *solver, int iColumn)
Is it integer for heuristics?
Collections of row cuts and column cuts.
std::vector< CbcHeuristicNode * > nodes_
int switches() const
Switches (does not apply equally to all heuristics) 1 bit - stop once allowable gap on objective reac...
CbcHeuristicNode & operator=(const CbcHeuristicNode &)
void append(CbcHeuristicNode *&node)
int numInvocationsInDeep_
How many invocations happened when in the deep part of the tree.
virtual void resetModel(CbcModel *model)
Resets stuff if model changes.
int numberNodes_
Number of nodes in any sub tree.
int minDistanceToRun_
How "far" should this node be from every other where the heuristic was run in order to allow the heur...
virtual bool isInteger(int colIndex) const
Return true if the variable is integer.
bool isHeuristicInteger(int colIndex) const
Return true only if integer and not optional.
void setFractionSmall(double value)
Sets fraction of new(rows+columns)/old(rows+columns) before doing small branch and bound (default 1...
int numberSolutionsFound() const
Get how many solutions the heuristic thought it got.
Abstract Base Class for describing an interface to a solver.
void setDecayFactor(double value)
Sets decay factor (for howOften) on failure.
void setNumberNodes(int value)
Sets number of nodes in subtree (default 200)
int feasibilityPumpOptions_
Feasibility pump options , -1 is off >=0 for feasibility pump itself -2 quick proximity search -3 lon...
void setMinDistanceToRun(int value)
How "far" should this node be from every other where the heuristic was run in order to allow the heur...
virtual void resetModel(CbcModel *model)
Resets stuff if model changes.
int numberNodes() const
Gets number of nodes in a subtree (default 200)
virtual void resetModel(CbcModel *model)=0
Resets stuff if model changes.
void setSeed(int value)
Set random number generator seed.
void setModelOnly(CbcModel *model)
Just set model - do not do anything else.
virtual void generateCpp(FILE *fp)
Create C++ lines to get to current state.
void setWhen(int value)
Sets "when" flag - 0 off, 1 at root, 2 other than root, 3 always.
int numRuns_
how many times the heuristic has actually run
virtual CbcHeuristic * clone() const
Clone.
void printDistanceToNodes()
virtual void resetModel(CbcModel *model)
Resets stuff if model changes.
void setHeuristicName(const char *name)
set name of heuristic
virtual void generateCpp(FILE *fp)
Create C++ lines to get to current state.
int howOften_
How often to do (code can change)
CbcHeuristic ** heuristic_
Abstract branching object base class Now just difference with OsiBranchingObject. ...
const CbcHeuristicNode * node(int i) const
Partial solution class If user knows a partial solution this tries to get an integer solution it uses...
void gutsOfConstructor(CbcModel &model)
CbcHeuristicNodeList & operator=(const CbcHeuristicNodeList &rhs)
virtual void setModel(CbcModel *model)
update model (This is needed if cliques update matrix etc)
bool exitNow(double bestObjective) const
Whether to exit at once on gap.
CbcHeuristicPartial & operator=(const CbcHeuristicPartial &rhs)
Assignment operator.
CbcRounding & operator=(const CbcRounding &rhs)
Assignment operator.
double fractionSmall() const
Gets fraction of new(rows+columns)/old(rows+columns) before doing small branch and bound (default 1...
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 sol...
CoinPackedMatrix matrixByRow_
int numCouldRun_
How many times the heuristic could run.
Just One class - this chooses one at random.
double avgDistance(const CbcHeuristicNodeList &nodeList) const
CbcHeuristicNodeList runNodes_
The description of the nodes where this heuristic has been applied.
virtual void validate()
Validate model i.e. sets when_ to 0 if necessary (may be NULL)
virtual void validate()
Validate model i.e. sets when_ to 0 if necessary (may be NULL)
Sparse Matrix Base Class.
void setWhereFrom(int value)
virtual bool shouldHeurRun(int whereFrom)
Check whether the heuristic should run at all 0 - before cuts at root node (or from doHeuristics) 1 -...
int shallowDepth_
Upto this depth we call the tree shallow and the heuristic can be called multiple times...
CbcSerendipity & operator=(const CbcSerendipity &rhs)
Assignment operator.
int getSeed() const
Get random number generator seed.
int numObjects_
The number of branching decisions made.
virtual bool canDealWithOdd() const
Returns true if can deal with "odd" problems e.g. sos type 2.
virtual int solution(double &objectiveValue, double *newSolution)
returns 0 if no solution, 1 if valid solution.
int numberSolutionsFound_
How many solutions the heuristic thought it got.
int when() const
Gets "when" flag - 0 off, 1 at root, 2 other than root, 3 always.
virtual void generateCpp(FILE *fp)
Create C++ lines to get to current state.
bool minDistanceIsSmall(const CbcHeuristicNodeList &nodeList, const double threshold) const
virtual CbcHeuristic * clone() const
Clone.
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 sol...
void setInputSolution(const double *solution, double objValue)
Set input solution.
CbcBranchingObject ** brObj_
The indices of the branching objects.
virtual void generateCpp(FILE *)
Create C++ lines to get to current state.
std::string heuristicName_
Name for printing.
virtual void setModel(CbcModel *model)
update model (This is needed if cliques update matrix etc)
A class describing the branching decisions that were made to get to the node where a heuristic was in...
void setSwitches(int value)
Switches (does not apply equally to all heuristics) 1 bit - stop once allowable gap on objective reac...
void normalizeProbabilities()
Normalize probabilities.
bool shouldHeurRun_randomChoice()
Check whether the heuristic should run this time.
virtual CbcHeuristic * clone() const =0
Clone.
virtual bool selectVariableToBranch(OsiSolverInterface *, const double *, int &, int &)
Selects the next variable to branch on.
void addHeuristic(const CbcHeuristic *heuristic, double probability)
Adds an heuristic with probability.
virtual bool shouldHeurRun(int whereFrom)
Check whether the heuristic should run at all 0 - before cuts at root node (or from doHeuristics) 1 -...
virtual void validate()
Validate model i.e. sets when_ to 0 if necessary (may be NULL)
virtual int solution2(double &, double *, OsiCuts &)
returns 0 if no solution, 1 if valid solution, -1 if just returning an estimate of best possible solu...
Simple Branch and bound class.
void setHowOftenShallow(int value)
How often to invoke the heuristics in the shallow part of the tree.
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 -...
int numRuns() const
how many times the heuristic has actually run
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 sol...
int numCouldRun() const
How many times the heuristic could run.
Class for thread specific random numbers.
virtual void setModel(CbcModel *model)
update model
heuristic - just picks up any good solution found by solver - see OsiBabSolver
virtual void validate()
Validate model i.e. sets when_ to 0 if necessary (may be NULL)