CbcGeneralDepth.hpp
Go to the documentation of this file.
1 // Edwin 11/10/2009-- carved out of CbcBranchActual
2 #ifndef CbcGeneralDepth_H
3 #define CbcGeneralDepth_H
4 
5 #include "CbcGeneral.hpp"
6 #include "CbcBranchBase.hpp"
7 #include "CbcSubProblem.hpp"
8 
9 #ifdef COIN_HAS_CLP
10 
14 #include "ClpSimplex.hpp"
15 #include "ClpNode.hpp"
16 
17 
18 class CbcGeneralDepth : public CbcGeneral {
19 
20 public:
21 
22  // Default Constructor
23  CbcGeneralDepth ();
24 
31  CbcGeneralDepth (CbcModel * model, int maximumDepth);
32 
33  // Copy constructor
34  CbcGeneralDepth ( const CbcGeneralDepth &);
35 
37  virtual CbcObject * clone() const;
38 
39  // Assignment operator
40  CbcGeneralDepth & operator=( const CbcGeneralDepth& rhs);
41 
42  // Destructor
43  ~CbcGeneralDepth ();
44 
46  virtual double infeasibility(const OsiBranchingInformation * info,
47  int &preferredWay) const;
48 
51  virtual void feasibleRegion();
52 
54  virtual CbcBranchingObject * createCbcBranch(OsiSolverInterface * solver, const OsiBranchingInformation * info, int way) ;
56  inline int maximumNodes() const {
57  return maximumNodes_;
58  }
60  inline int maximumDepth() const {
61  return maximumDepth_;
62  }
64  inline void setMaximumDepth(int value) {
65  maximumDepth_ = value;
66  }
68  inline int whichSolution() const {
69  return whichSolution_;
70  }
72  inline ClpNode * nodeInfo(int which) {
73  return nodeInfo_->nodeInfo_[which];
74  }
75 
77  virtual void redoSequenceEtc(CbcModel * model, int numberColumns, const int * originalColumns);
78 
79 protected:
82  int maximumDepth_;
84  int maximumNodes_;
86  mutable int whichSolution_;
88  mutable int numberNodes_;
90  mutable ClpNodeStuff * nodeInfo_;
91 };
95 class CbcNode;
96 class CbcGeneralBranchingObject : public CbcBranchingObject {
97 
98 public:
99 
100  // Default Constructor
101  CbcGeneralBranchingObject ();
102 
103  // Useful constructor
104  CbcGeneralBranchingObject (CbcModel * model);
105 
106  // Copy constructor
107  CbcGeneralBranchingObject ( const CbcGeneralBranchingObject &);
108 
109  // Assignment operator
110  CbcGeneralBranchingObject & operator=( const CbcGeneralBranchingObject& rhs);
111 
113  virtual CbcBranchingObject * clone() const;
114 
115  // Destructor
116  virtual ~CbcGeneralBranchingObject ();
117 
120  virtual double branch();
123  virtual void checkIsCutoff(double cutoff);
124 
128  virtual void print();
130  void state(double & objectiveValue, double & sumInfeasibilities,
131  int & numberUnsatisfied, int which) const;
133  inline void setNode(CbcNode * node) {
134  node_ = node;
135  }
137  virtual CbcBranchObjType type() const {
138  return GeneralDepthBranchObj;
139  }
140 
148  virtual int compareOriginalObject(const CbcBranchingObject* brObj) const;
149 
159  (const CbcBranchingObject* brObj, const bool replaceIfOverlap = false);
161  inline int numberSubProblems() const {
162  return numberSubProblems_;
163  }
165  inline int decrementNumberLeft() {
166  numberSubLeft_--;
167  return numberSubLeft_;
168  }
170  inline int whichNode() const {
171  return whichNode_;
172  }
174  inline void setWhichNode(int value) {
175  whichNode_ = value;
176  }
177  // Sub problem
178  const CbcSubProblem * subProblem(int which) const {
179  return subProblems_ + which;
180  }
181 
182 public:
184  // Sub problems
185  CbcSubProblem * subProblems_;
187  CbcNode * node_;
189  int numberSubProblems_;
191  int numberSubLeft_;
193  int whichNode_;
195  int numberRows_;
196 };
200 class CbcOneGeneralBranchingObject : public CbcBranchingObject {
201 
202 public:
203 
204  // Default Constructor
205  CbcOneGeneralBranchingObject ();
206 
207  // Useful constructor
208  CbcOneGeneralBranchingObject (CbcModel * model,
209  CbcGeneralBranchingObject * object,
210  int whichOne);
211 
212  // Copy constructor
213  CbcOneGeneralBranchingObject ( const CbcOneGeneralBranchingObject &);
214 
215  // Assignment operator
216  CbcOneGeneralBranchingObject & operator=( const CbcOneGeneralBranchingObject& rhs);
217 
219  virtual CbcBranchingObject * clone() const;
220 
221  // Destructor
222  virtual ~CbcOneGeneralBranchingObject ();
223 
226  virtual double branch();
229  virtual void checkIsCutoff(double cutoff);
230 
234  virtual void print();
236  virtual CbcBranchObjType type() const {
237  return OneGeneralBranchingObj;
238  }
239 
247  virtual int compareOriginalObject(const CbcBranchingObject* brObj) const;
248 
258  (const CbcBranchingObject* brObj, const bool replaceIfOverlap = false);
259 
260 public:
263  CbcGeneralBranchingObject * object_;
265  int whichOne_;
266 };
267 #endif //COIN_HAS_CLP
268 #endif
269 
virtual CbcBranchingObject * clone() const =0
Clone.
Abstract branching object base class Now just difference with OsiBranchingObject. ...
CbcGeneral & operator=(const CbcGeneral &rhs)
CbcRangeCompare
virtual void print() const
Print something about branch - only if log level high.
virtual CbcBranchObjType type() const =0
Return the type (an integer identifier) of this.
CbcBranchObjType
virtual CbcBranchingObject * createCbcBranch(OsiSolverInterface *solver, const OsiBranchingInformation *info, int way)
Creates a branching object.
virtual void feasibleRegion()=0
For the variable(s) referenced by the object, look at the current solution and set bounds to match th...
virtual double infeasibility(const OsiBranchingInformation *info, int &preferredWay) const
Infeasibility - large is 0.5.
virtual CbcRangeCompare compareBranchingObject(const CbcBranchingObject *brObj, const bool replaceIfOverlap=false)=0
Compare the this with brObj.
virtual void feasibleRegion()=0
This looks at solution and sets bounds to contain solution.
virtual CbcObject * clone() const =0
Clone.
CbcBranchingObject & operator=(const CbcBranchingObject &rhs)
Assignment operator.
virtual void redoSequenceEtc(CbcModel *model, int numberColumns, const int *originalColumns)=0
Redoes data when sequence numbers change.
Information required while the node is live.
Definition: CbcNode.hpp:47
Define a catch all class.
Definition: CbcGeneral.hpp:11
virtual int compareOriginalObject(const CbcBranchingObject *brObj) const
Compare the original object of this with the original object of brObj.
Simple Branch and bound class.
Definition: CbcModel.hpp:98
virtual double branch()=0
Execute the actions required to branch, as specified by the current state of the branching object...