Ignore:
Timestamp:
Mar 16, 2009 6:30:25 AM (10 years ago)
Author:
forrest
Message:

chnages to try and make faster

File:
1 edited

Legend:

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

    r1121 r1132  
    44714471  : CbcGeneral(),
    44724472    maximumDepth_(0),
     4473    maximumNodes_(0),
    44734474    whichSolution_(-1),
    44744475    numberNodes_(0),
     
    44814482  : CbcGeneral(model),
    44824483    maximumDepth_(maximumDepth),
     4484    maximumNodes_(0),
    44834485    whichSolution_(-1),
    44844486    numberNodes_(0),
    44854487    nodeInfo_(NULL)
    44864488{
    4487   int nNodes = maximumNodes();
    4488   if (nNodes) {
     4489  assert(maximumDepth_<1000000);
     4490  if (maximumDepth_>0)
     4491    maximumNodes_ = (1<<maximumDepth_)+1+maximumDepth_;
     4492  else if (maximumDepth_<0)
     4493    maximumNodes_ = 1+1-maximumDepth_;
     4494  else
     4495    maximumNodes_ = 0;
     4496#define MAX_NODES 100
     4497  maximumNodes_ = CoinMin(maximumNodes_,1+maximumDepth_+MAX_NODES);
     4498  if (maximumNodes_) {
    44894499    nodeInfo_ = new ClpNodeStuff();
     4500    nodeInfo_->maximumNodes_=maximumNodes_;
    44904501    ClpNodeStuff * info = nodeInfo_;
    44914502    // for reduced costs and duals
     
    44974508      info->solverOptions_ |= 32;
    44984509    }
    4499     ClpNode ** nodeInfo = new ClpNode * [nNodes];
    4500     for (int i=0;i<nNodes;i++)
     4510    ClpNode ** nodeInfo = new ClpNode * [maximumNodes_];
     4511    for (int i=0;i<maximumNodes_;i++)
    45014512      nodeInfo[i]=NULL;
    45024513    info->nodeInfo_ = nodeInfo;
     
    45114522{
    45124523  maximumDepth_ = rhs.maximumDepth_;
     4524  maximumNodes_ = rhs.maximumNodes_;
    45134525  whichSolution_ = -1;
    45144526  numberNodes_ = 0;
    4515   int nNodes = maximumNodes();
    4516   if (nNodes) {
     4527  if (maximumNodes_) {
    45174528    assert (rhs.nodeInfo_);
    45184529    nodeInfo_ = new ClpNodeStuff(*rhs.nodeInfo_);
     4530    nodeInfo_->maximumNodes_=maximumNodes_;
    45194531    ClpNodeStuff * info = nodeInfo_;
    45204532    if (maximumDepth_>0) {
     
    45254537    }
    45264538    if (!info->nodeInfo_) {
    4527       ClpNode ** nodeInfo = new ClpNode * [nNodes];
    4528       for (int i=0;i<nNodes;i++)
     4539      ClpNode ** nodeInfo = new ClpNode * [maximumNodes_];
     4540      for (int i=0;i<maximumNodes_;i++)
    45294541        nodeInfo[i]=NULL;
    45304542      info->nodeInfo_ = nodeInfo;
     
    45504562    delete nodeInfo_;
    45514563    maximumDepth_ = rhs.maximumDepth_;
     4564    maximumNodes_ = rhs.maximumNodes_;
    45524565    whichSolution_ = -1;
    45534566    numberNodes_ = 0;
     
    45554568      assert (rhs.nodeInfo_);
    45564569      nodeInfo_ = new ClpNodeStuff(*rhs.nodeInfo_);
     4570      nodeInfo_->maximumNodes_=maximumNodes_;
    45574571    } else {
    45584572      nodeInfo_ = NULL;
     
    45674581  delete nodeInfo_;
    45684582}
    4569 // Return maximum number of nodes
    4570 int
    4571 CbcGeneralDepth::maximumNodes() const
    4572 {
    4573   int n;
    4574   if (maximumDepth_>0)
    4575     n = (1<<maximumDepth_)+1+maximumDepth_;
    4576   else if (maximumDepth_<0)
    4577     n = 1+1-maximumDepth_;
    4578   else
    4579     n = 0;
    4580   return n;
    4581 }
    4582 
    45834583// Infeasibility - large is 0.5
    45844584double
     
    46264626      clpSolver->setBasis();
    46274627      whichSolution_ = simplex->fathomMany(info);
     4628      //printf("FAT %d nodes, %d iterations\n",
     4629      //info->numberNodesExplored_,info->numberIterations_);
     4630      //printf("CbcBranch %d rows, %d columns\n",clpSolver->getNumRows(),
     4631      //     clpSolver->getNumCols());
    46284632      model_->incrementExtra(info->numberNodesExplored_,
    46294633                             info->numberIterations_);
     
    48914895{
    48924896  double cutoff=model_->getCutoff();
     4897  //printf("GenB %x whichNode %d numberLeft %d which %d\n",
     4898  // this,whichNode_,numberBranchesLeft(),branchIndex());
    48934899  if (whichNode_<0) {
    48944900    assert (node_);
     
    49324938    OsiSolverInterface * solver = model_->solver();
    49334939    thisProb->apply(solver);
    4934     OsiClpSolverInterface * clpSolver
    4935       = dynamic_cast<OsiClpSolverInterface *> (solver);
    4936     assert (clpSolver);
     4940    //OsiClpSolverInterface * clpSolver
     4941    //= dynamic_cast<OsiClpSolverInterface *> (solver);
     4942    //assert (clpSolver);
    49374943    // Move status to basis
    4938     clpSolver->setWarmStart(NULL);
     4944    //clpSolver->setWarmStart(NULL);
    49394945  }
    49404946  return 0.0;
     
    51925198  // Current basis
    51935199  status_ = clpSolver->getBasis(status);
     5200  assert (status_->fullBasis());
     5201  //status_->print();
    51945202}
    51955203
Note: See TracChangeset for help on using the changeset viewer.