Scippy

SCIP

Solving Constraint Integer Programs

cons_quadratic.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-2022 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 scipopt.org. */
13 /* */
14 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
15 
16 /**@file cons_quadratic.h
17  * @ingroup CONSHDLRS
18  * @brief some API functions of removed constraint handler for quadratic constraints \f$\textrm{lhs} \leq \sum_{i,j} a_{i,j} x_ix_j + \sum_i b_i x_i \leq \textrm{rhs}\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_QUADRATIC_H__
26 #define __SCIP_CONS_QUADRATIC_H__
27 
28 #include "scip/def.h"
29 #include "scip/type_cons.h"
30 #include "scip/type_retcode.h"
31 #include "scip/type_scip.h"
32 #include "scip/type_var.h"
33 #include "scip/type_nlp.h"
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
39 /**@addtogroup CONSHDLRS
40  *
41  * @{
42  *
43  * @name Quadratic Constraints (deprecated)
44  *
45  * @{
46  */
47 
48 /** Creates and captures a quadratic nonlinear constraint.
49  *
50  * The constraint should be given in the form
51  * \f[
52  * \ell \leq \sum_{i=1}^n b_i x_i + \sum_{j=1}^m a_j y_j z_j \leq u,
53  * \f]
54  * where \f$x_i = y_j = z_k\f$ is possible.
55  *
56  * @note the constraint gets captured, hence at one point you have to release it using the method SCIPreleaseCons()
57  *
58  * @deprecated Use SCIPcreateConsQuadraticNonlinear() instead.
59  */
60 SCIP_EXPORT
62  SCIP* scip, /**< SCIP data structure */
63  SCIP_CONS** cons, /**< pointer to hold the created constraint */
64  const char* name, /**< name of constraint */
65  int nlinvars, /**< number of linear terms (n) */
66  SCIP_VAR** linvars, /**< variables in linear part (x_i) or NULL if nlinvars == 0 */
67  SCIP_Real* lincoefs, /**< coefficients of variables in linear part (b_i) or NULL if nlinvars == 0 */
68  int nquadterms, /**< number of quadratic terms (m) */
69  SCIP_VAR** quadvars1, /**< array with first variables in quadratic terms (y_j) or NULL if nquadterms == 0 */
70  SCIP_VAR** quadvars2, /**< array with second variables in quadratic terms (z_j) or NULL if nquadterms == 0 */
71  SCIP_Real* quadcoeffs, /**< array with coefficients of quadratic terms (a_j) or NULL if nquadterms == 0 */
72  SCIP_Real lhs, /**< left hand side of quadratic equation (l) */
73  SCIP_Real rhs, /**< right hand side of quadratic equation (u) */
74  SCIP_Bool initial, /**< should the LP relaxation of constraint be in the initial LP?
75  * Usually set to TRUE. Set to FALSE for 'lazy constraints'. */
76  SCIP_Bool separate, /**< should the constraint be separated during LP processing?
77  * Usually set to TRUE. */
78  SCIP_Bool enforce, /**< should the constraint be enforced during node processing?
79  * TRUE for model constraints, FALSE for additional, redundant constraints. */
80  SCIP_Bool check, /**< should the constraint be checked for feasibility?
81  * TRUE for model constraints, FALSE for additional, redundant constraints. */
82  SCIP_Bool propagate, /**< should the constraint be propagated during node processing?
83  * Usually set to TRUE. */
84  SCIP_Bool local, /**< is constraint only valid locally?
85  * Usually set to FALSE. Has to be set to TRUE, e.g., for branching constraints. */
86  SCIP_Bool modifiable, /**< is constraint modifiable (subject to column generation)?
87  * Usually set to FALSE. In column generation applications, set to TRUE if pricing
88  * adds coefficients to this constraint. */
89  SCIP_Bool dynamic, /**< is constraint subject to aging?
90  * Usually set to FALSE. Set to TRUE for own cuts which
91  * are separated as constraints. */
92  SCIP_Bool removable /**< should the relaxation be removed from the LP due to aging or cleanup?
93  * Usually set to FALSE. Set to TRUE for 'lazy constraints' and 'user cuts'. */
94  );
95 
96 /** creates and captures a quadratic nonlinear constraint
97  * in its most basic variant, i.e., with all constraint flags set to their default values, which can be set
98  * afterwards using SCIPsetConsFLAGNAME()
99  *
100  * The constraint should be given in the form
101  * \f[
102  * \ell \leq \sum_{i=1}^n b_i x_i + \sum_{j=1}^m a_j y_jz_j \leq u,
103  * \f]
104  * where \f$x_i = y_j = z_k\f$ is possible.
105  *
106  * @see SCIPcreateConsQuadratic() for the default constraint flag configuration
107  *
108  * @note the constraint gets captured, hence at one point you have to release it using the method SCIPreleaseCons()
109  *
110  * @deprecated Use SCIPcreateConsBasicQuadraticNonlinear instead.
111  */
112 SCIP_EXPORT
114  SCIP* scip, /**< SCIP data structure */
115  SCIP_CONS** cons, /**< pointer to hold the created constraint */
116  const char* name, /**< name of constraint */
117  int nlinvars, /**< number of linear terms (n) */
118  SCIP_VAR** linvars, /**< array with variables in linear part (x_i) */
119  SCIP_Real* lincoefs, /**< array with coefficients of variables in linear part (b_i) */
120  int nquadterms, /**< number of quadratic terms (m) */
121  SCIP_VAR** quadvars1, /**< array with first variables in quadratic terms (y_j) */
122  SCIP_VAR** quadvars2, /**< array with second variables in quadratic terms (z_j) */
123  SCIP_Real* quadcoefs, /**< array with coefficients of quadratic terms (a_j) */
124  SCIP_Real lhs, /**< left hand side of quadratic equation (ell) */
125  SCIP_Real rhs /**< right hand side of quadratic equation (u) */
126  );
127 
128 /** Adds a constant to the constraint function, that is, subtracts a constant from both sides
129  *
130  * @deprecated Use SCIPchgLhsNonlinear() and SCIPchgRhsNonlinear() instead.
131  */
132 SCIP_EXPORT
134  SCIP* scip, /**< SCIP data structure */
135  SCIP_CONS* cons, /**< constraint */
136  SCIP_Real constant /**< constant to subtract from both sides */
137  );
138 
139 /** Adds a linear variable with coefficient to a quadratic constraint.
140  *
141  * @deprecated Use SCIPaddLinearVarNonlinear() instead.
142  */
143 SCIP_EXPORT
145  SCIP* scip, /**< SCIP data structure */
146  SCIP_CONS* cons, /**< constraint */
147  SCIP_VAR* var, /**< variable */
148  SCIP_Real coef /**< coefficient of variable */
149  );
150 
151 /** Adds a quadratic variable with linear and square coefficient to a quadratic constraint.
152  *
153  * @deprecated Use SCIPaddLinearVarNonlinear() and SCIPaddExprNonlinear() instead.
154  */
155 SCIP_EXPORT
157  SCIP* scip, /**< SCIP data structure */
158  SCIP_CONS* cons, /**< constraint */
159  SCIP_VAR* var, /**< variable */
160  SCIP_Real lincoef, /**< linear coefficient of variable */
161  SCIP_Real sqrcoef /**< square coefficient of variable */
162  );
163 
164 /** Adds a linear coefficient for a quadratic variable.
165  *
166  * Variable will be added with square coefficient 0.0 if not existing yet.
167  *
168  * @deprecated Use SCIPaddLinearVarNonlinear() instead.
169  */
170 SCIP_EXPORT
172  SCIP* scip, /**< SCIP data structure */
173  SCIP_CONS* cons, /**< constraint */
174  SCIP_VAR* var, /**< variable */
175  SCIP_Real coef /**< value to add to linear coefficient of variable */
176  );
177 
178 /** Adds a square coefficient for a quadratic variable.
179  *
180  * Variable will be added with linear coefficient 0.0 if not existing yet.
181  *
182  * @deprecated Use SCIPaddExprNonlinear() instead.
183  */
184 SCIP_EXPORT
186  SCIP* scip, /**< SCIP data structure */
187  SCIP_CONS* cons, /**< constraint */
188  SCIP_VAR* var, /**< variable */
189  SCIP_Real coef /**< value to add to square coefficient of variable */
190  );
191 
192 /** Adds a bilinear term to a quadratic constraint.
193  *
194  * Variables will be added with linear and square coefficient 0.0 if not existing yet.
195  * If variables are equal, only the square coefficient of the variable is updated.
196  *
197  * @deprecated Use SCIPaddExprNonlinear() instead.
198  */
199 SCIP_EXPORT
201  SCIP* scip, /**< SCIP data structure */
202  SCIP_CONS* cons, /**< constraint */
203  SCIP_VAR* var1, /**< first variable */
204  SCIP_VAR* var2, /**< second variable */
205  SCIP_Real coef /**< coefficient of bilinear term */
206  );
207 
208 /** Gets the quadratic constraint as a nonlinear row representation.
209  *
210  * @deprecated Use SCIPgetNlRowNonlinear() instead.
211  */
212 SCIP_EXPORT
214  SCIP* scip, /**< SCIP data structure */
215  SCIP_CONS* cons, /**< constraint */
216  SCIP_NLROW** nlrow /**< pointer to store nonlinear row */
217  );
218 
219 /** sets the left hand side of a quadratic constraint
220  *
221  * @note This method may only be called during problem creation stage for an original constraint.
222  *
223  * @deprecated Use SCIPchgLhsNonlinear() instead.
224  */
225 SCIP_EXPORT
227  SCIP* scip, /**< SCIP data structure */
228  SCIP_CONS* cons, /**< constraint data */
229  SCIP_Real lhs /**< new left hand side */
230  );
231 
232 /** sets the right hand side of a quadratic constraint
233  *
234  * @note This method may only be called during problem creation stage for an original constraint.
235  *
236  * @deprecated Use SCIPchgRhsNonlinear() instead.
237  */
238 SCIP_EXPORT
240  SCIP* scip, /**< SCIP data structure */
241  SCIP_CONS* cons, /**< constraint data */
242  SCIP_Real rhs /**< new right hand side */
243  );
244 
245 /** @} */
246 /** @} */
247 
248 #ifdef __cplusplus
249 }
250 #endif
251 
252 #endif
SCIP_RETCODE SCIPaddQuadVarQuadratic(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var, SCIP_Real lincoef, SCIP_Real sqrcoef)
void SCIPaddConstantQuadratic(SCIP *scip, SCIP_CONS *cons, SCIP_Real constant)
type definitions for NLP management
SCIP_RETCODE SCIPaddSquareCoefQuadratic(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var, SCIP_Real coef)
SCIP_RETCODE SCIPchgRhsQuadratic(SCIP *scip, SCIP_CONS *cons, SCIP_Real rhs)
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:54
type definitions for return codes for SCIP methods
SCIP_RETCODE SCIPcreateConsBasicQuadratic(SCIP *scip, SCIP_CONS **cons, const char *name, int nlinvars, SCIP_VAR **linvars, SCIP_Real *lincoefs, int nquadterms, SCIP_VAR **quadvars1, SCIP_VAR **quadvars2, SCIP_Real *quadcoefs, SCIP_Real lhs, SCIP_Real rhs)
SCIP_RETCODE SCIPaddLinearVarQuadratic(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var, SCIP_Real coef)
SCIP_RETCODE SCIPcreateConsQuadratic(SCIP *scip, SCIP_CONS **cons, const char *name, int nlinvars, SCIP_VAR **linvars, SCIP_Real *lincoefs, int nquadterms, SCIP_VAR **quadvars1, SCIP_VAR **quadvars2, SCIP_Real *quadcoeffs, SCIP_Real lhs, SCIP_Real rhs, 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)
SCIP_RETCODE SCIPchgLhsQuadratic(SCIP *scip, SCIP_CONS *cons, SCIP_Real lhs)
type definitions for SCIP&#39;s main datastructure
SCIP_RETCODE SCIPgetNlRowQuadratic(SCIP *scip, SCIP_CONS *cons, SCIP_NLROW **nlrow)
type definitions for problem variables
SCIP_RETCODE SCIPaddBilinTermQuadratic(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var1, SCIP_VAR *var2, SCIP_Real coef)
#define SCIP_Bool
Definition: def.h:84
#define SCIP_Real
Definition: def.h:177
SCIP_RETCODE SCIPaddQuadVarLinearCoefQuadratic(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var, SCIP_Real coef)
common defines and data types used in all packages of SCIP
type definitions for constraints and constraint handlers