1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
/* This file is part of the program and library */
/* SCIP --- Solving Constraint Integer Programs */
/* */
/* Copyright 2002-2022 Zuse Institute Berlin */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); */
/* you may not use this file except in compliance with the License. */
/* You may obtain a copy of the License at */
/* */
/* http://www.apache.org/licenses/LICENSE-2.0 */
/* */
/* Unless required by applicable law or agreed to in writing, software */
/* distributed under the License is distributed on an "AS IS" BASIS, */
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
/* See the License for the specific language governing permissions and */
/* limitations under the License. */
/* */
/* You should have received a copy of the Apache-2.0 license */
/* along with SCIP; see the file LICENSE. If not visit scipopt.org. */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/**@file cons_quadratic.h
* @ingroup CONSHDLRS
* @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$
* @author Stefan Vigerske
*
*/
/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
#ifndef __SCIP_CONS_QUADRATIC_H__
#define __SCIP_CONS_QUADRATIC_H__
#include "scip/def.h"
#include "scip/type_cons.h"
#include "scip/type_retcode.h"
#include "scip/type_scip.h"
#include "scip/type_var.h"
#include "scip/type_nlp.h"
#ifdef __cplusplus
extern "C" {
#endif
/**@addtogroup CONSHDLRS
*
* @{
*
* @name Quadratic Constraints (deprecated)
*
* @{
*/
/** Creates and captures a quadratic nonlinear constraint.
*
* The constraint should be given in the form
* \f[
* \ell \leq \sum_{i=1}^n b_i x_i + \sum_{j=1}^m a_j y_j z_j \leq u,
* \f]
* where \f$x_i = y_j = z_k\f$ is possible.
*
* @note the constraint gets captured, hence at one point you have to release it using the method SCIPreleaseCons()
*
* @deprecated Use SCIPcreateConsQuadraticNonlinear() instead.
*/
SCIP_EXPORT
SCIP_DEPRECATED
SCIP_RETCODE SCIPcreateConsQuadratic(
SCIP* scip, /**< SCIP data structure */
SCIP_CONS** cons, /**< pointer to hold the created constraint */
const char* name, /**< name of constraint */
int nlinvars, /**< number of linear terms (n) */
SCIP_VAR** linvars, /**< variables in linear part (x_i) or NULL if nlinvars == 0 */
SCIP_Real* lincoefs, /**< coefficients of variables in linear part (b_i) or NULL if nlinvars == 0 */
int nquadterms, /**< number of quadratic terms (m) */
SCIP_VAR** quadvars1, /**< array with first variables in quadratic terms (y_j) or NULL if nquadterms == 0 */
SCIP_VAR** quadvars2, /**< array with second variables in quadratic terms (z_j) or NULL if nquadterms == 0 */
SCIP_Real* quadcoeffs, /**< array with coefficients of quadratic terms (a_j) or NULL if nquadterms == 0 */
SCIP_Real lhs, /**< left hand side of quadratic equation (l) */
SCIP_Real rhs, /**< right hand side of quadratic equation (u) */
SCIP_Bool initial, /**< should the LP relaxation of constraint be in the initial LP?
* Usually set to TRUE. Set to FALSE for 'lazy constraints'. */
SCIP_Bool separate, /**< should the constraint be separated during LP processing?
* Usually set to TRUE. */
SCIP_Bool enforce, /**< should the constraint be enforced during node processing?
* TRUE for model constraints, FALSE for additional, redundant constraints. */
SCIP_Bool check, /**< should the constraint be checked for feasibility?
* TRUE for model constraints, FALSE for additional, redundant constraints. */
SCIP_Bool propagate, /**< should the constraint be propagated during node processing?
* Usually set to TRUE. */
SCIP_Bool local, /**< is constraint only valid locally?
* Usually set to FALSE. Has to be set to TRUE, e.g., for branching constraints. */
SCIP_Bool modifiable, /**< is constraint modifiable (subject to column generation)?
* Usually set to FALSE. In column generation applications, set to TRUE if pricing
* adds coefficients to this constraint. */
SCIP_Bool dynamic, /**< is constraint subject to aging?
* Usually set to FALSE. Set to TRUE for own cuts which
* are separated as constraints. */
SCIP_Bool removable /**< should the relaxation be removed from the LP due to aging or cleanup?
* Usually set to FALSE. Set to TRUE for 'lazy constraints' and 'user cuts'. */
);
/** creates and captures a quadratic nonlinear constraint
* in its most basic variant, i.e., with all constraint flags set to their default values, which can be set
* afterwards using SCIPsetConsFLAGNAME()
*
* The constraint should be given in the form
* \f[
* \ell \leq \sum_{i=1}^n b_i x_i + \sum_{j=1}^m a_j y_jz_j \leq u,
* \f]
* where \f$x_i = y_j = z_k\f$ is possible.
*
* @see SCIPcreateConsQuadratic() for the default constraint flag configuration
*
* @note the constraint gets captured, hence at one point you have to release it using the method SCIPreleaseCons()
*
* @deprecated Use SCIPcreateConsBasicQuadraticNonlinear instead.
*/
SCIP_EXPORT
SCIP_DEPRECATED
SCIP_RETCODE SCIPcreateConsBasicQuadratic(
SCIP* scip, /**< SCIP data structure */
SCIP_CONS** cons, /**< pointer to hold the created constraint */
const char* name, /**< name of constraint */
int nlinvars, /**< number of linear terms (n) */
SCIP_VAR** linvars, /**< array with variables in linear part (x_i) */
SCIP_Real* lincoefs, /**< array with coefficients of variables in linear part (b_i) */
int nquadterms, /**< number of quadratic terms (m) */
SCIP_VAR** quadvars1, /**< array with first variables in quadratic terms (y_j) */
SCIP_VAR** quadvars2, /**< array with second variables in quadratic terms (z_j) */
SCIP_Real* quadcoefs, /**< array with coefficients of quadratic terms (a_j) */
SCIP_Real lhs, /**< left hand side of quadratic equation (ell) */
SCIP_Real rhs /**< right hand side of quadratic equation (u) */
);
/** Adds a constant to the constraint function, that is, subtracts a constant from both sides
*
* @deprecated Use SCIPchgLhsNonlinear() and SCIPchgRhsNonlinear() instead.
*/
SCIP_EXPORT
SCIP_DEPRECATED
void SCIPaddConstantQuadratic(
SCIP* scip, /**< SCIP data structure */
SCIP_CONS* cons, /**< constraint */
SCIP_Real constant /**< constant to subtract from both sides */
);
/** Adds a linear variable with coefficient to a quadratic constraint.
*
* @deprecated Use SCIPaddLinearVarNonlinear() instead.
*/
SCIP_EXPORT
SCIP_DEPRECATED
SCIP_RETCODE SCIPaddLinearVarQuadratic(
SCIP* scip, /**< SCIP data structure */
SCIP_CONS* cons, /**< constraint */
SCIP_VAR* var, /**< variable */
SCIP_Real coef /**< coefficient of variable */
);
/** Adds a quadratic variable with linear and square coefficient to a quadratic constraint.
*
* @deprecated Use SCIPaddLinearVarNonlinear() and SCIPaddExprNonlinear() instead.
*/
SCIP_EXPORT
SCIP_DEPRECATED
SCIP_RETCODE SCIPaddQuadVarQuadratic(
SCIP* scip, /**< SCIP data structure */
SCIP_CONS* cons, /**< constraint */
SCIP_VAR* var, /**< variable */
SCIP_Real lincoef, /**< linear coefficient of variable */
SCIP_Real sqrcoef /**< square coefficient of variable */
);
/** Adds a linear coefficient for a quadratic variable.
*
* Variable will be added with square coefficient 0.0 if not existing yet.
*
* @deprecated Use SCIPaddLinearVarNonlinear() instead.
*/
SCIP_EXPORT
SCIP_DEPRECATED
SCIP_RETCODE SCIPaddQuadVarLinearCoefQuadratic(
SCIP* scip, /**< SCIP data structure */
SCIP_CONS* cons, /**< constraint */
SCIP_VAR* var, /**< variable */
SCIP_Real coef /**< value to add to linear coefficient of variable */
);
/** Adds a square coefficient for a quadratic variable.
*
* Variable will be added with linear coefficient 0.0 if not existing yet.
*
* @deprecated Use SCIPaddExprNonlinear() instead.
*/
SCIP_EXPORT
SCIP_DEPRECATED
SCIP_RETCODE SCIPaddSquareCoefQuadratic(
SCIP* scip, /**< SCIP data structure */
SCIP_CONS* cons, /**< constraint */
SCIP_VAR* var, /**< variable */
SCIP_Real coef /**< value to add to square coefficient of variable */
);
/** Adds a bilinear term to a quadratic constraint.
*
* Variables will be added with linear and square coefficient 0.0 if not existing yet.
* If variables are equal, only the square coefficient of the variable is updated.
*
* @deprecated Use SCIPaddExprNonlinear() instead.
*/
SCIP_EXPORT
SCIP_DEPRECATED
SCIP_RETCODE SCIPaddBilinTermQuadratic(
SCIP* scip, /**< SCIP data structure */
SCIP_CONS* cons, /**< constraint */
SCIP_VAR* var1, /**< first variable */
SCIP_VAR* var2, /**< second variable */
SCIP_Real coef /**< coefficient of bilinear term */
);
/** Gets the quadratic constraint as a nonlinear row representation.
*
* @deprecated Use SCIPgetNlRowNonlinear() instead.
*/
SCIP_EXPORT
SCIP_DEPRECATED
SCIP_RETCODE SCIPgetNlRowQuadratic(
SCIP* scip, /**< SCIP data structure */
SCIP_CONS* cons, /**< constraint */
SCIP_NLROW** nlrow /**< pointer to store nonlinear row */
);
/** sets the left hand side of a quadratic constraint
*
* @note This method may only be called during problem creation stage for an original constraint.
*
* @deprecated Use SCIPchgLhsNonlinear() instead.
*/
SCIP_EXPORT
SCIP_DEPRECATED
SCIP_RETCODE SCIPchgLhsQuadratic(
SCIP* scip, /**< SCIP data structure */
SCIP_CONS* cons, /**< constraint data */
SCIP_Real lhs /**< new left hand side */
);
/** sets the right hand side of a quadratic constraint
*
* @note This method may only be called during problem creation stage for an original constraint.
*
* @deprecated Use SCIPchgRhsNonlinear() instead.
*/
SCIP_EXPORT
SCIP_DEPRECATED
SCIP_RETCODE SCIPchgRhsQuadratic(
SCIP* scip, /**< SCIP data structure */
SCIP_CONS* cons, /**< constraint data */
SCIP_Real rhs /**< new right hand side */
);
/** @} */
/** @} */
#ifdef __cplusplus
}
#endif
#endif