CouenneDisjCuts.cpp
Go to the documentation of this file.
1 /* $Id: CouenneDisjCuts.cpp 694 2011-06-18 20:13:17Z stefan $
2  *
3  * Name: CouenneDisjCuts.cpp
4  * Author: Pietro Belotti
5  * Purpose: methods for the disjunctive cuts
6  *
7  * (C) Carnegie-Mellon University, 2008-09.
8  * This file is licensed under the Eclipse Public License (EPL)
9  */
10 
11 #include "CouenneCutGenerator.hpp"
12 #include "CouenneDisjCuts.hpp"
13 #include "CouenneProblem.hpp"
14 
15 using namespace Ipopt;
16 using namespace Couenne;
17 
19 CouenneDisjCuts::CouenneDisjCuts (Bonmin::OsiTMINLPInterface *minlp,
22  OsiChooseVariable *bcv,
23  bool is_strong,
24  JnlstPtr journalist,
26  couenneCG_ (cg),
27  nrootcuts_ (-1), // to indicate first iteration not done yet
28  ntotalcuts_ (0),
29  septime_ (0.),
30  objValue_ (-COIN_DBL_MAX),
31  minlp_ (minlp),
32  branchingMethod_ (bcv),
33  isBranchingStrong_ (is_strong),
34  jnlst_ (journalist),
35  activeRows_ (false),
36  activeCols_ (false),
37  addPreviousCut_ (false),
38  cpuTime_ (-1.) {
39 
40  options -> GetNumericValue ("time_limit", cpuTime_, "couenne.");
41 
42  options -> GetNumericValue ("disj_init_perc", initDisjPercentage_, "couenne.");
43  options -> GetIntegerValue ("disj_init_number", initDisjNumber_, "couenne.");
44  options -> GetIntegerValue ("disj_depth_level", depthLevelling_, "couenne.");
45  options -> GetIntegerValue ("disj_depth_stop", depthStopSeparate_, "couenne.");
46 
47  std::string s;
48  options -> GetStringValue ("disj_active_rows", s, "couenne."); activeRows_ = (s == "yes");
49  options -> GetStringValue ("disj_active_cols", s, "couenne."); activeCols_ = (s == "yes");
50  options -> GetStringValue ("disj_cumulative", s, "couenne."); addPreviousCut_ = (s == "yes");
51 }
52 
53 
56  couenneCG_ (src.couenneCG_),
57  nrootcuts_ (src.nrootcuts_),
58  ntotalcuts_ (src.ntotalcuts_),
59  septime_ (src.septime_),
60  objValue_ (src.objValue_),
61  minlp_ (src.minlp_),
62  branchingMethod_ (src.branchingMethod_),
63  isBranchingStrong_ (src.isBranchingStrong_),
64  jnlst_ (src.jnlst_),
65  initDisjPercentage_ (src.initDisjPercentage_),
66  initDisjNumber_ (src.initDisjNumber_),
67  depthLevelling_ (src.depthLevelling_),
68  depthStopSeparate_ (src.depthStopSeparate_),
69  activeRows_ (src.activeRows_),
70  activeCols_ (src.activeCols_),
71  addPreviousCut_ (src.addPreviousCut_),
72  cpuTime_ (src.cpuTime_) {}
73 
74 
75 
78 {if (septime_ > 1e-9) jnlst_ -> Printf (J_ERROR, J_DISJCUTS, "Disjunctive cuts: total time %g\n", septime_);}
79 
80 
83 
84  roptions -> AddLowerBoundedIntegerOption
85  ("minlp_disj_cuts",
86  "The frequency (in terms of nodes) at which Couenne disjunctive cuts are generated.",
87  -99, 0,
88  "A frequency of 0 (default) means these cuts are never generated. "
89  "Any positive number n instructs Couenne to generate them at every n nodes of the B&B tree. "
90  "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."
91  );
92 
93  roptions -> AddLowerBoundedIntegerOption
94  ("disj_init_number",
95  "Maximum number of disjunction to consider at each iteration.",
96  -1, 10, "-1 means no limit.");
97 
98  roptions -> AddBoundedNumberOption
99  ("disj_init_perc",
100  "The maximum fraction of all disjunctions currently violated by the problem to consider for generating disjunctions.",
101  0., false,
102  1., false,
103  0.5, "");
104 
105  roptions -> AddLowerBoundedIntegerOption
106  ("disj_depth_level",
107  "Depth of the B&B tree when to start decreasing the number of objects that generate disjunctions.",
108  -1, 5, "This has a similar behavior as log_num_obbt_per_level. "
109  "A value of -1 means that generation can be done at all nodes.");
110 
111  roptions -> AddLowerBoundedIntegerOption
112  ("disj_depth_stop",
113  "Depth of the B&B tree where separation of disjunctive cuts is stopped.",
114  -1, 20, "A value of -1 means that generation can be done at all nodes");
115 
116  roptions -> AddStringOption2
117  ("disj_active_rows",
118  "Only include violated linear inequalities in the CGLP.",
119  "no",
120  "yes", "",
121  "no", "",
122  "This reduces the size of the CGLP, but may produce less efficient cuts.");
123 
124  roptions -> AddStringOption2
125  ("disj_active_cols",
126  "Only include violated variable bounds in the Cut Generating LP (CGLP).",
127  "no",
128  "yes", "",
129  "no", "",
130  "This reduces the size of the CGLP, but may produce less efficient cuts."
131  );
132 
133  roptions -> AddStringOption2
134  ("disj_cumulative",
135  "Add previous disjunctive cut to current CGLP.",
136  "no",
137  "yes", "",
138  "no", "",
139  "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. "
140  "Notice that, although this makes the cut generated more efficient, it increases the rank of the disjunctive cut generated."
141  );
142 }
Cut Generator for linear convexifications.
JnlstPtr jnlst_
SmartPointer to the Journalist.
int depthStopSeparate_
Depth of the BB tree where stop separation.
This is class provides an Osi interface for a Mixed Integer Linear Program expressed as a TMINLP (so ...
bool activeCols_
only include active columns in CGLP
const Ipopt::EJournalCategory J_DISJCUTS(Ipopt::J_USER6)
double septime_
separation time (includes generation of problem)
void fint fint fint real fint real real real real real real real real real * e
Cut Generator for linear convexifications.
int depthLevelling_
Depth of the BB tree where start decreasing number of objects.
A class to have all elements necessary to setup a branch-and-bound.
int initDisjNumber_
Initial number of objects to use for generating cuts.
bool addPreviousCut_
add previous disj cut to current CGLP?
void fint fint fint fint fint fint fint fint fint fint real real real real real real real real * s
CouenneDisjCuts(Bonmin::OsiTMINLPInterface *minlp=NULL, Bonmin::BabSetupBase *base=NULL, CouenneCutGenerator *cg=NULL, OsiChooseVariable *bcv=NULL, bool is_strong=false, JnlstPtr journalist=NULL, const Ipopt::SmartPtr< Ipopt::OptionsList > options=NULL)
constructor
bool activeRows_
only include active rows in CGLP
double cpuTime_
maximum CPU time
double initDisjPercentage_
Initial percentage of objects to use for generating cuts, in [0,1].
static void registerOptions(Ipopt::SmartPtr< Bonmin::RegisteredOptions > roptions)
Add list of options to be read from file.