Cbc  2.10.10
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CbcHeuristic.hpp
Go to the documentation of this file.
1 /* $Id$ */
2 // Copyright (C) 2002, International Business Machines
3 // Corporation and others. All Rights Reserved.
4 // This code is licensed under the terms of the Eclipse Public License (EPL).
5 
6 #ifndef CbcHeuristic_H
7 #define CbcHeuristic_H
8 
9 #include <string>
10 #include <vector>
11 #include "CoinPackedMatrix.hpp"
12 #include "OsiCuts.hpp"
13 #include "CoinHelperFunctions.hpp"
14 #include "OsiBranchingObject.hpp"
15 #include "CbcModel.hpp"
16 
17 class OsiSolverInterface;
18 
19 class CbcModel;
20 #ifdef COIN_HAS_CLP
21 #include "OsiClpSolverInterface.hpp"
22 #endif
23 //#############################################################################
24 
26 class CbcBranchingObject;
27 
32 private:
33  void gutsOfConstructor(CbcModel &model);
36 
37 private:
44 
45 public:
46  CbcHeuristicNode(CbcModel &model);
47 
50  double distance(const CbcHeuristicNode *node) const;
51  double minDistance(const CbcHeuristicNodeList &nodeList) const;
52  bool minDistanceIsSmall(const CbcHeuristicNodeList &nodeList,
53  const double threshold) const;
54  double avgDistance(const CbcHeuristicNodeList &nodeList) const;
55 };
56 
58 private:
59  void gutsOfDelete();
60  void gutsOfCopy(const CbcHeuristicNodeList &rhs);
61 
62 private:
63  std::vector< CbcHeuristicNode * > nodes_;
64 
65 public:
70 
72  void append(const CbcHeuristicNodeList &nodes);
73  inline const CbcHeuristicNode *node(int i) const
74  {
75  return nodes_[i];
76  }
77  inline int size() const
78  {
79  return static_cast< int >(nodes_.size());
80  }
81 };
82 
83 //#############################################################################
86 class CbcHeuristic {
87 private:
88  void gutsOfDelete() {}
89  void gutsOfCopy(const CbcHeuristic &rhs);
90 
91 public:
92  // Default Constructor
93  CbcHeuristic();
94 
95  // Constructor with model - assumed before cuts
96  CbcHeuristic(CbcModel &model);
97 
98  // Copy constructor
99  CbcHeuristic(const CbcHeuristic &);
100 
101  virtual ~CbcHeuristic();
102 
104  virtual CbcHeuristic *clone() const = 0;
105 
107  CbcHeuristic &operator=(const CbcHeuristic &rhs);
108 
110  virtual void setModel(CbcModel *model);
111 
113  virtual void resetModel(CbcModel *model) = 0;
114 
120  virtual int solution(double &objectiveValue,
121  double *newSolution)
122  = 0;
123 
131  virtual int solution2(double & /*objectiveValue*/,
132  double * /*newSolution*/,
133  OsiCuts & /*cs*/)
134  {
135  return 0;
136  }
137 
139  virtual void validate() {}
140 
145  inline void setWhen(int value)
146  {
147  when_ = value;
148  }
150  inline int when() const
151  {
152  return when_;
153  }
154 
156  inline void setNumberNodes(int value)
157  {
158  numberNodes_ = value;
159  }
161  inline int numberNodes() const
162  {
163  return numberNodes_;
164  }
175  inline void setSwitches(int value)
176  {
177  switches_ = value;
178  }
190  inline int switches() const
191  {
192  return switches_;
193  }
195  bool exitNow(double bestObjective) const;
197  inline void setFeasibilityPumpOptions(int value)
198  {
199  feasibilityPumpOptions_ = value;
200  }
202  inline int feasibilityPumpOptions() const
203  {
205  }
207  inline void setModelOnly(CbcModel *model)
208  {
209  model_ = model;
210  }
211 
213  inline void setFractionSmall(double value)
214  {
215  fractionSmall_ = value;
216  }
218  inline double fractionSmall() const
219  {
220  return fractionSmall_;
221  }
223  inline int numberSolutionsFound() const
224  {
225  return numberSolutionsFound_;
226  }
229  {
231  }
232 
242  int smallBranchAndBound(OsiSolverInterface *solver, int numberNodes,
243  double *newSolution, double &newSolutionValue,
244  double cutoff, std::string name) const;
246  virtual void generateCpp(FILE *) {}
248  void generateCpp(FILE *fp, const char *heuristic);
250  virtual bool canDealWithOdd() const
251  {
252  return false;
253  }
255  inline const char *heuristicName() const
256  {
257  return heuristicName_.c_str();
258  }
260  inline void setHeuristicName(const char *name)
261  {
262  heuristicName_ = name;
263  }
265  void setSeed(int value);
267  int getSeed() const;
269  inline void setDecayFactor(double value)
270  {
271  decayFactor_ = value;
272  }
274  void setInputSolution(const double *solution, double objValue);
275  /* Runs if bit set
276  0 - before cuts at root node (or from doHeuristics)
277  1 - during cuts at root
278  2 - after root node cuts
279  3 - after cuts at other nodes
280  4 - during cuts at other nodes
281  8 added if previous heuristic in loop found solution
282  */
283  inline void setWhereFrom(int value)
284  {
285  whereFrom_ = value;
286  }
287  inline int whereFrom() const
288  {
289  return whereFrom_;
290  }
297  inline void setShallowDepth(int value)
298  {
299  shallowDepth_ = value;
300  }
302  inline void setHowOftenShallow(int value)
303  {
304  howOftenShallow_ = value;
305  }
309  inline void setMinDistanceToRun(int value)
310  {
311  minDistanceToRun_ = value;
312  }
313 
322  virtual bool shouldHeurRun(int whereFrom);
325  void debugNodes();
326  void printDistanceToNodes();
328  inline int numRuns() const
329  {
330  return numRuns_;
331  }
332 
334  inline int numCouldRun() const
335  {
336  return numCouldRun_;
337  }
339  inline double trueObjValue(double value) const
340  {
341  return (model_->moreSpecialOptions2()&67108864)==0 ? value : -value;
342  }
344 #ifdef COIN_HAS_CLP
345  inline bool isHeuristicInteger(const OsiSolverInterface *solver, int iColumn) const
346  {
347  const OsiClpSolverInterface *clpSolver
348  = dynamic_cast< const OsiClpSolverInterface * >(solver);
349  if (clpSolver)
350  return clpSolver->isHeuristicInteger(iColumn);
351  else
352  return solver->isInteger(iColumn);
353  }
354 #else
355  inline bool isHeuristicInteger(const OsiSolverInterface *solver, int iColumn)
356  {
357  return solver->isInteger(iColumn);
358  }
359 #endif
360 
368  OsiSolverInterface *cloneBut(int type);
369 
370 protected:
374  int when_;
384  mutable double fractionSmall_;
386  CoinThreadRandom randomNumberGenerator_;
388  std::string heuristicName_;
389 
391  mutable int howOften_;
393  double decayFactor_;
404  mutable int switches_;
405  /* Runs if bit set
406  0 - before cuts at root node (or from doHeuristics)
407  1 - during cuts at root
408  2 - after root node cuts
409  3 - after cuts at other nodes
410  4 - during cuts at other nodes
411  8 added if previous heuristic in loop found solution
412  */
432  int numRuns_;
437 
440 
443 
446 
448  mutable int numberNodesDone_;
449 
450  // Input solution - so can be used as seed
451  double *inputSolution_;
452 
453 #ifdef JJF_ZERO
454  double *lowerBoundLastNode_;
457  double *upperBoundLastNode_;
458 #endif
459 };
463 class CbcRounding : public CbcHeuristic {
464 public:
465  // Default Constructor
466  CbcRounding();
467 
468  // Constructor with model - assumed before cuts
469  CbcRounding(CbcModel &model);
470 
471  // Copy constructor
472  CbcRounding(const CbcRounding &);
473 
474  // Destructor
475  ~CbcRounding();
476 
478  CbcRounding &operator=(const CbcRounding &rhs);
479 
481  virtual CbcHeuristic *clone() const;
483  virtual void generateCpp(FILE *fp);
484 
486  virtual void resetModel(CbcModel *model);
487 
489  virtual void setModel(CbcModel *model);
490 
497  virtual int solution(double &objectiveValue,
498  double *newSolution);
505  virtual int solution(double &objectiveValue,
506  double *newSolution,
507  double solutionValue);
509  virtual void validate();
510 
512  void setSeed(int value)
513  {
514  seed_ = value;
515  }
524  virtual bool shouldHeurRun(int whereFrom);
525 
526 protected:
527  // Data
528 
529  // Original matrix by column
530  CoinPackedMatrix matrix_;
531 
532  // Original matrix by
533  CoinPackedMatrix matrixByRow_;
534 
535  // Down locks
536  unsigned short *down_;
537 
538  // Up locks
539  unsigned short *up_;
540 
541  // Equality locks
542  unsigned short *equal_;
543 
544  // Seed for random stuff
545  int seed_;
546 };
547 
554 public:
555  // Default Constructor
557 
562  CbcHeuristicPartial(CbcModel &model, int fixPriority = 10000, int numberNodes = 200);
563 
564  // Copy constructor
566 
567  // Destructor
569 
572 
574  virtual CbcHeuristic *clone() const;
576  virtual void generateCpp(FILE *fp);
577 
579  virtual void resetModel(CbcModel *model);
580 
582  virtual void setModel(CbcModel *model);
583 
590  virtual int solution(double &objectiveValue,
591  double *newSolution);
593  virtual void validate();
594 
596  void setFixPriority(int value)
597  {
598  fixPriority_ = value;
599  }
600 
602  virtual bool shouldHeurRun(int whereFrom);
603 
604 protected:
605  // Data
606 
607  // All variables with abs priority <= this will be fixed
609 };
610 
615 class CbcSerendipity : public CbcHeuristic {
616 public:
617  // Default Constructor
618  CbcSerendipity();
619 
620  /* Constructor with model
621  */
622  CbcSerendipity(CbcModel &model);
623 
624  // Copy constructor
626 
627  // Destructor
628  ~CbcSerendipity();
629 
632 
634  virtual CbcHeuristic *clone() const;
636  virtual void generateCpp(FILE *fp);
637 
639  virtual void setModel(CbcModel *model);
640 
652  virtual int solution(double &objectiveValue,
653  double *newSolution);
655  virtual void resetModel(CbcModel *model);
656 
657 protected:
658 };
659 
664 public:
665  // Default Constructor
667 
668  // Constructor with model - assumed before cuts
670 
671  // Copy constructor
673 
674  // Destructor
676 
678  virtual CbcHeuristicJustOne *clone() const;
679 
682 
684  virtual void generateCpp(FILE *fp);
685 
692  virtual int solution(double &objectiveValue,
693  double *newSolution);
695  virtual void resetModel(CbcModel *model);
696 
698  virtual void setModel(CbcModel *model);
700 
706  virtual bool selectVariableToBranch(OsiSolverInterface * /*solver*/,
707  const double * /*newSolution*/,
708  int & /*bestColumn*/,
709  int & /*bestRound*/)
710  {
711  return true;
712  }
714  virtual void validate();
716  void addHeuristic(const CbcHeuristic *heuristic, double probability);
718  void normalizeProbabilities();
719 
720 protected:
721  // Data
722 
723  // Probability of running a heuristic
724  double *probabilities_;
725 
726  // Heuristics
728 
729  // Number of heuristics
731 };
732 #endif
733 
734 /* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2
735 */
CbcHeuristic::heuristicName
const char * heuristicName() const
return name of heuristic
Definition: CbcHeuristic.hpp:255
CbcSerendipity::clone
virtual CbcHeuristic * clone() const
Clone.
CbcHeuristicPartial::generateCpp
virtual void generateCpp(FILE *fp)
Create C++ lines to get to current state.
CbcHeuristicJustOne::probabilities_
double * probabilities_
Definition: CbcHeuristic.hpp:724
CbcHeuristic::CbcHeuristic
CbcHeuristic()
CbcHeuristicNodeList::nodes_
std::vector< CbcHeuristicNode * > nodes_
Definition: CbcHeuristic.hpp:63
CbcRounding::shouldHeurRun
virtual bool shouldHeurRun(int whereFrom)
Check whether the heuristic should run at all 0 - before cuts at root node (or from doHeuristics) 1 -...
CbcHeuristicJustOne::setModel
virtual void setModel(CbcModel *model)
update model (This is needed if cliques update matrix etc)
CbcHeuristicNodeList::append
void append(CbcHeuristicNode *&node)
CbcHeuristic::numInvocationsInShallow_
int numInvocationsInShallow_
How many invocations happened within the same node when in a shallow part of the tree.
Definition: CbcHeuristic.hpp:425
CbcHeuristicNodeList::size
int size() const
Definition: CbcHeuristic.hpp:77
CbcHeuristic::whereFrom_
int whereFrom_
Definition: CbcHeuristic.hpp:413
CbcRounding::seed_
int seed_
Definition: CbcHeuristic.hpp:545
CbcHeuristic::setSeed
void setSeed(int value)
Set random number generator seed.
CbcHeuristicJustOne::validate
virtual void validate()
Validate model i.e. sets when_ to 0 if necessary (may be NULL)
CbcHeuristic::whereFrom
int whereFrom() const
Definition: CbcHeuristic.hpp:287
CbcHeuristicPartial::operator=
CbcHeuristicPartial & operator=(const CbcHeuristicPartial &rhs)
Assignment operator.
CbcSerendipity::setModel
virtual void setModel(CbcModel *model)
update model
CbcHeuristicNode::numObjects_
int numObjects_
The number of branching decisions made.
Definition: CbcHeuristic.hpp:39
CbcHeuristic::setWhereFrom
void setWhereFrom(int value)
Definition: CbcHeuristic.hpp:283
CbcHeuristic::switches
int switches() const
Switches (does not apply equally to all heuristics) 1 bit - stop once allowable gap on objective reac...
Definition: CbcHeuristic.hpp:190
CbcHeuristicJustOne::numberHeuristics_
int numberHeuristics_
Definition: CbcHeuristic.hpp:730
CbcHeuristic::runNodes_
CbcHeuristicNodeList runNodes_
The description of the nodes where this heuristic has been applied.
Definition: CbcHeuristic.hpp:439
CbcModel::moreSpecialOptions2
int moreSpecialOptions2() const
Get more special options2.
Definition: CbcModel.hpp:2134
CbcHeuristicJustOne::CbcHeuristicJustOne
CbcHeuristicJustOne()
CbcModel.hpp
CbcRounding::equal_
unsigned short * equal_
Definition: CbcHeuristic.hpp:542
CbcHeuristic::~CbcHeuristic
virtual ~CbcHeuristic()
CbcHeuristic
Heuristic base class.
Definition: CbcHeuristic.hpp:86
CbcHeuristicJustOne::solution
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...
CbcHeuristic::setDecayFactor
void setDecayFactor(double value)
Sets decay factor (for howOften) on failure.
Definition: CbcHeuristic.hpp:269
CbcHeuristicNodeList::~CbcHeuristicNodeList
~CbcHeuristicNodeList()
CbcHeuristicNode::~CbcHeuristicNode
~CbcHeuristicNode()
CbcHeuristicPartial::~CbcHeuristicPartial
~CbcHeuristicPartial()
CbcHeuristic::canDealWithOdd
virtual bool canDealWithOdd() const
Returns true if can deal with "odd" problems e.g. sos type 2.
Definition: CbcHeuristic.hpp:250
CbcHeuristic::setModelOnly
void setModelOnly(CbcModel *model)
Just set model - do not do anything else.
Definition: CbcHeuristic.hpp:207
CbcHeuristic::setNumberNodes
void setNumberNodes(int value)
Sets number of nodes in subtree (default 200)
Definition: CbcHeuristic.hpp:156
CbcHeuristic::model_
CbcModel * model_
Model.
Definition: CbcHeuristic.hpp:372
CbcHeuristicNodeList
Definition: CbcHeuristic.hpp:57
CbcHeuristicJustOne::selectVariableToBranch
virtual bool selectVariableToBranch(OsiSolverInterface *, const double *, int &, int &)
Selects the next variable to branch on.
Definition: CbcHeuristic.hpp:706
CbcRounding::setSeed
void setSeed(int value)
Set seed.
Definition: CbcHeuristic.hpp:512
CbcRounding
Rounding class.
Definition: CbcHeuristic.hpp:463
CbcHeuristicNode::CbcHeuristicNode
CbcHeuristicNode()
CbcHeuristic::setShallowDepth
void setShallowDepth(int value)
Upto this depth we call the tree shallow and the heuristic can be called multiple times.
Definition: CbcHeuristic.hpp:297
CbcHeuristicNodeList::operator=
CbcHeuristicNodeList & operator=(const CbcHeuristicNodeList &rhs)
CbcHeuristic::minDistanceToRun_
int minDistanceToRun_
How "far" should this node be from every other where the heuristic was run in order to allow the heur...
Definition: CbcHeuristic.hpp:436
CbcRounding::up_
unsigned short * up_
Definition: CbcHeuristic.hpp:539
CbcHeuristicNodeList::node
const CbcHeuristicNode * node(int i) const
Definition: CbcHeuristic.hpp:73
CbcHeuristic::smallBranchAndBound
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 -...
CbcHeuristic::numberSolutionsFound_
int numberSolutionsFound_
How many solutions the heuristic thought it got.
Definition: CbcHeuristic.hpp:445
CbcHeuristic::numberSolutionsFound
int numberSolutionsFound() const
Get how many solutions the heuristic thought it got.
Definition: CbcHeuristic.hpp:223
CbcSerendipity::CbcSerendipity
CbcSerendipity()
CbcHeuristic::howOftenShallow_
int howOftenShallow_
How often to invoke the heuristics in the shallow part of the tree.
Definition: CbcHeuristic.hpp:422
CbcHeuristic::gutsOfCopy
void gutsOfCopy(const CbcHeuristic &rhs)
CbcHeuristic::cloneBut
OsiSolverInterface * cloneBut(int type)
Clone, but ...
CbcRounding::clone
virtual CbcHeuristic * clone() const
Clone.
CbcHeuristic::setFeasibilityPumpOptions
void setFeasibilityPumpOptions(int value)
Sets feasibility pump options (-1 is off)
Definition: CbcHeuristic.hpp:197
CbcHeuristic::feasibilityPumpOptions_
int feasibilityPumpOptions_
Feasibility pump options , -1 is off >=0 for feasibility pump itself -2 quick proximity search -3 lon...
Definition: CbcHeuristic.hpp:382
CbcRounding::resetModel
virtual void resetModel(CbcModel *model)
Resets stuff if model changes.
CbcSerendipity
heuristic - just picks up any good solution found by solver - see OsiBabSolver
Definition: CbcHeuristic.hpp:615
CbcHeuristic::numCouldRun
int numCouldRun() const
How many times the heuristic could run.
Definition: CbcHeuristic.hpp:334
CbcHeuristic::clone
virtual CbcHeuristic * clone() const =0
Clone.
CbcHeuristicJustOne::operator=
CbcHeuristicJustOne & operator=(const CbcHeuristicJustOne &rhs)
Assignment operator.
CbcModel
Simple Branch and bound class.
Definition: CbcModel.hpp:100
CbcHeuristicJustOne::addHeuristic
void addHeuristic(const CbcHeuristic *heuristic, double probability)
Adds an heuristic with probability.
CbcHeuristic::trueObjValue
double trueObjValue(double value) const
Return objective function value with sign corrected.
Definition: CbcHeuristic.hpp:339
CbcHeuristicJustOne::normalizeProbabilities
void normalizeProbabilities()
Normalize probabilities.
CbcHeuristicJustOne::heuristic_
CbcHeuristic ** heuristic_
Definition: CbcHeuristic.hpp:727
CbcHeuristicJustOne::clone
virtual CbcHeuristicJustOne * clone() const
Clone.
CbcHeuristic::numberNodesDone_
int numberNodesDone_
How many nodes the heuristic did this go.
Definition: CbcHeuristic.hpp:448
CbcHeuristic::lastRunDeep_
int lastRunDeep_
After how many deep invocations was the heuristic run last time.
Definition: CbcHeuristic.hpp:430
CbcHeuristic::isHeuristicInteger
bool isHeuristicInteger(const OsiSolverInterface *solver, int iColumn)
Is it integer for heuristics?
Definition: CbcHeuristic.hpp:355
CbcRounding::validate
virtual void validate()
Validate model i.e. sets when_ to 0 if necessary (may be NULL)
CbcHeuristic::inputSolution_
double * inputSolution_
Definition: CbcHeuristic.hpp:451
CbcSerendipity::~CbcSerendipity
~CbcSerendipity()
CbcHeuristicPartial::setFixPriority
void setFixPriority(int value)
Set priority level.
Definition: CbcHeuristic.hpp:596
CbcHeuristic::incrementNumberSolutionsFound
void incrementNumberSolutionsFound()
Increment how many solutions the heuristic thought it got.
Definition: CbcHeuristic.hpp:228
CbcHeuristic::setSwitches
void setSwitches(int value)
Switches (does not apply equally to all heuristics) 1 bit - stop once allowable gap on objective reac...
Definition: CbcHeuristic.hpp:175
CbcBranchingObject
Abstract branching object base class Now just difference with OsiBranchingObject.
Definition: CbcBranchingObject.hpp:51
CbcHeuristic::switches_
int switches_
Switches (does not apply equally to all heuristics) 1 bit - stop once allowable gap on objective reac...
Definition: CbcHeuristic.hpp:404
CbcSerendipity::solution
virtual int solution(double &objectiveValue, double *newSolution)
returns 0 if no solution, 1 if valid solution.
CbcRounding::operator=
CbcRounding & operator=(const CbcRounding &rhs)
Assignment operator.
CbcHeuristic::setHowOftenShallow
void setHowOftenShallow(int value)
How often to invoke the heuristics in the shallow part of the tree.
Definition: CbcHeuristic.hpp:302
CbcHeuristic::setInputSolution
void setInputSolution(const double *solution, double objValue)
Set input solution.
CbcSerendipity::operator=
CbcSerendipity & operator=(const CbcSerendipity &rhs)
Assignment operator.
CbcHeuristic::shouldHeurRun
virtual bool shouldHeurRun(int whereFrom)
Check whether the heuristic should run at all 0 - before cuts at root node (or from doHeuristics) 1 -...
CbcHeuristic::decayFactor_
double decayFactor_
How much to increase how often.
Definition: CbcHeuristic.hpp:393
CbcRounding::generateCpp
virtual void generateCpp(FILE *fp)
Create C++ lines to get to current state.
CbcHeuristic::numberNodes_
int numberNodes_
Number of nodes in any sub tree.
Definition: CbcHeuristic.hpp:376
CbcHeuristic::fractionSmall_
double fractionSmall_
Fraction of new(rows+columns)/old(rows+columns) before doing small branch and bound.
Definition: CbcHeuristic.hpp:384
CbcHeuristicNode::operator=
CbcHeuristicNode & operator=(const CbcHeuristicNode &)
CbcHeuristic::setMinDistanceToRun
void setMinDistanceToRun(int value)
How "far" should this node be from every other where the heuristic was run in order to allow the heur...
Definition: CbcHeuristic.hpp:309
CbcHeuristicNodeList::gutsOfDelete
void gutsOfDelete()
CbcHeuristicPartial::shouldHeurRun
virtual bool shouldHeurRun(int whereFrom)
Check whether the heuristic should run at all.
CbcHeuristic::heuristicName_
std::string heuristicName_
Name for printing.
Definition: CbcHeuristic.hpp:388
CbcHeuristic::setModel
virtual void setModel(CbcModel *model)
update model (This is needed if cliques update matrix etc)
CbcHeuristicPartial::clone
virtual CbcHeuristic * clone() const
Clone.
CbcHeuristic::setWhen
void setWhen(int value)
Sets "when" flag - 0 off, 1 at root, 2 other than root, 3 always.
Definition: CbcHeuristic.hpp:145
CbcHeuristic::numRuns_
int numRuns_
how many times the heuristic has actually run
Definition: CbcHeuristic.hpp:432
CbcHeuristic::numberNodes
int numberNodes() const
Gets number of nodes in a subtree (default 200)
Definition: CbcHeuristic.hpp:161
CbcSerendipity::generateCpp
virtual void generateCpp(FILE *fp)
Create C++ lines to get to current state.
CbcHeuristic::numRuns
int numRuns() const
how many times the heuristic has actually run
Definition: CbcHeuristic.hpp:328
CbcHeuristicNodeList::gutsOfCopy
void gutsOfCopy(const CbcHeuristicNodeList &rhs)
CbcHeuristic::shouldHeurRun_randomChoice
bool shouldHeurRun_randomChoice()
Check whether the heuristic should run this time.
CbcHeuristic::solution
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...
CbcRounding::matrixByRow_
CoinPackedMatrix matrixByRow_
Definition: CbcHeuristic.hpp:533
CbcHeuristic::debugNodes
void debugNodes()
CbcHeuristicJustOne::~CbcHeuristicJustOne
~CbcHeuristicJustOne()
CbcHeuristicPartial
Partial solution class If user knows a partial solution this tries to get an integer solution it uses...
Definition: CbcHeuristic.hpp:553
CbcHeuristic::setHeuristicName
void setHeuristicName(const char *name)
set name of heuristic
Definition: CbcHeuristic.hpp:260
CbcHeuristic::howOften_
int howOften_
How often to do (code can change)
Definition: CbcHeuristic.hpp:391
CbcHeuristicPartial::setModel
virtual void setModel(CbcModel *model)
update model (This is needed if cliques update matrix etc)
CbcRounding::CbcRounding
CbcRounding()
CbcHeuristic::solution2
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...
Definition: CbcHeuristic.hpp:131
CbcHeuristic::feasibilityPumpOptions
int feasibilityPumpOptions() const
Gets feasibility pump options (-1 is off)
Definition: CbcHeuristic.hpp:202
CbcHeuristic::getSeed
int getSeed() const
Get random number generator seed.
CbcHeuristic::numCouldRun_
int numCouldRun_
How many times the heuristic could run.
Definition: CbcHeuristic.hpp:442
CbcHeuristicNode::avgDistance
double avgDistance(const CbcHeuristicNodeList &nodeList) const
CbcHeuristic::numInvocationsInDeep_
int numInvocationsInDeep_
How many invocations happened when in the deep part of the tree.
Definition: CbcHeuristic.hpp:428
CbcRounding::solution
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...
CbcHeuristicPartial::CbcHeuristicPartial
CbcHeuristicPartial()
CbcHeuristic::gutsOfDelete
void gutsOfDelete()
Definition: CbcHeuristic.hpp:88
CbcHeuristicPartial::validate
virtual void validate()
Validate model i.e. sets when_ to 0 if necessary (may be NULL)
CbcHeuristicNode::minDistanceIsSmall
bool minDistanceIsSmall(const CbcHeuristicNodeList &nodeList, const double threshold) const
CbcRounding::~CbcRounding
~CbcRounding()
CbcHeuristic::when_
int when_
When flag - 0 off, 1 at root, 2 other than root, 3 always.
Definition: CbcHeuristic.hpp:374
CbcHeuristicPartial::resetModel
virtual void resetModel(CbcModel *model)
Resets stuff if model changes.
CbcHeuristicNode
A class describing the branching decisions that were made to get to the node where a heuristic was in...
Definition: CbcHeuristic.hpp:31
CbcHeuristic::shallowDepth_
int shallowDepth_
Upto this depth we call the tree shallow and the heuristic can be called multiple times.
Definition: CbcHeuristic.hpp:420
CbcHeuristicNode::distance
double distance(const CbcHeuristicNode *node) const
CbcHeuristic::setFractionSmall
void setFractionSmall(double value)
Sets fraction of new(rows+columns)/old(rows+columns) before doing small branch and bound (default 1....
Definition: CbcHeuristic.hpp:213
CbcHeuristicNodeList::CbcHeuristicNodeList
CbcHeuristicNodeList()
Definition: CbcHeuristic.hpp:66
CbcHeuristicNode::minDistance
double minDistance(const CbcHeuristicNodeList &nodeList) const
CbcHeuristic::when
int when() const
Gets "when" flag - 0 off, 1 at root, 2 other than root, 3 always.
Definition: CbcHeuristic.hpp:150
CbcHeuristic::resetModel
virtual void resetModel(CbcModel *model)=0
Resets stuff if model changes.
CbcHeuristicNode::gutsOfConstructor
void gutsOfConstructor(CbcModel &model)
CbcHeuristicPartial::fixPriority_
int fixPriority_
Definition: CbcHeuristic.hpp:608
CbcHeuristicJustOne::generateCpp
virtual void generateCpp(FILE *fp)
Create C++ lines to get to current state.
CbcHeuristicNode::brObj_
CbcBranchingObject ** brObj_
The indices of the branching objects.
Definition: CbcHeuristic.hpp:43
CbcHeuristic::operator=
CbcHeuristic & operator=(const CbcHeuristic &rhs)
Assignment operator.
CbcRounding::down_
unsigned short * down_
Definition: CbcHeuristic.hpp:536
CbcHeuristic::generateCpp
virtual void generateCpp(FILE *)
Create C++ lines to get to current state.
Definition: CbcHeuristic.hpp:246
CbcRounding::setModel
virtual void setModel(CbcModel *model)
update model (This is needed if cliques update matrix etc)
CbcHeuristic::exitNow
bool exitNow(double bestObjective) const
Whether to exit at once on gap.
CbcHeuristicPartial::solution
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...
CbcHeuristicJustOne
Just One class - this chooses one at random.
Definition: CbcHeuristic.hpp:663
CbcHeuristic::randomNumberGenerator_
CoinThreadRandom randomNumberGenerator_
Thread specific random number generator.
Definition: CbcHeuristic.hpp:386
CbcRounding::matrix_
CoinPackedMatrix matrix_
Definition: CbcHeuristic.hpp:530
CbcHeuristic::validate
virtual void validate()
Validate model i.e. sets when_ to 0 if necessary (may be NULL)
Definition: CbcHeuristic.hpp:139
CbcHeuristic::printDistanceToNodes
void printDistanceToNodes()
CbcSerendipity::resetModel
virtual void resetModel(CbcModel *model)
Resets stuff if model changes.
CbcHeuristicJustOne::resetModel
virtual void resetModel(CbcModel *model)
Resets stuff if model changes.
CbcHeuristic::fractionSmall
double fractionSmall() const
Gets fraction of new(rows+columns)/old(rows+columns) before doing small branch and bound (default 1....
Definition: CbcHeuristic.hpp:218