/// 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); }
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_; }
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; }