Ignore:
Timestamp:
Oct 20, 2005 5:10:05 PM (14 years ago)
Author:
forrest
Message:

stuff

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/CbcHeuristicLocal.cpp

    r182 r197  
    120120    }
    121121  }
    122   // Reduce printout
    123   newSolver->setHintParam(OsiDoReducePrint,true,OsiHintTry);
    124   newSolver->setHintParam(OsiDoPresolveInInitial,true,OsiHintTry);
    125   newSolver->setDblParam(OsiDualObjectiveLimit,objectiveValue);
    126   newSolver->initialSolve();
    127   bool betterSolution=true;
    128   if (newSolver->isProvenOptimal()) {
    129     CglPreProcess process;
    130     /* Do not try and produce equality cliques and
    131        do up to 5 passes */
    132     OsiSolverInterface * solver2= process.preProcess(*newSolver);
    133     if (!solver2) {
    134       printf("Pre-processing says infeasible\n");
    135       betterSolution=false;
    136     } else {
    137       solver2->resolve();
    138       CbcModel model(*solver2);
    139       model.setLogLevel(1);
    140       model.setCutoff(objectiveValue);
    141       model.setMaximumNodes(200);
    142       model.solver()->setHintParam(OsiDoReducePrint,true,OsiHintTry);
    143       CbcStrategyDefaultSubTree strategy(model_,true,5,5,0);
    144       model.setStrategy(strategy);
    145       // Lightweight
    146       model.setNumberStrong(5);
    147       model.setNumberBeforeTrust(1);
    148       model.solver()->setIntParam(OsiMaxNumIterationHotStart,10);
    149       // Do search
    150       model_->messageHandler()->message(CBC_START_SUB,model_->messages())
    151         << "CbcHeuristicLocal"
    152         << model.getMaximumNodes()
    153         <<CoinMessageEol;
    154       model.branchAndBound();
    155       model_->messageHandler()->message(CBC_END_SUB,model_->messages())
    156         << "CbcHeuristicLocal"
    157         <<CoinMessageEol;
    158       if (model.getMinimizationObjValue()<objectiveValue) {
    159         model_->messageHandler()->message(CBC_HEURISTIC_SOLUTION,model_->messages())
    160           << model.getMinimizationObjValue()
    161           << "CbcHeuristicLocal"
    162           <<CoinMessageEol;
    163         // solution
    164         // post process
    165         process.postProcess(*model.solver());
    166         // Solution now back in newSolver
    167         memcpy(newSolution,newSolver->getColSolution(),
    168                newSolver->getNumCols()*sizeof(double));
    169         objectiveValue = model.getMinimizationObjValue();
    170       } else {
    171         // no good
    172         betterSolution=false;
    173       }
    174     }
    175   } else {
    176     // no good
    177     betterSolution=false;
    178   }
     122  int returnCode = smallBranchAndBound(newSolver,200,newSolution,objectiveValue,
     123                                         objectiveValue,"CbcHeuristicLocal");
     124
    179125  delete newSolver;
    180   if (betterSolution) {
    181     return 1;
    182   } else {
    183     return 0;
    184   }
     126  return returnCode;
    185127}
    186128/*
Note: See TracChangeset for help on using the changeset viewer.