CbcNodeInfo.hpp
Go to the documentation of this file.
1 // Edwin 11/24/09 carved from CbcNode
2 #ifndef CbcNodeInfo_H
3 #define CbcNodeInfo_H
4 
5 #include <string>
6 #include <vector>
7 
8 #include "CoinWarmStartBasis.hpp"
9 #include "CoinSearchTree.hpp"
10 #include "CbcBranchBase.hpp"
11 
12 class OsiSolverInterface;
13 class OsiSolverBranch;
14 
15 class OsiCuts;
16 class OsiRowCut;
17 class OsiRowCutDebugger;
18 class CoinWarmStartBasis;
19 class CbcCountRowCut;
20 class CbcModel;
21 class CbcNode;
22 class CbcSubProblem;
23 class CbcGeneralBranchingObject;
24 
25 //#############################################################################
62 class CbcNodeInfo {
63 
64 public:
65 
72  CbcNodeInfo ();
73 
75  CbcNodeInfo ( const CbcNodeInfo &);
76 
77 #ifdef JJF_ZERO
78 
84 #endif
85 
91 
97  virtual ~CbcNodeInfo();
99 
100 
106  virtual void applyToModel (CbcModel *model, CoinWarmStartBasis *&basis,
108  int &currentNumberCuts) const = 0 ;
110  virtual int applyBounds(int iColumn, double & lower, double & upper, int force) = 0;
111 
116  virtual CbcNodeInfo * buildRowBasis(CoinWarmStartBasis & basis) const = 0;
118  virtual CbcNodeInfo * clone() const = 0;
120  virtual void allBranchesGone() {}
121 #ifndef JJF_ONE
122 
123  inline void increment(int amount = 1) {
124  numberPointingToThis_ += amount;/*printf("CbcNodeInfo %x incremented by %d to %d\n",this,amount,numberPointingToThis_);*/
125  }
126 
128  inline int decrement(int amount = 1) {
129  numberPointingToThis_ -= amount;/*printf("CbcNodeInfo %x decremented by %d to %d\n",this,amount,numberPointingToThis_);*/
130  return numberPointingToThis_;
131  }
132 #else
133 
134  void increment(int amount = 1);
136  int decrement(int amount = 1);
137 #endif
138 
143  inline void initializeInfo(int number) {
144  numberPointingToThis_ = number;
145  numberBranchesLeft_ = number;
146  }
147 
149  inline int numberBranchesLeft() const {
150  return numberBranchesLeft_;
151  }
152 
154  inline void setNumberBranchesLeft(int value) {
155  numberBranchesLeft_ = value;
156  }
157 
159  inline int numberPointingToThis() const {
160  return numberPointingToThis_;
161  }
162 
164  inline void setNumberPointingToThis(int number) {
165  numberPointingToThis_ = number;
166  }
167 
171  }
172 
174  inline int branchedOn() {
177  return numberBranchesLeft_;
178  }
179 
181  inline void throwAway() {
184  }
185 
187  CbcNodeInfo * parent() const {
188  return parent_;
189  }
191  inline void nullParent() {
192  parent_ = NULL;
193  }
194 
195  void addCuts(OsiCuts & cuts, int numberToBranch, //int * whichGenerator,
197  void addCuts(int numberCuts, CbcCountRowCut ** cuts, int numberToBranch);
201  void deleteCuts(int numberToDelete, CbcCountRowCut ** cuts);
202  void deleteCuts(int numberToDelete, int * which);
203 
205  void deleteCut(int whichOne);
206 
208  void decrementCuts(int change = 1);
209 
211  void incrementCuts(int change = 1);
212 
214  void decrementParentCuts(CbcModel * model, int change = 1);
215 
217  void incrementParentCuts(CbcModel * model, int change = 1);
218 
220  inline CbcCountRowCut ** cuts() const {
221  return cuts_;
222  }
223 
225  inline int numberCuts() const {
226  return numberCuts_;
227  }
228  inline void setNumberCuts(int value) {
229  numberCuts_ = value;
230  }
231 
233  inline void nullOwner() {
234  owner_ = NULL;
235  }
236  const inline CbcNode * owner() const {
237  return owner_;
238  }
239  inline CbcNode * mutableOwner() const {
240  return owner_;
241  }
243  inline int nodeNumber() const {
244  return nodeNumber_;
245  }
246  inline void setNodeNumber(int node) {
247  nodeNumber_ = node;
248  }
254  void deactivate(int mode = 3);
256  inline bool allActivated() const {
257  return (active_ == 7);
258  }
260  inline bool marked() const {
261  return ((active_&8) != 0);
262  }
264  inline void mark() {
265  active_ |= 8;
266  }
268  inline void unmark() {
269  active_ &= ~8;
270  }
271 
273  inline const OsiBranchingObject * parentBranch() const {
274  return parentBranch_;
275  }
277  void unsetParentBasedData();
278 protected:
279 
288 
291 
293  OsiBranchingObject * parentBranch_;
294 
296  CbcNode * owner_;
297 
299  int numberCuts_;
300 
302  int nodeNumber_;
303 
306 
309  int numberRows_;
310 
323  int active_;
324 
325 private:
326 
328  CbcNodeInfo & operator=(const CbcNodeInfo& rhs);
329 
331  void setParentBasedData();
332 };
333 
334 #endif // CbcNodeInfo_H
335