Scippy

SCIP

Solving Constraint Integer Programs

cons_soc.h
Go to the documentation of this file.
1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2 /* */
3 /* This file is part of the program and library */
4 /* SCIP --- Solving Constraint Integer Programs */
5 /* */
6 /* Copyright (C) 2002-2017 Konrad-Zuse-Zentrum */
7 /* fuer Informationstechnik Berlin */
8 /* */
9 /* SCIP is distributed under the terms of the ZIB Academic License. */
10 /* */
11 /* You should have received a copy of the ZIB Academic License */
12 /* along with SCIP; see the file COPYING. If not email to scip@zib.de. */
13 /* */
14 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
15 
16 /**@file cons_soc.h
17  * @ingroup CONSHDLRS
18  * @brief constraint handler for second order cone constraints \f$\sqrt{\gamma + \sum_{i=1}^{n} (\alpha_i\, (x_i + \beta_i))^2} \leq \alpha_{n+1}\, (x_{n+1}+\beta_{n+1})\f$
19  * @author Stefan Vigerske
20  *
21  */
22 
23 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
24 
25 #ifndef __SCIP_CONS_SOC_H__
26 #define __SCIP_CONS_SOC_H__
27 
28 #include "scip/scip.h"
29 #include "nlpi/type_nlpi.h"
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
35 /** creates the handler for second order cone constraints and includes it in SCIP
36  *
37  * @ingroup ConshdlrIncludes
38  * */
39 extern
41  SCIP* scip /**< SCIP data structure */
42  );
43 
44 /**@addtogroup CONSHDLRS
45  *
46  * @{
47  *
48  * @name Second Order Cone Constraints
49  *
50  * @{
51  *
52  * This constraint handler implements second order cone constraints of the form
53  * \f[
54  * \sqrt{\gamma + \sum_{i=1}^{n} (\alpha_i\, (x_i + \beta_i))^2} \leq \alpha_{n+1}\, (x_{n+1}+\beta_{n+1})
55  * \f]
56  * Here, \f$\gamma \geq 0\f$ and either \f$x_{n+1} \geq -\beta_{n+1}, \alpha_{n+1} \geq 0\f$ or
57  * \f$x_{n+1} \leq -\beta_{n+1}, \alpha_{n+1} \leq 0\f$.
58  *
59  * Constraints are enforced by separation, where cuts are generated by linearizing the (convex) nonlinear function on the left-hand-side of the constraint.
60  * Further, a linear outer-approximation (which includes new variables) based on Ben-Tal & Nemirovski or Glineur can be added.
61  * See also
62  *
63  * @par
64  * Timo Berthold and Stefan Heinz and Stefan Vigerske@n
65  * <a href="http://dx.doi.org/10.1007/978-1-4614-1927-3">Extending a CIP framework to solve MIQCPs</a>@n
66  * In: Jon Lee and Sven Leyffer (eds.),
67  * Mixed-integer nonlinear optimization: Algorithmic advances and applications,
68  * IMA volumes in Mathematics and its Applications, volume 154, 427-444, 2012.
69  *
70  * @par
71  * Aharon Ben-Tal and Arkadi Nemirovski@n
72  * On Polyhedral Approximations of the Second-order Cone@n
73  * Mathematics of Operations Research 26:2, 193-205, 2001
74  *
75  * @par
76  * Fran&ccedil;ois Glineur@n
77  * Computational experiments with a linear approximation of second order cone optimization@n
78  * Technical Report 2000:1, Facult&eacute; Polytechnique de Mons, Belgium
79  */
80 
81 /** creates and captures a second order cone constraint
82  *
83  * @note the constraint gets captured, hence at one point you have to release it using the method SCIPreleaseCons()
84  */
85 extern
87  SCIP* scip, /**< SCIP data structure */
88  SCIP_CONS** cons, /**< pointer to hold the created constraint */
89  const char* name, /**< name of constraint */
90  int nvars, /**< number of variables on left hand side of constraint (n) */
91  SCIP_VAR** vars, /**< array with variables on left hand side (x_i) */
92  SCIP_Real* coefs, /**< array with coefficients of left hand side variables (alpha_i), or NULL if all 1.0 */
93  SCIP_Real* offsets, /**< array with offsets of variables (beta_i), or NULL if all 0.0 */
94  SCIP_Real constant, /**< constant on left hand side (gamma) */
95  SCIP_VAR* rhsvar, /**< variable on right hand side of constraint (x_{n+1}) */
96  SCIP_Real rhscoeff, /**< coefficient of variable on right hand side (alpha_{n+1}) */
97  SCIP_Real rhsoffset, /**< offset of variable on right hand side (beta_{n+1}) */
98  SCIP_Bool initial, /**< should the LP relaxation of constraint be in the initial LP?
99  * Usually set to TRUE. Set to FALSE for 'lazy constraints'. */
100  SCIP_Bool separate, /**< should the constraint be separated during LP processing?
101  * Usually set to TRUE. */
102  SCIP_Bool enforce, /**< should the constraint be enforced during node processing?
103  * TRUE for model constraints, FALSE for additional, redundant constraints. */
104  SCIP_Bool check, /**< should the constraint be checked for feasibility?
105  * TRUE for model constraints, FALSE for additional, redundant constraints. */
106  SCIP_Bool propagate, /**< should the constraint be propagated during node processing?
107  * Usually set to TRUE. */
108  SCIP_Bool local, /**< is constraint only valid locally?
109  * Usually set to FALSE. Has to be set to TRUE, e.g., for branching constraints. */
110  SCIP_Bool modifiable, /**< is constraint modifiable (subject to column generation)?
111  * Usually set to FALSE. In column generation applications, set to TRUE if pricing
112  * adds coefficients to this constraint. */
113  SCIP_Bool dynamic, /**< is constraint subject to aging?
114  * Usually set to FALSE. Set to TRUE for own cuts which
115  * are separated as constraints. */
116  SCIP_Bool removable /**< should the relaxation be removed from the LP due to aging or cleanup?
117  * Usually set to FALSE. Set to TRUE for 'lazy constraints' and 'user cuts'. */
118  );
119 
120 /** creates and captures a second order cone constraint
121  * in its most basic variant, i. e., with all constraint flags set to their default values, which can be set
122  * afterwards using SCIPsetConsFLAGNAME() in scip.h
123  *
124  * @see SCIPcreateConsSOC() for the default constraint flag configuration
125  *
126  * @note the constraint gets captured, hence at one point you have to release it using the method SCIPreleaseCons()
127  */
128 extern
130  SCIP* scip, /**< SCIP data structure */
131  SCIP_CONS** cons, /**< pointer to hold the created constraint */
132  const char* name, /**< name of constraint */
133  int nvars, /**< number of variables on left hand side of constraint (n) */
134  SCIP_VAR** vars, /**< array with variables on left hand side (x_i) */
135  SCIP_Real* coefs, /**< array with coefficients of left hand side variables (alpha_i), or NULL if all 1.0 */
136  SCIP_Real* offsets, /**< array with offsets of variables (beta_i), or NULL if all 0.0 */
137  SCIP_Real constant, /**< constant on left hand side (gamma) */
138  SCIP_VAR* rhsvar, /**< variable on right hand side of constraint (x_{n+1}) */
139  SCIP_Real rhscoeff, /**< coefficient of variable on right hand side (alpha_{n+1}) */
140  SCIP_Real rhsoffset /**< offset of variable on right hand side (beta_{n+1}) */
141  );
142 
143 /** Gets the SOC constraint as a nonlinear row representation.
144  */
145 extern
147  SCIP* scip, /**< SCIP data structure */
148  SCIP_CONS* cons, /**< constraint */
149  SCIP_NLROW** nlrow /**< pointer to store nonlinear row */
150  );
151 
152 /** Gets the number of variables on the left hand side of a SOC constraint.
153  */
154 extern
156  SCIP* scip, /**< SCIP data structure */
157  SCIP_CONS* cons /**< constraint data */
158  );
159 
160 /** Gets the variables on the left hand side of a SOC constraint.
161  */
162 extern
164  SCIP* scip, /**< SCIP data structure */
165  SCIP_CONS* cons /**< constraint data */
166  );
167 
168 /** Gets the coefficients of the variables on the left hand side of a SOC constraint, or NULL if all are equal to 1.0.
169  */
170 extern
172  SCIP* scip, /**< SCIP data structure */
173  SCIP_CONS* cons /**< constraint data */
174  );
175 
176 /** Gets the offsets of the variables on the left hand side of a SOC constraint, or NULL if all are equal to 0.0.
177  */
178 extern
180  SCIP* scip, /**< SCIP data structure */
181  SCIP_CONS* cons /**< constraint data */
182  );
183 
184 /** Gets the constant on the left hand side of a SOC constraint.
185  */
186 extern
188  SCIP* scip, /**< SCIP data structure */
189  SCIP_CONS* cons /**< constraint data */
190  );
191 
192 /** Gets the variable on the right hand side of a SOC constraint.
193  */
194 extern
196  SCIP* scip, /**< SCIP data structure */
197  SCIP_CONS* cons /**< constraint data */
198  );
199 
200 /** Gets the coefficient of the variable on the right hand side of a SOC constraint.
201  */
202 extern
204  SCIP* scip, /**< SCIP data structure */
205  SCIP_CONS* cons /**< constraint data */
206  );
207 
208 /** Gets the offset of the variables on the right hand side of a SOC constraint.
209  */
210 extern
212  SCIP* scip, /**< SCIP data structure */
213  SCIP_CONS* cons /**< constraint data */
214  );
215 
216 /** Adds the constraint to an NLPI problem.
217  * Uses nonconvex formulation as quadratic function.
218  */
219 extern
221  SCIP* scip, /**< SCIP data structure */
222  SCIP_CONS* cons, /**< SOC constraint */
223  SCIP_NLPI* nlpi, /**< interface to NLP solver */
224  SCIP_NLPIPROBLEM* nlpiprob, /**< NLPI problem where to add constraint */
225  SCIP_HASHMAP* scipvar2nlpivar, /**< mapping from SCIP variables to variable indices in NLPI */
226  SCIP_Bool names /**< whether to pass constraint names to NLPI */
227  );
228 
229 /* @} */
230 
231 /* @} */
232 
233 #ifdef __cplusplus
234 }
235 #endif
236 
237 #endif
SCIP_VAR ** SCIPgetLhsVarsSOC(SCIP *scip, SCIP_CONS *cons)
Definition: cons_soc.c:5398
SCIP_RETCODE SCIPcreateConsBasicSOC(SCIP *scip, SCIP_CONS **cons, const char *name, int nvars, SCIP_VAR **vars, SCIP_Real *coefs, SCIP_Real *offsets, SCIP_Real constant, SCIP_VAR *rhsvar, SCIP_Real rhscoeff, SCIP_Real rhsoffset)
Definition: cons_soc.c:5336
SCIP_RETCODE SCIPincludeConshdlrSOC(SCIP *scip)
Definition: cons_soc.c:5090
SCIP_Real * SCIPgetLhsOffsetsSOC(SCIP *scip, SCIP_CONS *cons)
Definition: cons_soc.c:5424
SCIP_RETCODE SCIPaddToNlpiProblemSOC(SCIP *scip, SCIP_CONS *cons, SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *nlpiprob, SCIP_HASHMAP *scipvar2nlpivar, SCIP_Bool names)
Definition: cons_soc.c:5490
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:53
SCIP_RETCODE SCIPgetNlRowSOC(SCIP *scip, SCIP_CONS *cons, SCIP_NLROW **nlrow)
Definition: cons_soc.c:5359
SCIP_Real SCIPgetRhsOffsetSOC(SCIP *scip, SCIP_CONS *cons)
Definition: cons_soc.c:5476
#define SCIP_Bool
Definition: def.h:61
int SCIPgetNLhsVarsSOC(SCIP *scip, SCIP_CONS *cons)
Definition: cons_soc.c:5385
SCIP_VAR * SCIPgetRhsVarSOC(SCIP *scip, SCIP_CONS *cons)
Definition: cons_soc.c:5450
SCIP_Real SCIPgetLhsConstantSOC(SCIP *scip, SCIP_CONS *cons)
Definition: cons_soc.c:5437
SCIP_Real SCIPgetRhsCoefSOC(SCIP *scip, SCIP_CONS *cons)
Definition: cons_soc.c:5463
#define SCIP_Real
Definition: def.h:145
SCIP_RETCODE SCIPcreateConsSOC(SCIP *scip, SCIP_CONS **cons, const char *name, int nvars, SCIP_VAR **vars, SCIP_Real *coefs, SCIP_Real *offsets, SCIP_Real constant, SCIP_VAR *rhsvar, SCIP_Real rhscoeff, SCIP_Real rhsoffset, SCIP_Bool initial, SCIP_Bool separate, SCIP_Bool enforce, SCIP_Bool check, SCIP_Bool propagate, SCIP_Bool local, SCIP_Bool modifiable, SCIP_Bool dynamic, SCIP_Bool removable)
Definition: cons_soc.c:5209
SCIP_Real * SCIPgetLhsCoefsSOC(SCIP *scip, SCIP_CONS *cons)
Definition: cons_soc.c:5411
SCIP callable library.
type definitions for specific NLP solver interfaces