1 | /* $Id: CouenneCrossConv.hpp 945 2013-04-06 20:25:21Z stefan $ |
---|
2 | * |
---|
3 | * Name: CouenneCrossConv.hpp |
---|
4 | * Author: Pietro Belotti |
---|
5 | * Purpose: Convexification cuts on redundant relationships between auxiliaries |
---|
6 | * |
---|
7 | * (C) Pietro Belotti, 2010-11. |
---|
8 | * This file is licensed under the Eclipse Public License (EPL) |
---|
9 | */ |
---|
10 | |
---|
11 | #ifndef COUENNECROSSCONV_HPP |
---|
12 | #define COUENNECROSSCONV_HPP |
---|
13 | |
---|
14 | #include "BonRegisteredOptions.hpp" |
---|
15 | |
---|
16 | #include "CglConfig.h" |
---|
17 | #include "CglCutGenerator.hpp" |
---|
18 | #include "OsiRowCut.hpp" |
---|
19 | #include "CouenneJournalist.hpp" |
---|
20 | |
---|
21 | namespace Ipopt { |
---|
22 | template <class T> class SmartPtr; |
---|
23 | class OptionsList; |
---|
24 | } |
---|
25 | |
---|
26 | namespace Couenne { |
---|
27 | |
---|
28 | class CouenneProblem; |
---|
29 | |
---|
30 | /// Base class definition for relations between auxiliaries |
---|
31 | |
---|
32 | class AuxRelation { |
---|
33 | |
---|
34 | public: |
---|
35 | |
---|
36 | virtual int findRelations () = 0; |
---|
37 | |
---|
38 | virtual void generateCuts (const OsiSolverInterface &, |
---|
39 | OsiCuts &, |
---|
40 | const CglTreeInfo = CglTreeInfo ()) const; |
---|
41 | protected: |
---|
42 | |
---|
43 | }; |
---|
44 | |
---|
45 | /// Identifies 5-ples of variables of the form |
---|
46 | /// |
---|
47 | /// x_3 := log x_1 |
---|
48 | /// x_4 := log x_2 |
---|
49 | /// x_5 := x_1 x_2 in [l,u] |
---|
50 | /// |
---|
51 | /// and generates a cut |
---|
52 | /// |
---|
53 | /// x_3 + x_4 in [max {0, log l}, max {0, log u}]. |
---|
54 | /// |
---|
55 | /// This has to be repeatedly generated, even when l=u (l and/or u |
---|
56 | /// could change in other nodes). |
---|
57 | |
---|
58 | class SumLogAuxRel: public AuxRelation { |
---|
59 | |
---|
60 | public: |
---|
61 | |
---|
62 | virtual int findRelations (); |
---|
63 | |
---|
64 | virtual void generateCuts (const OsiSolverInterface &, |
---|
65 | OsiCuts &, |
---|
66 | const CglTreeInfo = CglTreeInfo ()) const; |
---|
67 | }; |
---|
68 | |
---|
69 | |
---|
70 | /// Identifies 5-ples of variables of the form |
---|
71 | /// |
---|
72 | /// x_k := x_i x_j |
---|
73 | /// x_l := x_i x_p |
---|
74 | /// |
---|
75 | /// x_q := x_k x_p OR x_q := x_k / x_j |
---|
76 | /// x_r := x_k x_j x_r := x_l / x_p |
---|
77 | /// |
---|
78 | /// and generates, ONLY ONCE, a cut |
---|
79 | /// |
---|
80 | /// x_q = x_r (in both cases). |
---|
81 | |
---|
82 | class MultiProdRel: public AuxRelation { |
---|
83 | |
---|
84 | public: |
---|
85 | |
---|
86 | virtual int findRelations (); |
---|
87 | |
---|
88 | virtual void generateCuts (const OsiSolverInterface &, |
---|
89 | OsiCuts &, |
---|
90 | const CglTreeInfo = CglTreeInfo ()) const; |
---|
91 | }; |
---|
92 | |
---|
93 | /// Identifies 5-tuple of the form |
---|
94 | /// |
---|
95 | /// x_j := x_i / x_k |
---|
96 | /// x_p := x_i / x_q |
---|
97 | /// |
---|
98 | /// x_l := x_j / x_p OR x_l := x_j x_k |
---|
99 | /// x_m := x_q / x_k x_m := x_p x_q |
---|
100 | /// |
---|
101 | /// and generates, ONLY once, a cut |
---|
102 | /// |
---|
103 | /// x_l = x_m (in both cases). |
---|
104 | |
---|
105 | class BiProdDivRel: public AuxRelation { |
---|
106 | |
---|
107 | public: |
---|
108 | |
---|
109 | virtual int findRelations (); |
---|
110 | |
---|
111 | virtual void generateCuts (const OsiSolverInterface &, |
---|
112 | OsiCuts &, |
---|
113 | const CglTreeInfo = CglTreeInfo ()) const; |
---|
114 | }; |
---|
115 | |
---|
116 | /// Identifies 5-tuple of the form |
---|
117 | /// |
---|
118 | /// x_j := x_i ^ alpha |
---|
119 | /// x_p := x_i ^ beta |
---|
120 | /// |
---|
121 | /// and generates cuts based on the relation |
---|
122 | /// |
---|
123 | /// x_p = x_j ^ {beta/alpha} |
---|
124 | |
---|
125 | class PowRel: public AuxRelation { |
---|
126 | |
---|
127 | public: |
---|
128 | |
---|
129 | virtual int findRelations (); |
---|
130 | |
---|
131 | virtual void generateCuts (const OsiSolverInterface &, |
---|
132 | OsiCuts &, |
---|
133 | const CglTreeInfo = CglTreeInfo ()) const; |
---|
134 | }; |
---|
135 | |
---|
136 | |
---|
137 | /// Cut Generator that uses relationships between auxiliaries |
---|
138 | |
---|
139 | class CouenneCrossConv: public CglCutGenerator { |
---|
140 | |
---|
141 | public: |
---|
142 | |
---|
143 | /// constructor |
---|
144 | CouenneCrossConv (CouenneProblem *, |
---|
145 | JnlstPtr, |
---|
146 | const Ipopt::SmartPtr <Ipopt::OptionsList>); |
---|
147 | |
---|
148 | /// copy constructor |
---|
149 | CouenneCrossConv (const CouenneCrossConv &); |
---|
150 | |
---|
151 | /// destructor |
---|
152 | virtual ~CouenneCrossConv (); |
---|
153 | |
---|
154 | /// clone method (necessary for the abstract CglCutGenerator class) |
---|
155 | virtual CouenneCrossConv *clone () const |
---|
156 | {return new CouenneCrossConv (*this);} |
---|
157 | |
---|
158 | /// the main CglCutGenerator |
---|
159 | virtual void generateCuts (const OsiSolverInterface &, |
---|
160 | OsiCuts &, |
---|
161 | const CglTreeInfo = CglTreeInfo ()) |
---|
162 | #if CGL_VERSION_MAJOR == 0 && CGL_VERSION_MINOR <= 57 |
---|
163 | const |
---|
164 | #endif |
---|
165 | ; |
---|
166 | |
---|
167 | /// Add list of options to be read from file |
---|
168 | static void registerOptions (Ipopt::SmartPtr <Bonmin::RegisteredOptions> roptions); |
---|
169 | |
---|
170 | /// Set up data structure to detect redundancies |
---|
171 | virtual void setup (); |
---|
172 | |
---|
173 | protected: |
---|
174 | |
---|
175 | /// Journalist |
---|
176 | JnlstPtr jnlst_; |
---|
177 | |
---|
178 | /// pointer to the CouenneProblem representation |
---|
179 | CouenneProblem *problem_; |
---|
180 | }; |
---|
181 | } |
---|
182 | |
---|
183 | #endif |
---|