Ignore:
Timestamp:
Dec 13, 2007 10:01:17 AM (12 years ago)
Author:
forrest
Message:

for deterministic parallel

File:
1 edited

Legend:

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

    r782 r838  
    1010CbcTree::CbcTree()
    1111{
     12  maximumNodeNumber_=0;
    1213}
    1314CbcTree::~CbcTree()
     
    1819{
    1920  nodes_=rhs.nodes_;
     21  maximumNodeNumber_=rhs.maximumNodeNumber_;
    2022}
    2123// Assignment operator
     
    2527  if (this != &rhs) {
    2628    nodes_=rhs.nodes_;
     29    maximumNodeNumber_=rhs.maximumNodeNumber_;
    2730  }
    2831  return *this;
     
    5457void
    5558CbcTree::push(CbcNode * x) {
     59  x->setNodeNumber(maximumNodeNumber_);
     60  maximumNodeNumber_++;
    5661  /*printf("push obj %g, refcount %d, left %d, pointing to %d\n",
    5762         x->objectiveValue(),x->nodeInfo()->decrement(0),
    5863         x->nodeInfo()->numberBranchesLeft(),x->nodeInfo()->numberPointingToThis());*/
    5964  assert(x->objectiveValue()!=COIN_DBL_MAX&&x->nodeInfo());
     65  x->setOnTree(true);
    6066  nodes_.push_back(x);
    6167  std::push_heap(nodes_.begin(), nodes_.end(), comparison_);
     
    6571void
    6672CbcTree::pop() {
     73  nodes_.front()->setOnTree(false);
    6774  std::pop_heap(nodes_.begin(), nodes_.end(), comparison_);
    6875  nodes_.pop_back();
     
    176183  }
    177184#endif
     185  if (best)
     186    best->setOnTree(false);
    178187  return best;
    179188}
     
    215224    double value = node ? node->objectiveValue() : COIN_DBL_MAX;
    216225    bestPossibleObjective = CoinMin(bestPossibleObjective,value);
    217     if (value >= cutoff) {
     226    if (value >= cutoff||!node->active()) {
    218227      if (node) {
    219228        nodeArray[--kDelete] = node;
     
    324333void
    325334CbcTree::push(CbcNode * x) {
     335  x->setNodeNumber(maximumNodeNumber_);
     336  maximumNodeNumber_++;
    326337  /*printf("push obj %g, refcount %d, left %d, pointing to %d\n",
    327338         x->objectiveValue(),x->nodeInfo()->decrement(0),
     
    463474  }
    464475#endif
     476  if (best)
     477    best->setOnTree(false);
    465478  return best;
    466479}
     
    614627void
    615628CbcTree::realpush(CbcNode * node) {
     629  node->setOnTree(true);
    616630  nodes_.push_back(node);
    617631  CbcNode** candidates = &nodes_[0];
Note: See TracChangeset for help on using the changeset viewer.