# CbcNodeInfo.hpp

Go to the documentation of this file.

    00001 // $Id$
    00002 // Copyright (C) 2002, International Business Machines
    00003 // Corporation and others.  All Rights Reserved.
    00004 // This code is licensed under the terms of the Eclipse Public License (EPL).
    00005
    00006 // Edwin 11/24/09 carved from CbcNode
    00007
    00008 #ifndef CbcNodeInfo_H
    00009 #define CbcNodeInfo_H
    00010
    00011 #include <string>
    00012 #include <vector>
    00013
    00014 #include "CoinWarmStartBasis.hpp"
    00015 #include "CoinSearchTree.hpp"
    00016 #include "CbcBranchBase.hpp"
    00017
    00018 class OsiSolverInterface;
    00019 class OsiSolverBranch;
    00020
    00021 class OsiCuts;
    00022 class OsiRowCut;
    00023 class OsiRowCutDebugger;
    00024 class CoinWarmStartBasis;
    00025 class CbcCountRowCut;
    00026 class CbcModel;
    00027 class CbcNode;
    00028 class CbcSubProblem;
    00029 class CbcGeneralBranchingObject;
    00030
    00031 //#############################################################################
    00068 class CbcNodeInfo {
    00069
    00070 public:
    00071
    00078     CbcNodeInfo ();
    00079
    00081     CbcNodeInfo ( const CbcNodeInfo &);
    00082
    00083 #ifdef JJF_ZERO
    00084
    00089     CbcNodeInfo (CbcNodeInfo * parent);
    00090 #endif
    00091
    00096     CbcNodeInfo (CbcNodeInfo * parent, CbcNode * owner);
    00097
    00103     virtual ~CbcNodeInfo();
    00105
    00106
    00112     virtual void applyToModel (CbcModel *model, CoinWarmStartBasis *&basis,
    00113                                CbcCountRowCut **addCuts,
    00114                                int &currentNumberCuts) const = 0 ;
    00116     virtual int applyBounds(int iColumn, double & lower, double & upper, int force) = 0;
    00117
    00122     virtual CbcNodeInfo * buildRowBasis(CoinWarmStartBasis & basis) const = 0;
    00124     virtual CbcNodeInfo * clone() const = 0;
    00126     virtual void allBranchesGone() {}
    00127 #ifndef JJF_ONE
    00129     inline void increment(int amount = 1) {
    00130         numberPointingToThis_ += amount;/*printf("CbcNodeInfo %x incremented by %d to %d\n",this,amount,numberPointingToThis_);*/
    00131     }
    00132
    00134     inline int decrement(int amount = 1) {
    00135         numberPointingToThis_ -= amount;/*printf("CbcNodeInfo %x decremented by %d to %d\n",this,amount,numberPointingToThis_);*/
    00136         return numberPointingToThis_;
    00137     }
    00138 #else
    00140     void increment(int amount = 1);
    00142     int decrement(int amount = 1);
    00143 #endif
    00144
    00149     inline void initializeInfo(int number) {
    00150         numberPointingToThis_ = number;
    00151         numberBranchesLeft_ = number;
    00152     }
    00153
    00155     inline int numberBranchesLeft() const {
    00156         return numberBranchesLeft_;
    00157     }
    00158
    00160     inline void setNumberBranchesLeft(int value) {
    00161         numberBranchesLeft_ = value;
    00162     }
    00163
    00165     inline int numberPointingToThis() const {
    00166         return numberPointingToThis_;
    00167     }
    00168
    00170     inline void setNumberPointingToThis(int number) {
    00171         numberPointingToThis_ = number;
    00172     }
    00173
    00175     inline void incrementNumberPointingToThis() {
    00176         numberPointingToThis_ ++;
    00177     }
    00178
    00180     inline int branchedOn() {
    00181         numberPointingToThis_--;
    00182         numberBranchesLeft_--;
    00183         return numberBranchesLeft_;
    00184     }
    00185
    00187     inline void throwAway() {
    00188         numberPointingToThis_ -= numberBranchesLeft_;
    00189         numberBranchesLeft_ = 0;
    00190     }
    00191
    00193     CbcNodeInfo * parent() const {
    00194         return parent_;
    00195     }
    00197     inline void nullParent() {
    00198         parent_ = NULL;
    00199     }
    00200
    00201     void addCuts(OsiCuts & cuts, int numberToBranch, //int * whichGenerator,
    00202                  int numberPointingToThis);
    00203     void addCuts(int numberCuts, CbcCountRowCut ** cuts, int numberToBranch);
    00207     void deleteCuts(int numberToDelete, CbcCountRowCut ** cuts);
    00208     void deleteCuts(int numberToDelete, int * which);
    00209
    00211     void deleteCut(int whichOne);
    00212
    00214     void decrementCuts(int change = 1);
    00215
    00217     void incrementCuts(int change = 1);
    00218
    00220     void decrementParentCuts(CbcModel * model, int change = 1);
    00221
    00223     void incrementParentCuts(CbcModel * model, int change = 1);
    00224
    00226     inline CbcCountRowCut ** cuts() const {
    00227         return cuts_;
    00228     }
    00229
    00231     inline int numberCuts() const {
    00232         return numberCuts_;
    00233     }
    00234     inline void setNumberCuts(int value) {
    00235         numberCuts_ = value;
    00236     }
    00237
    00239     inline void nullOwner() {
    00240         owner_ = NULL;
    00241     }
    00242     const inline CbcNode * owner() const {
    00243         return owner_;
    00244     }
    00245     inline CbcNode * mutableOwner() const {
    00246         return owner_;
    00247     }
    00249     inline int nodeNumber() const {
    00250         return nodeNumber_;
    00251     }
    00252     inline void setNodeNumber(int node) {
    00253         nodeNumber_ = node;
    00254     }
    00260     void deactivate(int mode = 3);
    00262     inline bool allActivated() const {
    00263         return (active_ == 7);
    00264     }
    00266     inline bool marked() const {
    00267         return ((active_&8) != 0);
    00268     }
    00270     inline void mark() {
    00271         active_ |= 8;
    00272     }
    00274     inline void unmark() {
    00275         active_ &= ~8;
    00276     }
    00277
    00279     inline const OsiBranchingObject * parentBranch() const {
    00280         return parentBranch_;
    00281     }
    00283     void unsetParentBasedData();
    00284 protected:
    00285
    00293     int numberPointingToThis_;
    00294
    00296     CbcNodeInfo * parent_;
    00297
    00299     OsiBranchingObject * parentBranch_;
    00300
    00302     CbcNode * owner_;
    00303
    00305     int numberCuts_;
    00306
    00308     int nodeNumber_;
    00309
    00311     CbcCountRowCut ** cuts_;
    00312
    00315     int numberRows_;
    00316
    00323     int numberBranchesLeft_;
    00329     int active_;
    00330
    00331 private:
    00332
    00334     CbcNodeInfo & operator=(const CbcNodeInfo& rhs);
    00335
    00337     void setParentBasedData();
    00338 };
    00339
    00340 #endif // CbcNodeInfo_H
    00341

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines