00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #include "CouenneDisjCuts.hpp"
00012 #include "CouenneProblem.hpp"
00013 #include "CouenneCutGenerator.hpp"
00014
00015
00017 CouenneDisjCuts::CouenneDisjCuts (Bonmin::OsiTMINLPInterface *minlp,
00018 Bonmin::BabSetupBase *base,
00019 CouenneCutGenerator *cg,
00020 OsiChooseVariable *bcv,
00021 bool is_strong,
00022 JnlstPtr journalist,
00023 const Ipopt::SmartPtr<Ipopt::OptionsList> options):
00024 couenneCG_ (cg),
00025 nrootcuts_ (-1),
00026 ntotalcuts_ (0),
00027 septime_ (0.),
00028 objValue_ (-COIN_DBL_MAX),
00029 minlp_ (minlp),
00030 branchingMethod_ (bcv),
00031 isBranchingStrong_ (is_strong),
00032 jnlst_ (journalist),
00033 activeRows_ (false),
00034 activeCols_ (false),
00035 addPreviousCut_ (false),
00036 cpuTime_ (-1.) {
00037
00038 options -> GetNumericValue ("time_limit", cpuTime_, "couenne.");
00039
00040 options -> GetNumericValue ("disj_init_perc", initDisjPercentage_, "couenne.");
00041 options -> GetIntegerValue ("disj_init_number", initDisjNumber_, "couenne.");
00042 options -> GetIntegerValue ("disj_depth_level", depthLevelling_, "couenne.");
00043 options -> GetIntegerValue ("disj_depth_stop", depthStopSeparate_, "couenne.");
00044
00045 std::string s;
00046 options -> GetStringValue ("disj_active_rows", s, "couenne."); activeRows_ = (s == "yes");
00047 options -> GetStringValue ("disj_active_cols", s, "couenne."); activeCols_ = (s == "yes");
00048 options -> GetStringValue ("disj_cumulative", s, "couenne."); addPreviousCut_ = (s == "yes");
00049 }
00050
00051
00053 CouenneDisjCuts::CouenneDisjCuts (const CouenneDisjCuts &src):
00054 couenneCG_ (src.couenneCG_),
00055 nrootcuts_ (src.nrootcuts_),
00056 ntotalcuts_ (src.ntotalcuts_),
00057 septime_ (src.septime_),
00058 objValue_ (src.objValue_),
00059 minlp_ (src.minlp_),
00060 branchingMethod_ (src.branchingMethod_),
00061 isBranchingStrong_ (src.isBranchingStrong_),
00062 jnlst_ (src.jnlst_),
00063 initDisjPercentage_ (src.initDisjPercentage_),
00064 initDisjNumber_ (src.initDisjNumber_),
00065 depthLevelling_ (src.depthLevelling_),
00066 depthStopSeparate_ (src.depthStopSeparate_),
00067 activeRows_ (src.activeRows_),
00068 activeCols_ (src.activeCols_),
00069 addPreviousCut_ (src.addPreviousCut_),
00070 cpuTime_ (src.cpuTime_) {}
00071
00072
00073
00075 CouenneDisjCuts::~CouenneDisjCuts ()
00076 {if (septime_ > 1e-9) jnlst_ -> Printf (J_ERROR, J_DISJCUTS, "Disjunctive cuts: total time %g\n", septime_);}
00077
00078
00080 void CouenneDisjCuts::registerOptions (Ipopt::SmartPtr <Bonmin::RegisteredOptions> roptions) {
00081
00082 roptions -> AddLowerBoundedIntegerOption
00083 ("minlp_disj_cuts",
00084 "The frequency (in terms of nodes) at which Couenne disjunctive cuts are generated.",
00085 -99, 0,
00086 "A frequency of 0 (default) means these cuts are never generated. "
00087 "Any positive number n instructs Couenne to generate them at every n nodes of the B&B tree. "
00088 "A negative number -n means that generation should be attempted at the root node, and if successful it can be repeated at every n nodes, otherwise it is stopped altogether."
00089 );
00090
00091 roptions -> AddLowerBoundedIntegerOption
00092 ("disj_init_number",
00093 "Maximum number of disjunction to consider at each iteration.",
00094 -1, 10, "-1 means no limit.");
00095
00096 roptions -> AddBoundedNumberOption
00097 ("disj_init_perc",
00098 "The maximum fraction of all disjunctions currently violated by the problem to consider for generating disjunctions.",
00099 0., false,
00100 1., false,
00101 0.5, "");
00102
00103 roptions -> AddLowerBoundedIntegerOption
00104 ("disj_depth_level",
00105 "Depth of the B&B tree when to start decreasing the number of objects that generate disjunctions.",
00106 -1, 5, "This has a similar behavior as log_num_obbt_per_level. "
00107 "A value of -1 means that generation can be done at all nodes.");
00108
00109 roptions -> AddLowerBoundedIntegerOption
00110 ("disj_depth_stop",
00111 "Depth of the B&B tree where separation of disjunctive cuts is stopped.",
00112 -1, 20, "A value of -1 means that generation can be done at all nodes");
00113
00114 roptions -> AddStringOption2
00115 ("disj_active_rows",
00116 "Only include violated linear inequalities in the CGLP.",
00117 "no",
00118 "yes", "",
00119 "no", "",
00120 "This reduces the size of the CGLP, but may produce less efficient cuts.");
00121
00122 roptions -> AddStringOption2
00123 ("disj_active_cols",
00124 "Only include violated variable bounds in the Cut Generating LP (CGLP).",
00125 "no",
00126 "yes", "",
00127 "no", "",
00128 "This reduces the size of the CGLP, but may produce less efficient cuts."
00129 );
00130
00131 roptions -> AddStringOption2
00132 ("disj_cumulative",
00133 "Add previous disjunctive cut to current CGLP.",
00134 "no",
00135 "yes", "",
00136 "no", "",
00137 "When generating disjunctive cuts on a set of disjunctions 1, 2, ..., k, introduce the cut relative to the previous disjunction i-1 in the CGLP used for disjunction i. "
00138 "Notice that, although this makes the cut generated more efficient, it increases the rank of the disjunctive cut generated."
00139 );
00140 }