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-2018 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 visit 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/def.h"
29 #include "scip/type_cons.h"
30 #include "scip/type_misc.h"
31 #include "scip/type_nlp.h"
32 #include "nlpi/type_nlpi.h"
33 #include "scip/type_retcode.h"
34 #include "scip/type_scip.h"
35 #include "scip/type_var.h"
36 
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40 
41 /** creates the handler for second order cone constraints and includes it in SCIP
42  *
43  * @ingroup ConshdlrIncludes
44  * */
45 extern
47  SCIP* scip /**< SCIP data structure */
48  );
49 
50 /**@addtogroup CONSHDLRS
51  *
52  * @{
53  *
54  * @name Second Order Cone Constraints
55  *
56  * @{
57  *
58  * This constraint handler implements second order cone constraints of the form
59  * \f[
60  * \sqrt{\gamma + \sum_{i=1}^{n} (\alpha_i\, (x_i + \beta_i))^2} \leq \alpha_{n+1}\, (x_{n+1}+\beta_{n+1})
61  * \f]
62  * Here, \f$\gamma \geq 0\f$ and either \f$x_{n+1} \geq -\beta_{n+1}, \alpha_{n+1} \geq 0\f$ or
63  * \f$x_{n+1} \leq -\beta_{n+1}, \alpha_{n+1} \leq 0\f$.
64  *
65  * Constraints are enforced by separation, where cuts are generated by linearizing the (convex) nonlinear function on the left-hand-side of the constraint.
66  * Further, a linear outer-approximation (which includes new variables) based on Ben-Tal & Nemirovski or Glineur can be added.
67  * See also
68  *
69  * @par
70  * Timo Berthold and Stefan Heinz and Stefan Vigerske@n
71  * <a href="http://dx.doi.org/10.1007/978-1-4614-1927-3">Extending a CIP framework to solve MIQCPs</a>@n
72  * In: Jon Lee and Sven Leyffer (eds.),
73  * Mixed-integer nonlinear optimization: Algorithmic advances and applications,
74  * IMA volumes in Mathematics and its Applications, volume 154, 427-444, 2012.
75  *
76  * @par
77  * Aharon Ben-Tal and Arkadi Nemirovski@n
78  * On Polyhedral Approximations of the Second-order Cone@n
79  * Mathematics of Operations Research 26:2, 193-205, 2001
80  *
81  * @par
82  * Fran&ccedil;ois Glineur@n
83  * Computational experiments with a linear approximation of second order cone optimization@n
84  * Technical Report 2000:1, Facult&eacute; Polytechnique de Mons, Belgium
85  */
86 
87 /** creates and captures a second order cone constraint
88  *
89  * @note the constraint gets captured, hence at one point you have to release it using the method SCIPreleaseCons()
90  */
91 extern
93  SCIP* scip, /**< SCIP data structure */
94  SCIP_CONS** cons, /**< pointer to hold the created constraint */
95  const char* name, /**< name of constraint */
96  int nvars, /**< number of variables on left hand side of constraint (n) */
97  SCIP_VAR** vars, /**< array with variables on left hand side (x_i) */
98  SCIP_Real* coefs, /**< array with coefficients of left hand side variables (alpha_i), or NULL if all 1.0 */
99  SCIP_Real* offsets, /**< array with offsets of variables (beta_i), or NULL if all 0.0 */
100  SCIP_Real constant, /**< constant on left hand side (gamma) */
101  SCIP_VAR* rhsvar, /**< variable on right hand side of constraint (x_{n+1}) */
102  SCIP_Real rhscoeff, /**< coefficient of variable on right hand side (alpha_{n+1}) */
103  SCIP_Real rhsoffset, /**< offset of variable on right hand side (beta_{n+1}) */
104  SCIP_Bool initial, /**< should the LP relaxation of constraint be in the initial LP?
105  * Usually set to TRUE. Set to FALSE for 'lazy constraints'. */
106  SCIP_Bool separate, /**< should the constraint be separated during LP processing?
107  * Usually set to TRUE. */
108  SCIP_Bool enforce, /**< should the constraint be enforced during node processing?
109  * TRUE for model constraints, FALSE for additional, redundant constraints. */
110  SCIP_Bool check, /**< should the constraint be checked for feasibility?
111  * TRUE for model constraints, FALSE for additional, redundant constraints. */
112  SCIP_Bool propagate, /**< should the constraint be propagated during node processing?
113  * Usually set to TRUE. */
114  SCIP_Bool local, /**< is constraint only valid locally?
115  * Usually set to FALSE. Has to be set to TRUE, e.g., for branching constraints. */
116  SCIP_Bool modifiable, /**< is constraint modifiable (subject to column generation)?
117  * Usually set to FALSE. In column generation applications, set to TRUE if pricing
118  * adds coefficients to this constraint. */
119  SCIP_Bool dynamic, /**< is constraint subject to aging?
120  * Usually set to FALSE. Set to TRUE for own cuts which
121  * are separated as constraints. */
122  SCIP_Bool removable /**< should the relaxation be removed from the LP due to aging or cleanup?
123  * Usually set to FALSE. Set to TRUE for 'lazy constraints' and 'user cuts'. */
124  );
125 
126 /** creates and captures a second order cone constraint
127  * in its most basic variant, i. e., with all constraint flags set to their default values, which can be set
128  * afterwards using SCIPsetConsFLAGNAME() in scip.h
129  *
130  * @see SCIPcreateConsSOC() for the default constraint flag configuration
131  *
132  * @note the constraint gets captured, hence at one point you have to release it using the method SCIPreleaseCons()
133  */
134 extern
136  SCIP* scip, /**< SCIP data structure */
137  SCIP_CONS** cons, /**< pointer to hold the created constraint */
138  const char* name, /**< name of constraint */
139  int nvars, /**< number of variables on left hand side of constraint (n) */
140  SCIP_VAR** vars, /**< array with variables on left hand side (x_i) */
141  SCIP_Real* coefs, /**< array with coefficients of left hand side variables (alpha_i), or NULL if all 1.0 */
142  SCIP_Real* offsets, /**< array with offsets of variables (beta_i), or NULL if all 0.0 */
143  SCIP_Real constant, /**< constant on left hand side (gamma) */
144  SCIP_VAR* rhsvar, /**< variable on right hand side of constraint (x_{n+1}) */
145  SCIP_Real rhscoeff, /**< coefficient of variable on right hand side (alpha_{n+1}) */
146  SCIP_Real rhsoffset /**< offset of variable on right hand side (beta_{n+1}) */
147  );
148 
149 /** Gets the SOC constraint as a nonlinear row representation.
150  */
151 extern
153  SCIP* scip, /**< SCIP data structure */
154  SCIP_CONS* cons, /**< constraint */
155  SCIP_NLROW** nlrow /**< pointer to store nonlinear row */
156  );
157 
158 /** Gets the number of variables on the left hand side of a SOC constraint.
159  */
160 extern
162  SCIP* scip, /**< SCIP data structure */
163  SCIP_CONS* cons /**< constraint data */
164  );
165 
166 /** Gets the variables on the left hand side of a SOC constraint.
167  */
168 extern
170  SCIP* scip, /**< SCIP data structure */
171  SCIP_CONS* cons /**< constraint data */
172  );
173 
174 /** Gets the coefficients of the variables on the left hand side of a SOC constraint, or NULL if all are equal to 1.0.
175  */
176 extern
178  SCIP* scip, /**< SCIP data structure */
179  SCIP_CONS* cons /**< constraint data */
180  );
181 
182 /** Gets the offsets of the variables on the left hand side of a SOC constraint, or NULL if all are equal to 0.0.
183  */
184 extern
186  SCIP* scip, /**< SCIP data structure */
187  SCIP_CONS* cons /**< constraint data */
188  );
189 
190 /** Gets the constant on the left hand side of a SOC constraint.
191  */
192 extern
194  SCIP* scip, /**< SCIP data structure */
195  SCIP_CONS* cons /**< constraint data */
196  );
197 
198 /** Gets the variable on the right hand side of a SOC constraint.
199  */
200 extern
202  SCIP* scip, /**< SCIP data structure */
203  SCIP_CONS* cons /**< constraint data */
204  );
205 
206 /** Gets the coefficient of the variable on the right hand side of a SOC constraint.
207  */
208 extern
210  SCIP* scip, /**< SCIP data structure */
211  SCIP_CONS* cons /**< constraint data */
212  );
213 
214 /** Gets the offset of the variables on the right hand side of a SOC constraint.
215  */
216 extern
218  SCIP* scip, /**< SCIP data structure */
219  SCIP_CONS* cons /**< constraint data */
220  );
221 
222 /** Adds the constraint to an NLPI problem.
223  * Uses nonconvex formulation as quadratic function.
224  */
225 extern
227  SCIP* scip, /**< SCIP data structure */
228  SCIP_CONS* cons, /**< SOC constraint */
229  SCIP_NLPI* nlpi, /**< interface to NLP solver */
230  SCIP_NLPIPROBLEM* nlpiprob, /**< NLPI problem where to add constraint */
231  SCIP_HASHMAP* scipvar2nlpivar, /**< mapping from SCIP variables to variable indices in NLPI */
232  SCIP_Bool names /**< whether to pass constraint names to NLPI */
233  );
234 
235 /* @} */
236 
237 /* @} */
238 
239 #ifdef __cplusplus
240 }
241 #endif
242 
243 #endif
SCIP_VAR ** SCIPgetLhsVarsSOC(SCIP *scip, SCIP_CONS *cons)
Definition: cons_soc.c:5379
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:5320
type definitions for miscellaneous datastructures
type definitions for NLP management
SCIP_RETCODE SCIPincludeConshdlrSOC(SCIP *scip)
Definition: cons_soc.c:5080
SCIP_Real * SCIPgetLhsOffsetsSOC(SCIP *scip, SCIP_CONS *cons)
Definition: cons_soc.c:5403
SCIP_RETCODE SCIPaddToNlpiProblemSOC(SCIP *scip, SCIP_CONS *cons, SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *nlpiprob, SCIP_HASHMAP *scipvar2nlpivar, SCIP_Bool names)
Definition: cons_soc.c:5465
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:53
type definitions for return codes for SCIP methods
SCIP_RETCODE SCIPgetNlRowSOC(SCIP *scip, SCIP_CONS *cons, SCIP_NLROW **nlrow)
Definition: cons_soc.c:5342
type definitions for SCIP&#39;s main datastructure
type definitions for problem variables
SCIP_Real SCIPgetRhsOffsetSOC(SCIP *scip, SCIP_CONS *cons)
Definition: cons_soc.c:5451
#define SCIP_Bool
Definition: def.h:62
int SCIPgetNLhsVarsSOC(SCIP *scip, SCIP_CONS *cons)
Definition: cons_soc.c:5367
SCIP_VAR * SCIPgetRhsVarSOC(SCIP *scip, SCIP_CONS *cons)
Definition: cons_soc.c:5427
SCIP_Real SCIPgetLhsConstantSOC(SCIP *scip, SCIP_CONS *cons)
Definition: cons_soc.c:5415
SCIP_Real SCIPgetRhsCoefSOC(SCIP *scip, SCIP_CONS *cons)
Definition: cons_soc.c:5439
#define SCIP_Real
Definition: def.h:150
common defines and data types used in all packages of SCIP
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:5191
SCIP_Real * SCIPgetLhsCoefsSOC(SCIP *scip, SCIP_CONS *cons)
Definition: cons_soc.c:5391
type definitions for constraints and constraint handlers
type definitions for specific NLP solver interfaces