Scippy

SCIP

Solving Constraint Integer Programs

pub_expr.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-2015 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 nlpi/pub_expr.h
17  * @brief public methods for expressions, expression trees, expression graphs, and related stuff
18  * @author Stefan Vigerske
19  * @author Thorsten Gellermann
20  */
21 
22 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
23 
24 #ifndef __NLPI_PUB_EXPR_H__
25 #define __NLPI_PUB_EXPR_H__
26 
27 #include "scip/def.h"
28 #include "scip/pub_message.h"
29 #include "scip/intervalarith.h"
30 #include "blockmemshell/memory.h"
31 #include "nlpi/type_expr.h"
33 
34 #ifdef NDEBUG
35 #include "nlpi/struct_expr.h"
36 #endif
37 
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41 
42 /**@name Expression curvature methods */
43 /**@{ */
44 
45 /** gives curvature for a sum of two functions with given curvature */
46 extern
48  SCIP_EXPRCURV curv1, /**< curvature of first summand */
49  SCIP_EXPRCURV curv2 /**< curvature of second summand */
50  );
51 
52 #ifdef NDEBUG
53 #define SCIPexprcurvAdd(curv1, curv2) ((SCIP_EXPRCURV) ((curv1) & (curv2)))
54 #endif
55 
56 /** gives the curvature for the negation of a function with given curvature */
57 extern
59  SCIP_EXPRCURV curvature /**< curvature of function */
60  );
61 
62 /** gives curvature for a functions with given curvature multiplied by a constant factor */
63 extern
65  SCIP_Real factor, /**< constant factor */
66  SCIP_EXPRCURV curvature /**< curvature of other factor */
67  );
68 
69 /** gives curvature for base^exponent for given bounds and curvature of base-function and constant exponent */
70 extern
72  SCIP_INTERVAL basebounds, /**< bounds on base function */
73  SCIP_EXPRCURV basecurv, /**< curvature of base function */
74  SCIP_Real exponent /**< exponent */
75  );
76 
77 /** gives curvature for a monomial with given curvatures and bounds for each factor */
78 extern
80  int nfactors, /**< number of factors in monomial */
81  SCIP_Real* exponents, /**< exponents in monomial, or NULL if all 1.0 */
82  int* factoridxs, /**< indices of factors, or NULL if identity mapping */
83  SCIP_EXPRCURV* factorcurv, /**< curvature of each factor */
84  SCIP_INTERVAL* factorbounds /**< bounds of each factor */
85  );
86 
87 /** gives name as string for a curvature */
88 extern
89 const char* SCIPexprcurvGetName(
90  SCIP_EXPRCURV curv /**< curvature */
91  );
92 
93 /**@} */
94 
95 /**@name Expression operand methods */
96 /**@{ */
97 
98 /** gives the name of an operand */
99 extern
100 const char* SCIPexpropGetName(
101  SCIP_EXPROP op /**< expression operand */
102  );
103 
104 /** gives the number of children of a simple operand
105  * @return -1 for invalid operands and -2 for complex operands (those where the number of children depends on the expression)
106  */
107 extern
109  SCIP_EXPROP op /**< expression operand */
110  );
111 
112 /**@} */
113 
114 /**@name Expression methods */
115 /**@{ */
116 
117 /** gives operator of expression */
118 extern
120  SCIP_EXPR* expr /**< expression */
121  );
122 
123 /** gives number of children of an expression */
124 extern
126  SCIP_EXPR* expr /**< expression */
127  );
128 
129 /** gives pointer to array with children of an expression */
130 extern
132  SCIP_EXPR* expr /**< expression */
133  );
134 
135 /** gives index belonging to a SCIP_EXPR_VARIDX or SCIP_EXPR_PARAM operand */
136 extern
138  SCIP_EXPR* expr /**< expression */
139  );
140 
141 /** gives real belonging to a SCIP_EXPR_CONST operand */
142 extern
144  SCIP_EXPR* expr /**< expression */
145  );
146 
147 /** gives void* belonging to a complex operand */
148 extern
149 void* SCIPexprGetOpData(
150  SCIP_EXPR* expr /**< expression */
151  );
152 
153 /** gives exponent belonging to a SCIP_EXPR_REALPOWER expression */
154 extern
156  SCIP_EXPR* expr /**< expression */
157  );
158 
159 /** gives exponent belonging to a SCIP_EXPR_INTPOWER expression */
160 extern
162  SCIP_EXPR* expr /**< expression */
163  );
164 
165 /** gives exponent belonging to a SCIP_EXPR_SIGNPOWER expression */
166 extern
168  SCIP_EXPR* expr /**< expression */
169  );
170 
171 /** gives linear coefficients belonging to a SCIP_EXPR_LINEAR expression */
172 extern
174  SCIP_EXPR* expr /**< expression */
175  );
176 
177 /** gives constant belonging to a SCIP_EXPR_LINEAR expression */
178 extern
180  SCIP_EXPR* expr /**< expression */
181  );
182 
183 /** gives quadratic elements belonging to a SCIP_EXPR_QUADRATIC expression */
184 extern
186  SCIP_EXPR* expr /**< quadratic expression */
187  );
188 
189 /** gives constant belonging to a SCIP_EXPR_QUADRATIC expression */
190 extern
192  SCIP_EXPR* expr /**< quadratic expression */
193  );
194 
195 /** gives linear coefficients belonging to a SCIP_EXPR_QUADRATIC expression
196  * can be NULL if all coefficients are 0.0 */
197 extern
199  SCIP_EXPR* expr /**< quadratic expression */
200  );
201 
202 /** gives number of quadratic elements belonging to a SCIP_EXPR_QUADRATIC expression */
203 extern
205  SCIP_EXPR* expr /**< quadratic expression */
206  );
207 
208 /** gives the monomials belonging to a SCIP_EXPR_POLYNOMIAL expression */
209 extern
211  SCIP_EXPR* expr /**< expression */
212  );
213 
214 /** gives the number of monomials belonging to a SCIP_EXPR_POLYNOMIAL expression */
215 extern
217  SCIP_EXPR* expr /**< expression */
218  );
219 
220 /** gives the constant belonging to a SCIP_EXPR_POLYNOMIAL expression */
221 extern
223  SCIP_EXPR* expr /**< expression */
224  );
225 
226 /** gets coefficient of a monomial */
227 extern
229  SCIP_EXPRDATA_MONOMIAL* monomial /**< monomial */
230  );
231 
232 /** gets number of factors of a monomial */
233 extern
235  SCIP_EXPRDATA_MONOMIAL* monomial /**< monomial */
236  );
237 
238 /** gets indices of children corresponding to factors of a monomial */
239 extern
241  SCIP_EXPRDATA_MONOMIAL* monomial /**< monomial */
242  );
243 
244 /** gets exponents in factors of a monomial */
245 extern
247  SCIP_EXPRDATA_MONOMIAL* monomial /**< monomial */
248  );
249 
250 /** gets user data of a user expression */
251 extern
253  SCIP_EXPR* expr
254  );
255 
256 /** indicates whether a user expression has the estimator callback defined */
257 extern
259  SCIP_EXPR* expr
260  );
261 
262 /** gives the evaluation capability of a user expression */
263 extern
265  SCIP_EXPR* expr
266  );
267 
268 #ifdef NDEBUG
269 
270 /* In optimized mode, the function calls are overwritten by defines to reduce the number of function calls and
271  * speed up the algorithms.
272  */
273 
274 #define SCIPexprGetOperator(expr) (expr)->op
275 #define SCIPexprGetNChildren(expr) (expr)->nchildren
276 #define SCIPexprGetChildren(expr) (expr)->children
277 #define SCIPexprGetOpIndex(expr) (expr)->data.intval
278 #define SCIPexprGetOpReal(expr) (expr)->data.dbl
279 #define SCIPexprGetOpData(expr) (expr)->data.data
280 #define SCIPexprGetRealPowerExponent(expr) (expr)->data.dbl
281 #define SCIPexprGetIntPowerExponent(expr) (expr)->data.intval
282 #define SCIPexprGetSignPowerExponent(expr) (expr)->data.dbl
283 #define SCIPexprGetLinearCoefs(expr) ((SCIP_Real*)(expr)->data.data)
284 #define SCIPexprGetLinearConstant(expr) (((SCIP_Real*)(expr)->data.data)[(expr)->nchildren])
285 #define SCIPexprGetQuadElements(expr) ((SCIP_EXPRDATA_QUADRATIC*)(expr)->data.data)->quadelems
286 #define SCIPexprGetQuadConstant(expr) ((SCIP_EXPRDATA_QUADRATIC*)(expr)->data.data)->constant
287 #define SCIPexprGetQuadLinearCoefs(expr) ((SCIP_EXPRDATA_QUADRATIC*)(expr)->data.data)->lincoefs
288 #define SCIPexprGetNQuadElements(expr) ((SCIP_EXPRDATA_QUADRATIC*)(expr)->data.data)->nquadelems
289 #define SCIPexprGetMonomials(expr) ((SCIP_EXPRDATA_POLYNOMIAL*)(expr)->data.data)->monomials
290 #define SCIPexprGetNMonomials(expr) ((SCIP_EXPRDATA_POLYNOMIAL*)(expr)->data.data)->nmonomials
291 #define SCIPexprGetPolynomialConstant(expr) ((SCIP_EXPRDATA_POLYNOMIAL*)(expr)->data.data)->constant
292 #define SCIPexprGetMonomialCoef(monomial) (monomial)->coef
293 #define SCIPexprGetMonomialNFactors(monomial) (monomial)->nfactors
294 #define SCIPexprGetMonomialChildIndices(monomial) (monomial)->childidxs
295 #define SCIPexprGetMonomialExponents(monomial) (monomial)->exponents
296 #define SCIPexprGetUserData(expr) ((SCIP_EXPRDATA_USER*)(expr)->data.data)->userdata
297 #define SCIPexprHasUserEstimator(expr) (((SCIP_EXPRDATA_USER*)expr->data.data)->estimate != NULL)
298 #define SCIPexprGetUserEvalCapability(expr) (((SCIP_EXPRDATA_USER*)expr->data.data)->evalcapability)
299 
300 #endif
301 
302 /** creates a simple expression */
303 extern
305  BMS_BLKMEM* blkmem, /**< block memory data structure */
306  SCIP_EXPR** expr, /**< pointer to buffer for expression address */
307  SCIP_EXPROP op, /**< operand of expression */
308  ... /**< arguments of operand */
309  );
310 
311 /** copies an expression including its children */
312 extern
314  BMS_BLKMEM* blkmem, /**< block memory data structure */
315  SCIP_EXPR** targetexpr, /**< buffer to store pointer to copied expression */
316  SCIP_EXPR* sourceexpr /**< expression to copy */
317  );
318 
319 /** frees an expression including its children */
320 extern
321 void SCIPexprFreeDeep(
322  BMS_BLKMEM* blkmem, /**< block memory data structure */
323  SCIP_EXPR** expr /**< pointer to expression to free */
324  );
325 
326 /** frees an expression but not its children */
327 extern
329  BMS_BLKMEM* blkmem, /**< block memory data structure */
330  SCIP_EXPR** expr /**< pointer to expression to free */
331  );
332 
333 /** creates an expression from the addition of two given expression, with coefficients, and a constant
334  *
335  * the given expressions may be modified or freed, otherwise it will be used a child expression
336  * favors creation and maintaining of SCIP_EXPR_LINEAR over SCIP_EXPR_PLUS or SCIP_EXPR_SUM
337  */
338 extern
340  BMS_BLKMEM* blkmem, /**< block memory data structure */
341  SCIP_EXPR** expr, /**< pointer to store pointer to created expression */
342  SCIP_Real coef1, /**< coefficient of first term */
343  SCIP_EXPR* term1, /**< expression of first term, or NULL */
344  SCIP_Real coef2, /**< coefficient of second term */
345  SCIP_EXPR* term2, /**< expression of second term, or NULL */
346  SCIP_Real constant /**< constant term to add */
347  );
348 
349 /** creates an expression from the multiplication of an expression with a constant
350  *
351  * the given expressions may be modified or freed, otherwise it will be used a child expression
352  * favors creation of SCIP_EXPR_LINEAR over SCIP_EXPR_MUP or SCIP_EXPR_PROD
353  */
354 extern
356  BMS_BLKMEM* blkmem, /**< block memory data structure */
357  SCIP_EXPR** expr, /**< buffer to store pointer to created expression */
358  SCIP_EXPR* term, /**< term to multiply by factor */
359  SCIP_Real factor /**< factor */
360  );
361 
362 /** creates a SCIP_EXPR_LINEAR expression that is (affine) linear in its children: constant + sum_i coef_i child_i */
363 extern
365  BMS_BLKMEM* blkmem, /**< block memory data structure */
366  SCIP_EXPR** expr, /**< pointer to buffer for expression address */
367  int nchildren, /**< number of children */
368  SCIP_EXPR** children, /**< children of expression */
369  SCIP_Real* coefs, /**< coefficients of children */
370  SCIP_Real constant /**< constant part */
371  );
372 
373 /** adds new terms to a linear expression */
374 extern
376  BMS_BLKMEM* blkmem, /**< block memory */
377  SCIP_EXPR* expr, /**< linear expression */
378  int nchildren, /**< number of children to add */
379  SCIP_Real* coefs, /**< coefficients of additional children */
380  SCIP_EXPR** children, /**< additional children expressions */
381  SCIP_Real constant /**< constant to add */
382  );
383 
384 /** creates a SCIP_EXPR_QUADRATIC expression: constant + sum_i coef_i child_i + sum_i coef_i child1_i child2_i */
386  BMS_BLKMEM* blkmem, /**< block memory data structure */
387  SCIP_EXPR** expr, /**< pointer to buffer for expression address */
388  int nchildren, /**< number of children */
389  SCIP_EXPR** children, /**< children of expression */
390  SCIP_Real constant, /**< constant */
391  SCIP_Real* lincoefs, /**< linear coefficients of children, or NULL if all 0.0 */
392  int nquadelems, /**< number of quadratic elements */
393  SCIP_QUADELEM* quadelems /**< quadratic elements specifying coefficients and child indices */
394  );
395 
396 /** ensures that quadratic elements of a quadratic expression are sorted */
397 extern
399  SCIP_EXPR* expr /**< quadratic expression */
400  );
401 
402 /** creates a SCIP_EXPR_POLYNOMIAL expression from an array of monomials: constant + sum_i monomial_i */
403 extern
405  BMS_BLKMEM* blkmem, /**< block memory data structure */
406  SCIP_EXPR** expr, /**< pointer to buffer for expression address */
407  int nchildren, /**< number of children */
408  SCIP_EXPR** children, /**< children of expression */
409  int nmonomials, /**< number of monomials */
410  SCIP_EXPRDATA_MONOMIAL** monomials, /**< monomials */
411  SCIP_Real constant, /**< constant part */
412  SCIP_Bool copymonomials /**< should monomials by copied or ownership be assumed? */
413  );
414 
415 /** adds an array of monomials to a SCIP_EXPR_POLYNOMIAL expression */
416 extern
418  BMS_BLKMEM* blkmem, /**< block memory of expression */
419  SCIP_EXPR* expr, /**< expression */
420  int nmonomials, /**< number of monomials to add */
421  SCIP_EXPRDATA_MONOMIAL** monomials, /**< the monomials to add */
422  SCIP_Bool copymonomials /**< should monomials by copied or ownership be assumed? */
423  );
424 
425 /** changes the constant in a SCIP_EXPR_POLYNOMIAL expression */
426 extern
428  SCIP_EXPR* expr, /**< expression */
429  SCIP_Real constant /**< new value for constant */
430  );
431 
432 /** multiplies each summand of a polynomial by a given constant */
433 extern
435  BMS_BLKMEM* blkmem, /**< block memory */
436  SCIP_EXPR* expr, /**< polynomial expression */
437  SCIP_Real factor /**< constant factor */
438  );
439 
440 /** multiplies each summand of a polynomial by a given monomial */
441 extern
443  BMS_BLKMEM* blkmem, /**< block memory */
444  SCIP_EXPR* expr, /**< polynomial expression */
445  SCIP_EXPRDATA_MONOMIAL* factor, /**< monomial factor */
446  int* childmap /**< map children in factor to children in expr, or NULL for 1:1 */
447  );
448 
449 /** multiplies this polynomial by a polynomial
450  * factor needs to be different from expr */
451 extern
453  BMS_BLKMEM* blkmem, /**< block memory */
454  SCIP_EXPR* expr, /**< polynomial expression */
455  SCIP_EXPR* factor, /**< polynomial factor */
456  int* childmap /**< map children in factor to children in expr, or NULL for 1:1 */
457  );
458 
459 /** takes a power of the polynomial
460  * exponent need to be an integer
461  * polynomial need to be a monomial, if exponent is negative
462  */
463 extern
465  BMS_BLKMEM* blkmem, /**< block memory */
466  SCIP_EXPR* expr, /**< polynomial expression */
467  int exponent /**< exponent of power operation */
468  );
469 
470 /** merges monomials in a polynomial expression that differ only in coefficient into a single monomial
471  * eliminates monomials with coefficient between -eps and eps
472  */
473 extern
475  BMS_BLKMEM* blkmem, /**< block memory */
476  SCIP_EXPR* expr, /**< polynomial expression */
477  SCIP_Real eps, /**< threshold under which numbers are treat as zero */
478  SCIP_Bool mergefactors /**< whether to merge factors in monomials too */
479  );
480 
481 /** creates a monomial */
482 extern
484  BMS_BLKMEM* blkmem, /**< block memory */
485  SCIP_EXPRDATA_MONOMIAL** monomial, /**< buffer where to store pointer to new monomial */
486  SCIP_Real coef, /**< coefficient of monomial */
487  int nfactors, /**< number of factors in monomial */
488  int* childidxs, /**< indices of children corresponding to factors, or NULL if identity */
489  SCIP_Real* exponents /**< exponent in each factor, or NULL if all 1.0 */
490  );
491 
492 /** frees a monomial */
493 extern
495  BMS_BLKMEM* blkmem, /**< block memory */
496  SCIP_EXPRDATA_MONOMIAL** monomial /**< pointer to monomial that should be freed */
497  );
498 
499 /** ensures that factors in a monomial are sorted */
500 extern
502  SCIP_EXPRDATA_MONOMIAL* monomial /**< monomial */
503  );
504 
505 /** finds a factor corresponding to a given child index in a monomial
506  * note that if the factors have not been merged, the position of some factor corresponding to a given child is given
507  * returns TRUE if a factor is found, FALSE if not
508  */
509 extern
511  SCIP_EXPRDATA_MONOMIAL* monomial, /**< monomial */
512  int childidx, /**< index of the child which factor to search for */
513  int* pos /**< buffer to store position of factor */
514  );
515 
516 /** checks if two monomials are equal */
517 extern
519  SCIP_EXPRDATA_MONOMIAL* monomial1, /**< first monomial */
520  SCIP_EXPRDATA_MONOMIAL* monomial2, /**< second monomial */
521  SCIP_Real eps /**< threshold under which numbers are treated as 0.0 */
522  );
523 
524 /** adds factors to a monomial */
525 extern
527  BMS_BLKMEM* blkmem, /**< block memory */
528  SCIP_EXPRDATA_MONOMIAL* monomial, /**< monomial */
529  int nfactors, /**< number of factors to add */
530  int* childidxs, /**< indices of children corresponding to factors */
531  SCIP_Real* exponents /**< exponent in each factor */
532  );
533 
534 /** changes coefficient of monomial */
535 extern
537  SCIP_EXPRDATA_MONOMIAL* monomial, /**< monomial */
538  SCIP_Real newcoef /**< new coefficient */
539  );
540 
541 /** multiplies a monomial with a monomial */
542 extern
544  BMS_BLKMEM* blkmem, /**< block memory */
545  SCIP_EXPRDATA_MONOMIAL* monomial, /**< monomial */
546  SCIP_EXPRDATA_MONOMIAL* factor, /**< factor monomial */
547  int* childmap /**< map to apply to children in factor, or NULL for 1:1 */
548  );
549 
550 /** replaces the monomial by a power of the monomial
551  * allows only integers as exponent
552  */
553 extern
555  SCIP_EXPRDATA_MONOMIAL* monomial, /**< monomial */
556  int exponent /**< integer exponent of power operation */
557  );
558 
559 /** merges factors that correspond to the same child by adding exponents
560  * eliminates factors with exponent between -eps and eps
561  */
562 extern
564  SCIP_EXPRDATA_MONOMIAL* monomial, /**< monomial */
565  SCIP_Real eps /**< threshold under which numbers are treated as 0.0 */
566  );
567 
568 /** ensures that monomials of a polynomial are sorted */
569 extern
571  SCIP_EXPR* expr /**< polynomial expression */
572  );
573 
574 /** creates a user expression */
575 extern
577  BMS_BLKMEM* blkmem, /**< block memory data structure */
578  SCIP_EXPR** expr, /**< pointer to buffer for expression address */
579  int nchildren, /**< number of children */
580  SCIP_EXPR** children, /**< children of expression */
581  SCIP_USEREXPRDATA* data, /**< user data for expression, expression assumes ownership */
582  SCIP_EXPRINTCAPABILITY evalcapability, /**< capability of evaluation functions (partially redundant, currently) */
583  SCIP_DECL_USEREXPREVAL ((*eval)), /**< evaluation function */
584  SCIP_DECL_USEREXPRINTEVAL ((*inteval)), /**< interval evaluation function, or NULL if not implemented */
585  SCIP_DECL_USEREXPRCURV ((*curv)), /**< curvature check function */
586  SCIP_DECL_USEREXPRPROP ((*prop)), /**< interval propagation function, or NULL if not implemented */
587  SCIP_DECL_USEREXPRESTIMATE ((*estimate)), /**< estimation function, or NULL if convex, concave, or not implemented */
588  SCIP_DECL_USEREXPRCOPYDATA ((*copydata)), /**< expression data copy function, or NULL if nothing to copy */
589  SCIP_DECL_USEREXPRFREEDATA ((*freedata)) /**< expression data free function, or NULL if nothing to free */
590  );
591 
592 /** indicates whether the expression contains a SCIP_EXPR_PARAM */
593 extern
595  SCIP_EXPR* expr /**< expression */
596  );
597 
598 /** gets maximal degree of expression, or SCIP_EXPR_DEGREEINFINITY if not a polynomial */
599 extern
601  SCIP_EXPR* expr, /**< expression */
602  int* maxdegree /**< buffer to store maximal degree */
603  );
604 
605 /** counts usage of variables in expression */
606 extern
608  SCIP_EXPR* expr, /**< expression to update */
609  int* varsusage /**< array with counters of variable usage */
610  );
611 
612 /** compares whether two expressions are the same
613  * inconclusive, i.e., may give FALSE even if expressions are equivalent (x*y != y*x)
614  */
615 extern
617  SCIP_EXPR* expr1, /**< first expression */
618  SCIP_EXPR* expr2, /**< second expression */
619  SCIP_Real eps /**< threshold under which numbers are assumed to be zero */
620  );
621 
622 /** aims at simplifying an expression and splitting of a linear expression
623  * if linear variables are split off, expression interpreter data, if stored in the tree, is freed
624  */
625 extern
627  BMS_BLKMEM* blkmem, /**< block memory data structure */
628  SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
629  SCIP_EXPR* expr, /**< expression */
630  SCIP_Real eps, /**< threshold, under which positive values are treat as 0 */
631  int maxexpansionexponent,/**< maximal exponent for which we still expand non-monomial polynomials */
632  int nvars, /**< number of variables in expression */
633  int* nlinvars, /**< buffer to store number of linear variables in linear part, or NULL if linear part should not be separated */
634  int* linidxs, /**< array to store indices of variables in expression tree which belong to linear part, or NULL */
635  SCIP_Real* lincoefs /**< array to store coefficients of linear part, or NULL */
636  );
637 
638 /** evaluates an expression w.r.t. given values for children expressions */
639 extern
641  SCIP_EXPR* expr, /**< expression */
642  SCIP_Real* argvals, /**< values for children, can be NULL if the expression has no children */
643  SCIP_Real* varvals, /**< values for variables, can be NULL if the expression operand is not a variable */
644  SCIP_Real* param, /**< values for parameters, can be NULL if the expression operand is not a parameter */
645  SCIP_Real* val /**< buffer to store value */
646  );
647 
648 /** evaluates an expression w.r.t. a point */
649 extern
651  SCIP_EXPR* expr, /**< expression */
652  SCIP_Real* varvals, /**< values for variables, can be NULL if the expression is constant */
653  SCIP_Real* param, /**< values for parameters, can be NULL if the expression is not parameterized */
654  SCIP_Real* val /**< buffer to store value */
655  );
656 
657 /** evaluates an expression w.r.t. given interval values for children expressions */
658 extern
660  SCIP_EXPR* expr, /**< expression */
661  SCIP_Real infinity, /**< value to use for infinity */
662  SCIP_INTERVAL* argvals, /**< interval values for children, can be NULL if the expression has no children */
663  SCIP_INTERVAL* varvals, /**< interval values for variables, can be NULL if the expression is constant */
664  SCIP_Real* param, /**< values for parameters, can be NULL if the expression is not parameterized */
665  SCIP_INTERVAL* val /**< buffer to store value */
666  );
667 
668 /** evaluates an expression w.r.t. an interval */
669 extern
671  SCIP_EXPR* expr, /**< expression */
672  SCIP_Real infinity, /**< value to use for infinity */
673  SCIP_INTERVAL* varvals, /**< interval values for variables, can be NULL if the expression is constant */
674  SCIP_Real* param, /**< values for parameters, can be NULL if the expression is not parameterized */
675  SCIP_INTERVAL* val /**< buffer to store value */
676  );
677 
678 /** evaluates a user expression w.r.t. given values for children expressions */
679 extern
681  SCIP_EXPR* expr, /**< expression */
682  SCIP_Real* argvals, /**< values for children */
683  SCIP_Real* val, /**< buffer to store function value */
684  SCIP_Real* gradient, /**< buffer to store gradient values, or NULL if not requested */
685  SCIP_Real* hessian /**< buffer to store values of full Hessian, or NULL if not requested */
686  );
687 
688 /** evaluates a user expression w.r.t. an interval */
689 extern
691  SCIP_EXPR* expr, /**< expression */
692  SCIP_Real infinity, /**< value to use for infinity */
693  SCIP_INTERVAL* argvals, /**< values for children */
694  SCIP_INTERVAL* val, /**< buffer to store value */
695  SCIP_INTERVAL* gradient, /**< buffer to store gradient values, or NULL if not requested */
696  SCIP_INTERVAL* hessian /**< buffer to store values of full Hessian, or NULL if not requested */
697  );
698 
699 /** tries to determine the curvature type of an expression w.r.t. given variable domains */
700 extern
702  SCIP_EXPR* expr, /**< expression to check */
703  SCIP_Real infinity, /**< value to use for infinity */
704  SCIP_INTERVAL* varbounds, /**< domains of variables */
705  SCIP_Real* param, /**< values for parameters, can be NULL if the expression is not parameterized */
706  SCIP_EXPRCURV* curv, /**< buffer to store curvature of expression */
707  SCIP_INTERVAL* bounds /**< buffer to store bounds on expression */
708  );
709 
710 /** under-/overestimates a user expression w.r.t. to given values and bounds for children expressions */
711 extern
713  SCIP_EXPR* expr, /**< expression */
714  SCIP_Real infinity, /**< value to use for infinity */
715  SCIP_Real* argvals, /**< values for children */
716  SCIP_INTERVAL* argbounds, /**< bounds for children */
717  SCIP_Bool overestimate, /**< whether to overestimate the expression */
718  SCIP_Real* coeffs, /**< buffer to store the linear coefficients for each child expression that gives a valid under-/overestimator */
719  SCIP_Real* constant, /**< buffer to store the constant value of the linear under-/overestimator */
720  SCIP_Bool* success /**< buffer to store whether an estimator was successfully computed */
721 );
722 
723 
724 /** substitutes variables (SCIP_EXPR_VARIDX) by expressions
725  * Note that only the children of the given expr are checked!
726  * A variable with index i is replaced by a copy of substexprs[i], if that latter is not NULL
727  * if substexprs[i] == NULL, then the variable expression i is not touched
728  */
729 extern
731  BMS_BLKMEM* blkmem, /**< block memory data structure */
732  SCIP_EXPR* expr, /**< expression, which of the children may be replaced */
733  SCIP_EXPR** substexprs /**< array of substitute expressions; single entries can be NULL */
734  );
735 
736 /** updates variable indices in expression tree */
737 extern
739  SCIP_EXPR* expr, /**< expression to update */
740  int* newindices /**< new indices of variables */
741  );
742 
743 /** updates parameter indices in expression tree */
744 extern
746  SCIP_EXPR* expr, /**< expression to update */
747  int* newindices /**< new indices of variables */
748  );
749 
750 /** prints an expression */
751 extern
752 void SCIPexprPrint(
753  SCIP_EXPR* expr, /**< expression */
754  SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
755  FILE* file, /**< file for printing, or NULL for stdout */
756  const char** varnames, /**< names of variables, or NULL for default names */
757  const char** paramnames, /**< names of parameters, or NULL for default names */
758  SCIP_Real* paramvals /**< values of parameters, or NULL for not printing */
759  );
760 
761 /** parses an expression from a string */
762 extern
764  BMS_BLKMEM* blkmem, /**< block memory data structure */
765  SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
766  SCIP_EXPR** expr, /**< buffer to store pointer to created expression */
767  const char* str, /**< pointer to the string to be parsed */
768  const char* lastchar, /**< pointer to the last char of str that should be parsed */
769  int* nvars, /**< buffer to store number of variables */
770  int* varnames /**< buffer to store variable names, prefixed by index (as int) */
771  );
772 
773 /**@} */
774 
775 /**@name Expression tree methods */
776 /**@{ */
777 
778 /** returns root expression of an expression tree */
779 extern
781  SCIP_EXPRTREE* tree /**< expression tree */
782  );
783 
784 /** returns number of variables in expression tree */
785 extern
787  SCIP_EXPRTREE* tree /**< expression tree */
788  );
789 
790 /** returns number of parameters in expression tree */
791 extern
793  SCIP_EXPRTREE* tree /**< expression tree */
794  );
795 
796 /** returns values of parameters or NULL if none */
797 extern
799  SCIP_EXPRTREE* tree /**< expression tree */
800  );
801 
802 /** sets value of a single parameter in expression tree */
803 extern
805  SCIP_EXPRTREE* tree, /**< expression tree */
806  int paramidx, /**< index of parameter */
807  SCIP_Real paramval /**< new value of parameter */
808  );
809 
810 /** gets data of expression tree interpreter, or NULL if not set */
811 extern
813  SCIP_EXPRTREE* tree /**< expression tree */
814  );
815 
816 /** sets data of expression tree interpreter */
817 extern
819  SCIP_EXPRTREE* tree, /**< expression tree */
820  SCIP_EXPRINTDATA* interpreterdata /**< expression interpreter data */
821  );
822 
823 /** frees data of expression tree interpreter, if any */
824 extern
826  SCIP_EXPRTREE* tree /**< expression tree */
827  );
828 
829 /** indicates whether there are parameterized constants (SCIP_EXPR_PARAM) in expression tree */
830 extern
832  SCIP_EXPRTREE* tree /**< expression tree */
833  );
834 
835 /** Gives maximal degree of expression in expression tree.
836  * If constant expression, gives 0,
837  * if linear expression, gives 1,
838  * if polynomial expression, gives its maximal degree,
839  * otherwise (nonpolynomial nonconstant expressions) gives at least SCIP_EXPR_DEGREEINFINITY.
840  */
841 extern
843  SCIP_EXPRTREE* tree, /**< expression tree */
844  int* maxdegree /**< buffer to store maximal degree */
845  );
846 
847 /** evaluates an expression tree w.r.t. a point */
848 extern
850  SCIP_EXPRTREE* tree, /**< expression tree */
851  SCIP_Real* varvals, /**< values for variables */
852  SCIP_Real* val /**< buffer to store expression tree value */
853  );
854 
855 /** evaluates an expression tree w.r.t. an interval */
856 extern
858  SCIP_EXPRTREE* tree, /**< expression tree */
859  SCIP_Real infinity, /**< value for infinity */
860  SCIP_INTERVAL* varvals, /**< intervals for variables */
861  SCIP_INTERVAL* val /**< buffer to store expression tree value */
862  );
863 
864 /** prints an expression tree */
865 extern
866 void SCIPexprtreePrint(
867  SCIP_EXPRTREE* tree, /**< expression tree */
868  SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
869  FILE* file, /**< file for printing, or NULL for stdout */
870  const char** varnames, /**< names of variables, or NULL for default names */
871  const char** paramnames /**< names of parameters, or NULL for default names */
872  );
873 
874 #ifdef NDEBUG
875 
876 /* In optimized mode, the function calls are overwritten by defines to reduce the number of function calls and
877  * speed up the algorithms.
878  */
879 
880 #define SCIPexprtreeGetRoot(tree) (tree)->root
881 #define SCIPexprtreeGetNVars(tree) (tree)->nvars
882 #define SCIPexprtreeGetNParams(tree) (tree)->nparams
883 #define SCIPexprtreeGetParamVals(tree) (tree)->params
884 #define SCIPexprtreeSetParamVal(tree, paramidx, paramval) do { (tree)->params[(paramidx)] = paramval; } while (FALSE)
885 #define SCIPexprtreeGetInterpreterData(tree) (tree)->interpreterdata
886 #define SCIPexprtreeSetInterpreterData(tree, newinterpreterdata) do { (tree)->interpreterdata = newinterpreterdata; } while (FALSE)
887 #define SCIPexprtreeFreeInterpreterData(tree) ((tree)->interpreterdata != NULL ? SCIPexprintFreeData(&(tree)->interpreterdata) : SCIP_OKAY)
888 #define SCIPexprtreeHasParam(tree) SCIPexprHasParam((tree)->root)
889 #define SCIPexprtreeGetMaxDegree(tree, maxdegree) SCIPexprGetMaxDegree((tree)->root, maxdegree)
890 #define SCIPexprtreeEval(tree, varvals, val) SCIPexprEval((tree)->root, varvals, (tree)->params, val)
891 #define SCIPexprtreeEvalInt(tree, infinity, varvals, val) SCIPexprEvalInt((tree)->root, infinity, varvals, (tree)->params, val)
892 #define SCIPexprtreePrint(tree, messagehdlr, file, varnames, paramnames) SCIPexprPrint((tree)->root, messagehdlr, file, varnames, paramnames, (tree)->params)
893 
894 #endif
895 
896 /** creates an expression tree */
897 extern
899  BMS_BLKMEM* blkmem, /**< block memory data structure */
900  SCIP_EXPRTREE** tree, /**< buffer to store address of created expression tree */
901  SCIP_EXPR* root, /**< pointer to root expression, not copied deep !, can be NULL */
902  int nvars, /**< number of variables in variable mapping */
903  int nparams, /**< number of parameters in expression */
904  SCIP_Real* params /**< values for parameters, or NULL (if NULL but nparams > 0, then params is initialized with zeros) */
905  );
906 
907 /** copies an expression tree */
908 extern
910  BMS_BLKMEM* blkmem, /**< block memory that should be used in new expression tree */
911  SCIP_EXPRTREE** targettree, /**< buffer to store address of copied expression tree */
912  SCIP_EXPRTREE* sourcetree /**< expression tree to copy */
913  );
914 
915 /** frees an expression tree */
916 extern
918  SCIP_EXPRTREE** tree /**< pointer to expression tree that is freed */
919  );
920 
921 /** sets number and values of all parameters in expression tree */
922 extern
924  SCIP_EXPRTREE* tree, /**< expression tree */
925  int nparams, /**< number of parameters */
926  SCIP_Real* paramvals /**< values of parameters, can be NULL if nparams == 0 */
927  );
928 
929 /** gives the number of usages for each variable in the expression tree */
930 extern
932  SCIP_EXPRTREE* tree, /**< expression tree */
933  int* varsusage /**< array where to store for each variable how often it is used in the tree */
934  );
935 
936 /** aims at simplifying an expression and splitting of a linear expression
937  * if linear variables are split off, expression interpreter data, if stored in the tree, is freed
938  */
939 extern
941  SCIP_EXPRTREE* tree, /**< expression tree */
942  SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
943  SCIP_Real eps, /**< threshold, under which positive values are treat as 0 */
944  int maxexpansionexponent,/**< maximal exponent for which we still expand non-monomial polynomials */
945  int* nlinvars, /**< buffer to store number of linear variables in linear part, or NULL if linear part should not be separated */
946  int* linidxs, /**< array to store indices of variables in expression tree which belong to linear part, or NULL */
947  SCIP_Real* lincoefs /**< array to store coefficients of linear part, or NULL */
948  );
949 
950 /** adds an expression to the root expression of the tree
951  * the root is replaced with an SCIP_EXPR_PLUS expression which has the previous root and the given expression as children
952  */
953 extern
955  SCIP_EXPRTREE* tree, /**< expression tree */
956  SCIP_EXPR* expr, /**< expression to add to tree */
957  SCIP_Bool copyexpr /**< whether expression should be copied */
958  );
959 
960 /** tries to determine the curvature type of an expression tree w.r.t. given variable domains */
961 extern
963  SCIP_EXPRTREE* tree, /**< expression tree */
964  SCIP_Real infinity, /**< value for infinity */
965  SCIP_INTERVAL* varbounds, /**< domains of variables */
966  SCIP_EXPRCURV* curv, /**< buffer to store curvature of expression */
967  SCIP_INTERVAL* bounds /**< buffer to store bounds on expression, or NULL if not needed */
968  );
969 
970 /** substitutes variables (SCIP_EXPR_VARIDX) in an expression tree by expressions
971  * A variable with index i is replaced by a copy of substexprs[i], if that latter is not NULL
972  * if substexprs[i] == NULL, then the variable expression i is not touched
973  */
974 extern
976  SCIP_EXPRTREE* tree, /**< expression tree */
977  SCIP_EXPR** substexprs /**< array of substitute expressions; single entries can be NULL */
978  );
979 
980 /**@} */
981 
982 /**@name Quadratic element methods */
983 /**@{ */
984 
985 /** sorts an array of quadratic elements
986  * The elements are sorted such that the first index is increasing and
987  * such that among elements with the same first index, the second index is increasing.
988  * For elements with same first and second index, the order is not defined.
989  */
990 extern
991 void SCIPquadelemSort(
992  SCIP_QUADELEM* quadelems, /**< array of quadratic elements */
993  int nquadelems /**< number of quadratic elements */
994  );
995 
996 /** Finds an index pair in a sorted array of quadratic elements.
997  * If (idx1,idx2) is found in quadelems, then returns TRUE and stores position of quadratic element in *pos.
998  * If (idx1,idx2) is not found in quadelems, then returns FALSE and stores position where a quadratic element with these indices would be inserted in *pos.
999  * Assumes that idx1 <= idx2.
1000  */
1001 extern
1003  SCIP_QUADELEM* quadelems, /**< array of quadratic elements */
1004  int idx1, /**< index of first variable in element to search for */
1005  int idx2, /**< index of second variable in element to search for */
1006  int nquadelems, /**< number of quadratic elements in array */
1007  int* pos /**< buffer to store position of found quadratic element, or position where it would be inserted */
1008  );
1009 
1010 /** Adds quadratic elements with same index and removes elements with coefficient 0.0.
1011  * Assumes that elements have been sorted before.
1012  */
1013 extern
1014 void SCIPquadelemSqueeze(
1015  SCIP_QUADELEM* quadelems, /**< array of quadratic elements */
1016  int nquadelems, /**< number of quadratic elements */
1017  int* nquadelemsnew /**< pointer to store new (reduced) number of quadratic elements */
1018  );
1019 
1020 /**@} */
1021 
1022 /**@name Expression graph node methods */
1023 /**@{ */
1024 
1025 /** captures node, i.e., increases number of uses */
1026 extern
1028  SCIP_EXPRGRAPHNODE* node /**< expression graph node to capture */
1029  );
1030 
1031 /** returns whether a node is currently enabled */
1032 extern
1034  SCIP_EXPRGRAPHNODE* node /**< expression graph node to enable */
1035  );
1036 
1037 /** gets number of children of a node in an expression graph */
1038 extern
1040  SCIP_EXPRGRAPHNODE* node /**< expression graph node */
1041  );
1042 
1043 /** gets children of a node in an expression graph */
1044 extern
1046  SCIP_EXPRGRAPHNODE* node /**< expression graph node */
1047  );
1048 
1049 /** gets number of parents of a node in an expression graph */
1050 extern
1052  SCIP_EXPRGRAPHNODE* node /**< expression graph node */
1053  );
1054 
1055 /** gets parents of a node in an expression graph */
1056 extern
1058  SCIP_EXPRGRAPHNODE* node /**< expression graph node */
1059  );
1060 
1061 /** gets depth of node in expression graph */
1062 extern
1064  SCIP_EXPRGRAPHNODE* node /**< expression graph node */
1065  );
1066 
1067 /** gets position of node in expression graph at its depth level */
1068 extern
1070  SCIP_EXPRGRAPHNODE* node /**< expression graph node */
1071  );
1072 
1073 /** gets operator of a node in an expression graph */
1074 extern
1076  SCIP_EXPRGRAPHNODE* node /**< expression graph node */
1077  );
1078 
1079 /** gives index belonging to a SCIP_EXPR_VARIDX or SCIP_EXPR_PARAM operand */
1080 extern
1082  SCIP_EXPRGRAPHNODE* node /**< expression graph node */
1083  );
1084 
1085 /** gives real belonging to a SCIP_EXPR_CONST operand */
1086 extern
1088  SCIP_EXPRGRAPHNODE* node /**< expression graph node */
1089  );
1090 
1091 /** gives variable belonging to a SCIP_EXPR_VARIDX expression */
1092 extern
1094  SCIP_EXPRGRAPH* exprgraph, /**< expression graph */
1095  SCIP_EXPRGRAPHNODE* node /**< expression graph node */
1096  );
1097 
1098 /** gives exponent belonging to a SCIP_EXPR_REALPOWER expression */
1099 extern
1101  SCIP_EXPRGRAPHNODE* node /**< expression graph node */
1102  );
1103 
1104 /** gives exponent belonging to a SCIP_EXPR_INTPOWER expression */
1105 extern
1107  SCIP_EXPRGRAPHNODE* node /**< expression graph node */
1108  );
1109 
1110 /** gives exponent belonging to a SCIP_EXPR_SIGNPOWER expression */
1111 extern
1113  SCIP_EXPRGRAPHNODE* node /**< expression graph node */
1114  );
1115 
1116 /** gives linear coefficients belonging to a SCIP_EXPR_LINEAR expression */
1117 extern
1119  SCIP_EXPRGRAPHNODE* node /**< expression graph node */
1120  );
1121 
1122 /** gives constant belonging to a SCIP_EXPR_LINEAR expression */
1123 extern
1125  SCIP_EXPRGRAPHNODE* node /**< expression graph node */
1126  );
1127 
1128 /** gives constant belonging to a SCIP_EXPR_QUADRATIC expression */
1129 extern
1131  SCIP_EXPRGRAPHNODE* node /**< expression graph node */
1132  );
1133 
1134 /** gives linear coefficients belonging to a SCIP_EXPR_QUADRATIC expression, or NULL if all coefficients are 0.0 */
1135 extern
1137  SCIP_EXPRGRAPHNODE* node /**< expression graph node */
1138  );
1139 
1140 /** gives quadratic elements belonging to a SCIP_EXPR_QUADRATIC expression */
1141 extern
1143  SCIP_EXPRGRAPHNODE* node /**< expression graph node */
1144  );
1145 
1146 /** gives number of quadratic elements belonging to a SCIP_EXPR_QUADRATIC expression */
1147 extern
1149  SCIP_EXPRGRAPHNODE* node /**< expression graph node */
1150  );
1151 
1152 /** gives the monomials belonging to a SCIP_EXPR_POLYNOMIAL expression */
1153 extern
1155  SCIP_EXPRGRAPHNODE* node /**< expression graph node */
1156  );
1157 
1158 /** gives the number of monomials belonging to a SCIP_EXPR_POLYNOMIAL expression */
1159 extern
1161  SCIP_EXPRGRAPHNODE* node /**< expression graph node */
1162  );
1163 
1164 /** gives the constant belonging to a SCIP_EXPR_POLYNOMIAL expression */
1165 extern
1167  SCIP_EXPRGRAPHNODE* node /**< expression graph node */
1168  );
1169 
1170 /** gives the curvature of a single monomial belonging to a SCIP_EXPR_POLYNOMIAL expression */
1171 extern
1173  SCIP_EXPRGRAPHNODE* node, /**< expression graph node */
1174  int monomialidx, /**< index of monomial */
1175  SCIP_Real infinity, /**< value for infinity in interval arithmetics */
1176  SCIP_EXPRCURV* curv /**< buffer to store monomial curvature */
1177  );
1178 
1179 /** gives the user data belonging to a SCIP_EXPR_USER expression */
1180 extern
1182  SCIP_EXPRGRAPHNODE* node
1183  );
1184 
1185 /** indicates whether a user expression has the estimator callback defined */
1186 extern
1188  SCIP_EXPRGRAPHNODE* node
1189  );
1190 
1191 /** gets bounds of a node in an expression graph */
1192 extern
1193 SCIP_INTERVAL SCIPexprgraphGetNodeBounds(
1194  SCIP_EXPRGRAPHNODE* node /**< expression graph node */
1195  );
1196 
1197 /** gets value of expression associated to node from last evaluation call */
1198 extern
1200  SCIP_EXPRGRAPHNODE* node /**< expression graph node */
1201  );
1202 
1203 /** gets curvature of expression associated to node from last curvature check call */
1204 extern
1206  SCIP_EXPRGRAPHNODE* node /**< expression graph node */
1207  );
1208 
1209 #ifdef NDEBUG
1210 
1211 /* In optimized mode, the function calls are overwritten by defines to reduce the number of function calls and
1212  * speed up the algorithms.
1213  */
1214 
1215 #define SCIPexprgraphCaptureNode(node) do { ++(node)->nuses; } while( FALSE )
1216 #define SCIPexprgraphIsNodeEnabled(node) (node)->enabled
1217 #define SCIPexprgraphGetNodeNChildren(node) (node)->nchildren
1218 #define SCIPexprgraphGetNodeChildren(node) (node)->children
1219 #define SCIPexprgraphGetNodeNParents(node) (node)->nparents
1220 #define SCIPexprgraphGetNodeParents(node) (node)->parents
1221 #define SCIPexprgraphGetNodeDepth(node) (node)->depth
1222 #define SCIPexprgraphGetNodePosition(node) (node)->pos
1223 #define SCIPexprgraphGetNodeOperator(node) (node)->op
1224 #define SCIPexprgraphGetNodeOperatorIndex(node) (node)->data.intval
1225 #define SCIPexprgraphGetNodeOperatorReal(node) (node)->data.dbl
1226 #define SCIPexprgraphGetNodeVar(exprgraph, node) (exprgraph)->vars[(node)->data.intval]
1227 #define SCIPexprgraphGetNodeRealPowerExponent(node) (node)->data.dbl
1228 #define SCIPexprgraphGetNodeIntPowerExponent(node) (node)->data.intval
1229 #define SCIPexprgraphGetNodeSignPowerExponent(node) (node)->data.dbl
1230 #define SCIPexprgraphGetNodeLinearCoefs(node) ((SCIP_Real*)(node)->data.data)
1231 #define SCIPexprgraphGetNodeLinearConstant(node) (((SCIP_Real*)(node)->data.data)[(node)->nchildren])
1232 #define SCIPexprgraphGetNodeQuadraticConstant(node) ((SCIP_EXPRDATA_QUADRATIC*)(node)->data.data)->constant
1233 #define SCIPexprgraphGetNodeQuadraticLinearCoefs(node) ((SCIP_EXPRDATA_QUADRATIC*)(node)->data.data)->lincoefs
1234 #define SCIPexprgraphGetNodeQuadraticQuadElements(node) ((SCIP_EXPRDATA_QUADRATIC*)(node)->data.data)->quadelems
1235 #define SCIPexprgraphGetNodeQuadraticNQuadElements(node) ((SCIP_EXPRDATA_QUADRATIC*)(node)->data.data)->nquadelems
1236 #define SCIPexprgraphGetNodePolynomialMonomials(node) ((SCIP_EXPRDATA_POLYNOMIAL*)(node)->data.data)->monomials
1237 #define SCIPexprgraphGetNodePolynomialNMonomials(node) ((SCIP_EXPRDATA_POLYNOMIAL*)(node)->data.data)->nmonomials
1238 #define SCIPexprgraphGetNodePolynomialConstant(node) ((SCIP_EXPRDATA_POLYNOMIAL*)(node)->data.data)->constant
1239 #define SCIPexprgraphGetNodeUserData(node) ((SCIP_EXPRDATA_USER*)(node)->data.data)->userdata
1240 #define SCIPexprgraphHasNodeUserEstimator(node) (((SCIP_EXPRDATA_USER*)node->data.data)->estimate != NULL)
1241 #define SCIPexprgraphGetNodeBounds(node) (node)->bounds
1242 #define SCIPexprgraphGetNodeVal(node) (node)->value
1243 #define SCIPexprgraphGetNodeCurvature(node) (node)->curv
1244 
1245 #endif
1246 
1247 /** creates an expression graph node */
1248 extern
1250  BMS_BLKMEM* blkmem, /**< block memory */
1251  SCIP_EXPRGRAPHNODE** node, /**< buffer to store expression graph node */
1252  SCIP_EXPROP op, /**< operator type of expression */
1253  ...
1254  );
1255 
1256 /** creates an expression graph node for a linear expression */
1257 extern
1259  BMS_BLKMEM* blkmem, /**< block memory */
1260  SCIP_EXPRGRAPHNODE** node, /**< buffer to store expression graph node */
1261  int ncoefs, /**< number of coefficients */
1262  SCIP_Real* coefs, /**< coefficients of linear expression */
1263  SCIP_Real constant /**< constant of linear expression */
1264  );
1265 
1266 /** creates an expression graph node for a quadratic expression */
1267 extern
1269  BMS_BLKMEM* blkmem, /**< block memory */
1270  SCIP_EXPRGRAPHNODE** node, /**< buffer to store expression graph node */
1271  int nchildren, /**< number of children */
1272  SCIP_Real* lincoefs, /**< linear coefficients for children, or NULL */
1273  int nquadelems, /**< number of quadratic elements */
1274  SCIP_QUADELEM* quadelems, /**< quadratic elements, or NULL if nquadelems == 0 */
1275  SCIP_Real constant /**< constant */
1276  );
1277 
1278 /** creates an expression graph node for a polynomial expression */
1279 extern
1281  BMS_BLKMEM* blkmem, /**< block memory */
1282  SCIP_EXPRGRAPHNODE** node, /**< buffer to store expression graph node */
1283  int nmonomials, /**< number of monomials */
1284  SCIP_EXPRDATA_MONOMIAL** monomials, /**< monomials */
1285  SCIP_Real constant, /**< constant of polynomial */
1286  SCIP_Bool copymonomials /**< whether to copy monomials or to assume ownership */
1287  );
1288 
1289 /** adds monomials to an expression graph node that is a polynomial expression */
1290 extern
1292  BMS_BLKMEM* blkmem, /**< block memory */
1293  SCIP_EXPRGRAPHNODE* node, /**< store expression graph node with polynomial operator */
1294  int nmonomials, /**< number of monomials */
1295  SCIP_EXPRDATA_MONOMIAL** monomials, /**< monomials */
1296  SCIP_Bool copymonomials /**< whether to copy monomials or to assume ownership */
1297  );
1298 
1299 /** creates an expression graph node for a user expression */
1300 extern
1302  BMS_BLKMEM* blkmem, /**< block memory */
1303  SCIP_EXPRGRAPHNODE** node, /**< buffer to store expression graph node */
1304  SCIP_USEREXPRDATA* data, /**< user data for expression, node assumes ownership */
1305  SCIP_EXPRINTCAPABILITY evalcapability, /**< evaluation capability */
1306  SCIP_DECL_USEREXPREVAL ((*eval)), /**< evaluation function */
1307  SCIP_DECL_USEREXPRINTEVAL ((*inteval)), /**< interval evaluation function */
1308  SCIP_DECL_USEREXPRCURV ((*curv)), /**< curvature check function */
1309  SCIP_DECL_USEREXPRPROP ((*prop)), /**< interval propagation function */
1310  SCIP_DECL_USEREXPRESTIMATE ((*estimate)), /**< estimation function, or NULL if convex, concave, or not implemented */
1311  SCIP_DECL_USEREXPRCOPYDATA ((*copydata)), /**< expression data copy function, or NULL if nothing to copy */
1312  SCIP_DECL_USEREXPRFREEDATA ((*freedata)) /**< expression data free function, or NULL if nothing to free */
1313  );
1314 
1315 /** given a node of an expression graph, splitup a linear part which variables are not used somewhere else in the same expression
1316  * E.g., if the expression is 1 + x + y + y^2, one gets 1 + x and the node remains at y + y^2.
1317  * If the node is a linear expression, it may be freed.
1318  * If it is not linear, the node may change, i.e., the remaining nonlinear part may be stored in a new node.
1319  * It is assumed that the user had captured the node.
1320  * It is assumed that the expression graph has been simplified before.
1321  */
1322 extern
1324  SCIP_EXPRGRAPH* exprgraph, /**< expression graph */
1325  SCIP_EXPRGRAPHNODE** node, /**< expression graph node where to splitup linear part */
1326  int linvarssize, /**< length of linvars and lincoefs arrays */
1327  int* nlinvars, /**< buffer to store length of linear term that have been splitup */
1328  void** linvars, /**< buffer to store variables of linear part */
1329  SCIP_Real* lincoefs, /**< buffer to store coefficients of linear part */
1330  SCIP_Real* constant /**< buffer to store constant part */
1331  );
1332 
1333 /** moves parents from a one node to another node
1334  * in other words, replaces the child srcnode by targetnode in all parents of srcnode
1335  * srcnode may be freed, if not captured
1336  * it is assumes that targetnode represents the same expression as srcnode
1337  */
1338 extern
1340  SCIP_EXPRGRAPH* exprgraph, /**< expression graph */
1341  SCIP_EXPRGRAPHNODE** srcnode, /**< node which parents to move */
1342  SCIP_EXPRGRAPHNODE* targetnode /**< node where to move parents to */
1343  );
1344 
1345 /** releases node, i.e., decreases number of uses
1346  * node is freed if no parents and no other uses
1347  * children are recursively released if they have no other parents
1348  * nodes that are removed are also freed
1349  * if node correspond to a variable, then the variable is removed from the expression graph
1350  * similar for constants
1351  */
1352 extern
1354  SCIP_EXPRGRAPH* exprgraph, /**< expression graph */
1355  SCIP_EXPRGRAPHNODE** node /**< expression graph node to release */
1356  );
1357 
1358 /** frees a node of an expression graph */
1359 extern
1361  BMS_BLKMEM* blkmem, /**< block memory */
1362  SCIP_EXPRGRAPHNODE** node /**< pointer to expression graph node that should be freed */
1363  );
1364 
1365 /** enables a node and recursively all its children in an expression graph */
1366 extern
1368  SCIP_EXPRGRAPH* exprgraph, /**< expression graph */
1369  SCIP_EXPRGRAPHNODE* node /**< expression graph node to enable */
1370  );
1371 
1372 /** disables a node and recursively all children which have no enabled parents in an expression graph */
1373 extern
1375  SCIP_EXPRGRAPH* exprgraph, /**< expression graph */
1376  SCIP_EXPRGRAPHNODE* node /**< expression graph node to enable */
1377  );
1378 
1379 /** returns whether the node has siblings in the expression graph */
1380 extern
1382  SCIP_EXPRGRAPHNODE* node /**< expression graph node */
1383  );
1384 
1385 /** returns whether all children of an expression graph node are variable nodes
1386  * gives TRUE for nodes without children
1387  */
1388 extern
1390  SCIP_EXPRGRAPHNODE* node /**< expression graph node */
1391  );
1392 
1393 /** returns whether the node has an ancestor which has a nonlinear expression operand */
1394 extern
1396  SCIP_EXPRGRAPHNODE* node /**< expression graph node */
1397  );
1398 
1399 /** prints an expression graph node */
1400 extern
1402  SCIP_EXPRGRAPHNODE* node, /**< expression graph node */
1403  SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
1404  FILE* file /**< file to print to, or NULL for stdout */
1405  );
1406 
1407 /** tightens the bounds in a node of the graph
1408  * preparation for reverse propagation
1409  * sets bound status to SCIP_EXPRBOUNDSTATUS_TIGHTENEDBYPARENTRECENT if tightening is strong enough and not cutoff
1410  */
1411 extern
1413  SCIP_EXPRGRAPH* exprgraph, /**< expression graph */
1414  SCIP_EXPRGRAPHNODE* node, /**< node in expression graph with no parents */
1415  SCIP_INTERVAL nodebounds, /**< new bounds for node */
1416  SCIP_Real minstrength, /**< minimal required relative bound strengthening in a node to trigger a propagation into children nodes (set to negative value if propagation should always be triggered) */
1417  SCIP_Real infinity, /**< value for infinity in interval arithmetics */
1418  SCIP_Bool* cutoff /**< buffer to store whether a node's bounds were propagated to an empty interval */
1419  );
1420 
1421 /** ensures that bounds and curvature information in a node is uptodate
1422  * assumes that bounds and curvature in children are uptodate
1423  */
1424 extern
1426  SCIP_EXPRGRAPHNODE* node, /**< expression graph node */
1427  SCIP_Real infinity, /**< value for infinity in interval arithmetics */
1428  SCIP_Real minstrength, /**< minimal required relative bound strengthening to trigger a bound recalculation in parent nodes */
1429  SCIP_Bool clearreverseprop /**< whether to reset bound tightenings from reverse propagation */
1430  );
1431 
1432 /**@} */
1433 
1434 /**@name Expression graph methods */
1435 /**@{ */
1436 
1437 /** get current maximal depth of expression graph */
1438 extern
1440  SCIP_EXPRGRAPH* exprgraph /**< expression graph */
1441  );
1442 
1443 /** gets array with number of nodes at each depth of expression graph */
1444 extern
1446  SCIP_EXPRGRAPH* exprgraph /**< expression graph */
1447  );
1448 
1449 /** gets nodes of expression graph, one array per depth */
1450 extern
1452  SCIP_EXPRGRAPH* exprgraph /**< expression graph */
1453  );
1454 
1455 /** gets number of variables in expression graph */
1456 extern
1458  SCIP_EXPRGRAPH* exprgraph /**< pointer to expression graph that should be freed */
1459  );
1460 
1461 /** gets array of variables in expression graph */
1462 extern
1463 void** SCIPexprgraphGetVars(
1464  SCIP_EXPRGRAPH* exprgraph /**< pointer to expression graph that should be freed */
1465  );
1466 
1467 /** gets array of expression graph nodes corresponding to variables */
1468 extern
1470  SCIP_EXPRGRAPH* exprgraph /**< pointer to expression graph that should be freed */
1471  );
1472 
1473 /** sets value for a single variable given as expression graph node */
1474 extern
1476  SCIP_EXPRGRAPHNODE* varnode, /**< expression graph node corresponding to variable */
1477  SCIP_Real value /**< new value for variable */
1478  );
1479 
1480 /** sets bounds for variables */
1481 extern
1483  SCIP_EXPRGRAPH* exprgraph, /**< expression graph */
1484  SCIP_INTERVAL* varbounds /**< new bounds for variables */
1485  );
1486 
1487 /** sets bounds for a single variable */
1488 extern
1490  SCIP_EXPRGRAPH* exprgraph, /**< expression graph */
1491  void* var, /**< variable */
1492  SCIP_INTERVAL varbounds /**< new bounds of variable */
1493  );
1494 
1495 /** sets bounds for a single variable given as expression graph node */
1496 extern
1498  SCIP_EXPRGRAPH* exprgraph, /**< expression graph */
1499  SCIP_EXPRGRAPHNODE* varnode, /**< expression graph node corresponding to variable */
1500  SCIP_INTERVAL varbounds /**< new bounds of variable */
1501  );
1502 
1503 /** sets lower bound for a single variable given as expression graph node */
1504 extern
1506  SCIP_EXPRGRAPH* exprgraph, /**< expression graph */
1507  SCIP_EXPRGRAPHNODE* varnode, /**< expression graph node corresponding to variable */
1508  SCIP_Real lb /**< new lower bound for variable */
1509  );
1510 
1511 /** sets upper bound for a single variable given as expression graph node */
1512 extern
1514  SCIP_EXPRGRAPH* exprgraph, /**< expression graph */
1515  SCIP_EXPRGRAPHNODE* varnode, /**< expression graph node corresponding to variable */
1516  SCIP_Real ub /**< new upper bound for variable */
1517  );
1518 
1519 /** gets bounds that are stored for all variables */
1520 extern
1521 SCIP_INTERVAL* SCIPexprgraphGetVarsBounds(
1522  SCIP_EXPRGRAPH* exprgraph /**< expression graph */
1523  );
1524 
1525 #ifdef NDEBUG
1526 
1527 /* In optimized mode, the function calls are overwritten by defines to reduce the number of function calls and
1528  * speed up the algorithms.
1529  */
1530 
1531 #define SCIPexprgraphGetDepth(exprgraph) (exprgraph)->depth
1532 #define SCIPexprgraphGetNNodes(exprgraph) (exprgraph)->nnodes
1533 #define SCIPexprgraphGetNodes(exprgraph) (exprgraph)->nodes
1534 #define SCIPexprgraphGetNVars(exprgraph) (exprgraph)->nvars
1535 #define SCIPexprgraphGetVars(exprgraph) (exprgraph)->vars
1536 #define SCIPexprgraphGetVarNodes(exprgraph) (exprgraph)->varnodes
1537 #define SCIPexprgraphSetVarNodeValue(varnode, newvalue) do { (varnode)->value = newvalue; } while (FALSE)
1538 #define SCIPexprgraphSetVarsBounds(exprgraph, newvarbounds) BMScopyMemoryArray((exprgraph)->varbounds, newvarbounds, (exprgraph)->nvars)
1539 #define SCIPexprgraphSetVarBounds(exprgraph, var, newvarbounds) do { (exprgraph)->varbounds[(int)(size_t)SCIPhashmapGetImage((exprgraph)->varidxs, var)] = newvarbounds; } while (FALSE)
1540 #define SCIPexprgraphSetVarNodeBounds(exprgraph, varnode, newvarbounds) do { (exprgraph)->varbounds[(varnode)->data.intval] = newvarbounds; } while (FALSE)
1541 #define SCIPexprgraphSetVarNodeLb(exprgraph, varnode, lb) do { (exprgraph)->varbounds[(varnode)->data.intval].inf = lb; } while (FALSE)
1542 #define SCIPexprgraphSetVarNodeUb(exprgraph, varnode, ub) do { (exprgraph)->varbounds[(varnode)->data.intval].sup = ub; } while (FALSE)
1543 #define SCIPexprgraphGetVarsBounds(exprgraph) (exprgraph)->varbounds
1544 
1545 #endif
1546 
1547 /** creates an empty expression graph */
1548 extern
1550  BMS_BLKMEM* blkmem, /**< block memory */
1551  SCIP_EXPRGRAPH** exprgraph, /**< buffer to store pointer to expression graph */
1552  int varssizeinit, /**< minimal initial size for variables array, or -1 to choose automatically */
1553  int depthinit, /**< minimal initial depth of expression graph, or -1 to choose automatically */
1554  SCIP_DECL_EXPRGRAPHVARADDED((*exprgraphvaradded)), /** callback method to invoke when a variable has been added to the expression graph, or NULL if not needed */
1555  SCIP_DECL_EXPRGRAPHVARREMOVE((*exprgraphvarremove)), /** callback method to invoke when a variable will be removed from the expression graph, or NULL if not needed */
1556  SCIP_DECL_EXPRGRAPHVARCHGIDX((*exprgraphvarchgidx)), /** callback method to invoke when a variable changes its index in the expression graph, or NULL if not needed */
1557  void* userdata /**< user data to pass to callback functions */
1558  );
1559 
1560 /** frees an expression graph */
1561 extern
1563  SCIP_EXPRGRAPH** exprgraph /**< pointer to expression graph that should be freed */
1564  );
1565 
1566 /** adds an expression graph node to an expression graph
1567  * expression graph assumes ownership of node
1568  * children are notified about new parent
1569  * depth will be chosen to be the maximum of mindepth and the depth of all children plus one
1570  */
1571 extern
1573  SCIP_EXPRGRAPH* exprgraph, /**< expression graph */
1574  SCIP_EXPRGRAPHNODE* node, /**< expression graph node to add */
1575  int mindepth, /**< minimal depth in expression graph where to add node, e.g., 0 or smaller to choose automatically */
1576  int nchildren, /**< number of children */
1577  SCIP_EXPRGRAPHNODE** children /**< children nodes, or NULL if no children */
1578  );
1579 
1580 /** adds variables to an expression graph, if not existing yet
1581  * also already existing nodes are enabled
1582  */
1583 extern
1585  SCIP_EXPRGRAPH* exprgraph, /**< expression graph */
1586  int nvars, /**< number of variables to add */
1587  void** vars, /**< variables to add */
1588  SCIP_EXPRGRAPHNODE** varnodes /**< array to store nodes corresponding to variables, or NULL if not of interest */
1589  );
1590 
1591 /** adds a constant to an expression graph, if not existing yet
1592  * also already existing nodes are enabled
1593  */
1595  SCIP_EXPRGRAPH* exprgraph, /**< expression graph */
1596  SCIP_Real constant, /**< constant to add */
1597  SCIP_EXPRGRAPHNODE** constnode /**< buffer to store pointer to expression graph node corresponding to constant */
1598  );
1599 
1600 /** adds sum of expression trees into expression graph
1601  * node will also be captured
1602  */
1603 extern
1605  SCIP_EXPRGRAPH* exprgraph, /**< expression graph */
1606  int nexprtrees, /**< number of expression trees to add */
1607  SCIP_EXPRTREE** exprtrees, /**< expression trees that should be added */
1608  SCIP_Real* coefs, /**< coefficients of expression trees, or NULL if all 1.0 */
1609  SCIP_EXPRGRAPHNODE** rootnode, /**< buffer to store expression graph node corresponding to root of expression tree */
1610  SCIP_Bool* rootnodeisnew /**< buffer to indicate whether the node in *rootnode has been newly created for this expression tree (otherwise, expression tree was already in graph) */
1611  );
1612 
1613 /** replaces variable in expression graph by a linear sum of variables
1614  * variables will be added if not in the graph yet
1615  */
1616 extern
1618  SCIP_EXPRGRAPH* exprgraph, /**< expression graph */
1619  void* var, /**< variable to replace */
1620  int ncoefs, /**< number of coefficients in linear term */
1621  SCIP_Real* coefs, /**< coefficients in linear term, or NULL if ncoefs == 0 */
1622  void** vars, /**< variables in linear term */
1623  SCIP_Real constant /**< constant offset */
1624  );
1625 
1626 /** finds expression graph node corresponding to a variable */
1627 extern
1629  SCIP_EXPRGRAPH* exprgraph, /**< expression graph */
1630  void* var, /**< variable to search for */
1631  SCIP_EXPRGRAPHNODE** varnode /**< buffer to store node corresponding to variable, if found, or NULL if not found */
1632  );
1633 
1634 /** finds expression graph node corresponding to a constant */
1635 extern
1637  SCIP_EXPRGRAPH* exprgraph, /**< expression graph */
1638  SCIP_Real constant, /**< constant to search for */
1639  SCIP_EXPRGRAPHNODE** constnode /**< buffer to store node corresponding to constant, if found, or NULL if not found */
1640  );
1641 
1642 /** prints an expression graph in dot format */
1643 extern
1645  SCIP_EXPRGRAPH* exprgraph, /**< expression graph */
1646  SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
1647  FILE* file, /**< file to print to, or NULL for stdout */
1648  const char** varnames /**< variable names, or NULL for generic names */
1649  );
1650 
1651 /** evaluates nodes of expression graph for given values of variables */
1652 extern
1654  SCIP_EXPRGRAPH* exprgraph, /**< expression graph */
1655  SCIP_Real* varvals /**< values for variables */
1656  );
1657 
1658 /** propagates bound changes in variables forward through the expression graph */
1659 extern
1661  SCIP_EXPRGRAPH* exprgraph, /**< expression graph */
1662  SCIP_Real infinity, /**< value for infinity in interval arithmetics */
1663  SCIP_Bool clearreverseprop, /**< whether to reset bound tightenings from reverse propagation */
1664  SCIP_Bool* domainerror /**< buffer to store whether a node with empty bounds has been found, propagation is interrupted in this case */
1665  );
1666 
1667 /** propagates bound changes in nodes backward through the graph
1668  * new bounds are not stored in varbounds, but only in nodes corresponding to variables
1669  * NOTE: it is assumed that SCIPexprgraphPropagateVarBounds was called before if variable bounds were relaxed
1670  */
1671 extern
1673  SCIP_EXPRGRAPH* exprgraph, /**< expression graph */
1674  SCIP_Real infinity, /**< value for infinity in interval arithmetics */
1675  SCIP_Real minstrength, /**< minimal required relative bound strengthening in a node to trigger a propagation into children nodes */
1676  SCIP_Bool* cutoff /**< buffer to store whether a node's bounds were propagated to an empty interval */
1677  );
1678 
1679 /** updates curvature information in expression graph nodes w.r.t. currently stored variable bounds
1680  * implies update of bounds in expression graph
1681  */
1682 extern
1684  SCIP_EXPRGRAPH* exprgraph, /**< expression graph */
1685  SCIP_Real infinity, /**< value for infinity in interval arithmetics */
1686  SCIP_Bool clearreverseprop /**< whether to reset bound tightenings from reverse propagation */
1687  );
1688 
1689 /** aims at simplifying an expression graph
1690  * a domain error can occur when variables were fixed to values for which a parent expression is not defined (e.g., 0^(-1) or log(-1))
1691  */
1692 extern
1694  SCIP_EXPRGRAPH* exprgraph, /**< expression graph */
1695  SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
1696  SCIP_Real eps, /**< threshold, under which positive values are treat as 0 */
1697  int maxexpansionexponent,/**< maximal exponent for which we still expand non-monomial polynomials */
1698  SCIP_Bool* havechange, /**< buffer to indicate whether the graph has been modified */
1699  SCIP_Bool* domainerror /**< buffer to indicate whether a domain error has been encountered, i.e., some expressions turned into NaN */
1700  );
1701 
1702 /** creates an expression tree from a given node in an expression graph */
1703 extern
1705  SCIP_EXPRGRAPH* exprgraph, /**< expression graph */
1706  SCIP_EXPRGRAPHNODE* rootnode, /**< expression graph node that should represent root of expression tree */
1707  SCIP_EXPRTREE** exprtree /**< buffer to store pointer to created expression tree */
1708  );
1709 
1710 /** creates a sum of expression trees with pairwise disjoint variables from a given node in an expression graph
1711  * Giving SCIPexprgraphGetNodeNChildren() for exprtreesize is always sufficient.
1712  */
1713 extern
1715  SCIP_EXPRGRAPH* exprgraph, /**< expression graph */
1716  SCIP_EXPRGRAPHNODE* node, /**< expression graph node which represents expression to get */
1717  int exprtreessize, /**< length of exprtrees and exprtreecoefs arrays, need to be at least one */
1718  int* nexprtrees, /**< buffer to store number of expression trees */
1719  SCIP_EXPRTREE** exprtrees, /**< array where to store expression trees */
1720  SCIP_Real* exprtreecoefs /**< array where to store coefficients of expression trees */
1721  );
1722 
1723 /** returns how often expression graph variables are used in a subtree of the expression graph */
1724 extern
1726  SCIP_EXPRGRAPH* exprgraph, /**< expression graph */
1727  SCIP_EXPRGRAPHNODE* node, /**< root node of expression graph subtree */
1728  int* varsusage /**< array where to count usage of variables, length must be at least the number of variables in the graph */
1729  );
1730 
1731 /** gives the number of summands which the expression of an expression graph node consists of */
1732 extern
1734  SCIP_EXPRGRAPHNODE* node /**< expression graph node */
1735  );
1736 
1737 /** creates a sum of expression trees, possibly sharing variables, from a given node in an expression graph */
1738 extern
1740  SCIP_EXPRGRAPH* exprgraph, /**< expression graph */
1741  SCIP_EXPRGRAPHNODE* node, /**< expression graph node which represents expression to get */
1742  int exprtreessize, /**< length of exprtrees and exptreecoefs arrays, should be at least SCIPexprgraphGetSumTreesNSummands() */
1743  int* nexprtrees, /**< buffer to store number of expression trees */
1744  SCIP_EXPRTREE** exprtrees, /**< array where to store expression trees */
1745  SCIP_Real* exprtreecoefs /**< array where to store coefficients of expression trees */
1746  );
1747 
1748 /**@} */
1749 
1750 #ifdef __cplusplus
1751 }
1752 #endif
1753 
1754 #endif /* __NLPI_PUB_EXPR_H__ */
SCIP_RETCODE SCIPexprAdd(BMS_BLKMEM *blkmem, SCIP_EXPR **expr, SCIP_Real coef1, SCIP_EXPR *term1, SCIP_Real coef2, SCIP_EXPR *term2, SCIP_Real constant)
SCIP_EXPRCURV SCIPexprcurvNegate(SCIP_EXPRCURV curvature)
int SCIPexprgraphGetNodeIntPowerExponent(SCIP_EXPRGRAPHNODE *node)
void ** SCIPexprgraphGetVars(SCIP_EXPRGRAPH *exprgraph)
SCIP_RETCODE SCIPexprMultiplyPolynomialByPolynomial(BMS_BLKMEM *blkmem, SCIP_EXPR *expr, SCIP_EXPR *factor, int *childmap)
void SCIPexprgraphDisableNode(SCIP_EXPRGRAPH *exprgraph, SCIP_EXPRGRAPHNODE *node)
SCIP_RETCODE SCIPexprgraphAddConst(SCIP_EXPRGRAPH *exprgraph, SCIP_Real constant, SCIP_EXPRGRAPHNODE **constnode)
SCIP_RETCODE SCIPexprgraphGetNodePolynomialMonomialCurvature(SCIP_EXPRGRAPHNODE *node, int monomialidx, SCIP_Real infinity, SCIP_EXPRCURV *curv)
void SCIPexprtreeGetVarsUsage(SCIP_EXPRTREE *tree, int *varsusage)
void SCIPquadelemSqueeze(SCIP_QUADELEM *quadelems, int nquadelems, int *nquadelemsnew)
SCIP_RETCODE SCIPexprtreeEval(SCIP_EXPRTREE *tree, SCIP_Real *varvals, SCIP_Real *val)
int SCIPexprgraphGetNodeNParents(SCIP_EXPRGRAPHNODE *node)
SCIP_RETCODE SCIPexprCreateQuadratic(BMS_BLKMEM *blkmem, SCIP_EXPR **expr, int nchildren, SCIP_EXPR **children, SCIP_Real constant, SCIP_Real *lincoefs, int nquadelems, SCIP_QUADELEM *quadelems)
SCIP_QUADELEM * SCIPexprgraphGetNodeQuadraticQuadElements(SCIP_EXPRGRAPHNODE *node)
int SCIPexprGetNChildren(SCIP_EXPR *expr)
void SCIPexprtreeSetInterpreterData(SCIP_EXPRTREE *tree, SCIP_EXPRINTDATA *interpreterdata)
struct SCIP_QuadElement SCIP_QUADELEM
Definition: type_expr.h:106
void SCIPexprFreeMonomial(BMS_BLKMEM *blkmem, SCIP_EXPRDATA_MONOMIAL **monomial)
SCIP_QUADELEM * SCIPexprGetQuadElements(SCIP_EXPR *expr)
struct SCIP_UserExprData SCIP_USEREXPRDATA
Definition: type_expr.h:219
SCIP_EXPRINTCAPABILITY SCIPexprGetUserEvalCapability(SCIP_EXPR *expr)
int SCIPexprgraphGetNodePolynomialNMonomials(SCIP_EXPRGRAPHNODE *node)
SCIP_Real SCIPexprGetMonomialCoef(SCIP_EXPRDATA_MONOMIAL *monomial)
void SCIPexprtreePrint(SCIP_EXPRTREE *tree, SCIP_MESSAGEHDLR *messagehdlr, FILE *file, const char **varnames, const char **paramnames)
#define SCIP_DECL_USEREXPREVAL(x)
Definition: type_expr.h:246
void SCIPexprMergeMonomialFactors(SCIP_EXPRDATA_MONOMIAL *monomial, SCIP_Real eps)
SCIP_Real SCIPexprgraphGetNodeLinearConstant(SCIP_EXPRGRAPHNODE *node)
void SCIPexprgraphSetVarsBounds(SCIP_EXPRGRAPH *exprgraph, SCIP_INTERVAL *varbounds)
type definitions for expression interpreter
SCIP_RETCODE SCIPexprgraphNodeSplitOffLinear(SCIP_EXPRGRAPH *exprgraph, SCIP_EXPRGRAPHNODE **node, int linvarssize, int *nlinvars, void **linvars, SCIP_Real *lincoefs, SCIP_Real *constant)
void SCIPexprChgMonomialCoef(SCIP_EXPRDATA_MONOMIAL *monomial, SCIP_Real newcoef)
SCIP_RETCODE SCIPexprgraphGetSumTrees(SCIP_EXPRGRAPH *exprgraph, SCIP_EXPRGRAPHNODE *node, int exprtreessize, int *nexprtrees, SCIP_EXPRTREE **exprtrees, SCIP_Real *exprtreecoefs)
void SCIPexprPrint(SCIP_EXPR *expr, SCIP_MESSAGEHDLR *messagehdlr, FILE *file, const char **varnames, const char **paramnames, SCIP_Real *paramvals)
struct SCIP_ExprData_Monomial SCIP_EXPRDATA_MONOMIAL
Definition: type_expr.h:109
SCIP_RETCODE SCIPexprgraphCreateNodeQuadratic(BMS_BLKMEM *blkmem, SCIP_EXPRGRAPHNODE **node, int nchildren, SCIP_Real *lincoefs, int nquadelems, SCIP_QUADELEM *quadelems, SCIP_Real constant)
SCIP_RETCODE SCIPexprgraphCreateNodeUser(BMS_BLKMEM *blkmem, SCIP_EXPRGRAPHNODE **node, SCIP_USEREXPRDATA *data, SCIP_EXPRINTCAPABILITY evalcapability, SCIP_DECL_USEREXPREVAL((*eval)), SCIP_DECL_USEREXPRINTEVAL((*inteval)), SCIP_DECL_USEREXPRCURV((*curv)), SCIP_DECL_USEREXPRPROP((*prop)), SCIP_DECL_USEREXPRESTIMATE((*estimate)), SCIP_DECL_USEREXPRCOPYDATA((*copydata)), SCIP_DECL_USEREXPRFREEDATA((*freedata)))
int SCIPexprgraphGetSumTreesNSummands(SCIP_EXPRGRAPHNODE *node)
SCIP_Bool SCIPexprAreMonomialsEqual(SCIP_EXPRDATA_MONOMIAL *monomial1, SCIP_EXPRDATA_MONOMIAL *monomial2, SCIP_Real eps)
int SCIPexprgraphGetNodeQuadraticNQuadElements(SCIP_EXPRGRAPHNODE *node)
struct SCIP_Messagehdlr SCIP_MESSAGEHDLR
Definition: type_message.h:50
SCIP_Real * SCIPexprGetMonomialExponents(SCIP_EXPRDATA_MONOMIAL *monomial)
void SCIPexprReindexVars(SCIP_EXPR *expr, int *newindices)
int SCIPexprtreeGetNVars(SCIP_EXPRTREE *tree)
SCIP_RETCODE SCIPexprgraphFree(SCIP_EXPRGRAPH **exprgraph)
void SCIPexprgraphSetVarNodeUb(SCIP_EXPRGRAPH *exprgraph, SCIP_EXPRGRAPHNODE *varnode, SCIP_Real ub)
SCIP_RETCODE SCIPexprSubstituteVars(BMS_BLKMEM *blkmem, SCIP_EXPR *expr, SCIP_EXPR **substexprs)
SCIP_RETCODE SCIPexprgraphCreateNodePolynomial(BMS_BLKMEM *blkmem, SCIP_EXPRGRAPHNODE **node, int nmonomials, SCIP_EXPRDATA_MONOMIAL **monomials, SCIP_Real constant, SCIP_Bool copymonomials)
SCIP_RETCODE SCIPexprgraphUpdateNodeBoundsCurvature(SCIP_EXPRGRAPHNODE *node, SCIP_Real infinity, SCIP_Real minstrength, SCIP_Bool clearreverseprop)
SCIP_EXPRGRAPHNODE ** SCIPexprgraphGetVarNodes(SCIP_EXPRGRAPH *exprgraph)
void SCIPexprgraphFreeNode(BMS_BLKMEM *blkmem, SCIP_EXPRGRAPHNODE **node)
SCIP_RETCODE SCIPexprgraphGetSeparableTrees(SCIP_EXPRGRAPH *exprgraph, SCIP_EXPRGRAPHNODE *node, int exprtreessize, int *nexprtrees, SCIP_EXPRTREE **exprtrees, SCIP_Real *exprtreecoefs)
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:53
SCIP_RETCODE SCIPexprEvalIntShallow(SCIP_EXPR *expr, SCIP_Real infinity, SCIP_INTERVAL *argvals, SCIP_INTERVAL *varvals, SCIP_Real *param, SCIP_INTERVAL *val)
SCIP_RETCODE SCIPexprAddMonomialFactors(BMS_BLKMEM *blkmem, SCIP_EXPRDATA_MONOMIAL *monomial, int nfactors, int *childidxs, SCIP_Real *exponents)
SCIP_Real SCIPexprGetSignPowerExponent(SCIP_EXPR *expr)
void * SCIPexprgraphGetNodeVar(SCIP_EXPRGRAPH *exprgraph, SCIP_EXPRGRAPHNODE *node)
SCIP_RETCODE SCIPexprCopyDeep(BMS_BLKMEM *blkmem, SCIP_EXPR **targetexpr, SCIP_EXPR *sourceexpr)
#define SCIP_DECL_USEREXPRINTEVAL(x)
Definition: type_expr.h:259
SCIP_EXPRCURV SCIPexprgraphGetNodeCurvature(SCIP_EXPRGRAPHNODE *node)
void * SCIPexprGetOpData(SCIP_EXPR *expr)
SCIP_RETCODE SCIPexprgraphNodePolynomialAddMonomials(BMS_BLKMEM *blkmem, SCIP_EXPRGRAPHNODE *node, int nmonomials, SCIP_EXPRDATA_MONOMIAL **monomials, SCIP_Bool copymonomials)
SCIP_Bool SCIPexprHasParam(SCIP_EXPR *expr)
SCIP_EXPRINTDATA * SCIPexprtreeGetInterpreterData(SCIP_EXPRTREE *tree)
int SCIPexprGetNMonomials(SCIP_EXPR *expr)
SCIP_RETCODE SCIPexprgraphAddExprtreeSum(SCIP_EXPRGRAPH *exprgraph, int nexprtrees, SCIP_EXPRTREE **exprtrees, SCIP_Real *coefs, SCIP_EXPRGRAPHNODE **rootnode, SCIP_Bool *rootnodeisnew)
SCIP_RETCODE SCIPexprSimplify(BMS_BLKMEM *blkmem, SCIP_MESSAGEHDLR *messagehdlr, SCIP_EXPR *expr, SCIP_Real eps, int maxexpansionexponent, int nvars, int *nlinvars, int *linidxs, SCIP_Real *lincoefs)
SCIP_Bool SCIPexprgraphAreAllNodeChildrenVars(SCIP_EXPRGRAPHNODE *node)
void SCIPexprgraphSetVarNodeBounds(SCIP_EXPRGRAPH *exprgraph, SCIP_EXPRGRAPHNODE *varnode, SCIP_INTERVAL varbounds)
unsigned int SCIP_EXPRINTCAPABILITY
SCIP_RETCODE SCIPexprCreatePolynomial(BMS_BLKMEM *blkmem, SCIP_EXPR **expr, int nchildren, SCIP_EXPR **children, int nmonomials, SCIP_EXPRDATA_MONOMIAL **monomials, SCIP_Real constant, SCIP_Bool copymonomials)
int SCIPexprgraphGetNodeDepth(SCIP_EXPRGRAPHNODE *node)
int SCIPexprGetNQuadElements(SCIP_EXPR *expr)
SCIP_INTERVAL * SCIPexprgraphGetVarsBounds(SCIP_EXPRGRAPH *exprgraph)
SCIP_EXPR ** SCIPexprGetChildren(SCIP_EXPR *expr)
SCIP_RETCODE SCIPexprtreeGetMaxDegree(SCIP_EXPRTREE *tree, int *maxdegree)
SCIP_EXPRCURV SCIPexprcurvMonomial(int nfactors, SCIP_Real *exponents, int *factoridxs, SCIP_EXPRCURV *factorcurv, SCIP_INTERVAL *factorbounds)
SCIP_EXPRCURV SCIPexprcurvMultiply(SCIP_Real factor, SCIP_EXPRCURV curvature)
SCIP_Bool SCIPexprgraphHasNodeNonlinearAncestor(SCIP_EXPRGRAPHNODE *node)
void SCIPexprSortQuadElems(SCIP_EXPR *expr)
SCIP_EXPRGRAPHNODE ** SCIPexprgraphGetNodeParents(SCIP_EXPRGRAPHNODE *node)
SCIP_RETCODE SCIPexprEvalInt(SCIP_EXPR *expr, SCIP_Real infinity, SCIP_INTERVAL *varvals, SCIP_Real *param, SCIP_INTERVAL *val)
#define SCIP_DECL_EXPRGRAPHVARADDED(x)
Definition: type_expr.h:181
SCIP_RETCODE SCIPexprEval(SCIP_EXPR *expr, SCIP_Real *varvals, SCIP_Real *param, SCIP_Real *val)
void SCIPexprSortMonomialFactors(SCIP_EXPRDATA_MONOMIAL *monomial)
int * SCIPexprGetMonomialChildIndices(SCIP_EXPRDATA_MONOMIAL *monomial)
SCIP_RETCODE SCIPexprtreeFree(SCIP_EXPRTREE **tree)
SCIP_RETCODE SCIPexprgraphPrintDot(SCIP_EXPRGRAPH *exprgraph, SCIP_MESSAGEHDLR *messagehdlr, FILE *file, const char **varnames)
SCIP_Real SCIPexprGetQuadConstant(SCIP_EXPR *expr)
SCIP_Bool SCIPexprAreEqual(SCIP_EXPR *expr1, SCIP_EXPR *expr2, SCIP_Real eps)
enum SCIP_ExprOp SCIP_EXPROP
Definition: type_expr.h:89
int SCIPexpropGetNChildren(SCIP_EXPROP op)
SCIP_EXPR * SCIPexprtreeGetRoot(SCIP_EXPRTREE *tree)
SCIP_RETCODE SCIPexprPolynomialPower(BMS_BLKMEM *blkmem, SCIP_EXPR *expr, int exponent)
SCIP_RETCODE SCIPexprParse(BMS_BLKMEM *blkmem, SCIP_MESSAGEHDLR *messagehdlr, SCIP_EXPR **expr, const char *str, const char *lastchar, int *nvars, int *varnames)
SCIP_RETCODE SCIPexprAddToLinear(BMS_BLKMEM *blkmem, SCIP_EXPR *expr, int nchildren, SCIP_Real *coefs, SCIP_EXPR **children, SCIP_Real constant)
SCIP_RETCODE SCIPexprtreeFreeInterpreterData(SCIP_EXPRTREE *tree)
SCIP_RETCODE SCIPexprgraphEval(SCIP_EXPRGRAPH *exprgraph, SCIP_Real *varvals)
SCIP_RETCODE SCIPexprgraphMoveNodeParents(SCIP_EXPRGRAPH *exprgraph, SCIP_EXPRGRAPHNODE **srcnode, SCIP_EXPRGRAPHNODE *targetnode)
void SCIPexprMergeMonomials(BMS_BLKMEM *blkmem, SCIP_EXPR *expr, SCIP_Real eps, SCIP_Bool mergefactors)
SCIP_Real SCIPexprgraphGetNodeRealPowerExponent(SCIP_EXPRGRAPHNODE *node)
int SCIPexprgraphGetNodePosition(SCIP_EXPRGRAPHNODE *node)
SCIP_RETCODE SCIPexprtreeEvalInt(SCIP_EXPRTREE *tree, SCIP_Real infinity, SCIP_INTERVAL *varvals, SCIP_INTERVAL *val)
SCIP_RETCODE SCIPexprgraphCreateNodeLinear(BMS_BLKMEM *blkmem, SCIP_EXPRGRAPHNODE **node, int ncoefs, SCIP_Real *coefs, SCIP_Real constant)
SCIP_EXPROP SCIPexprgraphGetNodeOperator(SCIP_EXPRGRAPHNODE *node)
SCIP_RETCODE SCIPexprgraphAddNode(SCIP_EXPRGRAPH *exprgraph, SCIP_EXPRGRAPHNODE *node, int mindepth, int nchildren, SCIP_EXPRGRAPHNODE **children)
SCIP_RETCODE SCIPexprEvalUser(SCIP_EXPR *expr, SCIP_Real *argvals, SCIP_Real *val, SCIP_Real *gradient, SCIP_Real *hessian)
SCIP_EXPRDATA_MONOMIAL ** SCIPexprGetMonomials(SCIP_EXPR *expr)
void SCIPexprgraphEnableNode(SCIP_EXPRGRAPH *exprgraph, SCIP_EXPRGRAPHNODE *node)
SCIP_RETCODE SCIPexprCreateUser(BMS_BLKMEM *blkmem, SCIP_EXPR **expr, int nchildren, SCIP_EXPR **children, SCIP_USEREXPRDATA *data, SCIP_EXPRINTCAPABILITY evalcapability, SCIP_DECL_USEREXPREVAL((*eval)), SCIP_DECL_USEREXPRINTEVAL((*inteval)), SCIP_DECL_USEREXPRCURV((*curv)), SCIP_DECL_USEREXPRPROP((*prop)), SCIP_DECL_USEREXPRESTIMATE((*estimate)), SCIP_DECL_USEREXPRCOPYDATA((*copydata)), SCIP_DECL_USEREXPRFREEDATA((*freedata)))
void SCIPexprMultiplyPolynomialByConstant(BMS_BLKMEM *blkmem, SCIP_EXPR *expr, SCIP_Real factor)
SCIP_RETCODE SCIPexprgraphCheckCurvature(SCIP_EXPRGRAPH *exprgraph, SCIP_Real infinity, SCIP_Bool clearreverseprop)
SCIP_RETCODE SCIPexprEvalShallow(SCIP_EXPR *expr, SCIP_Real *argvals, SCIP_Real *varvals, SCIP_Real *param, SCIP_Real *val)
#define SCIP_DECL_USEREXPRCURV(x)
Definition: type_expr.h:270
const char * SCIPexpropGetName(SCIP_EXPROP op)
void SCIPexprChgPolynomialConstant(SCIP_EXPR *expr, SCIP_Real constant)
SCIP_RETCODE SCIPexprGetMaxDegree(SCIP_EXPR *expr, int *maxdegree)
SCIP_Real SCIPexprGetOpReal(SCIP_EXPR *expr)
SCIP_Bool SCIPexprtreeHasParam(SCIP_EXPRTREE *tree)
void SCIPexprFreeShallow(BMS_BLKMEM *blkmem, SCIP_EXPR **expr)
SCIP_RETCODE SCIPexprEvalIntUser(SCIP_EXPR *expr, SCIP_Real infinity, SCIP_INTERVAL *argvals, SCIP_INTERVAL *val, SCIP_INTERVAL *gradient, SCIP_INTERVAL *hessian)
int SCIPexprgraphGetNVars(SCIP_EXPRGRAPH *exprgraph)
#define SCIP_DECL_USEREXPRESTIMATE(x)
Definition: type_expr.h:234
struct SCIP_ExprTree SCIP_EXPRTREE
Definition: type_expr.h:92
#define SCIP_DECL_USEREXPRPROP(x)
Definition: type_expr.h:282
SCIP_Real SCIPexprGetRealPowerExponent(SCIP_EXPR *expr)
SCIP_EXPRCURV SCIPexprcurvPower(SCIP_INTERVAL basebounds, SCIP_EXPRCURV basecurv, SCIP_Real exponent)
SCIP_RETCODE SCIPexprEstimateUser(SCIP_EXPR *expr, SCIP_Real infinity, SCIP_Real *argvals, SCIP_INTERVAL *argbounds, SCIP_Bool overestimate, SCIP_Real *coeffs, SCIP_Real *constant, SCIP_Bool *success)
int SCIPexprGetMonomialNFactors(SCIP_EXPRDATA_MONOMIAL *monomial)
#define SCIP_Bool
Definition: def.h:50
struct SCIP_ExprGraph SCIP_EXPRGRAPH
Definition: type_expr.h:171
SCIP_Bool SCIPquadelemSortedFind(SCIP_QUADELEM *quadelems, int idx1, int idx2, int nquadelems, int *pos)
void SCIPexprFreeDeep(BMS_BLKMEM *blkmem, SCIP_EXPR **expr)
SCIP_EXPRCURV SCIPexprcurvAdd(SCIP_EXPRCURV curv1, SCIP_EXPRCURV curv2)
int SCIPexprGetOpIndex(SCIP_EXPR *expr)
int SCIPexprgraphGetNodeOperatorIndex(SCIP_EXPRGRAPHNODE *node)
SCIP_RETCODE SCIPexprMultiplyMonomialByMonomial(BMS_BLKMEM *blkmem, SCIP_EXPRDATA_MONOMIAL *monomial, SCIP_EXPRDATA_MONOMIAL *factor, int *childmap)
SCIP_RETCODE SCIPexprtreeSubstituteVars(SCIP_EXPRTREE *tree, SCIP_EXPR **substexprs)
void SCIPexprgraphTightenNodeBounds(SCIP_EXPRGRAPH *exprgraph, SCIP_EXPRGRAPHNODE *node, SCIP_INTERVAL nodebounds, SCIP_Real minstrength, SCIP_Real infinity, SCIP_Bool *cutoff)
SCIP_Real SCIPexprGetPolynomialConstant(SCIP_EXPR *expr)
SCIP_USEREXPRDATA * SCIPexprGetUserData(SCIP_EXPR *expr)
SCIP_Bool SCIPexprHasUserEstimator(SCIP_EXPR *expr)
void SCIPexprgraphSetVarBounds(SCIP_EXPRGRAPH *exprgraph, void *var, SCIP_INTERVAL varbounds)
SCIP_Real * SCIPexprtreeGetParamVals(SCIP_EXPRTREE *tree)
struct SCIP_ExprGraphNode SCIP_EXPRGRAPHNODE
Definition: type_expr.h:170
int * SCIPexprgraphGetNNodes(SCIP_EXPRGRAPH *exprgraph)
SCIP_RETCODE SCIPexprgraphReleaseNode(SCIP_EXPRGRAPH *exprgraph, SCIP_EXPRGRAPHNODE **node)
SCIP_Real SCIPexprgraphGetNodeSignPowerExponent(SCIP_EXPRGRAPHNODE *node)
SCIP_RETCODE SCIPexprgraphSimplify(SCIP_EXPRGRAPH *exprgraph, SCIP_MESSAGEHDLR *messagehdlr, SCIP_Real eps, int maxexpansionexponent, SCIP_Bool *havechange, SCIP_Bool *domainerror)
SCIP_RETCODE SCIPexprMultiplyPolynomialByMonomial(BMS_BLKMEM *blkmem, SCIP_EXPR *expr, SCIP_EXPRDATA_MONOMIAL *factor, int *childmap)
SCIP_RETCODE SCIPexprgraphGetTree(SCIP_EXPRGRAPH *exprgraph, SCIP_EXPRGRAPHNODE *rootnode, SCIP_EXPRTREE **exprtree)
void SCIPexprgraphSetVarNodeValue(SCIP_EXPRGRAPHNODE *varnode, SCIP_Real value)
SCIP_RETCODE SCIPexprtreeCheckCurvature(SCIP_EXPRTREE *tree, SCIP_Real infinity, SCIP_INTERVAL *varbounds, SCIP_EXPRCURV *curv, SCIP_INTERVAL *bounds)
SCIP_RETCODE SCIPexprtreeCopy(BMS_BLKMEM *blkmem, SCIP_EXPRTREE **targettree, SCIP_EXPRTREE *sourcetree)
const char * SCIPexprcurvGetName(SCIP_EXPRCURV curv)
int SCIPexprgraphGetNodeNChildren(SCIP_EXPRGRAPHNODE *node)
SCIP_Real * SCIPexprgraphGetNodeLinearCoefs(SCIP_EXPRGRAPHNODE *node)
#define SCIP_DECL_EXPRGRAPHVARREMOVE(x)
Definition: type_expr.h:191
SCIP_RETCODE SCIPexprCreate(BMS_BLKMEM *blkmem, SCIP_EXPR **expr, SCIP_EXPROP op,...)
SCIP_RETCODE SCIPexprgraphPropagateVarBounds(SCIP_EXPRGRAPH *exprgraph, SCIP_Real infinity, SCIP_Bool clearreverseprop, SCIP_Bool *domainerror)
enum SCIP_ExprCurv SCIP_EXPRCURV
Definition: type_expr.h:93
SCIP_Bool SCIPexprgraphHasNodeSibling(SCIP_EXPRGRAPHNODE *node)
SCIP_Bool SCIPexprgraphHasNodeUserEstimator(SCIP_EXPRGRAPHNODE *node)
void SCIPexprgraphSetVarNodeLb(SCIP_EXPRGRAPH *exprgraph, SCIP_EXPRGRAPHNODE *varnode, SCIP_Real lb)
SCIP_RETCODE SCIPexprAddMonomials(BMS_BLKMEM *blkmem, SCIP_EXPR *expr, int nmonomials, SCIP_EXPRDATA_MONOMIAL **monomials, SCIP_Bool copymonomials)
SCIP_USEREXPRDATA * SCIPexprgraphGetNodeUserData(SCIP_EXPRGRAPHNODE *node)
int SCIPexprtreeGetNParams(SCIP_EXPRTREE *tree)
SCIP_Bool SCIPexprgraphFindVarNode(SCIP_EXPRGRAPH *exprgraph, void *var, SCIP_EXPRGRAPHNODE **varnode)
int SCIPexprgraphGetDepth(SCIP_EXPRGRAPH *exprgraph)
SCIP_RETCODE SCIPexprtreeSimplify(SCIP_EXPRTREE *tree, SCIP_MESSAGEHDLR *messagehdlr, SCIP_Real eps, int maxexpansionexponent, int *nlinvars, int *linidxs, SCIP_Real *lincoefs)
SCIP_Real SCIPexprgraphGetNodeOperatorReal(SCIP_EXPRGRAPHNODE *node)
SCIP_Real SCIPexprgraphGetNodePolynomialConstant(SCIP_EXPRGRAPHNODE *node)
void SCIPexprgraphCaptureNode(SCIP_EXPRGRAPHNODE *node)
SCIP_Bool SCIPexprgraphFindConstNode(SCIP_EXPRGRAPH *exprgraph, SCIP_Real constant, SCIP_EXPRGRAPHNODE **constnode)
SCIP_RETCODE SCIPexprMulConstant(BMS_BLKMEM *blkmem, SCIP_EXPR **expr, SCIP_EXPR *term, SCIP_Real factor)
type definitions for expressions and expression trees
void SCIPexprgraphPrintNode(SCIP_EXPRGRAPHNODE *node, SCIP_MESSAGEHDLR *messagehdlr, FILE *file)
public methods for message output
void SCIPquadelemSort(SCIP_QUADELEM *quadelems, int nquadelems)
SCIP_RETCODE SCIPexprgraphCreateNode(BMS_BLKMEM *blkmem, SCIP_EXPRGRAPHNODE **node, SCIP_EXPROP op,...)
void SCIPexprReindexParams(SCIP_EXPR *expr, int *newindices)
SCIP_EXPROP SCIPexprGetOperator(SCIP_EXPR *expr)
#define SCIP_DECL_USEREXPRCOPYDATA(x)
Definition: type_expr.h:291
#define SCIP_Real
Definition: def.h:124
int SCIPexprGetIntPowerExponent(SCIP_EXPR *expr)
SCIP_RETCODE SCIPexprgraphReplaceVarByLinearSum(SCIP_EXPRGRAPH *exprgraph, void *var, int ncoefs, SCIP_Real *coefs, void **vars, SCIP_Real constant)
void SCIPexprGetVarsUsage(SCIP_EXPR *expr, int *varsusage)
void SCIPexprgraphPropagateNodeBounds(SCIP_EXPRGRAPH *exprgraph, SCIP_Real infinity, SCIP_Real minstrength, SCIP_Bool *cutoff)
SCIP_Real SCIPexprGetLinearConstant(SCIP_EXPR *expr)
SCIP_EXPRGRAPHNODE *** SCIPexprgraphGetNodes(SCIP_EXPRGRAPH *exprgraph)
SCIP_RETCODE SCIPexprtreeCreate(BMS_BLKMEM *blkmem, SCIP_EXPRTREE **tree, SCIP_EXPR *root, int nvars, int nparams, SCIP_Real *params)
void SCIPexprMonomialPower(SCIP_EXPRDATA_MONOMIAL *monomial, int exponent)
SCIP_EXPRDATA_MONOMIAL ** SCIPexprgraphGetNodePolynomialMonomials(SCIP_EXPRGRAPHNODE *node)
SCIP_EXPRGRAPHNODE ** SCIPexprgraphGetNodeChildren(SCIP_EXPRGRAPHNODE *node)
void SCIPexprtreeSetParamVal(SCIP_EXPRTREE *tree, int paramidx, SCIP_Real paramval)
SCIP_RETCODE SCIPexprCreateMonomial(BMS_BLKMEM *blkmem, SCIP_EXPRDATA_MONOMIAL **monomial, SCIP_Real coef, int nfactors, int *childidxs, SCIP_Real *exponents)
SCIP_Real * SCIPexprGetLinearCoefs(SCIP_EXPR *expr)
SCIP_Bool SCIPexprFindMonomialFactor(SCIP_EXPRDATA_MONOMIAL *monomial, int childidx, int *pos)
SCIP_Real * SCIPexprgraphGetNodeQuadraticLinearCoefs(SCIP_EXPRGRAPHNODE *node)
SCIP_RETCODE SCIPexprtreeAddExpr(SCIP_EXPRTREE *tree, SCIP_EXPR *expr, SCIP_Bool copyexpr)
SCIP_Real SCIPexprgraphGetNodeQuadraticConstant(SCIP_EXPRGRAPHNODE *node)
common defines and data types used in all packages of SCIP
SCIP_RETCODE SCIPexprCheckCurvature(SCIP_EXPR *expr, SCIP_Real infinity, SCIP_INTERVAL *varbounds, SCIP_Real *param, SCIP_EXPRCURV *curv, SCIP_INTERVAL *bounds)
void SCIPexprgraphGetSubtreeVarsUsage(SCIP_EXPRGRAPH *exprgraph, SCIP_EXPRGRAPHNODE *node, int *varsusage)
struct SCIP_ExprIntData SCIP_EXPRINTDATA
SCIP_RETCODE SCIPexprCreateLinear(BMS_BLKMEM *blkmem, SCIP_EXPR **expr, int nchildren, SCIP_EXPR **children, SCIP_Real *coefs, SCIP_Real constant)
SCIP_Real SCIPexprgraphGetNodeVal(SCIP_EXPRGRAPHNODE *node)
#define SCIP_DECL_USEREXPRFREEDATA(x)
Definition: type_expr.h:299
SCIP_RETCODE SCIPexprtreeSetParams(SCIP_EXPRTREE *tree, int nparams, SCIP_Real *paramvals)
SCIP_RETCODE SCIPexprgraphAddVars(SCIP_EXPRGRAPH *exprgraph, int nvars, void **vars, SCIP_EXPRGRAPHNODE **varnodes)
SCIP_Bool SCIPexprgraphIsNodeEnabled(SCIP_EXPRGRAPHNODE *node)
void SCIPexprSortMonomials(SCIP_EXPR *expr)
SCIP_Real * SCIPexprGetQuadLinearCoefs(SCIP_EXPR *expr)
SCIP_RETCODE SCIPexprgraphCreate(BMS_BLKMEM *blkmem, SCIP_EXPRGRAPH **exprgraph, int varssizeinit, int depthinit, SCIP_DECL_EXPRGRAPHVARADDED((*exprgraphvaradded)), SCIP_DECL_EXPRGRAPHVARREMOVE((*exprgraphvarremove)), SCIP_DECL_EXPRGRAPHVARCHGIDX((*exprgraphvarchgidx)), void *userdata)
struct SCIP_Expr SCIP_EXPR
Definition: type_expr.h:91
#define SCIP_DECL_EXPRGRAPHVARCHGIDX(x)
Definition: type_expr.h:203
SCIP_INTERVAL SCIPexprgraphGetNodeBounds(SCIP_EXPRGRAPHNODE *node)