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-2017 Konrad-Zuse-Zentrum */
7 /* fuer Informationstechnik Berlin */
8 /* */
9 /* SCIP is distributed under the terms of the ZIB Academic License. */
10 /* */
11 /* You should have received a copy of the ZIB Academic License */
12 /* along with SCIP; see the file COPYING. If not email to scip@zib.de. */
13 /* */
14 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
15 
16 /**@file 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  SCIP_DECL_USEREXPRPRINT ((*print)) /**< expression print function, or NULL for default string "user" */
591  );
592 
593 /** indicates whether the expression contains a SCIP_EXPR_PARAM */
594 extern
596  SCIP_EXPR* expr /**< expression */
597  );
598 
599 /** gets maximal degree of expression, or SCIP_EXPR_DEGREEINFINITY if not a polynomial */
600 extern
602  SCIP_EXPR* expr, /**< expression */
603  int* maxdegree /**< buffer to store maximal degree */
604  );
605 
606 /** counts usage of variables in expression */
607 extern
609  SCIP_EXPR* expr, /**< expression to update */
610  int* varsusage /**< array with counters of variable usage */
611  );
612 
613 /** compares whether two expressions are the same
614  * inconclusive, i.e., may give FALSE even if expressions are equivalent (x*y != y*x)
615  */
616 extern
618  SCIP_EXPR* expr1, /**< first expression */
619  SCIP_EXPR* expr2, /**< second expression */
620  SCIP_Real eps /**< threshold under which numbers are assumed to be zero */
621  );
622 
623 /** aims at simplifying an expression and splitting of a linear expression
624  * if linear variables are split off, expression interpreter data, if stored in the tree, is freed
625  */
626 extern
628  BMS_BLKMEM* blkmem, /**< block memory data structure */
629  SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
630  SCIP_EXPR* expr, /**< expression */
631  SCIP_Real eps, /**< threshold, under which positive values are treat as 0 */
632  int maxexpansionexponent,/**< maximal exponent for which we still expand non-monomial polynomials */
633  int nvars, /**< number of variables in expression */
634  int* nlinvars, /**< buffer to store number of linear variables in linear part, or NULL if linear part should not be separated */
635  int* linidxs, /**< array to store indices of variables in expression tree which belong to linear part, or NULL */
636  SCIP_Real* lincoefs /**< array to store coefficients of linear part, or NULL */
637  );
638 
639 /** evaluates an expression w.r.t. given values for children expressions */
640 extern
642  SCIP_EXPR* expr, /**< expression */
643  SCIP_Real* argvals, /**< values for children, can be NULL if the expression has no children */
644  SCIP_Real* varvals, /**< values for variables, can be NULL if the expression operand is not a variable */
645  SCIP_Real* param, /**< values for parameters, can be NULL if the expression operand is not a parameter */
646  SCIP_Real* val /**< buffer to store value */
647  );
648 
649 /** evaluates an expression w.r.t. a point */
650 extern
652  SCIP_EXPR* expr, /**< expression */
653  SCIP_Real* varvals, /**< values for variables, can be NULL if the expression is constant */
654  SCIP_Real* param, /**< values for parameters, can be NULL if the expression is not parameterized */
655  SCIP_Real* val /**< buffer to store value */
656  );
657 
658 /** evaluates an expression w.r.t. given interval values for children expressions */
659 extern
661  SCIP_EXPR* expr, /**< expression */
662  SCIP_Real infinity, /**< value to use for infinity */
663  SCIP_INTERVAL* argvals, /**< interval values for children, can be NULL if the expression has no children */
664  SCIP_INTERVAL* varvals, /**< interval values for variables, can be NULL if the expression is constant */
665  SCIP_Real* param, /**< values for parameters, can be NULL if the expression is not parameterized */
666  SCIP_INTERVAL* val /**< buffer to store value */
667  );
668 
669 /** evaluates an expression w.r.t. an interval */
670 extern
672  SCIP_EXPR* expr, /**< expression */
673  SCIP_Real infinity, /**< value to use for infinity */
674  SCIP_INTERVAL* varvals, /**< interval values for variables, can be NULL if the expression is constant */
675  SCIP_Real* param, /**< values for parameters, can be NULL if the expression is not parameterized */
676  SCIP_INTERVAL* val /**< buffer to store value */
677  );
678 
679 /** evaluates a user expression w.r.t. given values for children expressions */
680 extern
682  SCIP_EXPR* expr, /**< expression */
683  SCIP_Real* argvals, /**< values for children */
684  SCIP_Real* val, /**< buffer to store function value */
685  SCIP_Real* gradient, /**< buffer to store gradient values, or NULL if not requested */
686  SCIP_Real* hessian /**< buffer to store values of full Hessian, or NULL if not requested */
687  );
688 
689 /** evaluates a user expression w.r.t. an interval */
690 extern
692  SCIP_EXPR* expr, /**< expression */
693  SCIP_Real infinity, /**< value to use for infinity */
694  SCIP_INTERVAL* argvals, /**< values for children */
695  SCIP_INTERVAL* val, /**< buffer to store value */
696  SCIP_INTERVAL* gradient, /**< buffer to store gradient values, or NULL if not requested */
697  SCIP_INTERVAL* hessian /**< buffer to store values of full Hessian, or NULL if not requested */
698  );
699 
700 /** tries to determine the curvature type of an expression w.r.t. given variable domains */
701 extern
703  SCIP_EXPR* expr, /**< expression to check */
704  SCIP_Real infinity, /**< value to use for infinity */
705  SCIP_INTERVAL* varbounds, /**< domains of variables */
706  SCIP_Real* param, /**< values for parameters, can be NULL if the expression is not parameterized */
707  SCIP_EXPRCURV* curv, /**< buffer to store curvature of expression */
708  SCIP_INTERVAL* bounds /**< buffer to store bounds on expression */
709  );
710 
711 /** under-/overestimates a user expression w.r.t. to given values and bounds for children expressions */
712 extern
714  SCIP_EXPR* expr, /**< expression */
715  SCIP_Real infinity, /**< value to use for infinity */
716  SCIP_Real* argvals, /**< values for children */
717  SCIP_INTERVAL* argbounds, /**< bounds for children */
718  SCIP_Bool overestimate, /**< whether to overestimate the expression */
719  SCIP_Real* coeffs, /**< buffer to store the linear coefficients for each child expression that gives a valid under-/overestimator */
720  SCIP_Real* constant, /**< buffer to store the constant value of the linear under-/overestimator */
721  SCIP_Bool* success /**< buffer to store whether an estimator was successfully computed */
722 );
723 
724 
725 /** substitutes variables (SCIP_EXPR_VARIDX) by expressions
726  * Note that only the children of the given expr are checked!
727  * A variable with index i is replaced by a copy of substexprs[i], if that latter is not NULL
728  * if substexprs[i] == NULL, then the variable expression i is not touched
729  */
730 extern
732  BMS_BLKMEM* blkmem, /**< block memory data structure */
733  SCIP_EXPR* expr, /**< expression, which of the children may be replaced */
734  SCIP_EXPR** substexprs /**< array of substitute expressions; single entries can be NULL */
735  );
736 
737 /** updates variable indices in expression tree */
738 extern
740  SCIP_EXPR* expr, /**< expression to update */
741  int* newindices /**< new indices of variables */
742  );
743 
744 /** updates parameter indices in expression tree */
745 extern
747  SCIP_EXPR* expr, /**< expression to update */
748  int* newindices /**< new indices of variables */
749  );
750 
751 /** prints an expression */
752 extern
753 void SCIPexprPrint(
754  SCIP_EXPR* expr, /**< expression */
755  SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
756  FILE* file, /**< file for printing, or NULL for stdout */
757  const char** varnames, /**< names of variables, or NULL for default names */
758  const char** paramnames, /**< names of parameters, or NULL for default names */
759  SCIP_Real* paramvals /**< values of parameters, or NULL for not printing */
760  );
761 
762 /** parses an expression from a string */
763 extern
765  BMS_BLKMEM* blkmem, /**< block memory data structure */
766  SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
767  SCIP_EXPR** expr, /**< buffer to store pointer to created expression */
768  const char* str, /**< pointer to the string to be parsed */
769  const char* lastchar, /**< pointer to the last char of str that should be parsed */
770  int* nvars, /**< buffer to store number of variables */
771  int* varnames /**< buffer to store variable names, prefixed by index (as int) */
772  );
773 
774 /**@} */
775 
776 /**@name Expression tree methods */
777 /**@{ */
778 
779 /** returns root expression of an expression tree */
780 extern
782  SCIP_EXPRTREE* tree /**< expression tree */
783  );
784 
785 /** returns number of variables in expression tree */
786 extern
788  SCIP_EXPRTREE* tree /**< expression tree */
789  );
790 
791 /** returns number of parameters in expression tree */
792 extern
794  SCIP_EXPRTREE* tree /**< expression tree */
795  );
796 
797 /** returns values of parameters or NULL if none */
798 extern
800  SCIP_EXPRTREE* tree /**< expression tree */
801  );
802 
803 /** sets value of a single parameter in expression tree */
804 extern
806  SCIP_EXPRTREE* tree, /**< expression tree */
807  int paramidx, /**< index of parameter */
808  SCIP_Real paramval /**< new value of parameter */
809  );
810 
811 /** gets data of expression tree interpreter, or NULL if not set */
812 extern
814  SCIP_EXPRTREE* tree /**< expression tree */
815  );
816 
817 /** sets data of expression tree interpreter */
818 extern
820  SCIP_EXPRTREE* tree, /**< expression tree */
821  SCIP_EXPRINTDATA* interpreterdata /**< expression interpreter data */
822  );
823 
824 /** frees data of expression tree interpreter, if any */
825 extern
827  SCIP_EXPRTREE* tree /**< expression tree */
828  );
829 
830 /** indicates whether there are parameterized constants (SCIP_EXPR_PARAM) in expression tree */
831 extern
833  SCIP_EXPRTREE* tree /**< expression tree */
834  );
835 
836 /** Gives maximal degree of expression in expression tree.
837  * If constant expression, gives 0,
838  * if linear expression, gives 1,
839  * if polynomial expression, gives its maximal degree,
840  * otherwise (nonpolynomial nonconstant expressions) gives at least SCIP_EXPR_DEGREEINFINITY.
841  */
842 extern
844  SCIP_EXPRTREE* tree, /**< expression tree */
845  int* maxdegree /**< buffer to store maximal degree */
846  );
847 
848 /** evaluates an expression tree w.r.t. a point */
849 extern
851  SCIP_EXPRTREE* tree, /**< expression tree */
852  SCIP_Real* varvals, /**< values for variables */
853  SCIP_Real* val /**< buffer to store expression tree value */
854  );
855 
856 /** evaluates an expression tree w.r.t. an interval */
857 extern
859  SCIP_EXPRTREE* tree, /**< expression tree */
860  SCIP_Real infinity, /**< value for infinity */
861  SCIP_INTERVAL* varvals, /**< intervals for variables */
862  SCIP_INTERVAL* val /**< buffer to store expression tree value */
863  );
864 
865 /** prints an expression tree */
866 extern
867 void SCIPexprtreePrint(
868  SCIP_EXPRTREE* tree, /**< expression tree */
869  SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
870  FILE* file, /**< file for printing, or NULL for stdout */
871  const char** varnames, /**< names of variables, or NULL for default names */
872  const char** paramnames /**< names of parameters, or NULL for default names */
873  );
874 
875 #ifdef NDEBUG
876 
877 /* In optimized mode, the function calls are overwritten by defines to reduce the number of function calls and
878  * speed up the algorithms.
879  */
880 
881 #define SCIPexprtreeGetRoot(tree) (tree)->root
882 #define SCIPexprtreeGetNVars(tree) (tree)->nvars
883 #define SCIPexprtreeGetNParams(tree) (tree)->nparams
884 #define SCIPexprtreeGetParamVals(tree) (tree)->params
885 #define SCIPexprtreeSetParamVal(tree, paramidx, paramval) do { (tree)->params[(paramidx)] = paramval; } while (FALSE)
886 #define SCIPexprtreeGetInterpreterData(tree) (tree)->interpreterdata
887 #define SCIPexprtreeSetInterpreterData(tree, newinterpreterdata) do { (tree)->interpreterdata = newinterpreterdata; } while (FALSE)
888 #define SCIPexprtreeFreeInterpreterData(tree) ((tree)->interpreterdata != NULL ? SCIPexprintFreeData(&(tree)->interpreterdata) : SCIP_OKAY)
889 #define SCIPexprtreeHasParam(tree) SCIPexprHasParam((tree)->root)
890 #define SCIPexprtreeGetMaxDegree(tree, maxdegree) SCIPexprGetMaxDegree((tree)->root, maxdegree)
891 #define SCIPexprtreeEval(tree, varvals, val) SCIPexprEval((tree)->root, varvals, (tree)->params, val)
892 #define SCIPexprtreeEvalInt(tree, infinity, varvals, val) SCIPexprEvalInt((tree)->root, infinity, varvals, (tree)->params, val)
893 #define SCIPexprtreePrint(tree, messagehdlr, file, varnames, paramnames) SCIPexprPrint((tree)->root, messagehdlr, file, varnames, paramnames, (tree)->params)
894 
895 #endif
896 
897 /** creates an expression tree */
898 extern
900  BMS_BLKMEM* blkmem, /**< block memory data structure */
901  SCIP_EXPRTREE** tree, /**< buffer to store address of created expression tree */
902  SCIP_EXPR* root, /**< pointer to root expression, not copied deep !, can be NULL */
903  int nvars, /**< number of variables in variable mapping */
904  int nparams, /**< number of parameters in expression */
905  SCIP_Real* params /**< values for parameters, or NULL (if NULL but nparams > 0, then params is initialized with zeros) */
906  );
907 
908 /** copies an expression tree */
909 extern
911  BMS_BLKMEM* blkmem, /**< block memory that should be used in new expression tree */
912  SCIP_EXPRTREE** targettree, /**< buffer to store address of copied expression tree */
913  SCIP_EXPRTREE* sourcetree /**< expression tree to copy */
914  );
915 
916 /** frees an expression tree */
917 extern
919  SCIP_EXPRTREE** tree /**< pointer to expression tree that is freed */
920  );
921 
922 /** sets number and values of all parameters in expression tree */
923 extern
925  SCIP_EXPRTREE* tree, /**< expression tree */
926  int nparams, /**< number of parameters */
927  SCIP_Real* paramvals /**< values of parameters, can be NULL if nparams == 0 */
928  );
929 
930 /** gives the number of usages for each variable in the expression tree */
931 extern
933  SCIP_EXPRTREE* tree, /**< expression tree */
934  int* varsusage /**< array where to store for each variable how often it is used in the tree */
935  );
936 
937 /** aims at simplifying an expression and splitting of a linear expression
938  * if linear variables are split off, expression interpreter data, if stored in the tree, is freed
939  */
940 extern
942  SCIP_EXPRTREE* tree, /**< expression tree */
943  SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
944  SCIP_Real eps, /**< threshold, under which positive values are treat as 0 */
945  int maxexpansionexponent,/**< maximal exponent for which we still expand non-monomial polynomials */
946  int* nlinvars, /**< buffer to store number of linear variables in linear part, or NULL if linear part should not be separated */
947  int* linidxs, /**< array to store indices of variables in expression tree which belong to linear part, or NULL */
948  SCIP_Real* lincoefs /**< array to store coefficients of linear part, or NULL */
949  );
950 
951 /** adds an expression to the root expression of the tree
952  * the root is replaced with an SCIP_EXPR_PLUS expression which has the previous root and the given expression as children
953  */
954 extern
956  SCIP_EXPRTREE* tree, /**< expression tree */
957  SCIP_EXPR* expr, /**< expression to add to tree */
958  SCIP_Bool copyexpr /**< whether expression should be copied */
959  );
960 
961 /** tries to determine the curvature type of an expression tree w.r.t. given variable domains */
962 extern
964  SCIP_EXPRTREE* tree, /**< expression tree */
965  SCIP_Real infinity, /**< value for infinity */
966  SCIP_INTERVAL* varbounds, /**< domains of variables */
967  SCIP_EXPRCURV* curv, /**< buffer to store curvature of expression */
968  SCIP_INTERVAL* bounds /**< buffer to store bounds on expression, or NULL if not needed */
969  );
970 
971 /** substitutes variables (SCIP_EXPR_VARIDX) in an expression tree by expressions
972  * A variable with index i is replaced by a copy of substexprs[i], if that latter is not NULL
973  * if substexprs[i] == NULL, then the variable expression i is not touched
974  */
975 extern
977  SCIP_EXPRTREE* tree, /**< expression tree */
978  SCIP_EXPR** substexprs /**< array of substitute expressions; single entries can be NULL */
979  );
980 
981 /**@} */
982 
983 /**@name Quadratic element methods */
984 /**@{ */
985 
986 /** sorts an array of quadratic elements
987  * The elements are sorted such that the first index is increasing and
988  * such that among elements with the same first index, the second index is increasing.
989  * For elements with same first and second index, the order is not defined.
990  */
991 extern
992 void SCIPquadelemSort(
993  SCIP_QUADELEM* quadelems, /**< array of quadratic elements */
994  int nquadelems /**< number of quadratic elements */
995  );
996 
997 /** Finds an index pair in a sorted array of quadratic elements.
998  * If (idx1,idx2) is found in quadelems, then returns TRUE and stores position of quadratic element in *pos.
999  * 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.
1000  * Assumes that idx1 <= idx2.
1001  */
1002 extern
1004  SCIP_QUADELEM* quadelems, /**< array of quadratic elements */
1005  int idx1, /**< index of first variable in element to search for */
1006  int idx2, /**< index of second variable in element to search for */
1007  int nquadelems, /**< number of quadratic elements in array */
1008  int* pos /**< buffer to store position of found quadratic element, or position where it would be inserted */
1009  );
1010 
1011 /** Adds quadratic elements with same index and removes elements with coefficient 0.0.
1012  * Assumes that elements have been sorted before.
1013  */
1014 extern
1015 void SCIPquadelemSqueeze(
1016  SCIP_QUADELEM* quadelems, /**< array of quadratic elements */
1017  int nquadelems, /**< number of quadratic elements */
1018  int* nquadelemsnew /**< pointer to store new (reduced) number of quadratic elements */
1019  );
1020 
1021 /**@} */
1022 
1023 /**@name Expression graph node methods */
1024 /**@{ */
1025 
1026 /** captures node, i.e., increases number of uses */
1027 extern
1029  SCIP_EXPRGRAPHNODE* node /**< expression graph node to capture */
1030  );
1031 
1032 /** returns whether a node is currently enabled */
1033 extern
1035  SCIP_EXPRGRAPHNODE* node /**< expression graph node to enable */
1036  );
1037 
1038 /** gets number of children of a node in an expression graph */
1039 extern
1041  SCIP_EXPRGRAPHNODE* node /**< expression graph node */
1042  );
1043 
1044 /** gets children of a node in an expression graph */
1045 extern
1047  SCIP_EXPRGRAPHNODE* node /**< expression graph node */
1048  );
1049 
1050 /** gets number of parents of a node in an expression graph */
1051 extern
1053  SCIP_EXPRGRAPHNODE* node /**< expression graph node */
1054  );
1055 
1056 /** gets parents of a node in an expression graph */
1057 extern
1059  SCIP_EXPRGRAPHNODE* node /**< expression graph node */
1060  );
1061 
1062 /** gets depth of node in expression graph */
1063 extern
1065  SCIP_EXPRGRAPHNODE* node /**< expression graph node */
1066  );
1067 
1068 /** gets position of node in expression graph at its depth level */
1069 extern
1071  SCIP_EXPRGRAPHNODE* node /**< expression graph node */
1072  );
1073 
1074 /** gets operator of a node in an expression graph */
1075 extern
1077  SCIP_EXPRGRAPHNODE* node /**< expression graph node */
1078  );
1079 
1080 /** gives index belonging to a SCIP_EXPR_VARIDX or SCIP_EXPR_PARAM operand */
1081 extern
1083  SCIP_EXPRGRAPHNODE* node /**< expression graph node */
1084  );
1085 
1086 /** gives real belonging to a SCIP_EXPR_CONST operand */
1087 extern
1089  SCIP_EXPRGRAPHNODE* node /**< expression graph node */
1090  );
1091 
1092 /** gives variable belonging to a SCIP_EXPR_VARIDX expression */
1093 extern
1095  SCIP_EXPRGRAPH* exprgraph, /**< expression graph */
1096  SCIP_EXPRGRAPHNODE* node /**< expression graph node */
1097  );
1098 
1099 /** gives exponent belonging to a SCIP_EXPR_REALPOWER expression */
1100 extern
1102  SCIP_EXPRGRAPHNODE* node /**< expression graph node */
1103  );
1104 
1105 /** gives exponent belonging to a SCIP_EXPR_INTPOWER expression */
1106 extern
1108  SCIP_EXPRGRAPHNODE* node /**< expression graph node */
1109  );
1110 
1111 /** gives exponent belonging to a SCIP_EXPR_SIGNPOWER expression */
1112 extern
1114  SCIP_EXPRGRAPHNODE* node /**< expression graph node */
1115  );
1116 
1117 /** gives linear coefficients belonging to a SCIP_EXPR_LINEAR expression */
1118 extern
1120  SCIP_EXPRGRAPHNODE* node /**< expression graph node */
1121  );
1122 
1123 /** gives constant belonging to a SCIP_EXPR_LINEAR expression */
1124 extern
1126  SCIP_EXPRGRAPHNODE* node /**< expression graph node */
1127  );
1128 
1129 /** gives constant belonging to a SCIP_EXPR_QUADRATIC expression */
1130 extern
1132  SCIP_EXPRGRAPHNODE* node /**< expression graph node */
1133  );
1134 
1135 /** gives linear coefficients belonging to a SCIP_EXPR_QUADRATIC expression, or NULL if all coefficients are 0.0 */
1136 extern
1138  SCIP_EXPRGRAPHNODE* node /**< expression graph node */
1139  );
1140 
1141 /** gives quadratic elements belonging to a SCIP_EXPR_QUADRATIC expression */
1142 extern
1144  SCIP_EXPRGRAPHNODE* node /**< expression graph node */
1145  );
1146 
1147 /** gives number of quadratic elements belonging to a SCIP_EXPR_QUADRATIC expression */
1148 extern
1150  SCIP_EXPRGRAPHNODE* node /**< expression graph node */
1151  );
1152 
1153 /** gives the monomials belonging to a SCIP_EXPR_POLYNOMIAL expression */
1154 extern
1156  SCIP_EXPRGRAPHNODE* node /**< expression graph node */
1157  );
1158 
1159 /** gives the number of monomials belonging to a SCIP_EXPR_POLYNOMIAL expression */
1160 extern
1162  SCIP_EXPRGRAPHNODE* node /**< expression graph node */
1163  );
1164 
1165 /** gives the constant belonging to a SCIP_EXPR_POLYNOMIAL expression */
1166 extern
1168  SCIP_EXPRGRAPHNODE* node /**< expression graph node */
1169  );
1170 
1171 /** gives the curvature of a single monomial belonging to a SCIP_EXPR_POLYNOMIAL expression */
1172 extern
1174  SCIP_EXPRGRAPHNODE* node, /**< expression graph node */
1175  int monomialidx, /**< index of monomial */
1176  SCIP_Real infinity, /**< value for infinity in interval arithmetics */
1177  SCIP_EXPRCURV* curv /**< buffer to store monomial curvature */
1178  );
1179 
1180 /** gives the user data belonging to a SCIP_EXPR_USER expression */
1181 extern
1183  SCIP_EXPRGRAPHNODE* node
1184  );
1185 
1186 /** indicates whether a user expression has the estimator callback defined */
1187 extern
1189  SCIP_EXPRGRAPHNODE* node
1190  );
1191 
1192 /** gets bounds of a node in an expression graph */
1193 extern
1195  SCIP_EXPRGRAPHNODE* node /**< expression graph node */
1196  );
1197 
1198 /** gets value of expression associated to node from last evaluation call */
1199 extern
1201  SCIP_EXPRGRAPHNODE* node /**< expression graph node */
1202  );
1203 
1204 /** gets curvature of expression associated to node from last curvature check call */
1205 extern
1207  SCIP_EXPRGRAPHNODE* node /**< expression graph node */
1208  );
1209 
1210 #ifdef NDEBUG
1211 
1212 /* In optimized mode, the function calls are overwritten by defines to reduce the number of function calls and
1213  * speed up the algorithms.
1214  */
1215 
1216 #define SCIPexprgraphCaptureNode(node) do { ++(node)->nuses; } while( FALSE )
1217 #define SCIPexprgraphIsNodeEnabled(node) (node)->enabled
1218 #define SCIPexprgraphGetNodeNChildren(node) (node)->nchildren
1219 #define SCIPexprgraphGetNodeChildren(node) (node)->children
1220 #define SCIPexprgraphGetNodeNParents(node) (node)->nparents
1221 #define SCIPexprgraphGetNodeParents(node) (node)->parents
1222 #define SCIPexprgraphGetNodeDepth(node) (node)->depth
1223 #define SCIPexprgraphGetNodePosition(node) (node)->pos
1224 #define SCIPexprgraphGetNodeOperator(node) (node)->op
1225 #define SCIPexprgraphGetNodeOperatorIndex(node) (node)->data.intval
1226 #define SCIPexprgraphGetNodeOperatorReal(node) (node)->data.dbl
1227 #define SCIPexprgraphGetNodeVar(exprgraph, node) (exprgraph)->vars[(node)->data.intval]
1228 #define SCIPexprgraphGetNodeRealPowerExponent(node) (node)->data.dbl
1229 #define SCIPexprgraphGetNodeIntPowerExponent(node) (node)->data.intval
1230 #define SCIPexprgraphGetNodeSignPowerExponent(node) (node)->data.dbl
1231 #define SCIPexprgraphGetNodeLinearCoefs(node) ((SCIP_Real*)(node)->data.data)
1232 #define SCIPexprgraphGetNodeLinearConstant(node) (((SCIP_Real*)(node)->data.data)[(node)->nchildren])
1233 #define SCIPexprgraphGetNodeQuadraticConstant(node) ((SCIP_EXPRDATA_QUADRATIC*)(node)->data.data)->constant
1234 #define SCIPexprgraphGetNodeQuadraticLinearCoefs(node) ((SCIP_EXPRDATA_QUADRATIC*)(node)->data.data)->lincoefs
1235 #define SCIPexprgraphGetNodeQuadraticQuadElements(node) ((SCIP_EXPRDATA_QUADRATIC*)(node)->data.data)->quadelems
1236 #define SCIPexprgraphGetNodeQuadraticNQuadElements(node) ((SCIP_EXPRDATA_QUADRATIC*)(node)->data.data)->nquadelems
1237 #define SCIPexprgraphGetNodePolynomialMonomials(node) ((SCIP_EXPRDATA_POLYNOMIAL*)(node)->data.data)->monomials
1238 #define SCIPexprgraphGetNodePolynomialNMonomials(node) ((SCIP_EXPRDATA_POLYNOMIAL*)(node)->data.data)->nmonomials
1239 #define SCIPexprgraphGetNodePolynomialConstant(node) ((SCIP_EXPRDATA_POLYNOMIAL*)(node)->data.data)->constant
1240 #define SCIPexprgraphGetNodeUserData(node) ((SCIP_EXPRDATA_USER*)(node)->data.data)->userdata
1241 #define SCIPexprgraphHasNodeUserEstimator(node) (((SCIP_EXPRDATA_USER*)node->data.data)->estimate != NULL)
1242 #define SCIPexprgraphGetNodeBounds(node) (node)->bounds
1243 #define SCIPexprgraphGetNodeVal(node) (node)->value
1244 #define SCIPexprgraphGetNodeCurvature(node) (node)->curv
1245 
1246 #endif
1247 
1248 /** creates an expression graph node */
1249 extern
1251  BMS_BLKMEM* blkmem, /**< block memory */
1252  SCIP_EXPRGRAPHNODE** node, /**< buffer to store expression graph node */
1253  SCIP_EXPROP op, /**< operator type of expression */
1254  ...
1255  );
1256 
1257 /** creates an expression graph node for a linear expression */
1258 extern
1260  BMS_BLKMEM* blkmem, /**< block memory */
1261  SCIP_EXPRGRAPHNODE** node, /**< buffer to store expression graph node */
1262  int ncoefs, /**< number of coefficients */
1263  SCIP_Real* coefs, /**< coefficients of linear expression */
1264  SCIP_Real constant /**< constant of linear expression */
1265  );
1266 
1267 /** creates an expression graph node for a quadratic expression */
1268 extern
1270  BMS_BLKMEM* blkmem, /**< block memory */
1271  SCIP_EXPRGRAPHNODE** node, /**< buffer to store expression graph node */
1272  int nchildren, /**< number of children */
1273  SCIP_Real* lincoefs, /**< linear coefficients for children, or NULL */
1274  int nquadelems, /**< number of quadratic elements */
1275  SCIP_QUADELEM* quadelems, /**< quadratic elements, or NULL if nquadelems == 0 */
1276  SCIP_Real constant /**< constant */
1277  );
1278 
1279 /** creates an expression graph node for a polynomial expression */
1280 extern
1282  BMS_BLKMEM* blkmem, /**< block memory */
1283  SCIP_EXPRGRAPHNODE** node, /**< buffer to store expression graph node */
1284  int nmonomials, /**< number of monomials */
1285  SCIP_EXPRDATA_MONOMIAL** monomials, /**< monomials */
1286  SCIP_Real constant, /**< constant of polynomial */
1287  SCIP_Bool copymonomials /**< whether to copy monomials or to assume ownership */
1288  );
1289 
1290 /** adds monomials to an expression graph node that is a polynomial expression */
1291 extern
1293  BMS_BLKMEM* blkmem, /**< block memory */
1294  SCIP_EXPRGRAPHNODE* node, /**< store expression graph node with polynomial operator */
1295  int nmonomials, /**< number of monomials */
1296  SCIP_EXPRDATA_MONOMIAL** monomials, /**< monomials */
1297  SCIP_Bool copymonomials /**< whether to copy monomials or to assume ownership */
1298  );
1299 
1300 /** creates an expression graph node for a user expression */
1301 extern
1303  BMS_BLKMEM* blkmem, /**< block memory */
1304  SCIP_EXPRGRAPHNODE** node, /**< buffer to store expression graph node */
1305  SCIP_USEREXPRDATA* data, /**< user data for expression, node assumes ownership */
1306  SCIP_EXPRINTCAPABILITY evalcapability, /**< evaluation capability */
1307  SCIP_DECL_USEREXPREVAL ((*eval)), /**< evaluation function */
1308  SCIP_DECL_USEREXPRINTEVAL ((*inteval)), /**< interval evaluation function */
1309  SCIP_DECL_USEREXPRCURV ((*curv)), /**< curvature check function */
1310  SCIP_DECL_USEREXPRPROP ((*prop)), /**< interval propagation function */
1311  SCIP_DECL_USEREXPRESTIMATE ((*estimate)), /**< estimation function, or NULL if convex, concave, or not implemented */
1312  SCIP_DECL_USEREXPRCOPYDATA ((*copydata)), /**< expression data copy function, or NULL if nothing to copy */
1313  SCIP_DECL_USEREXPRFREEDATA ((*freedata)), /**< expression data free function, or NULL if nothing to free */
1314  SCIP_DECL_USEREXPRPRINT ((*print)) /**< expression print function, or NULL for default string "user" */
1315  );
1316 
1317 /** given a node of an expression graph, splitup a linear part which variables are not used somewhere else in the same expression
1318  * E.g., if the expression is 1 + x + y + y^2, one gets 1 + x and the node remains at y + y^2.
1319  * If the node is a linear expression, it may be freed.
1320  * If it is not linear, the node may change, i.e., the remaining nonlinear part may be stored in a new node.
1321  * It is assumed that the user had captured the node.
1322  * It is assumed that the expression graph has been simplified before.
1323  */
1324 extern
1326  SCIP_EXPRGRAPH* exprgraph, /**< expression graph */
1327  SCIP_EXPRGRAPHNODE** node, /**< expression graph node where to splitup linear part */
1328  int linvarssize, /**< length of linvars and lincoefs arrays */
1329  int* nlinvars, /**< buffer to store length of linear term that have been splitup */
1330  void** linvars, /**< buffer to store variables of linear part */
1331  SCIP_Real* lincoefs, /**< buffer to store coefficients of linear part */
1332  SCIP_Real* constant /**< buffer to store constant part */
1333  );
1334 
1335 /** moves parents from a one node to another node
1336  * in other words, replaces the child srcnode by targetnode in all parents of srcnode
1337  * srcnode may be freed, if not captured
1338  * it is assumes that targetnode represents the same expression as srcnode
1339  */
1340 extern
1342  SCIP_EXPRGRAPH* exprgraph, /**< expression graph */
1343  SCIP_EXPRGRAPHNODE** srcnode, /**< node which parents to move */
1344  SCIP_EXPRGRAPHNODE* targetnode /**< node where to move parents to */
1345  );
1346 
1347 /** releases node, i.e., decreases number of uses
1348  * node is freed if no parents and no other uses
1349  * children are recursively released if they have no other parents
1350  * nodes that are removed are also freed
1351  * if node correspond to a variable, then the variable is removed from the expression graph
1352  * similar for constants
1353  */
1354 extern
1356  SCIP_EXPRGRAPH* exprgraph, /**< expression graph */
1357  SCIP_EXPRGRAPHNODE** node /**< expression graph node to release */
1358  );
1359 
1360 /** frees a node of an expression graph */
1361 extern
1363  BMS_BLKMEM* blkmem, /**< block memory */
1364  SCIP_EXPRGRAPHNODE** node /**< pointer to expression graph node that should be freed */
1365  );
1366 
1367 /** enables a node and recursively all its children in an expression graph */
1368 extern
1370  SCIP_EXPRGRAPH* exprgraph, /**< expression graph */
1371  SCIP_EXPRGRAPHNODE* node /**< expression graph node to enable */
1372  );
1373 
1374 /** disables a node and recursively all children which have no enabled parents in an expression graph */
1375 extern
1377  SCIP_EXPRGRAPH* exprgraph, /**< expression graph */
1378  SCIP_EXPRGRAPHNODE* node /**< expression graph node to enable */
1379  );
1380 
1381 /** returns whether the node has siblings in the expression graph */
1382 extern
1384  SCIP_EXPRGRAPHNODE* node /**< expression graph node */
1385  );
1386 
1387 /** returns whether all children of an expression graph node are variable nodes
1388  * gives TRUE for nodes without children
1389  */
1390 extern
1392  SCIP_EXPRGRAPHNODE* node /**< expression graph node */
1393  );
1394 
1395 /** returns whether the node has an ancestor which has a nonlinear expression operand */
1396 extern
1398  SCIP_EXPRGRAPHNODE* node /**< expression graph node */
1399  );
1400 
1401 /** prints an expression graph node */
1402 extern
1404  SCIP_EXPRGRAPHNODE* node, /**< expression graph node */
1405  SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
1406  FILE* file /**< file to print to, or NULL for stdout */
1407  );
1408 
1409 /** tightens the bounds in a node of the graph
1410  * preparation for reverse propagation
1411  * sets bound status to SCIP_EXPRBOUNDSTATUS_TIGHTENEDBYPARENTRECENT if tightening is strong enough and not cutoff
1412  */
1413 extern
1415  SCIP_EXPRGRAPH* exprgraph, /**< expression graph */
1416  SCIP_EXPRGRAPHNODE* node, /**< node in expression graph with no parents */
1417  SCIP_INTERVAL nodebounds, /**< new bounds for node */
1418  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) */
1419  SCIP_Real infinity, /**< value for infinity in interval arithmetics */
1420  SCIP_Bool* cutoff /**< buffer to store whether a node's bounds were propagated to an empty interval */
1421  );
1422 
1423 /** ensures that bounds and curvature information in a node is uptodate
1424  * assumes that bounds and curvature in children are uptodate
1425  */
1426 extern
1428  SCIP_EXPRGRAPHNODE* node, /**< expression graph node */
1429  SCIP_Real infinity, /**< value for infinity in interval arithmetics */
1430  SCIP_Real minstrength, /**< minimal required relative bound strengthening to trigger a bound recalculation in parent nodes */
1431  SCIP_Bool clearreverseprop /**< whether to reset bound tightenings from reverse propagation */
1432  );
1433 
1434 /**@} */
1435 
1436 /**@name Expression graph methods */
1437 /**@{ */
1438 
1439 /** get current maximal depth of expression graph */
1440 extern
1442  SCIP_EXPRGRAPH* exprgraph /**< expression graph */
1443  );
1444 
1445 /** gets array with number of nodes at each depth of expression graph */
1446 extern
1448  SCIP_EXPRGRAPH* exprgraph /**< expression graph */
1449  );
1450 
1451 /** gets nodes of expression graph, one array per depth */
1452 extern
1454  SCIP_EXPRGRAPH* exprgraph /**< expression graph */
1455  );
1456 
1457 /** gets number of variables in expression graph */
1458 extern
1460  SCIP_EXPRGRAPH* exprgraph /**< pointer to expression graph that should be freed */
1461  );
1462 
1463 /** gets array of variables in expression graph */
1464 extern
1465 void** SCIPexprgraphGetVars(
1466  SCIP_EXPRGRAPH* exprgraph /**< pointer to expression graph that should be freed */
1467  );
1468 
1469 /** gets array of expression graph nodes corresponding to variables */
1470 extern
1472  SCIP_EXPRGRAPH* exprgraph /**< pointer to expression graph that should be freed */
1473  );
1474 
1475 /** sets value for a single variable given as expression graph node */
1476 extern
1478  SCIP_EXPRGRAPHNODE* varnode, /**< expression graph node corresponding to variable */
1479  SCIP_Real value /**< new value for variable */
1480  );
1481 
1482 /** sets bounds for variables */
1483 extern
1485  SCIP_EXPRGRAPH* exprgraph, /**< expression graph */
1486  SCIP_INTERVAL* varbounds /**< new bounds for variables */
1487  );
1488 
1489 /** sets bounds for a single variable */
1490 extern
1492  SCIP_EXPRGRAPH* exprgraph, /**< expression graph */
1493  void* var, /**< variable */
1494  SCIP_INTERVAL varbounds /**< new bounds of variable */
1495  );
1496 
1497 /** sets bounds for a single variable given as expression graph node */
1498 extern
1500  SCIP_EXPRGRAPH* exprgraph, /**< expression graph */
1501  SCIP_EXPRGRAPHNODE* varnode, /**< expression graph node corresponding to variable */
1502  SCIP_INTERVAL varbounds /**< new bounds of variable */
1503  );
1504 
1505 /** sets lower bound for a single variable given as expression graph node */
1506 extern
1508  SCIP_EXPRGRAPH* exprgraph, /**< expression graph */
1509  SCIP_EXPRGRAPHNODE* varnode, /**< expression graph node corresponding to variable */
1510  SCIP_Real lb /**< new lower bound for variable */
1511  );
1512 
1513 /** sets upper bound for a single variable given as expression graph node */
1514 extern
1516  SCIP_EXPRGRAPH* exprgraph, /**< expression graph */
1517  SCIP_EXPRGRAPHNODE* varnode, /**< expression graph node corresponding to variable */
1518  SCIP_Real ub /**< new upper bound for variable */
1519  );
1520 
1521 /** gets bounds that are stored for all variables */
1522 extern
1524  SCIP_EXPRGRAPH* exprgraph /**< expression graph */
1525  );
1526 
1527 #ifdef NDEBUG
1528 
1529 /* In optimized mode, the function calls are overwritten by defines to reduce the number of function calls and
1530  * speed up the algorithms.
1531  */
1532 
1533 #define SCIPexprgraphGetDepth(exprgraph) (exprgraph)->depth
1534 #define SCIPexprgraphGetNNodes(exprgraph) (exprgraph)->nnodes
1535 #define SCIPexprgraphGetNodes(exprgraph) (exprgraph)->nodes
1536 #define SCIPexprgraphGetNVars(exprgraph) (exprgraph)->nvars
1537 #define SCIPexprgraphGetVars(exprgraph) (exprgraph)->vars
1538 #define SCIPexprgraphGetVarNodes(exprgraph) (exprgraph)->varnodes
1539 #define SCIPexprgraphSetVarNodeValue(varnode, newvalue) do { (varnode)->value = newvalue; } while (FALSE)
1540 #define SCIPexprgraphSetVarsBounds(exprgraph, newvarbounds) BMScopyMemoryArray((exprgraph)->varbounds, newvarbounds, (exprgraph)->nvars)
1541 #define SCIPexprgraphSetVarBounds(exprgraph, var, newvarbounds) do { (exprgraph)->varbounds[(int)(size_t)SCIPhashmapGetImage((exprgraph)->varidxs, var)] = newvarbounds; } while (FALSE)
1542 #define SCIPexprgraphSetVarNodeBounds(exprgraph, varnode, newvarbounds) do { (exprgraph)->varbounds[(varnode)->data.intval] = newvarbounds; } while (FALSE)
1543 #define SCIPexprgraphSetVarNodeLb(exprgraph, varnode, lb) do { (exprgraph)->varbounds[(varnode)->data.intval].inf = lb; } while (FALSE)
1544 #define SCIPexprgraphSetVarNodeUb(exprgraph, varnode, ub) do { (exprgraph)->varbounds[(varnode)->data.intval].sup = ub; } while (FALSE)
1545 #define SCIPexprgraphGetVarsBounds(exprgraph) (exprgraph)->varbounds
1546 
1547 #endif
1548 
1549 /** creates an empty expression graph */
1550 extern
1552  BMS_BLKMEM* blkmem, /**< block memory */
1553  SCIP_EXPRGRAPH** exprgraph, /**< buffer to store pointer to expression graph */
1554  int varssizeinit, /**< minimal initial size for variables array, or -1 to choose automatically */
1555  int depthinit, /**< minimal initial depth of expression graph, or -1 to choose automatically */
1556  SCIP_DECL_EXPRGRAPHVARADDED((*exprgraphvaradded)), /**< callback method to invoke when a variable has been added to the expression graph, or NULL if not needed */
1557  SCIP_DECL_EXPRGRAPHVARREMOVE((*exprgraphvarremove)), /**< callback method to invoke when a variable will be removed from the expression graph, or NULL if not needed */
1558  SCIP_DECL_EXPRGRAPHVARCHGIDX((*exprgraphvarchgidx)), /**< callback method to invoke when a variable changes its index in the expression graph, or NULL if not needed */
1559  void* userdata /**< user data to pass to callback functions */
1560  );
1561 
1562 /** frees an expression graph */
1563 extern
1565  SCIP_EXPRGRAPH** exprgraph /**< pointer to expression graph that should be freed */
1566  );
1567 
1568 /** adds an expression graph node to an expression graph
1569  * expression graph assumes ownership of node
1570  * children are notified about new parent
1571  * depth will be chosen to be the maximum of mindepth and the depth of all children plus one
1572  */
1573 extern
1575  SCIP_EXPRGRAPH* exprgraph, /**< expression graph */
1576  SCIP_EXPRGRAPHNODE* node, /**< expression graph node to add */
1577  int mindepth, /**< minimal depth in expression graph where to add node, e.g., 0 or smaller to choose automatically */
1578  int nchildren, /**< number of children */
1579  SCIP_EXPRGRAPHNODE** children /**< children nodes, or NULL if no children */
1580  );
1581 
1582 /** adds variables to an expression graph, if not existing yet
1583  * also already existing nodes are enabled
1584  */
1585 extern
1587  SCIP_EXPRGRAPH* exprgraph, /**< expression graph */
1588  int nvars, /**< number of variables to add */
1589  void** vars, /**< variables to add */
1590  SCIP_EXPRGRAPHNODE** varnodes /**< array to store nodes corresponding to variables, or NULL if not of interest */
1591  );
1592 
1593 /** adds a constant to an expression graph, if not existing yet
1594  * also already existing nodes are enabled
1595  */
1597  SCIP_EXPRGRAPH* exprgraph, /**< expression graph */
1598  SCIP_Real constant, /**< constant to add */
1599  SCIP_EXPRGRAPHNODE** constnode /**< buffer to store pointer to expression graph node corresponding to constant */
1600  );
1601 
1602 /** adds sum of expression trees into expression graph
1603  * node will also be captured
1604  */
1605 extern
1607  SCIP_EXPRGRAPH* exprgraph, /**< expression graph */
1608  int nexprtrees, /**< number of expression trees to add */
1609  SCIP_EXPRTREE** exprtrees, /**< expression trees that should be added */
1610  SCIP_Real* coefs, /**< coefficients of expression trees, or NULL if all 1.0 */
1611  SCIP_EXPRGRAPHNODE** rootnode, /**< buffer to store expression graph node corresponding to root of expression tree */
1612  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) */
1613  );
1614 
1615 /** replaces variable in expression graph by a linear sum of variables
1616  * variables will be added if not in the graph yet
1617  */
1618 extern
1620  SCIP_EXPRGRAPH* exprgraph, /**< expression graph */
1621  void* var, /**< variable to replace */
1622  int ncoefs, /**< number of coefficients in linear term */
1623  SCIP_Real* coefs, /**< coefficients in linear term, or NULL if ncoefs == 0 */
1624  void** vars, /**< variables in linear term */
1625  SCIP_Real constant /**< constant offset */
1626  );
1627 
1628 /** finds expression graph node corresponding to a variable */
1629 extern
1631  SCIP_EXPRGRAPH* exprgraph, /**< expression graph */
1632  void* var, /**< variable to search for */
1633  SCIP_EXPRGRAPHNODE** varnode /**< buffer to store node corresponding to variable, if found, or NULL if not found */
1634  );
1635 
1636 /** finds expression graph node corresponding to a constant */
1637 extern
1639  SCIP_EXPRGRAPH* exprgraph, /**< expression graph */
1640  SCIP_Real constant, /**< constant to search for */
1641  SCIP_EXPRGRAPHNODE** constnode /**< buffer to store node corresponding to constant, if found, or NULL if not found */
1642  );
1643 
1644 /** prints an expression graph in dot format */
1645 extern
1647  SCIP_EXPRGRAPH* exprgraph, /**< expression graph */
1648  SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
1649  FILE* file, /**< file to print to, or NULL for stdout */
1650  const char** varnames /**< variable names, or NULL for generic names */
1651  );
1652 
1653 /** evaluates nodes of expression graph for given values of variables */
1654 extern
1656  SCIP_EXPRGRAPH* exprgraph, /**< expression graph */
1657  SCIP_Real* varvals /**< values for variables */
1658  );
1659 
1660 /** propagates bound changes in variables forward through the expression graph */
1661 extern
1663  SCIP_EXPRGRAPH* exprgraph, /**< expression graph */
1664  SCIP_Real infinity, /**< value for infinity in interval arithmetics */
1665  SCIP_Bool clearreverseprop, /**< whether to reset bound tightenings from reverse propagation */
1666  SCIP_Bool* domainerror /**< buffer to store whether a node with empty bounds has been found, propagation is interrupted in this case */
1667  );
1668 
1669 /** propagates bound changes in nodes backward through the graph
1670  * new bounds are not stored in varbounds, but only in nodes corresponding to variables
1671  * NOTE: it is assumed that SCIPexprgraphPropagateVarBounds was called before if variable bounds were relaxed
1672  */
1673 extern
1675  SCIP_EXPRGRAPH* exprgraph, /**< expression graph */
1676  SCIP_Real infinity, /**< value for infinity in interval arithmetics */
1677  SCIP_Real minstrength, /**< minimal required relative bound strengthening in a node to trigger a propagation into children nodes */
1678  SCIP_Bool* cutoff /**< buffer to store whether a node's bounds were propagated to an empty interval */
1679  );
1680 
1681 /** updates curvature information in expression graph nodes w.r.t. currently stored variable bounds
1682  * implies update of bounds in expression graph
1683  */
1684 extern
1686  SCIP_EXPRGRAPH* exprgraph, /**< expression graph */
1687  SCIP_Real infinity, /**< value for infinity in interval arithmetics */
1688  SCIP_Bool clearreverseprop /**< whether to reset bound tightenings from reverse propagation */
1689  );
1690 
1691 /** aims at simplifying an expression graph
1692  * 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))
1693  */
1694 extern
1696  SCIP_EXPRGRAPH* exprgraph, /**< expression graph */
1697  SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
1698  SCIP_Real eps, /**< threshold, under which positive values are treat as 0 */
1699  int maxexpansionexponent,/**< maximal exponent for which we still expand non-monomial polynomials */
1700  SCIP_Bool* havechange, /**< buffer to indicate whether the graph has been modified */
1701  SCIP_Bool* domainerror /**< buffer to indicate whether a domain error has been encountered, i.e., some expressions turned into NaN */
1702  );
1703 
1704 /** creates an expression tree from a given node in an expression graph */
1705 extern
1707  SCIP_EXPRGRAPH* exprgraph, /**< expression graph */
1708  SCIP_EXPRGRAPHNODE* rootnode, /**< expression graph node that should represent root of expression tree */
1709  SCIP_EXPRTREE** exprtree /**< buffer to store pointer to created expression tree */
1710  );
1711 
1712 /** creates a sum of expression trees with pairwise disjoint variables from a given node in an expression graph
1713  * Giving SCIPexprgraphGetNodeNChildren() for exprtreesize is always sufficient.
1714  */
1715 extern
1717  SCIP_EXPRGRAPH* exprgraph, /**< expression graph */
1718  SCIP_EXPRGRAPHNODE* node, /**< expression graph node which represents expression to get */
1719  int exprtreessize, /**< length of exprtrees and exprtreecoefs arrays, need to be at least one */
1720  int* nexprtrees, /**< buffer to store number of expression trees */
1721  SCIP_EXPRTREE** exprtrees, /**< array where to store expression trees */
1722  SCIP_Real* exprtreecoefs /**< array where to store coefficients of expression trees */
1723  );
1724 
1725 /** returns how often expression graph variables are used in a subtree of the expression graph */
1726 extern
1728  SCIP_EXPRGRAPH* exprgraph, /**< expression graph */
1729  SCIP_EXPRGRAPHNODE* node, /**< root node of expression graph subtree */
1730  int* varsusage /**< array where to count usage of variables, length must be at least the number of variables in the graph */
1731  );
1732 
1733 /** gives the number of summands which the expression of an expression graph node consists of */
1734 extern
1736  SCIP_EXPRGRAPHNODE* node /**< expression graph node */
1737  );
1738 
1739 /** creates a sum of expression trees, possibly sharing variables, from a given node in an expression graph */
1740 extern
1742  SCIP_EXPRGRAPH* exprgraph, /**< expression graph */
1743  SCIP_EXPRGRAPHNODE* node, /**< expression graph node which represents expression to get */
1744  int exprtreessize, /**< length of exprtrees and exptreecoefs arrays, should be at least SCIPexprgraphGetSumTreesNSummands() */
1745  int* nexprtrees, /**< buffer to store number of expression trees */
1746  SCIP_EXPRTREE** exprtrees, /**< array where to store expression trees */
1747  SCIP_Real* exprtreecoefs /**< array where to store coefficients of expression trees */
1748  );
1749 
1750 /**@} */
1751 
1752 #ifdef __cplusplus
1753 }
1754 #endif
1755 
1756 #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)
Definition: expr.c:6221
SCIP_EXPRCURV SCIPexprcurvNegate(SCIP_EXPRCURV curvature)
Definition: expr.c:214
int SCIPexprgraphGetNodeIntPowerExponent(SCIP_EXPRGRAPHNODE *node)
Definition: expr.c:13008
void ** SCIPexprgraphGetVars(SCIP_EXPRGRAPH *exprgraph)
Definition: expr.c:14873
SCIP_RETCODE SCIPexprMultiplyPolynomialByPolynomial(BMS_BLKMEM *blkmem, SCIP_EXPR *expr, SCIP_EXPR *factor, int *childmap)
Definition: expr.c:6714
void SCIPexprgraphDisableNode(SCIP_EXPRGRAPH *exprgraph, SCIP_EXPRGRAPHNODE *node)
Definition: expr.c:14495
SCIP_RETCODE SCIPexprgraphAddConst(SCIP_EXPRGRAPH *exprgraph, SCIP_Real constant, SCIP_EXPRGRAPHNODE **constnode)
Definition: expr.c:15250
SCIP_RETCODE SCIPexprgraphGetNodePolynomialMonomialCurvature(SCIP_EXPRGRAPHNODE *node, int monomialidx, SCIP_Real infinity, SCIP_EXPRCURV *curv)
Definition: expr.c:13140
static SCIP_RETCODE eval(SCIP_EXPR *expr, const vector< Type > &x, SCIP_Real *param, Type &val)
void SCIPexprtreeGetVarsUsage(SCIP_EXPRTREE *tree, int *varsusage)
Definition: expr.c:8854
void SCIPquadelemSqueeze(SCIP_QUADELEM *quadelems, int nquadelems, int *nquadelemsnew)
Definition: expr.c:9217
SCIP_RETCODE SCIPexprtreeEval(SCIP_EXPRTREE *tree, SCIP_Real *varvals, SCIP_Real *val)
Definition: expr.c:8670
int SCIPexprgraphGetNodeNParents(SCIP_EXPRGRAPHNODE *node)
Definition: expr.c:12910
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)
Definition: expr.c:6559
SCIP_QUADELEM * SCIPexprgraphGetNodeQuadraticQuadElements(SCIP_EXPRGRAPHNODE *node)
Definition: expr.c:13077
int SCIPexprGetNChildren(SCIP_EXPR *expr)
Definition: expr.c:5680
void SCIPexprtreeSetInterpreterData(SCIP_EXPRTREE *tree, SCIP_EXPRINTDATA *interpreterdata)
Definition: expr.c:8614
void SCIPexprFreeMonomial(BMS_BLKMEM *blkmem, SCIP_EXPRDATA_MONOMIAL **monomial)
Definition: expr.c:7067
SCIP_QUADELEM * SCIPexprGetQuadElements(SCIP_EXPR *expr)
Definition: expr.c:5792
#define infinity
Definition: gastrans.c:71
struct SCIP_UserExprData SCIP_USEREXPRDATA
Definition: type_expr.h:219
SCIP_EXPRINTCAPABILITY SCIPexprGetUserEvalCapability(SCIP_EXPR *expr)
Definition: expr.c:5939
int SCIPexprgraphGetNodePolynomialNMonomials(SCIP_EXPRGRAPHNODE *node)
Definition: expr.c:13113
SCIP_Real SCIPexprGetMonomialCoef(SCIP_EXPRDATA_MONOMIAL *monomial)
Definition: expr.c:5877
void SCIPexprtreePrint(SCIP_EXPRTREE *tree, SCIP_MESSAGEHDLR *messagehdlr, FILE *file, const char **varnames, const char **paramnames)
Definition: expr.c:8703
#define SCIP_DECL_USEREXPREVAL(x)
Definition: type_expr.h:246
#define SCIP_DECL_USEREXPRPRINT(x)
Definition: type_expr.h:308
void SCIPexprMergeMonomialFactors(SCIP_EXPRDATA_MONOMIAL *monomial, SCIP_Real eps)
Definition: expr.c:6931
SCIP_Real SCIPexprgraphGetNodeLinearConstant(SCIP_EXPRGRAPHNODE *node)
Definition: expr.c:13041
void SCIPexprgraphSetVarsBounds(SCIP_EXPRGRAPH *exprgraph, SCIP_INTERVAL *varbounds)
Definition: expr.c:14905
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)
Definition: expr.c:13505
void SCIPexprChgMonomialCoef(SCIP_EXPRDATA_MONOMIAL *monomial, SCIP_Real newcoef)
Definition: expr.c:6826
SCIP_RETCODE SCIPexprgraphGetSumTrees(SCIP_EXPRGRAPH *exprgraph, SCIP_EXPRGRAPHNODE *node, int exprtreessize, int *nexprtrees, SCIP_EXPRTREE **exprtrees, SCIP_Real *exprtreecoefs)
Definition: expr.c:16685
void SCIPexprPrint(SCIP_EXPR *expr, SCIP_MESSAGEHDLR *messagehdlr, FILE *file, const char **varnames, const char **paramnames, SCIP_Real *paramvals)
Definition: expr.c:8176
SCIP_RETCODE SCIPexprgraphCreateNodeQuadratic(BMS_BLKMEM *blkmem, SCIP_EXPRGRAPHNODE **node, int nchildren, SCIP_Real *lincoefs, int nquadelems, SCIP_QUADELEM *quadelems, SCIP_Real constant)
Definition: expr.c:13381
int SCIPexprgraphGetSumTreesNSummands(SCIP_EXPRGRAPHNODE *node)
Definition: expr.c:16649
SCIP_Bool SCIPexprAreMonomialsEqual(SCIP_EXPRDATA_MONOMIAL *monomial1, SCIP_EXPRDATA_MONOMIAL *monomial2, SCIP_Real eps)
Definition: expr.c:6795
data definitions for expressions and expression trees
int SCIPexprgraphGetNodeQuadraticNQuadElements(SCIP_EXPRGRAPHNODE *node)
Definition: expr.c:13089
SCIP_Real * SCIPexprGetMonomialExponents(SCIP_EXPRDATA_MONOMIAL *monomial)
Definition: expr.c:5907
void SCIPexprReindexVars(SCIP_EXPR *expr, int *newindices)
Definition: expr.c:8134
int SCIPexprtreeGetNVars(SCIP_EXPRTREE *tree)
Definition: expr.c:8559
SCIP_RETCODE SCIPexprgraphFree(SCIP_EXPRGRAPH **exprgraph)
Definition: expr.c:15044
void SCIPexprgraphSetVarNodeUb(SCIP_EXPRGRAPH *exprgraph, SCIP_EXPRGRAPHNODE *varnode, SCIP_Real ub)
Definition: expr.c:14977
SCIP_RETCODE SCIPexprSubstituteVars(BMS_BLKMEM *blkmem, SCIP_EXPR *expr, SCIP_EXPR **substexprs)
Definition: expr.c:8096
SCIP_RETCODE SCIPexprgraphCreateNodePolynomial(BMS_BLKMEM *blkmem, SCIP_EXPRGRAPHNODE **node, int nmonomials, SCIP_EXPRDATA_MONOMIAL **monomials, SCIP_Real constant, SCIP_Bool copymonomials)
Definition: expr.c:13407
SCIP_RETCODE SCIPexprgraphUpdateNodeBoundsCurvature(SCIP_EXPRGRAPHNODE *node, SCIP_Real infinity, SCIP_Real minstrength, SCIP_Bool clearreverseprop)
Definition: expr.c:14683
SCIP_EXPRGRAPHNODE ** SCIPexprgraphGetVarNodes(SCIP_EXPRGRAPH *exprgraph)
Definition: expr.c:14883
void SCIPexprgraphFreeNode(BMS_BLKMEM *blkmem, SCIP_EXPRGRAPHNODE **node)
Definition: expr.c:14443
SCIP_RETCODE SCIPexprgraphGetSeparableTrees(SCIP_EXPRGRAPH *exprgraph, SCIP_EXPRGRAPHNODE *node, int exprtreessize, int *nexprtrees, SCIP_EXPRTREE **exprtrees, SCIP_Real *exprtreecoefs)
Definition: expr.c:16199
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)
Definition: expr.c:7882
SCIP_RETCODE SCIPexprAddMonomialFactors(BMS_BLKMEM *blkmem, SCIP_EXPRDATA_MONOMIAL *monomial, int nfactors, int *childidxs, SCIP_Real *exponents)
Definition: expr.c:6837
SCIP_Real SCIPexprGetSignPowerExponent(SCIP_EXPR *expr)
Definition: expr.c:5755
void * SCIPexprgraphGetNodeVar(SCIP_EXPRGRAPH *exprgraph, SCIP_EXPRGRAPHNODE *node)
Definition: expr.c:12982
SCIP_RETCODE SCIPexprCopyDeep(BMS_BLKMEM *blkmem, SCIP_EXPR **targetexpr, SCIP_EXPR *sourceexpr)
Definition: expr.c:6116
#define SCIP_DECL_USEREXPRINTEVAL(x)
Definition: type_expr.h:259
SCIP_EXPRCURV SCIPexprgraphGetNodeCurvature(SCIP_EXPRGRAPHNODE *node)
Definition: expr.c:13262
void * SCIPexprGetOpData(SCIP_EXPR *expr)
Definition: expr.c:5722
SCIP_RETCODE SCIPexprgraphNodePolynomialAddMonomials(BMS_BLKMEM *blkmem, SCIP_EXPRGRAPHNODE *node, int nmonomials, SCIP_EXPRDATA_MONOMIAL **monomials, SCIP_Bool copymonomials)
Definition: expr.c:13432
SCIP_Bool SCIPexprHasParam(SCIP_EXPR *expr)
Definition: expr.c:7188
SCIP_EXPRINTDATA * SCIPexprtreeGetInterpreterData(SCIP_EXPRTREE *tree)
Definition: expr.c:8604
int SCIPexprGetNMonomials(SCIP_EXPR *expr)
Definition: expr.c:5853
SCIP_RETCODE SCIPexprgraphAddExprtreeSum(SCIP_EXPRGRAPH *exprgraph, int nexprtrees, SCIP_EXPRTREE **exprtrees, SCIP_Real *coefs, SCIP_EXPRGRAPHNODE **rootnode, SCIP_Bool *rootnodeisnew)
Definition: expr.c:15297
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)
Definition: expr.c:7770
SCIP_Bool SCIPexprgraphAreAllNodeChildrenVars(SCIP_EXPRGRAPHNODE *node)
Definition: expr.c:14552
void SCIPexprgraphSetVarNodeBounds(SCIP_EXPRGRAPH *exprgraph, SCIP_EXPRGRAPHNODE *varnode, SCIP_INTERVAL varbounds)
Definition: expr.c:14937
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)
Definition: expr.c:6607
int SCIPexprgraphGetNodeDepth(SCIP_EXPRGRAPHNODE *node)
Definition: expr.c:12930
int SCIPexprGetNQuadElements(SCIP_EXPR *expr)
Definition: expr.c:5829
SCIP_INTERVAL * SCIPexprgraphGetVarsBounds(SCIP_EXPRGRAPH *exprgraph)
Definition: expr.c:14997
SCIP_EXPR ** SCIPexprGetChildren(SCIP_EXPR *expr)
Definition: expr.c:5690
SCIP_RETCODE SCIPexprtreeGetMaxDegree(SCIP_EXPRTREE *tree, int *maxdegree)
Definition: expr.c:8657
SCIP_EXPRCURV SCIPexprcurvMonomial(int nfactors, SCIP_Real *exponents, int *factoridxs, SCIP_EXPRCURV *factorcurv, SCIP_INTERVAL *factorbounds)
Definition: expr.c:361
SCIP_EXPRCURV SCIPexprcurvMultiply(SCIP_Real factor, SCIP_EXPRCURV curvature)
Definition: expr.c:240
SCIP_Bool SCIPexprgraphHasNodeNonlinearAncestor(SCIP_EXPRGRAPHNODE *node)
Definition: expr.c:14568
void SCIPexprSortQuadElems(SCIP_EXPR *expr)
Definition: expr.c:6595
SCIP_EXPRGRAPHNODE ** SCIPexprgraphGetNodeParents(SCIP_EXPRGRAPHNODE *node)
Definition: expr.c:12920
SCIP_RETCODE SCIPexprEvalInt(SCIP_EXPR *expr, SCIP_Real infinity, SCIP_INTERVAL *varvals, SCIP_Real *param, SCIP_INTERVAL *val)
Definition: expr.c:7902
#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)
Definition: expr.c:7841
void SCIPexprSortMonomialFactors(SCIP_EXPRDATA_MONOMIAL *monomial)
Definition: expr.c:7091
int * SCIPexprGetMonomialChildIndices(SCIP_EXPRDATA_MONOMIAL *monomial)
Definition: expr.c:5897
SCIP_RETCODE SCIPexprtreeFree(SCIP_EXPRTREE **tree)
Definition: expr.c:8799
SCIP_RETCODE SCIPexprgraphPrintDot(SCIP_EXPRGRAPH *exprgraph, SCIP_MESSAGEHDLR *messagehdlr, FILE *file, const char **varnames)
Definition: expr.c:15686
SCIP_Real SCIPexprGetQuadConstant(SCIP_EXPR *expr)
Definition: expr.c:5804
SCIP_Bool SCIPexprAreEqual(SCIP_EXPR *expr1, SCIP_EXPR *expr2, SCIP_Real eps)
Definition: expr.c:7555
enum SCIP_ExprOp SCIP_EXPROP
Definition: type_expr.h:89
int SCIPexpropGetNChildren(SCIP_EXPROP op)
Definition: expr.c:3273
interval arithmetics for provable bounds
SCIP_EXPR * SCIPexprtreeGetRoot(SCIP_EXPRTREE *tree)
Definition: expr.c:8549
SCIP_RETCODE SCIPexprPolynomialPower(BMS_BLKMEM *blkmem, SCIP_EXPR *expr, int exponent)
Definition: expr.c:6760
SCIP_RETCODE SCIPexprParse(BMS_BLKMEM *blkmem, SCIP_MESSAGEHDLR *messagehdlr, SCIP_EXPR **expr, const char *str, const char *lastchar, int *nvars, int *varnames)
Definition: expr.c:8488
SCIP_RETCODE SCIPexprAddToLinear(BMS_BLKMEM *blkmem, SCIP_EXPR *expr, int nchildren, SCIP_Real *coefs, SCIP_EXPR **children, SCIP_Real constant)
Definition: expr.c:6514
SCIP_RETCODE SCIPexprtreeFreeInterpreterData(SCIP_EXPRTREE *tree)
Definition: expr.c:8627
SCIP_RETCODE SCIPexprgraphEval(SCIP_EXPRGRAPH *exprgraph, SCIP_Real *varvals)
Definition: expr.c:15735
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)), SCIP_DECL_USEREXPRPRINT((*print)))
Definition: expr.c:13451
SCIP_RETCODE SCIPexprgraphMoveNodeParents(SCIP_EXPRGRAPH *exprgraph, SCIP_EXPRGRAPHNODE **srcnode, SCIP_EXPRGRAPHNODE *targetnode)
Definition: expr.c:14317
void SCIPexprMergeMonomials(BMS_BLKMEM *blkmem, SCIP_EXPR *expr, SCIP_Real eps, SCIP_Bool mergefactors)
Definition: expr.c:6780
SCIP_Real SCIPexprgraphGetNodeRealPowerExponent(SCIP_EXPRGRAPHNODE *node)
Definition: expr.c:12997
int SCIPexprgraphGetNodePosition(SCIP_EXPRGRAPHNODE *node)
Definition: expr.c:12940
SCIP_RETCODE SCIPexprtreeEvalInt(SCIP_EXPRTREE *tree, SCIP_Real infinity, SCIP_INTERVAL *varvals, SCIP_INTERVAL *val)
Definition: expr.c:8686
SCIP_RETCODE SCIPexprgraphCreateNodeLinear(BMS_BLKMEM *blkmem, SCIP_EXPRGRAPHNODE **node, int ncoefs, SCIP_Real *coefs, SCIP_Real constant)
Definition: expr.c:13355
SCIP_EXPROP SCIPexprgraphGetNodeOperator(SCIP_EXPRGRAPHNODE *node)
Definition: expr.c:12950
SCIP_RETCODE SCIPexprgraphAddNode(SCIP_EXPRGRAPH *exprgraph, SCIP_EXPRGRAPHNODE *node, int mindepth, int nchildren, SCIP_EXPRGRAPHNODE **children)
Definition: expr.c:15093
SCIP_RETCODE SCIPexprEvalUser(SCIP_EXPR *expr, SCIP_Real *argvals, SCIP_Real *val, SCIP_Real *gradient, SCIP_Real *hessian)
Definition: expr.c:7944
SCIP_EXPRDATA_MONOMIAL ** SCIPexprGetMonomials(SCIP_EXPR *expr)
Definition: expr.c:5841
void SCIPexprgraphEnableNode(SCIP_EXPRGRAPH *exprgraph, SCIP_EXPRGRAPHNODE *node)
Definition: expr.c:14468
void SCIPexprMultiplyPolynomialByConstant(BMS_BLKMEM *blkmem, SCIP_EXPR *expr, SCIP_Real factor)
Definition: expr.c:6677
SCIP_RETCODE SCIPexprgraphCheckCurvature(SCIP_EXPRGRAPH *exprgraph, SCIP_Real infinity, SCIP_Bool clearreverseprop)
Definition: expr.c:15842
SCIP_RETCODE SCIPexprEvalShallow(SCIP_EXPR *expr, SCIP_Real *argvals, SCIP_Real *varvals, SCIP_Real *param, SCIP_Real *val)
Definition: expr.c:7822
#define SCIP_DECL_USEREXPRCURV(x)
Definition: type_expr.h:270
const char * SCIPexpropGetName(SCIP_EXPROP op)
Definition: expr.c:3263
void SCIPexprChgPolynomialConstant(SCIP_EXPR *expr, SCIP_Real constant)
Definition: expr.c:6664
SCIP_RETCODE SCIPexprGetMaxDegree(SCIP_EXPR *expr, int *maxdegree)
Definition: expr.c:7207
SCIP_Real SCIPexprGetOpReal(SCIP_EXPR *expr)
Definition: expr.c:5711
SCIP_Bool SCIPexprtreeHasParam(SCIP_EXPRTREE *tree)
Definition: expr.c:8641
void SCIPexprFreeShallow(BMS_BLKMEM *blkmem, SCIP_EXPR **expr)
Definition: expr.c:6196
SCIP_RETCODE SCIPexprEvalIntUser(SCIP_EXPR *expr, SCIP_Real infinity, SCIP_INTERVAL *argvals, SCIP_INTERVAL *val, SCIP_INTERVAL *gradient, SCIP_INTERVAL *hessian)
Definition: expr.c:7967
int SCIPexprgraphGetNVars(SCIP_EXPRGRAPH *exprgraph)
Definition: expr.c:14863
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)), SCIP_DECL_USEREXPRPRINT((*print)))
Definition: expr.c:7128
#define SCIP_DECL_USEREXPRESTIMATE(x)
Definition: type_expr.h:234
#define SCIP_DECL_USEREXPRPROP(x)
Definition: type_expr.h:282
SCIP_Real SCIPexprGetRealPowerExponent(SCIP_EXPR *expr)
Definition: expr.c:5733
SCIP_EXPRCURV SCIPexprcurvPower(SCIP_INTERVAL basebounds, SCIP_EXPRCURV basecurv, SCIP_Real exponent)
Definition: expr.c:253
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)
Definition: expr.c:8058
int SCIPexprGetMonomialNFactors(SCIP_EXPRDATA_MONOMIAL *monomial)
Definition: expr.c:5887
char ** varnames
Definition: nlpioracle.c:67
#define SCIP_Bool
Definition: def.h:61
SCIP_Bool SCIPquadelemSortedFind(SCIP_QUADELEM *quadelems, int idx1, int idx2, int nquadelems, int *pos)
Definition: expr.c:9165
void SCIPexprFreeDeep(BMS_BLKMEM *blkmem, SCIP_EXPR **expr)
Definition: expr.c:6158
SCIP_EXPRCURV SCIPexprcurvAdd(SCIP_EXPRCURV curv1, SCIP_EXPRCURV curv2)
Definition: expr.c:205
int SCIPexprGetOpIndex(SCIP_EXPR *expr)
Definition: expr.c:5700
int SCIPexprgraphGetNodeOperatorIndex(SCIP_EXPRGRAPHNODE *node)
Definition: expr.c:12960
SCIP_RETCODE SCIPexprMultiplyMonomialByMonomial(BMS_BLKMEM *blkmem, SCIP_EXPRDATA_MONOMIAL *monomial, SCIP_EXPRDATA_MONOMIAL *factor, int *childmap)
Definition: expr.c:6866
SCIP_RETCODE SCIPexprtreeSubstituteVars(SCIP_EXPRTREE *tree, SCIP_EXPR **substexprs)
Definition: expr.c:8976
void SCIPexprgraphTightenNodeBounds(SCIP_EXPRGRAPH *exprgraph, SCIP_EXPRGRAPHNODE *node, SCIP_INTERVAL nodebounds, SCIP_Real minstrength, SCIP_Real infinity, SCIP_Bool *cutoff)
Definition: expr.c:14621
SCIP_Real SCIPexprGetPolynomialConstant(SCIP_EXPR *expr)
Definition: expr.c:5865
SCIP_USEREXPRDATA * SCIPexprGetUserData(SCIP_EXPR *expr)
Definition: expr.c:5917
SCIP_Bool SCIPexprHasUserEstimator(SCIP_EXPR *expr)
Definition: expr.c:5928
void SCIPexprgraphSetVarBounds(SCIP_EXPRGRAPH *exprgraph, void *var, SCIP_INTERVAL varbounds)
Definition: expr.c:14917
SCIP_Real * SCIPexprtreeGetParamVals(SCIP_EXPRTREE *tree)
Definition: expr.c:8579
int * SCIPexprgraphGetNNodes(SCIP_EXPRGRAPH *exprgraph)
Definition: expr.c:14843
SCIP_RETCODE SCIPexprgraphReleaseNode(SCIP_EXPRGRAPH *exprgraph, SCIP_EXPRGRAPHNODE **node)
Definition: expr.c:14349
SCIP_Real SCIPexprgraphGetNodeSignPowerExponent(SCIP_EXPRGRAPHNODE *node)
Definition: expr.c:13019
SCIP_RETCODE SCIPexprgraphSimplify(SCIP_EXPRGRAPH *exprgraph, SCIP_MESSAGEHDLR *messagehdlr, SCIP_Real eps, int maxexpansionexponent, SCIP_Bool *havechange, SCIP_Bool *domainerror)
Definition: expr.c:15885
SCIP_RETCODE SCIPexprMultiplyPolynomialByMonomial(BMS_BLKMEM *blkmem, SCIP_EXPR *expr, SCIP_EXPRDATA_MONOMIAL *factor, int *childmap)
Definition: expr.c:6691
SCIP_RETCODE SCIPexprgraphGetTree(SCIP_EXPRGRAPH *exprgraph, SCIP_EXPRGRAPHNODE *rootnode, SCIP_EXPRTREE **exprtree)
Definition: expr.c:16146
void SCIPexprgraphSetVarNodeValue(SCIP_EXPRGRAPHNODE *varnode, SCIP_Real value)
Definition: expr.c:14893
SCIP_RETCODE SCIPexprtreeCheckCurvature(SCIP_EXPRTREE *tree, SCIP_Real infinity, SCIP_INTERVAL *varbounds, SCIP_EXPRCURV *curv, SCIP_INTERVAL *bounds)
Definition: expr.c:8950
SCIP_RETCODE SCIPexprtreeCopy(BMS_BLKMEM *blkmem, SCIP_EXPRTREE **targettree, SCIP_EXPRTREE *sourcetree)
Definition: expr.c:8759
const char * SCIPexprcurvGetName(SCIP_EXPRCURV curv)
Definition: expr.c:474
int SCIPexprgraphGetNodeNChildren(SCIP_EXPRGRAPHNODE *node)
Definition: expr.c:12890
SCIP_Real * SCIPexprgraphGetNodeLinearCoefs(SCIP_EXPRGRAPHNODE *node)
Definition: expr.c:13030
#define SCIP_DECL_EXPRGRAPHVARREMOVE(x)
Definition: type_expr.h:191
SCIP_RETCODE SCIPexprCreate(BMS_BLKMEM *blkmem, SCIP_EXPR **expr, SCIP_EXPROP op,...)
Definition: expr.c:5950
SCIP_RETCODE SCIPexprgraphPropagateVarBounds(SCIP_EXPRGRAPH *exprgraph, SCIP_Real infinity, SCIP_Bool clearreverseprop, SCIP_Bool *domainerror)
Definition: expr.c:15756
enum SCIP_ExprCurv SCIP_EXPRCURV
Definition: type_expr.h:93
SCIP_Bool SCIPexprgraphHasNodeSibling(SCIP_EXPRGRAPHNODE *node)
Definition: expr.c:14533
SCIP_Bool SCIPexprgraphHasNodeUserEstimator(SCIP_EXPRGRAPHNODE *node)
Definition: expr.c:13230
void SCIPexprgraphSetVarNodeLb(SCIP_EXPRGRAPH *exprgraph, SCIP_EXPRGRAPHNODE *varnode, SCIP_Real lb)
Definition: expr.c:14957
SCIP_RETCODE SCIPexprAddMonomials(BMS_BLKMEM *blkmem, SCIP_EXPR *expr, int nmonomials, SCIP_EXPRDATA_MONOMIAL **monomials, SCIP_Bool copymonomials)
Definition: expr.c:6642
SCIP_USEREXPRDATA * SCIPexprgraphGetNodeUserData(SCIP_EXPRGRAPHNODE *node)
Definition: expr.c:13218
int SCIPexprtreeGetNParams(SCIP_EXPRTREE *tree)
Definition: expr.c:8569
SCIP_Bool SCIPexprgraphFindVarNode(SCIP_EXPRGRAPH *exprgraph, void *var, SCIP_EXPRGRAPHNODE **varnode)
Definition: expr.c:15609
int SCIPexprgraphGetDepth(SCIP_EXPRGRAPH *exprgraph)
Definition: expr.c:14833
SCIP_RETCODE SCIPexprtreeSimplify(SCIP_EXPRTREE *tree, SCIP_MESSAGEHDLR *messagehdlr, SCIP_Real eps, int maxexpansionexponent, int *nlinvars, int *linidxs, SCIP_Real *lincoefs)
Definition: expr.c:8873
SCIP_Real SCIPexprgraphGetNodeOperatorReal(SCIP_EXPRGRAPHNODE *node)
Definition: expr.c:12971
SCIP_Real SCIPexprgraphGetNodePolynomialConstant(SCIP_EXPRGRAPHNODE *node)
Definition: expr.c:13125
void SCIPexprgraphCaptureNode(SCIP_EXPRGRAPHNODE *node)
Definition: expr.c:12868
SCIP_Bool SCIPexprgraphFindConstNode(SCIP_EXPRGRAPH *exprgraph, SCIP_Real constant, SCIP_EXPRGRAPHNODE **constnode)
Definition: expr.c:15638
SCIP_RETCODE SCIPexprMulConstant(BMS_BLKMEM *blkmem, SCIP_EXPR **expr, SCIP_EXPR *term, SCIP_Real factor)
Definition: expr.c:6379
type definitions for expressions and expression trees
void SCIPexprgraphPrintNode(SCIP_EXPRGRAPHNODE *node, SCIP_MESSAGEHDLR *messagehdlr, FILE *file)
Definition: expr.c:14605
public methods for message output
void SCIPquadelemSort(SCIP_QUADELEM *quadelems, int nquadelems)
Definition: expr.c:9140
SCIP_RETCODE SCIPexprgraphCreateNode(BMS_BLKMEM *blkmem, SCIP_EXPRGRAPHNODE **node, SCIP_EXPROP op,...)
Definition: expr.c:13272
void SCIPexprReindexParams(SCIP_EXPR *expr, int *newindices)
Definition: expr.c:8155
SCIP_EXPROP SCIPexprGetOperator(SCIP_EXPR *expr)
Definition: expr.c:5670
#define SCIP_DECL_USEREXPRCOPYDATA(x)
Definition: type_expr.h:291
#define SCIP_Real
Definition: def.h:145
int SCIPexprGetIntPowerExponent(SCIP_EXPR *expr)
Definition: expr.c:5744
SCIP_RETCODE SCIPexprgraphReplaceVarByLinearSum(SCIP_EXPRGRAPH *exprgraph, void *var, int ncoefs, SCIP_Real *coefs, void **vars, SCIP_Real constant)
Definition: expr.c:15437
void SCIPexprGetVarsUsage(SCIP_EXPR *expr, int *varsusage)
Definition: expr.c:7532
void SCIPexprgraphPropagateNodeBounds(SCIP_EXPRGRAPH *exprgraph, SCIP_Real infinity, SCIP_Real minstrength, SCIP_Bool *cutoff)
Definition: expr.c:15810
SCIP_Real SCIPexprGetLinearConstant(SCIP_EXPR *expr)
Definition: expr.c:5779
SCIP_EXPRGRAPHNODE *** SCIPexprgraphGetNodes(SCIP_EXPRGRAPH *exprgraph)
Definition: expr.c:14853
SCIP_RETCODE SCIPexprtreeCreate(BMS_BLKMEM *blkmem, SCIP_EXPRTREE **tree, SCIP_EXPR *root, int nvars, int nparams, SCIP_Real *params)
Definition: expr.c:8718
void SCIPexprMonomialPower(SCIP_EXPRDATA_MONOMIAL *monomial, int exponent)
Definition: expr.c:6901
SCIP_EXPRDATA_MONOMIAL ** SCIPexprgraphGetNodePolynomialMonomials(SCIP_EXPRGRAPHNODE *node)
Definition: expr.c:13101
SCIP_EXPRGRAPHNODE ** SCIPexprgraphGetNodeChildren(SCIP_EXPRGRAPHNODE *node)
Definition: expr.c:12900
void SCIPexprtreeSetParamVal(SCIP_EXPRTREE *tree, int paramidx, SCIP_Real paramval)
Definition: expr.c:8589
BMS_BLKMEM * blkmem
Definition: nlpioracle.c:59
SCIP_RETCODE SCIPexprCreateMonomial(BMS_BLKMEM *blkmem, SCIP_EXPRDATA_MONOMIAL **monomial, SCIP_Real coef, int nfactors, int *childidxs, SCIP_Real *exponents)
Definition: expr.c:7010
SCIP_Real * SCIPexprGetLinearCoefs(SCIP_EXPR *expr)
Definition: expr.c:5766
SCIP_Bool SCIPexprFindMonomialFactor(SCIP_EXPRDATA_MONOMIAL *monomial, int childidx, int *pos)
Definition: expr.c:7111
SCIP_Real * SCIPexprgraphGetNodeQuadraticLinearCoefs(SCIP_EXPRGRAPHNODE *node)
Definition: expr.c:13065
SCIP_RETCODE SCIPexprtreeAddExpr(SCIP_EXPRTREE *tree, SCIP_EXPR *expr, SCIP_Bool copyexpr)
Definition: expr.c:8927
SCIP_Real SCIPexprgraphGetNodeQuadraticConstant(SCIP_EXPRGRAPHNODE *node)
Definition: expr.c:13053
common defines and data types used in all packages of SCIP
struct BMS_BlkMem BMS_BLKMEM
Definition: memory.h:396
SCIP_RETCODE SCIPexprCheckCurvature(SCIP_EXPR *expr, SCIP_Real infinity, SCIP_INTERVAL *varbounds, SCIP_Real *param, SCIP_EXPRCURV *curv, SCIP_INTERVAL *bounds)
Definition: expr.c:8000
void SCIPexprgraphGetSubtreeVarsUsage(SCIP_EXPRGRAPH *exprgraph, SCIP_EXPRGRAPHNODE *node, int *varsusage)
Definition: expr.c:16633
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)
Definition: expr.c:6477
SCIP_Real SCIPexprgraphGetNodeVal(SCIP_EXPRGRAPHNODE *node)
Definition: expr.c:13252
#define SCIP_DECL_USEREXPRFREEDATA(x)
Definition: type_expr.h:299
SCIP_RETCODE SCIPexprtreeSetParams(SCIP_EXPRTREE *tree, int nparams, SCIP_Real *paramvals)
Definition: expr.c:8823
SCIP_RETCODE SCIPexprgraphAddVars(SCIP_EXPRGRAPH *exprgraph, int nvars, void **vars, SCIP_EXPRGRAPHNODE **varnodes)
Definition: expr.c:15177
SCIP_Bool SCIPexprgraphIsNodeEnabled(SCIP_EXPRGRAPHNODE *node)
Definition: expr.c:12880
void SCIPexprSortMonomials(SCIP_EXPR *expr)
Definition: expr.c:6998
SCIP_Real * SCIPexprGetQuadLinearCoefs(SCIP_EXPR *expr)
Definition: expr.c:5817
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)
Definition: expr.c:15005
#define SCIP_DECL_EXPRGRAPHVARCHGIDX(x)
Definition: type_expr.h:203
SCIP_INTERVAL SCIPexprgraphGetNodeBounds(SCIP_EXPRGRAPHNODE *node)
Definition: expr.c:13242
memory allocation routines