Cbc 2.10.12
Loading...
Searching...
No Matches
CbcNodeInfo.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// Edwin 11/24/09 carved from CbcNode
7
8#ifndef CbcNodeInfo_H
9#define CbcNodeInfo_H
10
11#include <string>
12#include <vector>
13
14#include "CoinWarmStartBasis.hpp"
15#include "CoinSearchTree.hpp"
16#include "CbcBranchBase.hpp"
17
18class OsiSolverInterface;
19class OsiSolverBranch;
20
21class OsiCuts;
22class OsiRowCut;
23class OsiRowCutDebugger;
24class CoinWarmStartBasis;
25class CbcCountRowCut;
26class CbcModel;
27class CbcNode;
28class CbcSubProblem;
29class CbcGeneralBranchingObject;
30
31//#############################################################################
67
69
70public:
73
78
81
82#ifdef JJF_ZERO
89#endif
90
96
102 virtual ~CbcNodeInfo();
104
110 virtual void applyToModel(CbcModel *model, CoinWarmStartBasis *&basis,
112 int &currentNumberCuts) const = 0;
114 virtual int applyBounds(int iColumn, double &lower, double &upper, int force) = 0;
115
120 virtual CbcNodeInfo *buildRowBasis(CoinWarmStartBasis &basis) const = 0;
122 virtual CbcNodeInfo *clone() const = 0;
124 virtual void allBranchesGone() {}
125#ifndef JJF_ONE
127 inline void increment(int amount = 1)
128 {
129 numberPointingToThis_ += amount; /*printf("CbcNodeInfo %x incremented by %d to %d\n",this,amount,numberPointingToThis_);*/
130 }
131
133 inline int decrement(int amount = 1)
134 {
135 numberPointingToThis_ -= amount; /*printf("CbcNodeInfo %x decremented by %d to %d\n",this,amount,numberPointingToThis_);*/
137 }
138#else
140 void increment(int amount = 1);
142 int decrement(int amount = 1);
143#endif
148
149 inline void initializeInfo(int number)
150 {
151 numberPointingToThis_ = number;
152 numberBranchesLeft_ = number;
153 }
154
156 inline int numberBranchesLeft() const
157 {
158 return numberBranchesLeft_;
159 }
160
163 {
165 }
166
168 inline int numberPointingToThis() const
169 {
171 }
172
174 inline void setNumberPointingToThis(int number)
175 {
176 numberPointingToThis_ = number;
177 }
178
181 {
183 }
184
186 inline int branchedOn()
187 {
190 return numberBranchesLeft_;
191 }
192
194 inline void throwAway()
195 {
198 }
199
202 {
203 return parent_;
204 }
205
206 inline void nullParent()
207 {
208 parent_ = NULL;
209 }
210
211 void addCuts(OsiCuts &cuts, int numberToBranch, //int * whichGenerator,
213 void addCuts(int numberCuts, CbcCountRowCut **cuts, int numberToBranch);
217 void deleteCuts(int numberToDelete, CbcCountRowCut **cuts);
218 void deleteCuts(int numberToDelete, int *which);
219
221 void deleteCut(int whichOne);
222
224 void decrementCuts(int change = 1);
225
227 void incrementCuts(int change = 1);
228
230 void decrementParentCuts(CbcModel *model, int change = 1);
231
233 void incrementParentCuts(CbcModel *model, int change = 1);
234
236 inline CbcCountRowCut **cuts() const
237 {
238 return cuts_;
239 }
240
241 /// Number of row cuts (this node)
242 inline int numberCuts() const
243 {
244 return numberCuts_;
245 }
246 inline void setNumberCuts(int value)
247 {
248 numberCuts_ = value;
249 }
250
252 inline void nullOwner()
253 {
254 owner_ = NULL;
255 }
256 const inline CbcNode *owner() const
257 {
258 return owner_;
259 }
260 inline CbcNode *mutableOwner() const
261 {
262 return owner_;
263 }
264
265 inline int nodeNumber() const
266 {
267 return nodeNumber_;
268 }
269 inline void setNodeNumber(int node)
270 {
271 nodeNumber_ = node;
272 }
273
280 void deactivate(int mode = 3);
282 inline bool allActivated() const
283 {
284 return ((active_ & 7) == 7);
285 }
286
287 inline bool marked() const
288 {
289 return ((active_ & 8) != 0);
290 }
291
292 inline void mark()
293 {
294 active_ |= 8;
295 }
296
297 inline void unmark()
298 {
299 active_ &= ~8;
300 }
301
301 /// Get symmetry value (true worked at this node)
302 inline bool symmetryWorked() const
303 {
304 return (active_ & 16) != 0;
305 }
306
307 inline void setSymmetryWorked()
308 {
309 active_ |= 16;
310 }
311
313 inline const OsiBranchingObject *parentBranch() const
314 {
315 return parentBranch_;
316 }
317
319
320protected:
329
332
334 OsiBranchingObject *parentBranch_;
335
337 CbcNode *owner_;
338
340 int numberCuts_;
341
344
347
351
365
366private:
368 CbcNodeInfo &operator=(const CbcNodeInfo &rhs);
369
372};
373
374#endif // CbcNodeInfo_H
375
376/* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2
377*/
CbcModel * model() const
Return model.
OsiRowCut augmented with bookkeeping.
Simple Branch and bound class.
Definition CbcModel.hpp:100
*Decrement active cut counts void decrementCuts(int change=1)
void deleteCuts(int numberToDelete, CbcCountRowCut **cuts)
Delete cuts (decrements counts) Slow unless cuts in same order as saved.
*Increment number of objects pointing to this void incrementNumberPointingToThis()
*Say if normal bool allActivated() const
*Decrement number of references and return number left int decrement(int amount=1)
*Increment number of references void increment(int amount=1)
*Say thrown away void throwAway()
*Return number of objects pointing to this int numberPointingToThis() const
*Unmark void unmark()
*parent CbcNodeInfo * parent_
int numberBranchesLeft_
Number of branch arms left to explore at this node.
int active_
Active node information.
void initializeInfo(int number)
Initialize reference counts.
*routine common to constructors void setParentBasedData()
*Increment active cut counts void incrementCuts(int change=1)
*Get symmetry value(true worked at this node) inline bool symmetryWorked() const
virtual CbcNodeInfo * buildRowBasis(CoinWarmStartBasis &basis) const =0
Builds up row basis backwards (until original model).
CbcNodeInfo(const CbcNodeInfo &)
Copy constructor.
*Say one branch taken int branchedOn()
*virtual Clone CbcNodeInfo * clone() const =0
virtual void applyToModel(CbcModel *model, CoinWarmStartBasis *&basis, CbcCountRowCut **addCuts, int &currentNumberCuts) const =0
Modify model according to information at node.
CbcNodeInfo()
Default Constructor.
void setNumberCuts(int value)
*Branching object for the parent const OsiBranchingObject * parentBranch() const
*Just apply bounds to one variable force means overwrite by double double & upper
*Mark void mark()
*Just apply bounds to one variable force means overwrite by double double int force
int numberRows_
Number of rows in problem (before these cuts).
*Array of pointers to cuts CbcCountRowCut ** cuts() const
*If we need to take off parent based data void unsetParentBasedData()
*Parent of this CbcNodeInfo * parent() const
*Set owner null void nullOwner()
*Decrement all active cut counts in chain starting at parent void decrementParentCuts(CbcModel *model, int change=1)
*Say if marked bool marked() const
*Return number of branches left in object int numberBranchesLeft() const
*The node number int nodeNumber() const
*Array of pointers to cuts CbcCountRowCut ** cuts_
const CbcNode * owner() const
*Set parent null void nullParent()
void addCuts(OsiCuts &cuts, int numberToBranch, int numberPointingToThis)
*Set number of objects pointing to this void setNumberPointingToThis(int number)
void setNodeNumber(int node)
CbcNode * mutableOwner() const
*Copy of the branching object of the parent when the node is created OsiBranchingObject * parentBranch_
void deactivate(int mode=3)
Deactivate node information.
void addCuts(int numberCuts, CbcCountRowCut **cuts, int numberToBranch)
*Called when number branches left down to virtual zero void allBranchesGone()
virtual ~CbcNodeInfo()
Construct with parent and owner.
*Really delete a cut void deleteCut(int whichOne)
*Owner CbcNode * owner_
void deleteCuts(int numberToDelete, int *which)
int numberPointingToThis_
Number of other nodes pointing to this node.
*Just apply bounds to one variable force means overwrite by lower
*Increment all active cut counts in parent chain void incrementParentCuts(CbcModel *model, int change=1)
*Say symmetry worked at this node void setSymmetryWorked()
*Set number of branches left in object void setNumberBranchesLeft(int value)
*The node number int nodeNumber_