source: branches/devel/Bonmin/src/CbcBonmin/BonCbcParam.cpp @ 99

Last change on this file since 99 was 99, checked in by pbonami, 13 years ago

Add option to choose branching strategy,
include cmath in BonCurvatureEstimator?

  • Property svn:eol-style set to native
  • Property svn:keywords set to "Author Date Id Revision"
File size: 4.7 KB
Line 
1// (C) Copyright International Business Machines Corporation and Carnegie Mellon University 2006
2// All Rights Reserved.
3// This code is published under the Common Public License.
4//
5// Authors :
6// Laszlo Ladanyi, International Business Machines Corporation
7// Pierre Bonami, Carnegie Mellon University,
8//
9// Date : 03/15/2006
10
11#include "BonOsiTMINLPInterface.hpp"
12#include "BonCbcParam.hpp"
13
14namespace Bonmin
15{
16  bool
17  BonminCbcParam::extractParams(OsiTMINLPInterface * solver)
18  {
19    bool success = true;
20
21    Ipopt::SmartPtr<Ipopt::OptionsList> Options = solver->retrieve_options();
22
23    //extract IpoptInterface special params
24    solver->extractInterfaceParams();
25
26    //log levels
27    success &= Options->GetIntegerValue("bb_log_level",bbLogLevel,"bonmin.");
28    success &= Options->GetIntegerValue("bb_log_interval",logInterval,"bonmin.");
29    success &= Options->GetIntegerValue("lp_log_level",lpLogLevel,"bonmin.");
30    success &= Options->GetIntegerValue("milp_log_level",milpLogLevel,"bonmin.");
31    success &= Options->GetIntegerValue("oa_log_level",oaLogLevel,"bonmin.");
32    success &= Options->GetNumericValue("oa_log_frequency",oaLogFrequency,"bonmin.");
33    success &= Options->GetIntegerValue("nlp_log_level",nlpLogLevel,"bonmin.");
34    //General options
35    success &= Options->GetEnumValue("algorithm",algo,"bonmin.");
36    success &= Options->GetNumericValue("time_limit", maxTime, "bonmin.");
37    success &= Options->GetIntegerValue("node_limit",maxNodes,"bonmin.");
38    success &= Options->GetNumericValue("integer_tolerance",intTol,"bonmin.");
39    success &= Options->GetNumericValue("allowable_gap",allowableGap,"bonmin.");
40    success &= Options->GetNumericValue("allowable_fraction_gap",allowableFractionGap,"bonmin.");
41    success &= Options->GetNumericValue("cutoff_decr",cutoffDecr,"bonmin.");
42    success &= Options->GetNumericValue("cutoff",cutoff,"bonmin.");
43
44    // Branch & bound setting
45    success &= Options->GetEnumValue("nodeselect_stra",nodeSelection,"bonmin.");
46    success &= Options->GetEnumValue("varseselect_stra",varSelection,"bonmin.");
47    success &= Options->GetIntegerValue("number_strong_branch",numberStrong,"bonmin.");
48    success &= Options->GetIntegerValue("number_before_trust", minReliability,"bonmin.");
49
50    success &=  Options->GetEnumValue("sos_constraints",disableSos,"bonmin.");
51    // Robustness and non convex minlps
52    success &= Options->GetIntegerValue("max_consecutive_failures",
53        maxFailures,"bonmin.");
54    success &= Options->GetIntegerValue("max_consecutive_infeasible",
55        maxInfeasible,"bonmin.");
56    success &= Options->GetEnumValue("nlp_failure_behavior",failureBehavior,".bonmin");
57
58    // Hybrid options
59    success &= Options->GetIntegerValue("nlp_solve_frequency",nlpSolveFrequency,"bonmin.");
60    success &= Options->GetNumericValue("oa_dec_time_limit",oaDecMaxTime,"bonmin.");
61    success &= Options->GetIntegerValue("Gomory_cuts", migFreq,"bonmin.");
62    success &= Options->GetIntegerValue("probing_cuts",probFreq,"bonmin.");
63    success &= Options->GetIntegerValue("mir_cuts",mirFreq,"bonmin.");
64    success &= Options->GetIntegerValue("cover_cuts",coverFreq,"bonmin.");
65
66    // milp subsolver options
67    success &= Options->GetEnumValue("milp_subsolver",milpSubSolver,"bonmin.");
68    success &= Options->GetEnumValue("nodeselect_stra",milpSubSolver_nodeSelection,"milp_sub.");
69    success &= Options->GetIntegerValue("number_strong_branch",milpSubSolver_numberStrong,"milp_sub.");
70    success &= Options->GetIntegerValue("number_before_trust", milpSubSolver_minReliability,"milp_sub.");
71    success &= Options->GetIntegerValue("Gomory_cuts", milpSubSolver_migFreq,"milp_sub.");
72    success &= Options->GetIntegerValue("probing_cuts",milpSubSolver_probFreq,"milp_sub.");
73    success &= Options->GetIntegerValue("mir_cuts",milpSubSolver_mirFreq,"milp_sub.");
74    success &= Options->GetIntegerValue("cover_cuts",milpSubSolver_coverFreq,"milp_sub.");
75
76    //Preset default for algorithm
77    if (algo==0)//B-BB
78    {
79      if(varSelection == 1 || varSelection == 2){
80        std::cout<<"Variable selection strategy not available with B-BB.\nSetting to most fractional."<<std::endl;
81        varSelection = 0;
82      }
83    }
84    else if (algo==1)//B-OA
85    {
86      oaDecMaxTime = DBL_MAX;
87      nlpSolveFrequency = 0;
88      bbLogLevel = 0;
89    }
90    else if (algo==2) {
91      oaDecMaxTime = 0;
92      nlpSolveFrequency = 0;
93      migFreq = 0;
94      probFreq = 0;
95      mirFreq = 0;
96      coverFreq = 0;
97    }
98    else if (algo==3)//Nothing to do
99    {
100    }
101   
102    // Set branching strategy
103    if(varSelection == 0){
104      minReliability = 0;
105      numberStrong = 0;
106    }
107    else if(varSelection == 1){
108      minReliability = 0;
109    }
110    else if(varSelection == 3){
111      minReliability = 10000;
112    } 
113    return success;
114  }
115}
Note: See TracBrowser for help on using the repository browser.