Ignore:
Timestamp:
Apr 10, 2008 1:55:10 PM (13 years ago)
Author:
ladanyi
Message:

Incorporated changes from branches/heur

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Cbc/src/CbcNode.cpp

    r881 r912  
    4646  numberPointingToThis_(0),
    4747  parent_(NULL),
     48  parentBranch_(NULL),
    4849  owner_(NULL),
    4950  numberCuts_(0),
     
    5859#endif
    5960}
     61
     62void
     63CbcNodeInfo::setParentBasedData()
     64{
     65  if (parent_) {
     66    numberRows_ = parent_->numberRows_+parent_->numberCuts_;
     67    //parent_->increment();
     68    if (parent_->owner()) {
     69      const OsiBranchingObject* br = parent_->owner()->branchingObject();
     70      const CbcBranchingObject* cbcbr = dynamic_cast<const CbcBranchingObject*>(br);
     71      assert(cbcbr);
     72      parentBranch_ = cbcbr->clone();
     73      parentBranch_->previousBranch();
     74    }
     75  }
     76}
     77
     78#if 0
    6079// Constructor given parent
    6180CbcNodeInfo::CbcNodeInfo (CbcNodeInfo * parent)
     
    6382  numberPointingToThis_(2),
    6483  parent_(parent),
     84  parentBranch_(NULL),
    6585  owner_(NULL),
    6686  numberCuts_(0),
     
    7494  printf("CbcNodeInfo %x Constructor from parent %x\n",this,parent_);
    7595#endif
    76   if (parent_) {
    77     numberRows_ = parent_->numberRows_+parent_->numberCuts_;
    78     //parent_->increment();
    79   }
     96  setParentBasedData();
    8097}
     98#endif
     99
    81100// Copy Constructor
    82101CbcNodeInfo::CbcNodeInfo (const CbcNodeInfo & rhs)
     
    84103  numberPointingToThis_(rhs.numberPointingToThis_),
    85104  parent_(rhs.parent_),
     105  parentBranch_(NULL),
    86106  owner_(rhs.owner_),
    87107  numberCuts_(rhs.numberCuts_),
     
    109129    numberCuts_=n;
    110130  }
     131  if (rhs.parentBranch_) {
     132    parentBranch_ = rhs.parentBranch_->clone();
     133  }
    111134}
    112135// Constructor given parent and owner
     
    115138  numberPointingToThis_(2),
    116139  parent_(parent),
     140  parentBranch_(NULL),
    117141  owner_(owner),
    118142  numberCuts_(0),
     
    126150  printf("CbcNodeInfo %x Constructor from parent %x\n",this,parent_);
    127151#endif
    128   if (parent_) {
    129     numberRows_ = parent_->numberRows_+parent_->numberCuts_;
    130   }
     152  setParentBasedData();
    131153}
    132154
     
    161183    if (!numberLinks) delete parent_;
    162184  }
     185  delete parentBranch_;
    163186}
    164187
     
    479502CbcFullNodeInfo::CbcFullNodeInfo(CbcModel * model,
    480503                                 int numberRowsAtContinuous) :
    481   CbcNodeInfo()
     504  CbcNodeInfo(NULL, model->currentNode())
    482505{
    483506  OsiSolverInterface * solver = model->solver();
     
    654677CbcPartialNodeInfo::CbcPartialNodeInfo (const CbcPartialNodeInfo & rhs)
    655678
    656   : CbcNodeInfo(rhs.parent_)
     679  : CbcNodeInfo(rhs)
    657680
    658681{ basisDiff_ = rhs.basisDiff_->clone() ;
Note: See TracChangeset for help on using the changeset viewer.