Go to the documentation of this file.00001
00002 #ifndef CbcNodeInfo_H
00003 #define CbcNodeInfo_H
00004
00005 #include <string>
00006 #include <vector>
00007
00008 #include "CoinWarmStartBasis.hpp"
00009 #include "CoinSearchTree.hpp"
00010 #include "CbcBranchBase.hpp"
00011
00012 class OsiSolverInterface;
00013 class OsiSolverBranch;
00014
00015 class OsiCuts;
00016 class OsiRowCut;
00017 class OsiRowCutDebugger;
00018 class CoinWarmStartBasis;
00019 class CbcCountRowCut;
00020 class CbcModel;
00021 class CbcNode;
00022 class CbcSubProblem;
00023 class CbcGeneralBranchingObject;
00024
00025
00062 class CbcNodeInfo {
00063
00064 public:
00065
00072 CbcNodeInfo ();
00073
00075 CbcNodeInfo ( const CbcNodeInfo &);
00076
00077 #ifdef JJF_ZERO
00078
00083 CbcNodeInfo (CbcNodeInfo * parent);
00084 #endif
00085
00090 CbcNodeInfo (CbcNodeInfo * parent, CbcNode * owner);
00091
00097 virtual ~CbcNodeInfo();
00099
00100
00106 virtual void applyToModel (CbcModel *model, CoinWarmStartBasis *&basis,
00107 CbcCountRowCut **addCuts,
00108 int ¤tNumberCuts) const = 0 ;
00110 virtual int applyBounds(int iColumn, double & lower, double & upper, int force) = 0;
00111
00116 virtual CbcNodeInfo * buildRowBasis(CoinWarmStartBasis & basis) const = 0;
00118 virtual CbcNodeInfo * clone() const = 0;
00120 virtual void allBranchesGone() {}
00121 #ifndef JJF_ONE
00122
00123 inline void increment(int amount = 1) {
00124 numberPointingToThis_ += amount;
00125 }
00126
00128 inline int decrement(int amount = 1) {
00129 numberPointingToThis_ -= amount;
00130 return numberPointingToThis_;
00131 }
00132 #else
00133
00134 void increment(int amount = 1);
00136 int decrement(int amount = 1);
00137 #endif
00138
00143 inline void initializeInfo(int number) {
00144 numberPointingToThis_ = number;
00145 numberBranchesLeft_ = number;
00146 }
00147
00149 inline int numberBranchesLeft() const {
00150 return numberBranchesLeft_;
00151 }
00152
00154 inline void setNumberBranchesLeft(int value) {
00155 numberBranchesLeft_ = value;
00156 }
00157
00159 inline int numberPointingToThis() const {
00160 return numberPointingToThis_;
00161 }
00162
00164 inline void setNumberPointingToThis(int number) {
00165 numberPointingToThis_ = number;
00166 }
00167
00169 inline void incrementNumberPointingToThis() {
00170 numberPointingToThis_ ++;
00171 }
00172
00174 inline int branchedOn() {
00175 numberPointingToThis_--;
00176 numberBranchesLeft_--;
00177 return numberBranchesLeft_;
00178 }
00179
00181 inline void throwAway() {
00182 numberPointingToThis_ -= numberBranchesLeft_;
00183 numberBranchesLeft_ = 0;
00184 }
00185
00187 CbcNodeInfo * parent() const {
00188 return parent_;
00189 }
00191 inline void nullParent() {
00192 parent_ = NULL;
00193 }
00194
00195 void addCuts(OsiCuts & cuts, int numberToBranch,
00196 int numberPointingToThis);
00197 void addCuts(int numberCuts, CbcCountRowCut ** cuts, int numberToBranch);
00201 void deleteCuts(int numberToDelete, CbcCountRowCut ** cuts);
00202 void deleteCuts(int numberToDelete, int * which);
00203
00205 void deleteCut(int whichOne);
00206
00208 void decrementCuts(int change = 1);
00209
00211 void incrementCuts(int change = 1);
00212
00214 void decrementParentCuts(CbcModel * model, int change = 1);
00215
00217 void incrementParentCuts(CbcModel * model, int change = 1);
00218
00220 inline CbcCountRowCut ** cuts() const {
00221 return cuts_;
00222 }
00223
00225 inline int numberCuts() const {
00226 return numberCuts_;
00227 }
00228 inline void setNumberCuts(int value) {
00229 numberCuts_ = value;
00230 }
00231
00233 inline void nullOwner() {
00234 owner_ = NULL;
00235 }
00236 const inline CbcNode * owner() const {
00237 return owner_;
00238 }
00239 inline CbcNode * mutableOwner() const {
00240 return owner_;
00241 }
00243 inline int nodeNumber() const {
00244 return nodeNumber_;
00245 }
00246 inline void setNodeNumber(int node) {
00247 nodeNumber_ = node;
00248 }
00254 void deactivate(int mode = 3);
00256 inline bool allActivated() const {
00257 return (active_ == 7);
00258 }
00260 inline bool marked() const {
00261 return ((active_&8) != 0);
00262 }
00264 inline void mark() {
00265 active_ |= 8;
00266 }
00268 inline void unmark() {
00269 active_ &= ~8;
00270 }
00271
00273 inline const OsiBranchingObject * parentBranch() const {
00274 return parentBranch_;
00275 }
00277 void unsetParentBasedData();
00278 protected:
00279
00287 int numberPointingToThis_;
00288
00290 CbcNodeInfo * parent_;
00291
00293 OsiBranchingObject * parentBranch_;
00294
00296 CbcNode * owner_;
00297
00299 int numberCuts_;
00300
00302 int nodeNumber_;
00303
00305 CbcCountRowCut ** cuts_;
00306
00309 int numberRows_;
00310
00317 int numberBranchesLeft_;
00323 int active_;
00324
00325 private:
00326
00328 CbcNodeInfo & operator=(const CbcNodeInfo& rhs);
00329
00331 void setParentBasedData();
00332 };
00333
00334 #endif // CbcNodeInfo_H
00335