示例#1
0
 /// New usefull constructor
 OaFeasibilityChecker::OaFeasibilityChecker(BabSetupBase &b):
     OaDecompositionBase(b, false, true),
     cut_count_(0)
 {
   int ival;
   b.options()->GetEnumValue("feas_check_cut_types", ival, b.prefix()); 
   type_ = CutsTypes(ival);
   b.options()->GetEnumValue("feas_check_discard_policy", ival, b.prefix()); 
   pol_ = CutsPolicies(ival);
   b.options()->GetIntegerValue("generate_benders_after_so_many_oa", ival, b.prefix());
   maximum_oa_cuts_ = static_cast<unsigned int>(ival);
 }
示例#2
0
 BonNWayChoose::BonNWayChoose(BabSetupBase &b, const OsiSolverInterface* solver):
     OsiChooseVariable(solver),
     br_depth_(0),
     bounds_(),
     unit_changes_(),
     num_ps_costs_(),
     num_eval_(),
     geo_means_(0)
 {
   Ipopt::SmartPtr<Ipopt::OptionsList> options = b.options();
   options->GetNumericValue("time_limit", time_limit_, b.prefix());
   options->GetNumericValue("cutoff_multiplier", cutoff_multiplier_, b.prefix());
   options->GetNumericValue("pseudocost_trust_value", pseudocost_trust_value_, b.prefix());
   options->GetIntegerValue("strong_branch_depth", br_depth_, b.prefix());
   options->GetIntegerValue("nway_branch_log_level", log_, b.prefix());
   options->GetEnumValue("do_fixings", do_fixings_, b.prefix());
   options->GetEnumValue("use_geo_means", geo_means_, b.prefix());
   /** Set values of standard branching options.*/
   int numberObjects = solver_->numberObjects();
   std::cout<<"Number objects "<<numberObjects<<std::endl;
   start_time_ = CoinCpuTime();
   OsiObject ** object = solver->objects();
   for (int i=0;i<numberObjects;i++) {
      BonNWayObject * nway = dynamic_cast<BonNWayObject *>(object[i]);
     if(!nway) continue;
     start_nway_ = i;
     break;
   }
   numberObjects -= start_nway_;
 }
示例#3
0
  OaDecompositionBase::OaDecompositionBase(BabSetupBase &b, bool leaveSiUnchanged,
      bool reassignLpsolver):
      CglCutGenerator(),
      nlp_(b.nonlinearSolver()),
      s_(&b),
      lp_(NULL),
      objects_(NULL),
      nObjects_(0),
      nLocalSearch_(0),
      handler_(NULL),
      leaveSiUnchanged_(leaveSiUnchanged),
      reassignLpsolver_(reassignLpsolver),
      timeBegin_(0),
      numSols_(0),
      parameters_(),
      currentNodeNumber_(-1)
  {
    handler_ = new CoinMessageHandler();
    int logLevel;
    b.options()->GetIntegerValue("oa_log_level",logLevel,b.prefix());
    b.options()->GetNumericValue("oa_log_frequency",parameters_.logFrequency_,b.prefix());
    b.options()->GetNumericValue("allowable_fraction_gap", parameters_.gap_tol_, b.prefix());
    handler_ -> setLogLevel(logLevel);
    b.options()->GetIntegerValue("solution_limit", parameters_.maxSols_,b.prefix());

    messages_ = OaMessages();
    timeBegin_ = CoinCpuTime();
    b.options()->GetIntegerValue("milp_log_level",parameters_.subMilpLogLevel_,b.prefix());
    b.options()->GetNumericValue("cutoff_decr",parameters_.cbcCutoffIncrement_,b.prefix());
    b.options()->GetNumericValue("integer_tolerance",parameters_.cbcIntegerTolerance_,b.prefix());
    int ivalue;
    b.options()->GetEnumValue("add_only_violated_oa", ivalue,b.prefix());
    parameters_.addOnlyViolated_ = ivalue;
    b.options()->GetEnumValue("oa_cuts_scope", ivalue,b.prefix());
    parameters_.global_ = ivalue;
}
  void LinearCutsGenerator::initialize(BabSetupBase & s){
    assert(dynamic_cast<TMINLP2TNLPQuadCuts *> (s.nonlinearSolver()->problem()));
    int freq;
    s.options()->GetIntegerValue("Gomory_cuts", freq,"bonmin.");
    if (freq) {
      Coin::SmartPtr<CuttingMethod> cg = new CuttingMethod;
      cg->frequency = freq;
      CglGomory * gom = new CglGomory;
      cg->cgl = gom;
      gom->setLimitAtRoot(512);
      gom->setLimit(50);
      cg->id = "Mixed Integer Gomory";
      methods_.push_back(cg);
    }

    s.options()->GetIntegerValue("mir_cuts",freq,"bonmin.");
    if (freq) {
      Coin::SmartPtr<CuttingMethod> cg = new CuttingMethod;
      cg->frequency = freq;
      CglMixedIntegerRounding2 * mir = new CglMixedIntegerRounding2;
      cg->cgl = mir;
      cg->id = "Mixed Integer Rounding";
      methods_.push_back(cg);


    }
    s.options()->GetIntegerValue("2mir_cuts",freq,"bonmin.");
    if (freq) {
      Coin::SmartPtr<CuttingMethod> cg = new CuttingMethod;
      cg->frequency = freq;
      CglTwomir * mir2 = new CglTwomir;
      cg->cgl = mir2;
      cg->id = "2-MIR";
      methods_.push_back(cg);
    }
    s.options()->GetIntegerValue("cover_cuts",freq,"bonmin.");
    if (freq) {
      Coin::SmartPtr<CuttingMethod> cg = new CuttingMethod;
      cg->frequency = freq;
      CglKnapsackCover * cover = new CglKnapsackCover;
      cg->cgl = cover;
      cg->id = "Cover";
      methods_.push_back(cg);
    }

    s.options()->GetIntegerValue("clique_cuts",freq,"bonmin.");
    if (freq) {
      Coin::SmartPtr<CuttingMethod> cg = new CuttingMethod;
      cg->frequency = freq;
      CglClique * clique = new CglClique;
      clique->setStarCliqueReport(false);
      clique->setRowCliqueReport(false);
      clique->setMinViolation(0.1);

      cg->cgl = clique;
      cg->id = "Clique";
      methods_.push_back(cg);
    }
    s.options()->GetIntegerValue("flow_cover_cuts",freq,"bonmin.");
    if (freq) {
      Coin::SmartPtr<CuttingMethod> cg = new CuttingMethod;
      cg->frequency = freq;
      CglFlowCover * flow = new CglFlowCover;
      cg->cgl = flow;
      cg->id = "Flow Covers";
      methods_.push_back(cg);
    }
    s.options()->GetIntegerValue("lift_and_project_cuts",freq,"bonmin.");
    if (freq) {
      Coin::SmartPtr<CuttingMethod> cg = new CuttingMethod;
      cg->frequency = freq;
      CglLandP * landp = new CglLandP;
      cg->cgl = landp;
      cg->id = "Lift-and-Project";
      methods_.push_back(cg);
    }
    s.options()->GetIntegerValue("reduce_and_split_cuts",freq,"bonmin.");
    if (freq) {
      Coin::SmartPtr<CuttingMethod> cg = new CuttingMethod;
      cg->frequency = freq;
      CglRedSplit * rands = new CglRedSplit;
      cg->cgl = rands;
      cg->id = "Reduce-and-Split";
      methods_.push_back(cg);
    }
  }