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-2016 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_quadratic.h
17  * @ingroup CONSHDLRS
18  * @brief constraint handler for quadratic constraints \f$\textrm{lhs} \leq \sum_{i,j=1}^n a_{i,j} x_ix_j + \sum_{i=1}^n b_i x_i \leq \textrm{rhs}\f$
19  * @author Stefan Vigerske
20  *
21  * This constraint handler handles constraints of the form
22  * \f[
23  * \textrm{lhs} \leq \sum_{i,j=1}^n a_{i,j} x_ix_j + \sum_{i=1}^n b_i x_i \leq \textrm{rhs}
24  * \f]
25  *
26  * Constraints are enforced by separation, domain propagation, and spatial branching.
27  *
28  * For semidefinite matrices \f$A=(a_{i,j})_{i,j}\f$, cuts based on linearization of \f$\langle x, Ax\rangle\f$ are implemented.
29  * For underestimating a non-convex term, McCormick underestimators and secants for univariate concave quadratic terms are implemented.
30  * If \f$\langle x, Ax\rangle\f$ is factorable (i.e., can be written as product of two linear functions),
31  * specialized separation techniques (e.g., lifted tangent inequalities) that take the constraint sides into account are applied.
32  *
33  * Branching is performed for variables in nonconvex terms, if the relaxation solution cannot be separated.
34  * Further, domain propagation is applied.
35  *
36  * During presolve, variable products which contain binary variables may be reformulated into linear constraints, thereby introducing new variables.
37  *
38  * See also
39  * @par
40  * Timo Berthold and Stefan Heinz and Stefan Vigerske@n
41  * <a href="http://dx.doi.org/10.1007/978-1-4614-1927-3">Extending a CIP framework to solve MIQCPs</a>@n
42  * In: Jon Lee and Sven Leyffer (eds.),
43  * Mixed-integer nonlinear optimization: Algorithmic advances and applications,
44  * IMA volumes in Mathematics and its Applications, volume 154, 427-444, 2012.
45  *
46  * @par
47  * Stefan Vigerske@n
48  * Decomposition of Multistage Stochastic Programs and a Constraint Integer Programming Approach to Mixed-Integer Nonlinear Programming@n
49  * PhD Thesis, Humboldt-University Berlin, 2012, submitted.
50  *
51  * @par
52  * Pietro Belotti and Andrew J. Miller and Mahdi Namazifar@n
53  * Linear inequalities for bounded products of variables@n
54  * SIAG/OPT Views-and-News 22:1, 1-8, 2011.
55  */
56 
57 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
58 
59 #ifndef __SCIP_CONS_QUADRATIC_H__
60 #define __SCIP_CONS_QUADRATIC_H__
61 
62 #include "scip/scip.h"
63 #include "scip/intervalarith.h"
64 #include "nlpi/type_nlpi.h"
65 
66 #ifdef __cplusplus
67 extern "C" {
68 #endif
69 
70 /** event data for variable bound changes in quadratic constraints */
71 typedef struct SCIP_QuadVarEventData SCIP_QUADVAREVENTDATA;
72 
73 /** data structure to store a single term associated to a quadratic variable
74  */
75 struct SCIP_QuadVarTerm
76 {
77  SCIP_VAR* var; /**< quadratic variable */
78  SCIP_Real lincoef; /**< linear coefficient of variable */
79  SCIP_Real sqrcoef; /**< square coefficient of variable */
80 
81  int nadjbilin; /**< number of bilinear terms this variable is involved in */
82  int adjbilinsize; /**< size of adjacent bilinear terms array */
83  int* adjbilin; /**< indices of associated bilinear terms */
84 
85  SCIP_QUADVAREVENTDATA* eventdata; /**< event data for bound change events */
86 };
87 typedef struct SCIP_QuadVarTerm SCIP_QUADVARTERM;
88 
89 /** data structure to store a single bilinear term (similar to SCIP_QUADELEM)
90  * except for temporary reasons, we assume that the index of var1 is smaller than the index of var2
91  */
92 struct SCIP_BilinTerm
93 {
94  SCIP_VAR* var1;
95  SCIP_VAR* var2;
96  SCIP_Real coef;
97 };
98 typedef struct SCIP_BilinTerm SCIP_BILINTERM;
99 
100 
101 /** upgrading method for quadratic constraints into more specific constraints
102  *
103  * the method might upgrade a quadratic constraint into a set of quadratic constraints
104  * the caller provided an array upgdconss to store upgrade constraints
105  * the length of upgdconss is given by upgdconsssize
106  * if an upgrade is not possible, set *nupgdconss to zero
107  * if more than upgdconsssize many constraints shall replace cons, the function
108  * should return the required number as negated value in *nupgdconss
109  * i.e., if cons should be replaced by 3 constraints, the function should set
110  * *nupgdconss to -3 and return with SCIP_OKAY
111  *
112  * input:
113  * - scip : SCIP main data structure
114  * - cons : the quadratic constraint to upgrade
115  * - nbinlin : number of binary variables in linear part
116  * - nbinquad : number of binary variables in quadratic part
117  * - nintlin : number of integer variables in linear part
118  * - nintquad : number of integer variables in quadratic part
119  * - nimpllin : number of implicit integer variables in linear part
120  * - nimplquad : number of implicit integer variables in quadratic part
121  * - ncontlin : number of continuous variables in linear part
122  * - ncontquad : number of continuous variables in quadratic part
123  * - integral : TRUE iff constraints activity value is always integral
124  * - nupgdconss : pointer to store number of constraints that replace this constraint
125  * - upgdconss : array to store constraints that replace this constraint
126  * - upgdconsssize : length of the provided upgdconss array
127  * - presoltiming : current presolve timing
128  */
129 #define SCIP_DECL_QUADCONSUPGD(x) SCIP_RETCODE x (SCIP* scip, SCIP_CONS* cons, \
130  int nbinlin, int nbinquad, int nintlin, int nintquad, int nimpllin, int nimplquad, int ncontlin, int ncontquad, \
131  SCIP_Bool integral, int* nupgdconss, SCIP_CONS** upgdconss, int upgdconsssize, SCIP_PRESOLTIMING presoltiming)
132 
133 /** creates the handler for quadratic constraints and includes it in SCIP */
134 extern
136  SCIP* scip /**< SCIP data structure */
137  );
138 
139 /** includes a quadratic constraint upgrade method into the quadratic constraint handler */
140 extern
142  SCIP* scip, /**< SCIP data structure */
143  SCIP_DECL_QUADCONSUPGD((*quadconsupgd)), /**< method to call for upgrading quadratic constraint */
144  int priority, /**< priority of upgrading method */
145  SCIP_Bool active, /**< should the upgrading method be active by default? */
146  const char* conshdlrname /**< name of the constraint handler */
147  );
148 
149 /** Creates and captures a quadratic constraint.
150  *
151  * The constraint should be given in the form
152  * \f[
153  * \ell \leq \sum_{i=1}^n b_i x_i + \sum_{j=1}^m a_j y_j z_j \leq u,
154  * \f]
155  * where \f$x_i = y_j = z_k\f$ is possible.
156  *
157  * @note the constraint gets captured, hence at one point you have to release it using the method SCIPreleaseCons()
158  */
159 extern
161  SCIP* scip, /**< SCIP data structure */
162  SCIP_CONS** cons, /**< pointer to hold the created constraint */
163  const char* name, /**< name of constraint */
164  int nlinvars, /**< number of linear terms (n) */
165  SCIP_VAR** linvars, /**< variables in linear part (x_i) or NULL if nlinvars == 0 */
166  SCIP_Real* lincoefs, /**< coefficients of variables in linear part (b_i) or NULL if nlinvars == 0 */
167  int nquadterms, /**< number of quadratic terms (m) */
168  SCIP_VAR** quadvars1, /**< array with first variables in quadratic terms (y_j) or NULL if nquadterms == 0 */
169  SCIP_VAR** quadvars2, /**< array with second variables in quadratic terms (z_j) or NULL if nquadterms == 0 */
170  SCIP_Real* quadcoeffs, /**< array with coefficients of quadratic terms (a_j) or NULL if nquadterms == 0 */
171  SCIP_Real lhs, /**< left hand side of quadratic equation (l) */
172  SCIP_Real rhs, /**< right hand side of quadratic equation (u) */
173  SCIP_Bool initial, /**< should the LP relaxation of constraint be in the initial LP?
174  * Usually set to TRUE. Set to FALSE for 'lazy constraints'. */
175  SCIP_Bool separate, /**< should the constraint be separated during LP processing?
176  * Usually set to TRUE. */
177  SCIP_Bool enforce, /**< should the constraint be enforced during node processing?
178  * TRUE for model constraints, FALSE for additional, redundant constraints. */
179  SCIP_Bool check, /**< should the constraint be checked for feasibility?
180  * TRUE for model constraints, FALSE for additional, redundant constraints. */
181  SCIP_Bool propagate, /**< should the constraint be propagated during node processing?
182  * Usually set to TRUE. */
183  SCIP_Bool local, /**< is constraint only valid locally?
184  * Usually set to FALSE. Has to be set to TRUE, e.g., for branching constraints. */
185  SCIP_Bool modifiable, /**< is constraint modifiable (subject to column generation)?
186  * Usually set to FALSE. In column generation applications, set to TRUE if pricing
187  * adds coefficients to this constraint. */
188  SCIP_Bool dynamic, /**< is constraint subject to aging?
189  * Usually set to FALSE. Set to TRUE for own cuts which
190  * are separated as constraints. */
191  SCIP_Bool removable /**< should the relaxation be removed from the LP due to aging or cleanup?
192  * Usually set to FALSE. Set to TRUE for 'lazy constraints' and 'user cuts'. */
193  );
194 
195 /** creates and captures a quadratic constraint
196  * in its most basic variant, i. e., with all constraint flags set to their default values, which can be set
197  * afterwards using SCIPsetConsFLAGNAME() in scip.h
198  *
199  * The constraint should be given in the form
200  * \f[
201  * \ell \leq \sum_{i=1}^n b_i x_i + \sum_{j=1}^m a_j y_jz_j \leq u,
202  * \f]
203  * where \f$x_i = y_j = z_k\f$ is possible.
204  *
205  * @see SCIPcreateConsQuadratic() for the default constraint flag configuration
206  *
207 
208  * @note the constraint gets captured, hence at one point you have to release it using the method SCIPreleaseCons()
209  */
210 extern
212  SCIP* scip, /**< SCIP data structure */
213  SCIP_CONS** cons, /**< pointer to hold the created constraint */
214  const char* name, /**< name of constraint */
215  int nlinvars, /**< number of linear terms (n) */
216  SCIP_VAR** linvars, /**< array with variables in linear part (x_i) */
217  SCIP_Real* lincoefs, /**< array with coefficients of variables in linear part (b_i) */
218  int nquadterms, /**< number of quadratic terms (m) */
219  SCIP_VAR** quadvars1, /**< array with first variables in quadratic terms (y_j) */
220  SCIP_VAR** quadvars2, /**< array with second variables in quadratic terms (z_j) */
221  SCIP_Real* quadcoefs, /**< array with coefficients of quadratic terms (a_j) */
222  SCIP_Real lhs, /**< left hand side of quadratic equation (ell) */
223  SCIP_Real rhs /**< right hand side of quadratic equation (u) */
224  );
225 
226 /** creates and captures a quadratic constraint.
227  *
228  * The constraint should be given in the form
229  * \f[
230  * \ell \leq \sum_{i=1}^n b_i x_i + \sum_{j=1}^m (a_j y_j^2 + b_j y_j) + \sum_{k=1}^p c_k v_k w_k \leq u.
231  * \f]
232  *
233  * @note the constraint gets captured, hence at one point you have to release it using the method SCIPreleaseCons()
234  */
235 extern
237  SCIP* scip, /**< SCIP data structure */
238  SCIP_CONS** cons, /**< pointer to hold the created constraint */
239  const char* name, /**< name of constraint */
240  int nlinvars, /**< number of linear terms (n) */
241  SCIP_VAR** linvars, /**< array with variables in linear part (x_i) */
242  SCIP_Real* lincoefs, /**< array with coefficients of variables in linear part (b_i) */
243  int nquadvarterms, /**< number of quadratic terms (m) */
244  SCIP_QUADVARTERM* quadvarterms, /**< quadratic variable terms */
245  int nbilinterms, /**< number of bilinear terms (p) */
246  SCIP_BILINTERM* bilinterms, /**< bilinear terms */
247  SCIP_Real lhs, /**< constraint left hand side (ell) */
248  SCIP_Real rhs, /**< constraint right hand side (u) */
249  SCIP_Bool initial, /**< should the LP relaxation of constraint be in the initial LP? */
250  SCIP_Bool separate, /**< should the constraint be separated during LP processing? */
251  SCIP_Bool enforce, /**< should the constraint be enforced during node processing? */
252  SCIP_Bool check, /**< should the constraint be checked for feasibility? */
253  SCIP_Bool propagate, /**< should the constraint be propagated during node processing? */
254  SCIP_Bool local, /**< is constraint only valid locally? */
255  SCIP_Bool modifiable, /**< is constraint modifiable (subject to column generation)? */
256  SCIP_Bool dynamic, /**< is constraint dynamic? */
257  SCIP_Bool removable /**< should the constraint be removed from the LP due to aging or cleanup? */
258  );
259 
260 /** creates and captures a quadratic constraint
261  * in its most basic variant, i. e., with all constraint flags set to their default values, which can be set
262  * afterwards using SCIPsetConsFLAGNAME() in scip.h
263  *
264  * The constraint should be given in the form
265  * \f[
266  * \ell \leq \sum_{i=1}^n b_i x_i + \sum_{j=1}^m (a_j y_j^2 + b_j y_j) + \sum_{k=1}^p c_kv_kw_k \leq u.
267  * \f]
268  *
269  * @see SCIPcreateConsQuadratic2() for the default constraint flag configuration
270  *
271  * @note the constraint gets captured, hence at one point you have to release it using the method SCIPreleaseCons()
272  */
273 extern
275  SCIP* scip, /**< SCIP data structure */
276  SCIP_CONS** cons, /**< pointer to hold the created constraint */
277  const char* name, /**< name of constraint */
278  int nlinvars, /**< number of linear terms (n) */
279  SCIP_VAR** linvars, /**< array with variables in linear part (x_i) */
280  SCIP_Real* lincoefs, /**< array with coefficients of variables in linear part (b_i) */
281  int nquadvarterms, /**< number of quadratic terms (m) */
282  SCIP_QUADVARTERM* quadvarterms, /**< quadratic variable terms */
283  int nbilinterms, /**< number of bilinear terms (p) */
284  SCIP_BILINTERM* bilinterms, /**< bilinear terms */
285  SCIP_Real lhs, /**< constraint left hand side (ell) */
286  SCIP_Real rhs /**< constraint right hand side (u) */
287  );
288 
289 /** Adds a constant to the constraint function, that is, subtracts a constant from both sides */
290 extern
292  SCIP* scip, /**< SCIP data structure */
293  SCIP_CONS* cons, /**< constraint */
294  SCIP_Real constant /**< constant to subtract from both sides */
295  );
296 
297 /** Adds a linear variable with coefficient to a quadratic constraint.
298  */
299 extern
301  SCIP* scip, /**< SCIP data structure */
302  SCIP_CONS* cons, /**< constraint */
303  SCIP_VAR* var, /**< variable */
304  SCIP_Real coef /**< coefficient of variable */
305  );
306 
307 /** Adds a quadratic variable with linear and square coefficient to a quadratic constraint.
308  */
309 extern
311  SCIP* scip, /**< SCIP data structure */
312  SCIP_CONS* cons, /**< constraint */
313  SCIP_VAR* var, /**< variable */
314  SCIP_Real lincoef, /**< linear coefficient of variable */
315  SCIP_Real sqrcoef /**< square coefficient of variable */
316  );
317 
318 /** Adds a linear coefficient for a quadratic variable.
319  *
320  * Variable will be added with square coefficient 0.0 if not existing yet.
321  */
322 extern
324  SCIP* scip, /**< SCIP data structure */
325  SCIP_CONS* cons, /**< constraint */
326  SCIP_VAR* var, /**< variable */
327  SCIP_Real coef /**< value to add to linear coefficient of variable */
328  );
329 
330 /** Adds a square coefficient for a quadratic variable.
331  *
332  * Variable will be added with linear coefficient 0.0 if not existing yet.
333  */
334 extern
336  SCIP* scip, /**< SCIP data structure */
337  SCIP_CONS* cons, /**< constraint */
338  SCIP_VAR* var, /**< variable */
339  SCIP_Real coef /**< value to add to square coefficient of variable */
340  );
341 
342 /** Adds a bilinear term to a quadratic constraint.
343  *
344  * Variables will be added with linear and square coefficient 0.0 if not existing yet.
345  * If variables are equal, only the square coefficient of the variable is updated.
346  */
347 extern
349  SCIP* scip, /**< SCIP data structure */
350  SCIP_CONS* cons, /**< constraint */
351  SCIP_VAR* var1, /**< first variable */
352  SCIP_VAR* var2, /**< second variable */
353  SCIP_Real coef /**< coefficient of bilinear term */
354  );
355 
356 /** Gets the quadratic constraint as a nonlinear row representation.
357  */
358 extern
360  SCIP* scip, /**< SCIP data structure */
361  SCIP_CONS* cons, /**< constraint */
362  SCIP_NLROW** nlrow /**< pointer to store nonlinear row */
363  );
364 
365 /** Gets the number of variables in the linear part of a quadratic constraint.
366  */
367 extern
369  SCIP* scip, /**< SCIP data structure */
370  SCIP_CONS* cons /**< constraint */
371  );
372 
373 /** Gets the variables in the linear part of a quadratic constraint.
374  * Length is given by SCIPgetNLinearVarsQuadratic.
375  */
376 extern
378  SCIP* scip, /**< SCIP data structure */
379  SCIP_CONS* cons /**< constraint */
380  );
381 
382 /** Gets the coefficients in the linear part of a quadratic constraint.
383  * Length is given by SCIPgetNQuadVarsQuadratic.
384  */
385 extern
387  SCIP* scip, /**< SCIP data structure */
388  SCIP_CONS* cons /**< constraint */
389  );
390 
391 /** Gets the number of quadratic variable terms of a quadratic constraint.
392  */
393 extern
395  SCIP* scip, /**< SCIP data structure */
396  SCIP_CONS* cons /**< constraint */
397  );
398 
399 /** Gets the quadratic variable terms of a quadratic constraint.
400  * Length is given by SCIPgetNQuadVarTermsQuadratic.
401  */
402 extern
404  SCIP* scip, /**< SCIP data structure */
405  SCIP_CONS* cons /**< constraint */
406  );
407 
408 /** Ensures that quadratic variable terms are sorted. */
409 extern
411  SCIP* scip, /**< SCIP data structure */
412  SCIP_CONS* cons /**< constraint */
413  );
414 
415 /** Finds the position of a quadratic variable term for a given variable.
416  *
417  * @note If the quadratic variable terms have not been sorted before, then a search may reorder the current order of the terms.
418  */
419 extern
421  SCIP* scip, /**< SCIP data structure */
422  SCIP_CONS* cons, /**< constraint */
423  SCIP_VAR* var, /**< variable to search for */
424  int* pos /**< buffer to store position of quadvarterm for var, or -1 if not found */
425  );
426 
427 /** Gets the number of bilinear terms of a quadratic constraint.
428  */
429 extern
431  SCIP* scip, /**< SCIP data structure */
432  SCIP_CONS* cons /**< constraint */
433  );
434 
435 /** Gets the bilinear terms of a quadratic constraint.
436  * Length is given by SCIPgetNBilinTermQuadratic.
437  */
438 extern
440  SCIP* scip, /**< SCIP data structure */
441  SCIP_CONS* cons /**< constraint */
442  );
443 
444 /** Gets the left hand side of a quadratic constraint.
445  */
446 extern
448  SCIP* scip, /**< SCIP data structure */
449  SCIP_CONS* cons /**< constraint */
450  );
451 
452 /** Gets the right hand side of a quadratic constraint.
453  */
454 extern
456  SCIP* scip, /**< SCIP data structure */
457  SCIP_CONS* cons /**< constraint */
458  );
459 
460 /** Check the quadratic function of a quadratic constraint for its semi-definiteness, if not done yet.
461  */
462 extern
464  SCIP* scip, /**< SCIP data structure */
465  SCIP_CONS* cons /**< constraint */
466  );
467 
468 /** Indicates whether the quadratic function of a quadratic constraint is (known to be) convex.
469  */
470 extern
472  SCIP* scip, /**< SCIP data structure */
473  SCIP_CONS* cons /**< constraint */
474  );
475 
476 /** Indicates whether the quadratic function of a quadratic constraint is (known to be) concave.
477  */
478 extern
480  SCIP* scip, /**< SCIP data structure */
481  SCIP_CONS* cons /**< constraint */
482  );
483 
484 /** Gets the violation of a constraint by a solution. */
485 extern
487  SCIP* scip, /**< SCIP data structure */
488  SCIP_CONS* cons, /**< constraint */
489  SCIP_SOL* sol, /**< solution which violation to calculate, or NULL for LP solution */
490  SCIP_Real* violation /**< pointer to store violation of constraint */
491  );
492 
493 /** Indicates whether the quadratic constraint is local w.r.t. the current local bounds.
494  *
495  * That is, checks whether each variable with a square term is fixed and for each bilinear term at least one variable is fixed.
496  */
497 extern
499  SCIP* scip, /**< SCIP data structure */
500  SCIP_CONS* cons /**< constraint */
501  );
502 
503 /** Adds the constraint to an NLPI problem. */
504 extern
506  SCIP* scip, /**< SCIP data structure */
507  SCIP_CONS* cons, /**< constraint */
508  SCIP_NLPI* nlpi, /**< interface to NLP solver */
509  SCIP_NLPIPROBLEM* nlpiprob, /**< NLPI problem where to add constraint */
510  SCIP_HASHMAP* scipvar2nlpivar, /**< mapping from SCIP variables to variable indices in NLPI */
511  SCIP_Bool names /**< whether to pass constraint names to NLPI */
512  );
513 
514 /** sets the left hand side of a quadratic constraint
515  *
516  * @note This method may only be called during problem creation stage for an original constraint.
517  */
518 extern
520  SCIP* scip, /**< SCIP data structure */
521  SCIP_CONS* cons, /**< constraint data */
522  SCIP_Real lhs /**< new left hand side */
523  );
524 
525 /** sets the right hand side of a quadratic constraint
526  *
527  * @note This method may only be called during problem creation stage for an original constraint.
528  */
529 extern
531  SCIP* scip, /**< SCIP data structure */
532  SCIP_CONS* cons, /**< constraint data */
533  SCIP_Real rhs /**< new right hand side */
534  );
535 
536 extern
537 /** gets the feasibility of the quadratic constraint in the given solution */
539  SCIP* scip, /**< SCIP data structure */
540  SCIP_CONS* cons, /**< constraint data */
541  SCIP_SOL* sol, /**< solution, or NULL to use current node's solution */
542  SCIP_Real* feasibility /**< pointer to store the feasibility */
543  );
544 
545 /** gets the activity of the quadratic constraint in the given solution */
546 extern
548  SCIP* scip, /**< SCIP data structure */
549  SCIP_CONS* cons, /**< constraint data */
550  SCIP_SOL* sol, /**< solution, or NULL to use current node's solution */
551  SCIP_Real* activity /**< pointer to store the activity */
552  );
553 
554 /** changes the linear coefficient value for a given quadratic variable in a quadratic constraint data; if not
555  * available, it adds it
556  *
557  * @note this is only allowed for original constraints and variables in problem creation stage
558  */
559 extern
561  SCIP* scip, /**< SCIP data structure */
562  SCIP_CONS* cons, /**< constraint data */
563  SCIP_VAR* var, /**< quadratic variable */
564  SCIP_Real coef /**< new coefficient */
565  );
566 
567 /** changes the square coefficient value for a given quadratic variable in a quadratic constraint data; if not
568  * available, it adds it
569  *
570  * @note this is only allowed for original constraints and variables in problem creation stage
571  */
572 extern
574  SCIP* scip, /**< SCIP data structure */
575  SCIP_CONS* cons, /**< constraint data */
576  SCIP_VAR* var, /**< quadratic variable */
577  SCIP_Real coef /**< new coefficient */
578  );
579 
580 /** changes the bilinear coefficient value for a given quadratic variable in a quadratic constraint data; if not
581  * available, it adds it
582  *
583  * @note this is only allowed for original constraints and variables in problem creation stage
584  */
585 extern
587  SCIP* scip, /**< SCIP data structure */
588  SCIP_CONS* cons, /**< constraint */
589  SCIP_VAR* var1, /**< first quadratic variable */
590  SCIP_VAR* var2, /**< second quadratic variable */
591  SCIP_Real coef /**< coefficient of bilinear term */
592  );
593 
594 #ifdef __cplusplus
595 }
596 #endif
597 
598 #endif
struct SCIP_Nlpi SCIP_NLPI
Definition: type_nlpi.h:37
SCIP_RETCODE SCIPincludeQuadconsUpgrade(SCIP *scip, SCIP_DECL_QUADCONSUPGD((*quadconsupgd)), int priority, SCIP_Bool active, const char *conshdlrname)
SCIP_Real SCIPgetLhsQuadratic(SCIP *scip, SCIP_CONS *cons)
struct SCIP_Cons SCIP_CONS
Definition: type_cons.h:48
SCIP_RETCODE SCIPsortQuadVarTermsQuadratic(SCIP *scip, SCIP_CONS *cons)
struct SCIP_NlpiProblem SCIP_NLPIPROBLEM
Definition: type_nlpi.h:39
SCIP_RETCODE SCIPaddBilinTermQuadratic(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var1, SCIP_VAR *var2, SCIP_Real coef)
SCIP_BILINTERM * SCIPgetBilinTermsQuadratic(SCIP *scip, SCIP_CONS *cons)
SCIP_RETCODE SCIPgetViolationQuadratic(SCIP *scip, SCIP_CONS *cons, SCIP_SOL *sol, SCIP_Real *violation)
SCIP_RETCODE SCIPaddQuadVarQuadratic(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var, SCIP_Real lincoef, SCIP_Real sqrcoef)
struct SCIP_HashMap SCIP_HASHMAP
Definition: type_misc.h:78
SCIP_RETCODE SCIPincludeConshdlrQuadratic(SCIP *scip)
#define SCIP_DECL_QUADCONSUPGD(x)
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:53
SCIP_RETCODE SCIPchgRhsQuadratic(SCIP *scip, SCIP_CONS *cons, SCIP_Real rhs)
SCIP_RETCODE SCIPchgLhsQuadratic(SCIP *scip, SCIP_CONS *cons, SCIP_Real lhs)
SCIP_Bool SCIPisLinearLocalQuadratic(SCIP *scip, SCIP_CONS *cons)
SCIP_RETCODE SCIPaddToNlpiProblemQuadratic(SCIP *scip, SCIP_CONS *cons, SCIP_NLPI *nlpi, SCIP_NLPIPROBLEM *nlpiprob, SCIP_HASHMAP *scipvar2nlpivar, SCIP_Bool names)
SCIP_RETCODE SCIPcreateConsBasicQuadratic2(SCIP *scip, SCIP_CONS **cons, const char *name, int nlinvars, SCIP_VAR **linvars, SCIP_Real *lincoefs, int nquadvarterms, SCIP_QUADVARTERM *quadvarterms, int nbilinterms, SCIP_BILINTERM *bilinterms, SCIP_Real lhs, SCIP_Real rhs)
struct SCIP_BilinTerm SCIP_BILINTERM
SCIP_RETCODE SCIPaddQuadVarLinearCoefQuadratic(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var, SCIP_Real coef)
void SCIPaddConstantQuadratic(SCIP *scip, SCIP_CONS *cons, SCIP_Real constant)
SCIP_Bool SCIPisConcaveQuadratic(SCIP *scip, SCIP_CONS *cons)
SCIP_VAR ** SCIPgetLinearVarsQuadratic(SCIP *scip, SCIP_CONS *cons)
struct SCIP_NlRow SCIP_NLROW
Definition: type_nlp.h:31
SCIP_RETCODE SCIPfindQuadVarTermQuadratic(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var, int *pos)
SCIP_RETCODE SCIPaddLinearVarQuadratic(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var, SCIP_Real coef)
SCIP_RETCODE SCIPcheckCurvatureQuadratic(SCIP *scip, SCIP_CONS *cons)
int SCIPgetNLinearVarsQuadratic(SCIP *scip, SCIP_CONS *cons)
SCIP_RETCODE SCIPchgSquareCoefQuadratic(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var, SCIP_Real coef)
struct SCIP_QuadVarEventData SCIP_QUADVAREVENTDATA
struct Scip SCIP
Definition: type_scip.h:30
struct SCIP_Sol SCIP_SOL
Definition: type_sol.h:45
#define SCIP_Bool
Definition: def.h:53
SCIP_RETCODE SCIPgetActivityQuadratic(SCIP *scip, SCIP_CONS *cons, SCIP_SOL *sol, SCIP_Real *activity)
SCIP_RETCODE SCIPgetFeasibilityQuadratic(SCIP *scip, SCIP_CONS *cons, SCIP_SOL *sol, SCIP_Real *feasibility)
struct SCIP_QuadVarTerm SCIP_QUADVARTERM
struct SCIP_Var SCIP_VAR
Definition: type_var.h:95
SCIP_Real * SCIPgetCoefsLinearVarsQuadratic(SCIP *scip, SCIP_CONS *cons)
int SCIPgetNQuadVarTermsQuadratic(SCIP *scip, SCIP_CONS *cons)
SCIP_RETCODE SCIPgetNlRowQuadratic(SCIP *scip, SCIP_CONS *cons, SCIP_NLROW **nlrow)
SCIP_RETCODE SCIPcreateConsQuadratic2(SCIP *scip, SCIP_CONS **cons, const char *name, int nlinvars, SCIP_VAR **linvars, SCIP_Real *lincoefs, int nquadvarterms, SCIP_QUADVARTERM *quadvarterms, int nbilinterms, SCIP_BILINTERM *bilinterms, 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 SCIPaddSquareCoefQuadratic(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var, SCIP_Real coef)
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_Bool SCIPisConvexQuadratic(SCIP *scip, SCIP_CONS *cons)
#define SCIP_Real
Definition: def.h:127
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_Real SCIPgetRhsQuadratic(SCIP *scip, SCIP_CONS *cons)
SCIP_RETCODE SCIPchgLinearCoefQuadratic(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var, SCIP_Real coef)
int SCIPgetNBilinTermsQuadratic(SCIP *scip, SCIP_CONS *cons)
SCIP_RETCODE SCIPchgBilinCoefQuadratic(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var1, SCIP_VAR *var2, SCIP_Real coef)
SCIP_QUADVARTERM * SCIPgetQuadVarTermsQuadratic(SCIP *scip, SCIP_CONS *cons)
SCIP callable library.
type definitions for specific NLP solver interfaces