Changeset 897 for branches/heur


Ignore:
Timestamp:
Mar 12, 2008 4:57:55 PM (11 years ago)
Author:
ladanyi
Message:

evenly distributed heur invocation doesn't crash

Location:
branches/heur/Cbc/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/heur/Cbc/src/CbcBranchBase.hpp

    r889 r897  
    308308  virtual double branch(OsiSolverInterface * solver)
    309309  { return branch();}
     310
     311  /** Reset every information so that the branching object appears to point to
     312      the previous child. This method does not need to modify anything in any
     313      solver. */
     314  virtual void previousBranch() {
     315    assert(branchIndex_ > 0);
     316    branchIndex_--;
     317    way_ = -way_;
     318  }
    310319
    311320  using OsiBranchingObject::print ;
  • branches/heur/Cbc/src/CbcHeuristic.cpp

    r896 r897  
    168168}
    169169
    170 void
    171 CbcHeuristic::debugNodes()
     170void CbcHeurDebugNodes(CbcModel* model_)
    172171{
    173172  CbcNode* node = model_->currentNode();
     
    219218}
    220219
     220void
     221CbcHeuristic::debugNodes()
     222{
     223  CbcHeurDebugNodes(model_);
     224}
     225
    221226bool
    222227CbcHeuristic::shouldHeurRun()
     
    228233  }
    229234
    230   debugNodes();
    231   return false;
     235//   debugNodes();
     236//   return false;
    232237
    233238  const int depth = currentNode->depth();
     
    693698CbcHeuristicNode::gutsOfConstructor(CbcModel& model)
    694699{
     700  //  CbcHeurDebugNodes(&model);
    695701  CbcNode* node = model.currentNode();
    696   brObj_ = new CbcBranchingObject*[node->depth()-1];
     702  brObj_ = new CbcBranchingObject*[node->depth()];
    697703  CbcNodeInfo* nodeInfo = node->nodeInfo();
    698704  int cnt = 0;
  • branches/heur/Cbc/src/CbcModel.cpp

    r882 r897  
    22652265      if (branchesLeft) {
    22662266        // set nodenumber correctly
     2267#ifdef CBC_DEBUG_NODENUMBER
     2268        printf("CbcModel: numberNodes2_: %i,  node->nodeNumber(): %i\n",
     2269               numberNodes2_, node->nodeNumber());
     2270#endif
    22672271        node->nodeInfo()->setNodeNumber(numberNodes2_);
    22682272        tree_->push(node) ;
     
    1189011894      if (branchesLeft) {
    1189111895        // set nodenumber correctly
    11892         if (node->nodeInfo())
     11896        if (node->nodeInfo()) {
     11897#ifdef CBC_DEBUG_NODENUMBER
     11898          printf("CbcModel: numberNodes2_: %i,  node->nodeNumber(): %i\n",
     11899                 numberNodes2_, node->nodeNumber());
     11900#endif
    1189311901          node->nodeInfo()->setNodeNumber(numberNodes2_);
     11902        }
    1189411903#ifndef CBC_DETERMINISTIC_THREAD
    1189511904#ifdef PUSH_LATER
  • branches/heur/Cbc/src/CbcNode.cpp

    r896 r897  
    7171      assert(cbcbr);
    7272      parentBranch_ = cbcbr->clone();
     73      parentBranch_->previousBranch();
    7374    }
    7475  }
    7576}
    7677
     78#if 0
    7779// Constructor given parent
    7880CbcNodeInfo::CbcNodeInfo (CbcNodeInfo * parent)
     
    9496  setParentBasedData();
    9597}
     98#endif
     99
    96100// Copy Constructor
    97101CbcNodeInfo::CbcNodeInfo (const CbcNodeInfo & rhs)
     
    179183    if (!numberLinks) delete parent_;
    180184  }
     185  delete parentBranch_;
    181186}
    182187
     
    497502CbcFullNodeInfo::CbcFullNodeInfo(CbcModel * model,
    498503                                 int numberRowsAtContinuous) :
    499   CbcNodeInfo()
     504  CbcNodeInfo(NULL, model->currentNode())
    500505{
    501506  OsiSolverInterface * solver = model->solver();
     
    672677CbcPartialNodeInfo::CbcPartialNodeInfo (const CbcPartialNodeInfo & rhs)
    673678
    674   : CbcNodeInfo(rhs.parent_)
     679  : CbcNodeInfo(rhs)
    675680
    676681{ basisDiff_ = rhs.basisDiff_->clone() ;
     
    11141119  }
    11151120  // Set node number
     1121#ifdef CBC_DEBUG_NODENUMBER
     1122  printf("CbcNode: model->getNodeCount2(): %i,     this->nodeNumber_: %i\n",
     1123         model->getNodeCount2(), nodeNumber_);
     1124#endif
    11161125  nodeInfo_->setNodeNumber(model->getNodeCount2());
    11171126  state_ |= 2; // say active
     
    12971306  }
    12981307  // Set node number
     1308#ifdef CBC_DEBUG_NODENUMBER
     1309  printf("CbcNode: model->getNodeCount2(): %i,     this->nodeNumber_: %i\n",
     1310         model->getNodeCount2(), nodeNumber_);
     1311#endif
    12991312  nodeInfo_->setNodeNumber(model->getNodeCount2());
    13001313  state_ |= 2; // say active
  • branches/heur/Cbc/src/CbcNode.hpp

    r896 r897  
    7474  CbcNodeInfo ( const CbcNodeInfo &);
    7575   
    76 
     76#if 0
    7777  /** Construct with parent
    7878
     
    8181  */
    8282  CbcNodeInfo (CbcNodeInfo * parent);
     83#endif
    8384   
    8485  /** Construct with parent and owner
Note: See TracChangeset for help on using the changeset viewer.