Changeset 190 for trunk


Ignore:
Timestamp:
Oct 10, 2005 2:08:42 PM (15 years ago)
Author:
forrest
Message:

local search

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/CbcNode.cpp

    r181 r190  
    23722372        if (choice.upMovement<1.0e100) {
    23732373          if(choice.downMovement<1.0e100) {
     2374            // In case solution coming in was odd
     2375            choice.upMovement = CoinMax(0.0,choice.upMovement);
     2376            choice.downMovement = CoinMax(0.0,choice.downMovement);
    23742377            // feasible - see which best
    23752378            int iColumn =
  • trunk/CbcTreeLocal.cpp

    r188 r190  
    464464        rhs_ += range_/2;
    465465      } else {
    466         // This will be last try (may hit max time0
     466        // This will be last try (may hit max time)
    467467        lastTry=true;
     468        if (!maxDiversification_)
     469          typeCuts_=-1; // make sure can't start again
    468470        model_->setCutoff(bestCutoff_);
    469471        printf("Exiting local search with current set of cuts\n");
     
    576578  case 4:
    577579    // solution not found and subtree not exhausted
    578     if (nextStrong_) {
    579       // Reverse cut weakly
    580       reverseCut(4,rhs_);
    581       model_->setCutoff(1.0e50);
    582       diversification_++;
    583       searchType_=0;
    584     } else {
    585       // delete last cut
    586       deleteCut(cut_);
    587       searchType_=1;
    588     }
    589     nextStrong_=true;
    590     rhs_ += range_/2;
     580    if (maxDiversification_) {
     581      if (nextStrong_) {
     582        // Reverse cut weakly
     583        reverseCut(4,rhs_);
     584        model_->setCutoff(1.0e50);
     585        diversification_++;
     586        searchType_=0;
     587      } else {
     588        // delete last cut
     589        deleteCut(cut_);
     590        searchType_=1;
     591      }
     592      nextStrong_=true;
     593      rhs_ += range_/2;
     594    } else {
     595      // special case when using as heuristic
     596      // This will be last try (may hit max time0
     597      lastTry=true;
     598      model_->setCutoff(bestCutoff_);
     599      printf("Exiting local search with current set of cuts\n");
     600      rhs_=1.0e100;
     601      // Can now stop on gap
     602      model_->setDblParam(CbcModel::CbcAllowableGap,savedGap_);
     603      typeCuts_ =-1;
     604    }
    591605    break;
    592606  }
     
    652666CbcTreeLocal::createCut(const double * solution,OsiRowCut & rowCut)
    653667{
     668  if (rhs_>1.0e20)
     669    return -1;
    654670  OsiSolverInterface * solver = model_->solver();
    655671  const double * rowLower = solver->getRowLower();
Note: See TracChangeset for help on using the changeset viewer.