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