Changeset 1159


Ignore:
Timestamp:
Apr 24, 2009 7:13:50 AM (11 years ago)
Author:
forrest
Message:

update example

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Cbc/examples/fpump.cpp

    r1156 r1159  
    55#include "CbcHeuristicFPump.hpp"
    66#include "CbcHeuristicRINS.hpp"
     7#include "CbcHeuristicLocal.hpp"
     8#include "CbcHeuristicDiveCoefficient.hpp"
     9#include "CbcHeuristicDiveFractional.hpp"
    710
    811// Using as solver
     
    3033  //model.setLogLevel(1);
    3134  //model.solver()->setHintParam(OsiDoReducePrint,true,OsiHintTry);
     35  CbcHeuristicDiveCoefficient heuristicDC(model);
     36  heuristicDC.setHeuristicName("DiveCoefficient");
     37  // allow to exit if close enough to optimum
     38  heuristicDC.setSwitches(1);
     39  model.addHeuristic(&heuristicDC);
     40  CbcHeuristicDiveFractional heuristicDF(model);
     41  heuristicDF.setHeuristicName("DiveFractional");
     42  heuristicDF.setSwitches(1);
     43  model.addHeuristic(&heuristicDF);
    3244  CbcHeuristicFPump pump(model);
    33   //pump.setMaximumTime(60);
     45  // allow to exit if close enough to optimum
     46  // plus some dubious options
     47  pump.setSwitches(1+4+8);
     48  pump.setMaximumTime(200);
    3449  pump.setMaximumPasses(100);
    3550  pump.setMaximumRetries(1);
     
    3954  pump.setWhen(13);
    4055  pump.setFakeCutoff(objValue+0.01*fabs(objValue));
     56  pump.setReducedCostMultiplier(0.1);
    4157  pump.setFeasibilityPumpOptions(80);
    4258  model.addHeuristic(&pump);
     
    5874  rins.setDecayFactor(5.0);
    5975  model.addHeuristic(&rins) ;
     76  CbcHeuristicLocal local(model);
     77  local.setHeuristicName("LOCAL");
     78  local.setFractionSmall(0.5);
     79  local.setSearchType(1);
     80  model.addHeuristic(&local) ;
    6081  model.setThreadMode(8);
    6182  model.setNumberThreads(2);
    6283  model.setMaximumNodes(-1);
     84  // Say what is good enough for solution
     85  model.setAllowableFractionGap(0.005);
    6386  // Do root
    6487  model.branchAndBound();
Note: See TracChangeset for help on using the changeset viewer.