Scippy

SCIP

Solving Constraint Integer Programs

cons_nonlinear.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_nonlinear.h
17  * @ingroup CONSHDLRS
18  * @brief constraint handler for nonlinear constraints specified by algebraic expressions
19  * @author Ksenia Bestuzheva
20  * @author Benjamin Mueller
21  * @author Felipe Serrano
22  * @author Stefan Vigerske
23  *
24  * For additional documentation on this constraint handler, see also the SCIP 8 release report.
25  */
26 
27 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
28 
29 #ifndef __SCIP_CONS_NONLINEAR_H__
30 #define __SCIP_CONS_NONLINEAR_H__
31 
32 
33 #include "scip/scip.h"
34 #include "scip/type_nlhdlr.h"
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 
40 /**@addtogroup CONSHDLRS
41  * @{
42  *
43  * @name Nonlinear Constraints
44  * @{
45  */
46 
47 /** linear auxiliary expression of the form xy {≤,≥,=} coefs[0]w + coefs[1]x + coefs[2]y + cst */
49 {
50  SCIP_Real coefs[3]; /**< coefficients in the auxiliary expression */
51  SCIP_Real cst; /**< constant */
52  SCIP_VAR* auxvar; /**< auxiliary variable w in xy {&le;,&ge;,=} auxexpr(w, x, y) */
53  SCIP_Bool underestimate; /**< whether the auxexpr underestimates the product */
54  SCIP_Bool overestimate; /**< whether the auxexpr overestimates the product */
55 };
57 
58 /** bilinear term structure
59  *
60  * This can represent a product which
61  * - explicitly exists in the problem and is under- and/or overestimated by a single auxiliary variable
62  * stored as `var` in the union `aux` (case `nauxexprs` = 0) or
63  * - is involved in bilinear relations implicitly given by linear constraints with binary variables, and
64  * is under- and/or overestimated by linear expression(s) stored as `exprs` in the union `aux` (case `nauxexprs` > 0).
65  *
66  * An explicitly existing product can also be involved in implicit relations, then it will be stored as in
67  * the second case.
68  */
70 {
71  SCIP_VAR* x; /**< first variable */
72  SCIP_VAR* y; /**< second variable */
73  union
74  {
75  SCIP_CONSNONLINEAR_AUXEXPR** exprs; /**< auxiliary expressions for the implicit product of x and y */
76  SCIP_VAR* var; /**< auxiliary variable for the explicit product of x and y */
77  } aux;
78  int nauxexprs; /**< number of aux.exprs (0 for products without implicit relations) */
79  int auxexprssize; /**< size of the aux.exprs array */
80  int nlockspos; /**< number of positive expression locks */
81  int nlocksneg; /**< number of negative expression locks */
82  SCIP_Bool existing; /**< does the product exist explicitly in the problem? */
83 };
84 typedef struct SCIP_ConsNonlinear_BilinTerm SCIP_CONSNONLINEAR_BILINTERM; /**< bilinear term structure */
85 
86 /** evaluation callback for (vertex-polyhedral) functions used as input for facet computation of its envelopes
87  *
88  * \param[in] args the point to be evaluated
89  * \param[in] nargs the number of arguments of the function (length of array `args`)
90  * \param[in] funcdata user-data of function evaluation callback
91  * \return value of function in point given by `args` or SCIP_INVALID if could not be evaluated
92  */
93 #define SCIP_DECL_VERTEXPOLYFUN(f) SCIP_Real f (SCIP_Real* args, int nargs, void* funcdata)
94 
95 /** maximum dimension of vertex-polyhedral function for which we can try to compute a facet of its convex or concave envelope */
96 #define SCIP_MAXVERTEXPOLYDIM 14
97 
98 /** upgrading method for nonlinear constraints into more specific constraints
99  *
100  * The method might upgrade a nonlinear constraint into a set of upgrade constraints.
101  * The caller provided an array `upgdconss` of size `upgdconsssize` to store upgrade constraints.
102  * If an upgrade is not possible, set `*nupgdconss` to zero.
103  * If more than `upgdconsssize` many constraints shall replace `cons`, the function
104  * should return the required number as negated value in `*nupgdconss`,
105  * e.g., if `cons` should be replaced by 3 constraints, the function should set
106  * `*nupgdconss` to -3 and return with SCIP_OKAY.
107  *
108  * \param[in] scip SCIP main data structure
109  * \param[in] cons the nonlinear constraint to upgrade
110  * \param[in] nvarexprs total number of variable expressions in the nonlinear constraint
111  * \param[out] nupgdconss pointer to store number of constraints that replace this constraint
112  * \param[out] upgdconss array to store constraints that replace this constraint
113  * \param[in] upgdconsssize length of the provided `upgdconss` array
114  */
115 #define SCIP_DECL_NONLINCONSUPGD(x) SCIP_RETCODE x (SCIP* scip, SCIP_CONS* cons, int nvarexprs, \
116  int* nupgdconss, SCIP_CONS** upgdconss, int upgdconsssize)
117 
118 /** @} */
119 /** @} */
120 
121 /** creates the handler for nonlinear constraints and includes it in SCIP
122  *
123  * @ingroup ConshdlrIncludes
124  */
125 SCIP_EXPORT
127  SCIP* scip /**< SCIP data structure */
128  );
129 
130 /**@addtogroup CONSHDLRS
131  *
132  * @{
133  *
134  * @name Nonlinear Constraints
135  *
136  * @{
137  */
138 
139 /* Nonlinear Constraint Handler Methods */
140 
141 /** includes a nonlinear constraint upgrade method into the nonlinear constraint handler */
142 SCIP_EXPORT
144  SCIP* scip, /**< SCIP data structure */
145  SCIP_DECL_NONLINCONSUPGD((*nlconsupgd)), /**< method to call for upgrading nonlinear constraint */
146  int priority, /**< priority of upgrading method */
147  SCIP_Bool active, /**< should the upgrading method by active by default? */
148  const char* conshdlrname /**< name of the constraint handler */
149  );
150 
151 /** creates and captures a nonlinear constraint
152  *
153  * @note the constraint gets captured, hence at one point you have to release it using the method SCIPreleaseCons()
154  */
155 SCIP_EXPORT
157  SCIP* scip, /**< SCIP data structure */
158  SCIP_CONS** cons, /**< pointer to hold the created constraint */
159  const char* name, /**< name of constraint */
160  SCIP_EXPR* expr, /**< expression of constraint (must not be NULL) */
161  SCIP_Real lhs, /**< left hand side of constraint */
162  SCIP_Real rhs, /**< right hand side of constraint */
163  SCIP_Bool initial, /**< should the LP relaxation of constraint be in the initial LP?
164  * Usually set to TRUE. Set to FALSE for 'lazy constraints'. */
165  SCIP_Bool separate, /**< should the constraint be separated during LP processing?
166  * Usually set to TRUE. */
167  SCIP_Bool enforce, /**< should the constraint be enforced during node processing?
168  * TRUE for model constraints, FALSE for additional, redundant constraints. */
169  SCIP_Bool check, /**< should the constraint be checked for feasibility?
170  * TRUE for model constraints, FALSE for additional, redundant constraints. */
171  SCIP_Bool propagate, /**< should the constraint be propagated during node processing?
172  * Usually set to TRUE. */
173  SCIP_Bool local, /**< is constraint only valid locally?
174  * Usually set to FALSE. Has to be set to TRUE, e.g., for branching constraints. */
175  SCIP_Bool modifiable, /**< is constraint modifiable (subject to column generation)?
176  * Usually set to FALSE. In column generation applications, set to TRUE if pricing
177  * adds coefficients to this constraint. */
178  SCIP_Bool dynamic, /**< is constraint subject to aging?
179  * Usually set to FALSE. Set to TRUE for own cuts which
180  * are separated as constraints. */
181  SCIP_Bool removable /**< should the relaxation be removed from the LP due to aging or cleanup?
182  * Usually set to FALSE. Set to TRUE for 'lazy constraints' and 'user cuts'. */
183  );
184 
185 /** creates and captures a nonlinear constraint with all its constraint flags set to their default values
186  *
187  * All flags can be set via SCIPconsSetFLAGNAME-methods.
188  *
189  * @see SCIPcreateConsNonlinear() for information about the basic constraint flag configuration.
190  *
191  * @note the constraint gets captured, hence at one point you have to release it using the method SCIPreleaseCons()
192  */
193 SCIP_EXPORT
195  SCIP* scip, /**< SCIP data structure */
196  SCIP_CONS** cons, /**< pointer to hold the created constraint */
197  const char* name, /**< name of constraint */
198  SCIP_EXPR* expr, /**< expression of constraint (must not be NULL) */
199  SCIP_Real lhs, /**< left hand side of constraint */
200  SCIP_Real rhs /**< right hand side of constraint */
201  );
202 
203 /** creates and captures a quadratic nonlinear constraint
204  *
205  * @note the constraint gets captured, hence at one point you have to release it using the method SCIPreleaseCons()
206  */
207 SCIP_EXPORT
209  SCIP* scip, /**< SCIP data structure */
210  SCIP_CONS** cons, /**< pointer to hold the created constraint */
211  const char* name, /**< name of constraint */
212  int nlinvars, /**< number of linear terms */
213  SCIP_VAR** linvars, /**< array with variables in linear part */
214  SCIP_Real* lincoefs, /**< array with coefficients of variables in linear part */
215  int nquadterms, /**< number of quadratic terms */
216  SCIP_VAR** quadvars1, /**< array with first variables in quadratic terms */
217  SCIP_VAR** quadvars2, /**< array with second variables in quadratic terms */
218  SCIP_Real* quadcoefs, /**< array with coefficients of quadratic terms */
219  SCIP_Real lhs, /**< left hand side of quadratic equation */
220  SCIP_Real rhs, /**< right hand side of quadratic equation */
221  SCIP_Bool initial, /**< should the LP relaxation of constraint be in the initial LP?
222  * Usually set to TRUE. Set to FALSE for 'lazy constraints'. */
223  SCIP_Bool separate, /**< should the constraint be separated during LP processing?
224  * Usually set to TRUE. */
225  SCIP_Bool enforce, /**< should the constraint be enforced during node processing?
226  * TRUE for model constraints, FALSE for additional, redundant constraints. */
227  SCIP_Bool check, /**< should the constraint be checked for feasibility?
228  * TRUE for model constraints, FALSE for additional, redundant constraints. */
229  SCIP_Bool propagate, /**< should the constraint be propagated during node processing?
230  * Usually set to TRUE. */
231  SCIP_Bool local, /**< is constraint only valid locally?
232  * Usually set to FALSE. Has to be set to TRUE, e.g., for branching constraints. */
233  SCIP_Bool modifiable, /**< is constraint modifiable (subject to column generation)?
234  * Usually set to FALSE. In column generation applications, set to TRUE if pricing
235  * adds coefficients to this constraint. */
236  SCIP_Bool dynamic, /**< is constraint subject to aging?
237  * Usually set to FALSE. Set to TRUE for own cuts which
238  * are separated as constraints. */
239  SCIP_Bool removable /**< should the relaxation be removed from the LP due to aging or cleanup?
240  * Usually set to FALSE. Set to TRUE for 'lazy constraints' and 'user cuts'. */
241  );
242 
243 /** creates and captures a quadratic nonlinear constraint with all its constraint flags set to their default values
244  *
245  * All flags can be set via SCIPconsSetFLAGNAME-methods.
246  *
247  * @see SCIPcreateConsQuadraticNonlinear() for information about the basic constraint flag configuration.
248  *
249  * @note the constraint gets captured, hence at one point you have to release it using the method SCIPreleaseCons()
250  */
251 SCIP_EXPORT
253  SCIP* scip, /**< SCIP data structure */
254  SCIP_CONS** cons, /**< pointer to hold the created constraint */
255  const char* name, /**< name of constraint */
256  int nlinvars, /**< number of linear terms */
257  SCIP_VAR** linvars, /**< array with variables in linear part */
258  SCIP_Real* lincoefs, /**< array with coefficients of variables in linear part */
259  int nquadterms, /**< number of quadratic terms */
260  SCIP_VAR** quadvars1, /**< array with first variables in quadratic terms */
261  SCIP_VAR** quadvars2, /**< array with second variables in quadratic terms */
262  SCIP_Real* quadcoefs, /**< array with coefficients of quadratic terms */
263  SCIP_Real lhs, /**< left hand side of quadratic equation */
264  SCIP_Real rhs /**< right hand side of quadratic equation */
265  );
266 
267 /** creates and captures a nonlinear constraint that is a second-order cone constraint with all its constraint flags set to their default values
268  *
269  * \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$
270  *
271  * @note the constraint gets captured, hence at one point you have to release it using the method SCIPreleaseCons()
272  */
273 SCIP_EXPORT
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 nvars, /**< number of variables on left hand side of constraint (n) */
279  SCIP_VAR** vars, /**< array with variables on left hand side (x_i) */
280  SCIP_Real* coefs, /**< array with coefficients of left hand side variables (alpha_i), or NULL if all 1.0 */
281  SCIP_Real* offsets, /**< array with offsets of variables (beta_i), or NULL if all 0.0 */
282  SCIP_Real constant, /**< constant on left hand side (gamma) */
283  SCIP_VAR* rhsvar, /**< variable on right hand side of constraint (x_{n+1}) */
284  SCIP_Real rhscoeff, /**< coefficient of variable on right hand side (alpha_{n+1}) */
285  SCIP_Real rhsoffset /**< offset of variable on right hand side (beta_{n+1}) */
286  );
287 
288 /** creates and captures a signpower nonlinear constraint with all its constraint flags set to their default values
289  *
290  * \f$\textrm{lhs} \leq \textrm{sign}(x+a) |x+a|^n + c z \leq \textrm{rhs}\f$
291  *
292  * @note the constraint gets captured, hence at one point you have to release it using the method SCIPreleaseCons()
293  */
294 SCIP_EXPORT
296  SCIP* scip, /**< SCIP data structure */
297  SCIP_CONS** cons, /**< pointer to hold the created constraint */
298  const char* name, /**< name of constraint */
299  SCIP_VAR* x, /**< nonlinear variable x in constraint */
300  SCIP_VAR* z, /**< linear variable z in constraint */
301  SCIP_Real exponent, /**< exponent n of |x+offset|^n term in constraint */
302  SCIP_Real xoffset, /**< offset in |x+offset|^n term in constraint */
303  SCIP_Real zcoef, /**< coefficient of z in constraint */
304  SCIP_Real lhs, /**< left hand side of constraint */
305  SCIP_Real rhs /**< right hand side of constraint */
306  );
307 
308 /** gets tag indicating current local variable bounds */
309 SCIP_EXPORT
311  SCIP_CONSHDLR* conshdlr /**< nonlinear constraint handler */
312  );
313 
314 /** gets the `curboundstag` from the last time where variable bounds were relaxed */
315 SCIP_EXPORT
317  SCIP_CONSHDLR* conshdlr /**< nonlinear constraint handler */
318  );
319 
320 /** increments `curboundstag` and resets `lastboundrelax` in constraint handler data
321  *
322  * @attention This method is not intended for normal use.
323  * These tags are maintained by the event handler for variable bound change events.
324  * This method is used by some unittests.
325  */
326 SCIP_EXPORT
328  SCIP_CONSHDLR* conshdlr, /**< nonlinear constraint handler */
329  SCIP_Bool boundrelax /**< indicates whether a bound was relaxed, i.e., lastboundrelax should be set too */
330  );
331 
332 /** returns the hashmap that is internally used to map variables to their corresponding variable expressions */
333 SCIP_EXPORT
335  SCIP_CONSHDLR* conshdlr /**< nonlinear constraint handler */
336  );
337 
338 /** processes a rowprep for cut addition and maybe report branchscores */
339 SCIP_EXPORT
341  SCIP* scip, /**< SCIP data structure */
342  SCIP_NLHDLR* nlhdlr, /**< nonlinear handler which provided the estimator */
343  SCIP_CONS* cons, /**< nonlinear constraint */
344  SCIP_EXPR* expr, /**< expression */
345  SCIP_ROWPREP* rowprep, /**< cut to be added */
346  SCIP_Bool overestimate, /**< whether the expression needs to be over- or underestimated */
347  SCIP_VAR* auxvar, /**< auxiliary variable */
348  SCIP_Real auxvalue, /**< current value of expression w.r.t. auxiliary variables as obtained from EVALAUX */
349  SCIP_Bool allowweakcuts, /**< whether we should only look for "strong" cuts, or anything that separates is fine */
350  SCIP_Bool branchscoresuccess, /**< whether the estimator generation generated branching scores */
351  SCIP_Bool inenforcement, /**< whether we are in enforcement, or only in separation */
352  SCIP_SOL* sol, /**< solution to be separated (NULL for the LP solution) */
353  SCIP_RESULT* result /**< pointer to store the result */
354  );
355 
356 /** returns whether all nonlinear constraints are assumed to be convex */
357 SCIP_EXPORT
359  SCIP_CONSHDLR* conshdlr
360  );
361 
362 /** collects all bilinear terms for a given set of constraints
363  *
364  * @attention This method should only be used for unit tests that depend on SCIPgetBilinTermsNonlinear(),
365  * SCIPgetBilinTermNonlinear() or SCIPgetBilinTermIdxNonlinear().
366  */
367 SCIP_EXPORT
369  SCIP* scip, /**< SCIP data structure */
370  SCIP_CONSHDLR* conshdlr, /**< nonlinear constraint handler */
371  SCIP_CONS** conss, /**< nonlinear constraints */
372  int nconss /**< total number of nonlinear constraints */
373  );
374 
375 /** returns the total number of bilinear terms that are contained in all nonlinear constraints
376  *
377  * @note This method should only be used after auxiliary variables have been created, i.e., after CONSINITLP.
378  */
379 SCIP_EXPORT
381  SCIP_CONSHDLR* conshdlr /**< nonlinear constraint handler */
382  );
383 
384 /** returns all bilinear terms that are contained in all nonlinear constraints
385  *
386  * @note This method should only be used after auxiliary variables have been created, i.e., after CONSINITLP.
387  * @note The value of the auxiliary variable of a bilinear term might be NULL, which indicates that the term does not have an auxiliary variable.
388  */
389 SCIP_EXPORT
391  SCIP_CONSHDLR* conshdlr /**< nonlinear constraint handler */
392  );
393 
394 /** returns the index of the bilinear term representing the product of the two given variables
395  *
396  * @note The method should only be used after auxiliary variables have been created, i.e., after CONSINITLP.
397  * @return The method returns -1 if the variables do not appear bilinearly.
398  */
399 SCIP_EXPORT
401  SCIP_CONSHDLR* conshdlr, /**< nonlinear constraint handler */
402  SCIP_VAR* x, /**< first variable */
403  SCIP_VAR* y /**< second variable */
404  );
405 
406 /** returns the bilinear term that represents the product of two given variables
407  *
408  * @note The method should only be used after auxiliary variables have been created, i.e., after CONSINITLP.
409  * @return The method returns NULL if the variables do not appear bilinearly.
410  */
411 SCIP_EXPORT
413  SCIP_CONSHDLR* conshdlr, /**< nonlinear constraint handler */
414  SCIP_VAR* x, /**< first variable */
415  SCIP_VAR* y /**< second variable */
416  );
417 
418 /** evaluates an auxiliary expression for a bilinear term */
419 SCIP_EXPORT
421  SCIP* scip, /**< SCIP data structure */
422  SCIP_VAR* x, /**< first variable of the bilinear term */
423  SCIP_VAR* y, /**< second variable of the bilinear term */
424  SCIP_CONSNONLINEAR_AUXEXPR* auxexpr, /**< auxiliary expression */
425  SCIP_SOL* sol /**< solution at which to evaluate (can be NULL) */
426  );
427 
428 /** stores the variables of a bilinear term in the data of the constraint handler */
429 SCIP_EXPORT
431  SCIP* scip, /**< SCIP data structure */
432  SCIP_CONSHDLR* conshdlr, /**< constraint handler */
433  SCIP_VAR* x, /**< first variable */
434  SCIP_VAR* y, /**< second variable */
435  SCIP_VAR* auxvar, /**< auxiliary variable (might be NULL) */
436  int nlockspos, /**< number of positive expression locks */
437  int nlocksneg /**< number of negative expression locks */
438  );
439 
440 /** stores the variables of a bilinear term in the data of the constraint handler */
441 SCIP_EXPORT
443  SCIP* scip, /**< SCIP data structure */
444  SCIP_CONSHDLR* conshdlr, /**< constraint handler */
445  SCIP_VAR* x, /**< first variable */
446  SCIP_VAR* y, /**< second variable */
447  SCIP_VAR* auxvar, /**< auxiliary variable (might be NULL) */
448  SCIP_Real coefx, /**< coefficient of x in the auxiliary expression */
449  SCIP_Real coefy, /**< coefficient of y in the auxiliary expression */
450  SCIP_Real coefaux, /**< coefficient of auxvar in the auxiliary expression */
451  SCIP_Real cst, /**< constant of the auxiliary expression */
452  SCIP_Bool overestimate /**< whether the auxiliary expression overestimates the bilinear product */
453  );
454 
455 /** computes a facet of the convex or concave envelope of a vertex polyhedral function
456  *
457  * If \f$ f(x) \f$ is vertex-polyhedral, then \f$ g \f$ is a convex underestimator if and only if
458  * \f$ g(v^i) \leq f(v^i), \forall i \f$, where \f$ \{ v^i \}_{i = 1}^{2^n} \subseteq \mathbb R^n \f$ are the vertices
459  * of the domain of \f$ x \f$, \f$ [\ell,u] \f$. Hence, we can compute a linear underestimator by solving the following
460  * LP (we don't necessarily get a facet of the convex envelope, see below):
461  *
462  * \f{align*}{
463  * \max \, & \alpha^T x^* + \beta \\
464  * s.t. \; & \alpha^T v^i + \beta \le f(v^i), \, \forall i = 1, \ldots, 2^n
465  * \f}
466  *
467  * In principle, one would need to update the LP whenever the domain changes. However, \f$ [\ell,u] = T([0, 1]^n) \f$,
468  * where \f$ T \f$ is an affine linear invertible transformation given by \f$ T(y)_i = (u_i - \ell_i) y_i + \ell_i \f$.
469  * Working with the change of variables \f$ x = T(y) \f$ allows us to keep the constraints of the LP, even if the domain
470  * changes. Indeed, after the change of variables, the problem is: find an affine underestimator \f$ g \f$ such that \f$
471  * g(T(y)) \le f(T(y)) \f$, for all \f$ y \in [0, 1]^n \f$. Now \f$ f(T(y)) \f$ is componentwise affine, but still
472  * satisfies that \f$ g \f$ is a valid underestimator if and only if \f$ g(T(u)) \leq f(T(u)), \forall u \in \{0, 1\}^n
473  * \f$. So we now look for \f$ \bar g(y) := g(T(y)) = g(((u_i - \ell_i) y_i + \ell_i)_i) = \bar \alpha^T y + \bar \beta
474  * \f$, where \f$ \bar \alpha_i = (u_i - \ell_i) \alpha_i \f$ and \f$ \bar \beta = \sum_i \alpha_i \ell_i + \beta \f$. So
475  * we find \f$ \bar g \f$ by solving the LP:
476  *
477  * \f{align*}{
478  * \max \, & \bar \alpha^T T^{-1}(x^*) + \bar \beta \\
479  * s.t. \; & \bar \alpha^T u + \bar \beta \le f(T(u)), \, \forall u \in \{0, 1\}^n
480  * \f}
481  *
482  * and recover \f$ g \f$ by calculating \f$ \bar \alpha_i = (u_i - \ell_i) \alpha_i, \bar \beta = \sum_i \alpha_i \ell_i +
483  * \beta \f$. Notice that \f$ f(T(u^i)) = f(v^i) \f$ so the right hand side doesn't change after the change of variables.
484  *
485  * Furthermore, the LP has more constraints than variables, so we solve its dual:
486  * \f{align*}{
487  * \min \, & \sum_i \lambda_i f(v^i) \\
488  * s.t. \; & \sum_i \lambda_i u^i = T^{-1}(x^*) \\
489  * & \sum_i \lambda_i = 1 \\
490  * & \forall i, \, \lambda_i \geq 0
491  * \f}
492  *
493  * In case we look for an overestimate, we do exactly the same, but have to maximize in the dual LP instead
494  * of minimize.
495  *
496  * #### Technical and implementation details
497  * -# \f$ U \f$ has exponentially many variables, so we only apply this separator for \f$n\f$ &le; \ref SCIP_MAXVERTEXPOLYDIM.
498  * -# If the bounds are not finite, there is no underestimator. Also, \f$ T^{-1}(x^*) \f$ must be in the domain,
499  * otherwise the dual is infeasible.
500  * -# After a facet is computed, we check whether it is a valid facet (i.e. we check \f$ \alpha^T v + \beta \le f(v) \f$
501  * for every vertex \f$ v \f$). If we find a violation of at most ADJUSTFACETFACTOR * SCIPlpfeastol(), then we weaken \f$
502  * \beta \f$ by this amount, otherwise, we discard the cut.
503  * -# If a variable is fixed within tolerances, we replace it with its value and compute the facet of the remaining
504  * expression. Note that since we are checking the cut for validity, this will never produce wrong result.
505  * -# If \f$ x^* \f$ is in the boundary of the domain, then the LP has infinitely many solutions, some of which might
506  * have very bad numerical properties. For this reason, we perturb \f$ x^* \f$ to be in the interior of the region.
507  * Furthermore, for some interior points, there might also be infinitely many solutions (e.g. for \f$ x y \f$ in \f$
508  * [0,1]^2 \f$ any point \f$ (x^*, y^*) \f$ such that \f$ y^* = 1 - x^* \f$ has infinitely many solutions). For this
509  * reason, we perturb any given \f$ x^* \f$. The idea is to try to get a facet of the convex/concave envelope. This only
510  * happens when the solution has \f$ n + 1 \f$ non zero \f$ \lambda \f$'s (i.e. the primal has a unique solution).
511  * -# We need to compute \f$ f(v^i) \f$ for every vertex of \f$ [\ell,u] \f$. A vertex is encoded by a number between 0
512  * and \f$ 2^n - 1 \f$, via its binary representation (0 bit is lower bound, 1 bit is upper bound), so we can compute
513  * all these values by iterating between 0 and \f$ 2^n - 1 \f$.
514  * -# To check that the computed cut is valid we do the following: we use a gray code to loop over the vertices
515  * of the box domain w.r.t. unfixed variables in order to evaluate the underestimator. To ensure the validity of the
516  * underestimator, we check whether \f$ \alpha v^i + \beta \le f(v^i) \f$ for every vertex \f$ v^i \f$ and adjust
517  * \f$ \beta \f$ if the maximal violation is small.
518  *
519  * @todo the solution is a facet if all variables of the primal have positive reduced costs (i.e. the solution is
520  * unique). In the dual, this means that there are \f$ n + 1 \f$ variables with positive value. Can we use this or some
521  * other information to handle any of both cases (point in the boundary or point in the intersection of polytopes
522  * defining different pieces of the convex envelope)? In the case where the point is in the boundary, can we use that
523  * information to maybe solve another to find a facet? How do the polytopes defining the pieces where the convex
524  * envelope is linear looks like, i.e, given a point in the interior of a facet of the domain, does the midpoint of the
525  * segment joining \f$ x^* \f$ with the center of the domain, always belongs to the interior of one of those polytopes?
526  */
527 SCIP_EXPORT
529  SCIP* scip, /**< SCIP data structure */
530  SCIP_CONSHDLR* conshdlr, /**< nonlinear constraint handler */
531  SCIP_Bool overestimate, /**< whether to compute facet of concave (TRUE) or convex (FALSE) envelope */
532  SCIP_DECL_VERTEXPOLYFUN((*function)), /**< pointer to vertex polyhedral function */
533  void* fundata, /**< data for function evaluation (can be NULL) */
534  SCIP_Real* xstar, /**< point to be separated */
535  SCIP_Real* box, /**< box where to compute facet: should be lb_1, ub_1, lb_2, ub_2... */
536  int nallvars, /**< half of the length of box */
537  SCIP_Real targetvalue, /**< target value: no need to compute facet if value in xstar would be worse than this value */
538  SCIP_Bool* success, /**< buffer to store whether a facet could be computed successfully */
539  SCIP_Real* facetcoefs, /**< buffer to store coefficients of facet defining inequality; must be an array of length at least nallvars */
540  SCIP_Real* facetconstant /**< buffer to store constant part of facet defining inequality */
541  );
542 
543 
544 /* Nonlinear Constraint Methods */
545 
546 /** returns the expression of the given nonlinear constraint */
547 SCIP_EXPORT
549  SCIP_CONS* cons /**< constraint data */
550  );
551 
552 /** gets the left hand side of a nonlinear constraint */
553 SCIP_EXPORT
555  SCIP_CONS* cons /**< constraint data */
556  );
557 
558 /** gets the right hand side of a nonlinear constraint */
559 SCIP_EXPORT
561  SCIP_CONS* cons /**< constraint data */
562  );
563 
564 /** gets the nonlinear constraint as a nonlinear row representation. */
565 SCIP_EXPORT
567  SCIP* scip, /**< SCIP data structure */
568  SCIP_CONS* cons, /**< constraint */
569  SCIP_NLROW** nlrow /**< pointer to store nonlinear row */
570  );
571 
572 /** returns the curvature of the expression of a given nonlinear constraint
573  *
574  * @note The curvature information is computed during CONSINITSOL.
575  */
576 SCIP_EXPORT
578  SCIP_CONS* cons /**< constraint data */
579  );
580 
581 /** checks whether expression of constraint can be represented as quadratic form
582  *
583  * Only sets `*isquadratic` to TRUE if the whole expression is quadratic (in the non-extended formulation) and non-linear.
584  * That is, the expression in each \ref SCIP_QUADEXPR_QUADTERM will be a variable expressions and
585  * \ref SCIPgetVarExprVar() can be used to retrieve the variable.
586  */
587 SCIP_EXPORT
589  SCIP* scip, /**< SCIP data structure */
590  SCIP_CONS* cons, /**< constraint data */
591  SCIP_Bool* isquadratic /**< buffer to store whether constraint is quadratic */
592  );
593 
594 /** changes left-hand-side of a nonlinear constraint
595  *
596  * @attention This method can only be called in the problem stage.
597  */
598 SCIP_EXPORT
600  SCIP* scip, /**< SCIP data structure */
601  SCIP_CONS* cons, /**< constraint data */
602  SCIP_Real lhs /**< new left-hand-side */
603  );
604 
605 /** changes right-hand-side of a nonlinear constraint
606  *
607  * @attention This method can only be called in the problem stage.
608  */
609 SCIP_EXPORT
611  SCIP* scip, /**< SCIP data structure */
612  SCIP_CONS* cons, /**< constraint data */
613  SCIP_Real rhs /**< new right-hand-side */
614  );
615 
616 /** changes expression of a nonlinear constraint
617  *
618  * @attention This method can only be called in the problem stage.
619  */
620 SCIP_EXPORT
622  SCIP* scip, /**< SCIP data structure */
623  SCIP_CONS* cons, /**< constraint data */
624  SCIP_EXPR* expr /**< new expression */
625  );
626 
627 /** adds coef * var to nonlinear constraint
628  *
629  * @attention This method can only be called in the problem stage.
630  */
631 SCIP_EXPORT
633  SCIP* scip, /**< SCIP data structure */
634  SCIP_CONS* cons, /**< constraint data */
635  SCIP_VAR* var, /**< variable */
636  SCIP_Real coef /**< coefficient */
637  );
638 
639 /** adds coef * expr to nonlinear constraint
640  *
641  * @attention This method can only be called in the problem stage.
642  */
643 SCIP_EXPORT
645  SCIP* scip, /**< SCIP data structure */
646  SCIP_CONS* cons, /**< nonlinear constraint */
647  SCIP_EXPR* expr, /**< expression */
648  SCIP_Real coef /**< coefficient */
649  );
650 
651 /** gets absolute violation of nonlinear constraint
652  *
653  * This function evaluates the constraints in the given solution.
654  *
655  * If this value is at most SCIPfeastol(), the constraint would be considered feasible.
656  */
657 SCIP_EXPORT
659  SCIP* scip, /**< SCIP data structure */
660  SCIP_CONS* cons, /**< constraint */
661  SCIP_SOL* sol, /**< solution to check */
662  SCIP_Real* viol /**< buffer to store computed violation */
663  );
664 
665 /** gets scaled violation of nonlinear constraint
666  *
667  * This function evaluates the constraints in the given solution.
668  *
669  * The scaling that is applied to the absolute violation of the constraint
670  * depends on the setting of parameter constraints/nonlinear/violscale.
671  */
672 SCIP_EXPORT
674  SCIP* scip, /**< SCIP data structure */
675  SCIP_CONS* cons, /**< constraint */
676  SCIP_SOL* sol, /**< solution to check */
677  SCIP_Real* viol /**< buffer to store computed violation */
678  );
679 
680 /** returns a variable that appears linearly that may be decreased without making any other constraint infeasible */
681 SCIP_EXPORT
683  SCIP* scip, /**< SCIP data structure */
684  SCIP_CONS* cons, /**< nonlinear constraint */
685  SCIP_VAR** var, /**< pointer to store the variable */
686  SCIP_Real* coef /**< pointer to store the coefficient */
687  );
688 
689 /** returns a variable that appears linearly that may be increased without making any other constraint infeasible */
690 SCIP_EXPORT
692  SCIP* scip, /**< SCIP data structure */
693  SCIP_CONS* cons, /**< nonlinear constraint */
694  SCIP_VAR** var, /**< pointer to store the variable */
695  SCIP_Real* coef /**< pointer to store the coefficient */
696  );
697 
698 
699 /* Methods for Expressions in Nonlinear Constraints
700  * All functions in this group assume that the expression is owned by a the nonlinear constraint handler.
701  */
702 
703 /** returns the number of positive rounding locks of an expression */
704 SCIP_EXPORT
706  SCIP_EXPR* expr /**< expression */
707  );
708 
709 /** returns the number of negative rounding locks of an expression */
710 SCIP_EXPORT
712  SCIP_EXPR* expr /**< expression */
713  );
714 
715 /** returns the variable used for linearizing a given expression (return value might be NULL)
716  *
717  * @note for variable expression it returns the corresponding variable
718  */
719 SCIP_EXPORT
721  SCIP_EXPR* expr /**< expression */
722  );
723 
724 /** returns the number of enforcements for an expression */
725 SCIP_EXPORT
727  SCIP_EXPR* expr /**< expression */
728  );
729 
730 /** returns the data for one of the enforcements of an expression */
731 SCIP_EXPORT
733  SCIP_EXPR* expr, /**< expression */
734  int idx, /**< position of enforcement in enfos array */
735  SCIP_NLHDLR** nlhdlr, /**< buffer to store nlhldr */
736  SCIP_NLHDLREXPRDATA** nlhdlrexprdata, /**< buffer to store nlhdlr data for expression, or NULL */
737  SCIP_NLHDLR_METHOD* nlhdlrparticipation, /**< buffer to store methods where nonlinear handler participates, or NULL */
738  SCIP_Bool* sepabelowusesactivity, /**< buffer to store whether sepabelow uses activity of some expression, or NULL */
739  SCIP_Bool* sepaaboveusesactivity, /**< buffer to store whether sepaabove uses activity of some expression, or NULL */
740  SCIP_Real* auxvalue /**< buffer to store current auxvalue, or NULL */
741  );
742 
743 /** sets the auxiliary value of expression for one of the enforcements of an expression */
744 SCIP_EXPORT
746  SCIP_EXPR* expr, /**< expression */
747  int idx, /**< position of enforcement in enfos array */
748  SCIP_Real auxvalue /**< the new value of auxval */
749  );
750 
751 /** number of nonlinear handlers whose activity computation and propagation methods depend on the activity of the expression
752  *
753  * @note This method can only be used after the detection methods of the nonlinear handlers have been called.
754  */
755 SCIP_EXPORT
757  SCIP_EXPR* expr /**< expression */
758  );
759 
760 /** number of nonlinear handlers whose separation methods (estimate or enforcement) depend on the activity of the expression
761  *
762  * @note This method can only be used after the detection methods of the nonlinear handlers have been called.
763  */
764 SCIP_EXPORT
766  SCIP_EXPR* expr /**< expression */
767  );
768 
769 /** number of nonlinear handlers whose separation methods (estimate or enforcement) use auxiliary variable of the expression
770  *
771  * @note This method can only be used after the detection methods of the nonlinear handlers have been called.
772  */
773 SCIP_EXPORT
775  SCIP_EXPR* expr /**< expression */
776  );
777 
778 /** method to be called by a nlhdlr during NLHDLRDETECT to notify an expression that it will be used
779  *
780  * - if `useauxvar` is enabled, then ensures that an auxiliary variable will be created in INITLP
781  * - if `useactivityforprop` or `useactivityforsepa{below,above}` is enabled, then ensured that activity will be updated for `expr`
782  * - if `useactivityforprop` is enabled, then increments the count returned by SCIPgetExprNPropUsesActivityNonlinear()
783  * - if `useactivityforsepa{below,above}` is enabled, then increments the count returned by SCIPgetExprNSepaUsesActivityNonlinear()
784  * and also increments this count for all variables in the expression.
785  *
786  * The distinction into `useactivityforprop` and `useactivityforsepa{below,above}` is to recognize variables which domain influences
787  * under/overestimators. Domain propagation routines (like OBBT) may invest more work for these variables.
788  * The distinction into `useactivityforsepabelow` and `useactivityforsepaabove` is to recognize whether a nlhdlr that called this method
789  * will use activity of `expr` in enfomethod \ref SCIP_NLHDLR_METHOD_SEPABELOW or \ref SCIP_NLHDLR_METHOD_SEPAABOVE.
790  */
791 SCIP_EXPORT
793  SCIP* scip, /**< SCIP data structure */
794  SCIP_EXPR* expr, /**< expression */
795  SCIP_Bool useauxvar, /**< whether an auxiliary variable will be used for estimate or cut generation */
796  SCIP_Bool useactivityforprop, /**< whether activity of expr will be used by domain propagation or activity calculation (inteval) */
797  SCIP_Bool useactivityforsepabelow, /**< whether activity of expr will be used by underestimation */
798  SCIP_Bool useactivityforsepaabove /**< whether activity of expr will be used by overestimation */
799  );
800 
801 /** computes absolute violation for auxvar relation in an expression w.r.t. original variables
802  *
803  * Assume the expression is f(x), where x are original (i.e., not auxiliary) variables.
804  * Assume that f(x) is associated with auxiliary variable z.
805  *
806  * If there are negative locks, then returns the violation of z &le; f(x) and sets `violover` to TRUE.
807  * If there are positive locks, then returns the violation of z &ge; f(x) and sets `violunder` to TRUE.
808  * Of course, if there both negative and positive locks, then return the violation of z = f(x).
809  *
810  * If necessary, f is evaluated in the given solution. If that fails (domain error),
811  * then `viol` is set to SCIPinfinity() and both `violover` and `violunder` are set to TRUE.
812  */
813 SCIP_EXPORT
815  SCIP* scip, /**< SCIP data structure */
816  SCIP_EXPR* expr, /**< expression */
817  SCIP_SOL* sol, /**< solution */
818  SCIP_Longint soltag, /**< tag of solution */
819  SCIP_Real* viol, /**< buffer to store computed violation */
820  SCIP_Bool* violunder, /**< buffer to store whether z >= f(x) is violated, or NULL */
821  SCIP_Bool* violover /**< buffer to store whether z <= f(x) is violated, or NULL */
822  );
823 
824 /** computes absolute violation for auxvar relation in an expression w.r.t. auxiliary variables
825  *
826  * Assume the expression is f(w), where w are auxiliary variables that were introduced by some nlhdlr.
827  * Assume that f(w) is associated with auxiliary variable z.
828  *
829  * If there are negative locks, then returns the violation of z &le; f(w) and sets `violover` to TRUE.
830  * If there are positive locks, then returns the violation of z &ge; f(w) and sets `violunder` to TRUE.
831  * Of course, if there both negative and positive locks, then return the violation of z = f(w).
832  *
833  * If the given value of f(w) is SCIP_INVALID, then `viol` is set to SCIPinfinity() and
834  * both `violover` and `violunder` are set to TRUE.
835  */
836 SCIP_EXPORT
838  SCIP* scip, /**< SCIP data structure */
839  SCIP_EXPR* expr, /**< expression */
840  SCIP_Real auxvalue, /**< the value of f(w) */
841  SCIP_SOL* sol, /**< solution that has been evaluated */
842  SCIP_Real* viol, /**< buffer to store computed violation */
843  SCIP_Bool* violunder, /**< buffer to store whether z >= f(w) is violated, or NULL */
844  SCIP_Bool* violover /**< buffer to store whether z <= f(w) is violated, or NULL */
845  );
846 
847 /** computes relative violation for auxvar relation in an expression w.r.t. auxiliary variables
848  *
849  * Assume the expression is f(w), where w are auxiliary variables that were introduced by some nlhdlr.
850  * Assume that f(w) is associated with auxiliary variable z.
851  *
852  * Taking the absolute violation from SCIPgetExprAbsAuxViolationNonlinear(), this function returns
853  * the absolute violation divided by max(1,|f(w)|).
854  *
855  * If the given value of f(w) is SCIP_INVALID, then `viol` is set to SCIPinfinity() and
856  * both `violover` and `violunder` are set to TRUE.
857  */
858 SCIP_EXPORT
860  SCIP* scip, /**< SCIP data structure */
861  SCIP_EXPR* expr, /**< expression */
862  SCIP_Real auxvalue, /**< the value of f(w) */
863  SCIP_SOL* sol, /**< solution that has been evaluated */
864  SCIP_Real* viol, /**< buffer to store computed violation */
865  SCIP_Bool* violunder, /**< buffer to store whether z >= f(w) is violated, or NULL */
866  SCIP_Bool* violover /**< buffer to store whether z <= f(w) is violated, or NULL */
867  );
868 
869 /** returns bounds on the expression
870  *
871  * This gives an intersection of bounds from
872  * - activity calculation (SCIPexprGetActivity()), if valid,
873  * - auxiliary variable, if present,
874  * - stored by SCIPtightenExprIntervalNonlinear() during domain propagation
875  *
876  * @note The returned interval can be empty!
877  */
878 SCIP_EXPORT
880  SCIP* scip, /**< SCIP data structure */
881  SCIP_EXPR* expr /**< expression */
882  );
883 
884 /** informs the expression about new bounds that can be used for reverse-propagation and to tighten bounds of
885  * corresponding (auxiliary) variable (if any)
886  *
887  * @attention this function should only be called during domain propagation in cons_nonlinear
888  */
889 SCIP_EXPORT
891  SCIP* scip, /**< SCIP data structure */
892  SCIP_EXPR* expr, /**< expression to be tightened */
893  SCIP_INTERVAL newbounds, /**< new bounds for the expression */
894  SCIP_Bool* cutoff, /**< buffer to store whether a cutoff was detected */
895  int* ntightenings /**< buffer to add the total number of tightenings, or NULL */
896  );
897 
898 /** mark constraints that include this expression to be propagated again
899  *
900  * This can be used by, e.g., nlhdlrs, to trigger a new propagation of constraints without
901  * a change of variable bounds, e.g., because new information on the expression is available
902  * that could potentially lead to tighter expression activity values.
903  *
904  * Note, that this call marks also constraints for propagation which only share some variable
905  * with this expression.
906  */
907 SCIP_EXPORT
909  SCIP* scip, /**< SCIP data structure */
910  SCIP_EXPR* expr /**< expression to propagate again */
911  );
912 
913 /** adds violation-branching score to an expression
914  *
915  * Adds a score to the expression-specific violation-branching score, thereby marking it as branching candidate.
916  * The expression must either be a variable expression or have an aux-variable.
917  * In the latter case, branching on auxiliary variables must have been enabled.
918  * In case of doubt, use SCIPaddExprsViolScoreNonlinear(). Roughly, the difference between these functions is that the current
919  * function adds `violscore` to the expression directly, while SCIPaddExprsViolScoreNonlinear() will split the
920  * violation score among all the given expressions according to parameter constraints/nonlinear/branching/violsplit.
921  *
922  * @see SCIPaddExprsViolScoreNonlinear()
923  */
924 SCIP_EXPORT
926  SCIP* scip, /**< SCIP data structure */
927  SCIP_EXPR* expr, /**< expression where to add branching score */
928  SCIP_Real violscore /**< violation score to add to expression */
929  );
930 
931 /** adds violation-branching score to a set of expressions, distributing the score among all the expressions
932  *
933  * Each expression must either be a variable expression or have an aux-variable.
934  * If branching on aux-variables is disabled, then the violation branching score will be distributed among all
935  * variables present in `exprs`.
936  */
937 SCIP_EXPORT
939  SCIP* scip, /**< SCIP data structure */
940  SCIP_EXPR** exprs, /**< expressions where to add branching score */
941  int nexprs, /**< number of expressions */
942  SCIP_Real violscore, /**< violation score to add to expression */
943  SCIP_SOL* sol, /**< current solution */
944  SCIP_Bool* success /**< buffer to store whether at least one violscore was added */
945  );
946 
947 /** gives violation-branching score stored in expression, or 0.0 if no valid score has been stored */
948 SCIP_EXPORT
950  SCIP_EXPR* expr /**< expression */
951  );
952 
953 /** returns the partial derivative of an expression w.r.t. a variable (or SCIP_INVALID if there was an evaluation error)
954  *
955  * @see SCIPexprGetDerivative()
956  */
957 SCIP_EXPORT
959  SCIP* scip, /**< SCIP data structure */
960  SCIP_EXPR* expr, /**< root expression of constraint used in the last SCIPevalExprGradient() call */
961  SCIP_VAR* var /**< variable (needs to be in the expression) */
962  );
963 
964 /** returns the var's coordinate of Hu partial derivative of an expression w.r.t. a variable (or SCIP_INVALID if there was an evaluation error)
965  *
966  * @see SCIPexprGetBardot()
967  */
968 SCIP_EXPORT
970  SCIP* scip, /**< SCIP data structure */
971  SCIP_EXPR* expr, /**< root expression of constraint used in the last SCIPevalExprHessianDir() call */
972  SCIP_VAR* var /**< variable (needs to be in the expression) */
973  );
974 
975 /** evaluates quadratic term in a solution w.r.t. auxiliary variables
976  *
977  * \note This requires that for every expr used in the quadratic data, a variable or auxiliary variable is available.
978  */
979 SCIP_EXPORT
981  SCIP* scip, /**< SCIP data structure */
982  SCIP_EXPR* expr, /**< quadratic expression */
983  SCIP_SOL* sol /**< solution to evaluate, or NULL for LP solution */
984  );
985 
986 /** @} */
987 /** @} */
988 
989 /**@addtogroup PublicNlhdlrInterfaceMethods
990  * @{
991  */
992 
993 /** creates a nonlinear handler and includes it into the nonlinear constraint handler */
994 SCIP_EXPORT
996  SCIP* scip, /**< SCIP data structure */
997  SCIP_NLHDLR** nlhdlr, /**< buffer where to store nonlinear handler */
998  const char* name, /**< name of nonlinear handler (must not be NULL) */
999  const char* desc, /**< description of nonlinear handler (can be NULL) */
1000  int detectpriority, /**< detection priority of nonlinear handler */
1001  int enfopriority, /**< enforcement priority of nonlinear handler */
1002  SCIP_DECL_NLHDLRDETECT((*detect)), /**< structure detection callback of nonlinear handler */
1003  SCIP_DECL_NLHDLREVALAUX((*evalaux)), /**< auxiliary evaluation callback of nonlinear handler */
1004  SCIP_NLHDLRDATA* nlhdlrdata /**< data of nonlinear handler (can be NULL) */
1005  );
1006 
1007 /** get number of nonlinear handler */
1008 SCIP_EXPORT
1010  SCIP_CONSHDLR* conshdlr /**< nonlinear constraint handler */
1011  );
1012 
1013 /** get nonlinear handlers */
1014 SCIP_EXPORT
1016  SCIP_CONSHDLR* conshdlr /**< nonlinear constraint handler */
1017  );
1018 /** returns a nonlinear handler of a given name (or NULL if not found) */
1019 SCIP_EXPORT
1021  SCIP_CONSHDLR* conshdlr, /**< nonlinear constraint handler */
1022  const char* name /**< name of nonlinear handler */
1023  );
1024 
1025 /** gives expression data that a given nonlinear handler stored in an expression
1026  *
1027  * Returns NULL if expr has not been detected by nlhdlr or nlhdlr did not store data.
1028  */
1029 SCIP_EXPORT
1031  SCIP_NLHDLR* nlhdlr, /**< nonlinear handler */
1032  SCIP_EXPR* expr /**< expression */
1033  );
1034 
1035 /** @} */
1036 
1037 #ifdef __cplusplus
1038 }
1039 #endif
1040 
1041 #endif
enum SCIP_Result SCIP_RESULT
Definition: type_result.h:52
SCIP_RETCODE SCIPcreateConsBasicSignpowerNonlinear(SCIP *scip, SCIP_CONS **cons, const char *name, SCIP_VAR *x, SCIP_VAR *z, SCIP_Real exponent, SCIP_Real xoffset, SCIP_Real zcoef, SCIP_Real lhs, SCIP_Real rhs)
void SCIPaddExprViolScoreNonlinear(SCIP *scip, SCIP_EXPR *expr, SCIP_Real violscore)
SCIP_RETCODE SCIPinsertBilinearTermExistingNonlinear(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_VAR *x, SCIP_VAR *y, SCIP_VAR *auxvar, int nlockspos, int nlocksneg)
SCIP_RETCODE SCIPincludeConsUpgradeNonlinear(SCIP *scip, SCIP_DECL_NONLINCONSUPGD((*nlconsupgd)), int priority, SCIP_Bool active, const char *conshdlrname)
unsigned int SCIPgetExprNAuxvarUsesNonlinear(SCIP_EXPR *expr)
SCIP_RETCODE SCIPchgExprNonlinear(SCIP *scip, SCIP_CONS *cons, SCIP_EXPR *expr)
SCIP_RETCODE SCIPgetRelViolationNonlinear(SCIP *scip, SCIP_CONS *cons, SCIP_SOL *sol, SCIP_Real *viol)
SCIP_Real SCIPgetRhsNonlinear(SCIP_CONS *cons)
SCIP_RETCODE SCIPregisterExprUsageNonlinear(SCIP *scip, SCIP_EXPR *expr, SCIP_Bool useauxvar, SCIP_Bool useactivityforprop, SCIP_Bool useactivityforsepabelow, SCIP_Bool useactivityforsepaabove)
SCIP_Bool SCIPassumeConvexNonlinear(SCIP_CONSHDLR *conshdlr)
SCIP_RETCODE SCIPmarkExprPropagateNonlinear(SCIP *scip, SCIP_EXPR *expr)
int SCIPgetNBilinTermsNonlinear(SCIP_CONSHDLR *conshdlr)
SCIP_NLHDLREXPRDATA * SCIPgetNlhdlrExprDataNonlinear(SCIP_NLHDLR *nlhdlr, SCIP_EXPR *expr)
SCIP_RETCODE SCIPchgRhsNonlinear(SCIP *scip, SCIP_CONS *cons, SCIP_Real rhs)
SCIP_RETCODE SCIPgetNlRowNonlinear(SCIP *scip, SCIP_CONS *cons, SCIP_NLROW **nlrow)
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:54
SCIP_NLHDLR * SCIPfindNlhdlrNonlinear(SCIP_CONSHDLR *conshdlr, const char *name)
#define SCIP_DECL_NLHDLRDETECT(x)
Definition: type_nlhdlr.h:168
int SCIPgetBilinTermIdxNonlinear(SCIP_CONSHDLR *conshdlr, SCIP_VAR *x, SCIP_VAR *y)
static GRAPHNODE ** active
void SCIPincrementCurBoundsTagNonlinear(SCIP_CONSHDLR *conshdlr, SCIP_Bool boundrelax)
SCIP_EXPRCURV SCIPgetCurvatureNonlinear(SCIP_CONS *cons)
SCIP_VAR ** x
Definition: circlepacking.c:54
SCIP_HASHMAP * SCIPgetVarExprHashmapNonlinear(SCIP_CONSHDLR *conshdlr)
SCIP_RETCODE SCIPcreateConsBasicSOCNonlinear(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_RETCODE SCIPgetAbsViolationNonlinear(SCIP *scip, SCIP_CONS *cons, SCIP_SOL *sol, SCIP_Real *viol)
type definitions related to nonlinear handlers of nonlinear constraints
SCIP_NLHDLR ** SCIPgetNlhdlrsNonlinear(SCIP_CONSHDLR *conshdlr)
#define SCIP_DECL_NONLINCONSUPGD(x)
SCIP_Real SCIPgetExprViolScoreNonlinear(SCIP_EXPR *expr)
SCIP_RETCODE SCIPcreateConsBasicQuadraticNonlinear(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 SCIPcomputeFacetVertexPolyhedralNonlinear(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_Bool overestimate, SCIP_DECL_VERTEXPOLYFUN((*function)), void *fundata, SCIP_Real *xstar, SCIP_Real *box, int nallvars, SCIP_Real targetvalue, SCIP_Bool *success, SCIP_Real *facetcoefs, SCIP_Real *facetconstant)
int SCIPgetExprNEnfosNonlinear(SCIP_EXPR *expr)
#define SCIP_DECL_NLHDLREVALAUX(x)
Definition: type_nlhdlr.h:193
SCIP_RETCODE SCIPgetExprAbsOrigViolationNonlinear(SCIP *scip, SCIP_EXPR *expr, SCIP_SOL *sol, SCIP_Longint soltag, SCIP_Real *viol, SCIP_Bool *violunder, SCIP_Bool *violover)
SCIP_RETCODE SCIPcollectBilinTermsNonlinear(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS **conss, int nconss)
SCIP_RETCODE SCIPincludeNlhdlrNonlinear(SCIP *scip, SCIP_NLHDLR **nlhdlr, const char *name, const char *desc, int detectpriority, int enfopriority, SCIP_DECL_NLHDLRDETECT((*detect)), SCIP_DECL_NLHDLREVALAUX((*evalaux)), SCIP_NLHDLRDATA *nlhdlrdata)
SCIP_RETCODE SCIPcreateConsBasicNonlinear(SCIP *scip, SCIP_CONS **cons, const char *name, SCIP_EXPR *expr, SCIP_Real lhs, SCIP_Real rhs)
SCIP_RETCODE SCIPcreateConsQuadraticNonlinear(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 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_EXPR * SCIPgetExprNonlinear(SCIP_CONS *cons)
unsigned int SCIPgetExprNPropUsesActivityNonlinear(SCIP_EXPR *expr)
SCIP_CONSNONLINEAR_BILINTERM * SCIPgetBilinTermNonlinear(SCIP_CONSHDLR *conshdlr, SCIP_VAR *x, SCIP_VAR *y)
SCIP_RETCODE SCIPaddExprNonlinear(SCIP *scip, SCIP_CONS *cons, SCIP_EXPR *expr, SCIP_Real coef)
SCIP_Real SCIPgetExprPartialDiffGradientDirNonlinear(SCIP *scip, SCIP_EXPR *expr, SCIP_VAR *var)
void SCIPgetExprEnfoDataNonlinear(SCIP_EXPR *expr, int idx, SCIP_NLHDLR **nlhdlr, SCIP_NLHDLREXPRDATA **nlhdlrexprdata, SCIP_NLHDLR_METHOD *nlhdlrparticipation, SCIP_Bool *sepabelowusesactivity, SCIP_Bool *sepaaboveusesactivity, SCIP_Real *auxvalue)
SCIP_RETCODE SCIPaddLinearVarNonlinear(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var, SCIP_Real coef)
int SCIPgetExprNLocksNegNonlinear(SCIP_EXPR *expr)
SCIP_RETCODE SCIPcheckQuadraticNonlinear(SCIP *scip, SCIP_CONS *cons, SCIP_Bool *isquadratic)
SCIP_Real SCIPgetExprPartialDiffNonlinear(SCIP *scip, SCIP_EXPR *expr, SCIP_VAR *var)
#define SCIP_Bool
Definition: def.h:84
SCIP_CONSNONLINEAR_BILINTERM * SCIPgetBilinTermsNonlinear(SCIP_CONSHDLR *conshdlr)
SCIP_EXPRCURV
Definition: type_expr.h:48
unsigned int SCIP_NLHDLR_METHOD
Definition: type_nlhdlr.h:48
SCIP_RETCODE SCIPchgLhsNonlinear(SCIP *scip, SCIP_CONS *cons, SCIP_Real lhs)
SCIP_Longint SCIPgetLastBoundRelaxTagNonlinear(SCIP_CONSHDLR *conshdlr)
SCIP_Real SCIPevalBilinAuxExprNonlinear(SCIP *scip, SCIP_VAR *x, SCIP_VAR *y, SCIP_CONSNONLINEAR_AUXEXPR *auxexpr, SCIP_SOL *sol)
SCIP_RETCODE SCIPtightenExprIntervalNonlinear(SCIP *scip, SCIP_EXPR *expr, SCIP_INTERVAL newbounds, SCIP_Bool *cutoff, int *ntightenings)
int SCIPgetExprNLocksPosNonlinear(SCIP_EXPR *expr)
SCIP_RETCODE SCIPprocessRowprepNonlinear(SCIP *scip, SCIP_NLHDLR *nlhdlr, SCIP_CONS *cons, SCIP_EXPR *expr, SCIP_ROWPREP *rowprep, SCIP_Bool overestimate, SCIP_VAR *auxvar, SCIP_Real auxvalue, SCIP_Bool allowweakcuts, SCIP_Bool branchscoresuccess, SCIP_Bool inenforcement, SCIP_SOL *sol, SCIP_RESULT *result)
void SCIPgetLinvarMayDecreaseNonlinear(SCIP *scip, SCIP_CONS *cons, SCIP_VAR **var, SCIP_Real *coef)
SCIP_Longint SCIPgetCurBoundsTagNonlinear(SCIP_CONSHDLR *conshdlr)
#define SCIP_DECL_VERTEXPOLYFUN(f)
SCIP_RETCODE SCIPgetExprAbsAuxViolationNonlinear(SCIP *scip, SCIP_EXPR *expr, SCIP_Real auxvalue, SCIP_SOL *sol, SCIP_Real *viol, SCIP_Bool *violunder, SCIP_Bool *violover)
int SCIPgetNNlhdlrsNonlinear(SCIP_CONSHDLR *conshdlr)
SCIP_RETCODE SCIPincludeConshdlrNonlinear(SCIP *scip)
SCIP_RETCODE SCIPaddExprsViolScoreNonlinear(SCIP *scip, SCIP_EXPR **exprs, int nexprs, SCIP_Real violscore, SCIP_SOL *sol, SCIP_Bool *success)
#define SCIP_Real
Definition: def.h:177
SCIP_VAR ** y
Definition: circlepacking.c:55
SCIP_RETCODE SCIPgetExprRelAuxViolationNonlinear(SCIP *scip, SCIP_EXPR *expr, SCIP_Real auxvalue, SCIP_SOL *sol, SCIP_Real *viol, SCIP_Bool *violunder, SCIP_Bool *violover)
SCIP_RETCODE SCIPcreateConsNonlinear(SCIP *scip, SCIP_CONS **cons, const char *name, SCIP_EXPR *expr, 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)
#define SCIP_Longint
Definition: def.h:162
struct SCIP_NlhdlrExprData SCIP_NLHDLREXPRDATA
Definition: type_nlhdlr.h:404
struct SCIP_NlhdlrData SCIP_NLHDLRDATA
Definition: type_nlhdlr.h:403
SCIP_RETCODE SCIPinsertBilinearTermImplicitNonlinear(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_VAR *x, SCIP_VAR *y, SCIP_VAR *auxvar, SCIP_Real coefx, SCIP_Real coefy, SCIP_Real coefaux, SCIP_Real cst, SCIP_Bool overestimate)
void SCIPsetExprEnfoAuxValueNonlinear(SCIP_EXPR *expr, int idx, SCIP_Real auxvalue)
unsigned int SCIPgetExprNSepaUsesActivityNonlinear(SCIP_EXPR *expr)
SCIP_VAR * SCIPgetExprAuxVarNonlinear(SCIP_EXPR *expr)
SCIP_Real SCIPevalExprQuadraticAuxNonlinear(SCIP *scip, SCIP_EXPR *expr, SCIP_SOL *sol)
SCIP_INTERVAL SCIPgetExprBoundsNonlinear(SCIP *scip, SCIP_EXPR *expr)
SCIP_Real SCIPgetLhsNonlinear(SCIP_CONS *cons)
SCIP_CONSNONLINEAR_AUXEXPR ** exprs
SCIP callable library.
void SCIPgetLinvarMayIncreaseNonlinear(SCIP *scip, SCIP_CONS *cons, SCIP_VAR **var, SCIP_Real *coef)