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-2018 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  int varnameslength /**< length of the varnames buffer array */
773  );
774 
775 /**@} */
776 
777 /**@name Expression tree methods */
778 /**@{ */
779 
780 /** returns root expression of an expression tree */
781 extern
783  SCIP_EXPRTREE* tree /**< expression tree */
784  );
785 
786 /** returns number of variables in expression tree */
787 extern
789  SCIP_EXPRTREE* tree /**< expression tree */
790  );
791 
792 /** returns number of parameters in expression tree */
793 extern
795  SCIP_EXPRTREE* tree /**< expression tree */
796  );
797 
798 /** returns values of parameters or NULL if none */
799 extern
801  SCIP_EXPRTREE* tree /**< expression tree */
802  );
803 
804 /** sets value of a single parameter in expression tree */
805 extern
807  SCIP_EXPRTREE* tree, /**< expression tree */
808  int paramidx, /**< index of parameter */
809  SCIP_Real paramval /**< new value of parameter */
810  );
811 
812 /** gets data of expression tree interpreter, or NULL if not set */
813 extern
815  SCIP_EXPRTREE* tree /**< expression tree */
816  );
817 
818 /** sets data of expression tree interpreter */
819 extern
821  SCIP_EXPRTREE* tree, /**< expression tree */
822  SCIP_EXPRINTDATA* interpreterdata /**< expression interpreter data */
823  );
824 
825 /** frees data of expression tree interpreter, if any */
826 extern
828  SCIP_EXPRTREE* tree /**< expression tree */
829  );
830 
831 /** indicates whether there are parameterized constants (SCIP_EXPR_PARAM) in expression tree */
832 extern
834  SCIP_EXPRTREE* tree /**< expression tree */
835  );
836 
837 /** Gives maximal degree of expression in expression tree.
838  * If constant expression, gives 0,
839  * if linear expression, gives 1,
840  * if polynomial expression, gives its maximal degree,
841  * otherwise (nonpolynomial nonconstant expressions) gives at least SCIP_EXPR_DEGREEINFINITY.
842  */
843 extern
845  SCIP_EXPRTREE* tree, /**< expression tree */
846  int* maxdegree /**< buffer to store maximal degree */
847  );
848 
849 /** evaluates an expression tree w.r.t. a point */
850 extern
852  SCIP_EXPRTREE* tree, /**< expression tree */
853  SCIP_Real* varvals, /**< values for variables */
854  SCIP_Real* val /**< buffer to store expression tree value */
855  );
856 
857 /** evaluates an expression tree w.r.t. an interval */
858 extern
860  SCIP_EXPRTREE* tree, /**< expression tree */
861  SCIP_Real infinity, /**< value for infinity */
862  SCIP_INTERVAL* varvals, /**< intervals for variables */
863  SCIP_INTERVAL* val /**< buffer to store expression tree value */
864  );
865 
866 /** prints an expression tree */
867 extern
868 void SCIPexprtreePrint(
869  SCIP_EXPRTREE* tree, /**< expression tree */
870  SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
871  FILE* file, /**< file for printing, or NULL for stdout */
872  const char** varnames, /**< names of variables, or NULL for default names */
873  const char** paramnames /**< names of parameters, or NULL for default names */
874  );
875 
876 #ifdef NDEBUG
877 
878 /* In optimized mode, the function calls are overwritten by defines to reduce the number of function calls and
879  * speed up the algorithms.
880  */
881 
882 #define SCIPexprtreeGetRoot(tree) (tree)->root
883 #define SCIPexprtreeGetNVars(tree) (tree)->nvars
884 #define SCIPexprtreeGetNParams(tree) (tree)->nparams
885 #define SCIPexprtreeGetParamVals(tree) (tree)->params
886 #define SCIPexprtreeSetParamVal(tree, paramidx, paramval) do { (tree)->params[(paramidx)] = paramval; } while (FALSE)
887 #define SCIPexprtreeGetInterpreterData(tree) (tree)->interpreterdata
888 #define SCIPexprtreeSetInterpreterData(tree, newinterpreterdata) do { (tree)->interpreterdata = newinterpreterdata; } while (FALSE)
889 #define SCIPexprtreeFreeInterpreterData(tree) ((tree)->interpreterdata != NULL ? SCIPexprintFreeData(&(tree)->interpreterdata) : SCIP_OKAY)
890 #define SCIPexprtreeHasParam(tree) SCIPexprHasParam((tree)->root)
891 #define SCIPexprtreeGetMaxDegree(tree, maxdegree) SCIPexprGetMaxDegree((tree)->root, maxdegree)
892 #define SCIPexprtreeEval(tree, varvals, val) SCIPexprEval((tree)->root, varvals, (tree)->params, val)
893 #define SCIPexprtreeEvalInt(tree, infinity, varvals, val) SCIPexprEvalInt((tree)->root, infinity, varvals, (tree)->params, val)
894 #define SCIPexprtreePrint(tree, messagehdlr, file, varnames, paramnames) SCIPexprPrint((tree)->root, messagehdlr, file, varnames, paramnames, (tree)->params)
895 
896 #endif
897 
898 /** creates an expression tree */
899 extern
901  BMS_BLKMEM* blkmem, /**< block memory data structure */
902  SCIP_EXPRTREE** tree, /**< buffer to store address of created expression tree */
903  SCIP_EXPR* root, /**< pointer to root expression, not copied deep !, can be NULL */
904  int nvars, /**< number of variables in variable mapping */
905  int nparams, /**< number of parameters in expression */
906  SCIP_Real* params /**< values for parameters, or NULL (if NULL but nparams > 0, then params is initialized with zeros) */
907  );
908 
909 /** copies an expression tree */
910 extern
912  BMS_BLKMEM* blkmem, /**< block memory that should be used in new expression tree */
913  SCIP_EXPRTREE** targettree, /**< buffer to store address of copied expression tree */
914  SCIP_EXPRTREE* sourcetree /**< expression tree to copy */
915  );
916 
917 /** frees an expression tree */
918 extern
920  SCIP_EXPRTREE** tree /**< pointer to expression tree that is freed */
921  );
922 
923 /** sets number and values of all parameters in expression tree */
924 extern
926  SCIP_EXPRTREE* tree, /**< expression tree */
927  int nparams, /**< number of parameters */
928  SCIP_Real* paramvals /**< values of parameters, can be NULL if nparams == 0 */
929  );
930 
931 /** gives the number of usages for each variable in the expression tree */
932 extern
934  SCIP_EXPRTREE* tree, /**< expression tree */
935  int* varsusage /**< array where to store for each variable how often it is used in the tree */
936  );
937 
938 /** aims at simplifying an expression and splitting of a linear expression
939  * if linear variables are split off, expression interpreter data, if stored in the tree, is freed
940  */
941 extern
943  SCIP_EXPRTREE* tree, /**< expression tree */
944  SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
945  SCIP_Real eps, /**< threshold, under which positive values are treat as 0 */
946  int maxexpansionexponent,/**< maximal exponent for which we still expand non-monomial polynomials */
947  int* nlinvars, /**< buffer to store number of linear variables in linear part, or NULL if linear part should not be separated */
948  int* linidxs, /**< array to store indices of variables in expression tree which belong to linear part, or NULL */
949  SCIP_Real* lincoefs /**< array to store coefficients of linear part, or NULL */
950  );
951 
952 /** adds an expression to the root expression of the tree
953  * the root is replaced with an SCIP_EXPR_PLUS expression which has the previous root and the given expression as children
954  */
955 extern
957  SCIP_EXPRTREE* tree, /**< expression tree */
958  SCIP_EXPR* expr, /**< expression to add to tree */
959  SCIP_Bool copyexpr /**< whether expression should be copied */
960  );
961 
962 /** tries to determine the curvature type of an expression tree w.r.t. given variable domains */
963 extern
965  SCIP_EXPRTREE* tree, /**< expression tree */
966  SCIP_Real infinity, /**< value for infinity */
967  SCIP_INTERVAL* varbounds, /**< domains of variables */
968  SCIP_EXPRCURV* curv, /**< buffer to store curvature of expression */
969  SCIP_INTERVAL* bounds /**< buffer to store bounds on expression, or NULL if not needed */
970  );
971 
972 /** substitutes variables (SCIP_EXPR_VARIDX) in an expression tree by expressions
973  * A variable with index i is replaced by a copy of substexprs[i], if that latter is not NULL
974  * if substexprs[i] == NULL, then the variable expression i is not touched
975  */
976 extern
978  SCIP_EXPRTREE* tree, /**< expression tree */
979  SCIP_EXPR** substexprs /**< array of substitute expressions; single entries can be NULL */
980  );
981 
982 /**@} */
983 
984 /**@name Quadratic element methods */
985 /**@{ */
986 
987 /** sorts an array of quadratic elements
988  * The elements are sorted such that the first index is increasing and
989  * such that among elements with the same first index, the second index is increasing.
990  * For elements with same first and second index, the order is not defined.
991  */
992 extern
993 void SCIPquadelemSort(
994  SCIP_QUADELEM* quadelems, /**< array of quadratic elements */
995  int nquadelems /**< number of quadratic elements */
996  );
997 
998 /** Finds an index pair in a sorted array of quadratic elements.
999  * If (idx1,idx2) is found in quadelems, then returns TRUE and stores position of quadratic element in *pos.
1000  * 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.
1001  * Assumes that idx1 <= idx2.
1002  */
1003 extern
1005  SCIP_QUADELEM* quadelems, /**< array of quadratic elements */
1006  int idx1, /**< index of first variable in element to search for */
1007  int idx2, /**< index of second variable in element to search for */
1008  int nquadelems, /**< number of quadratic elements in array */
1009  int* pos /**< buffer to store position of found quadratic element, or position where it would be inserted */
1010  );
1011 
1012 /** Adds quadratic elements with same index and removes elements with coefficient 0.0.
1013  * Assumes that elements have been sorted before.
1014  */
1015 extern
1016 void SCIPquadelemSqueeze(
1017  SCIP_QUADELEM* quadelems, /**< array of quadratic elements */
1018  int nquadelems, /**< number of quadratic elements */
1019  int* nquadelemsnew /**< pointer to store new (reduced) number of quadratic elements */
1020  );
1021 
1022 /**@} */
1023 
1024 /**@name Expression graph node methods */
1025 /**@{ */
1026 
1027 /** captures node, i.e., increases number of uses */
1028 extern
1030  SCIP_EXPRGRAPHNODE* node /**< expression graph node to capture */
1031  );
1032 
1033 /** returns whether a node is currently enabled */
1034 extern
1036  SCIP_EXPRGRAPHNODE* node /**< expression graph node to enable */
1037  );
1038 
1039 /** gets number of children of a node in an expression graph */
1040 extern
1042  SCIP_EXPRGRAPHNODE* node /**< expression graph node */
1043  );
1044 
1045 /** gets children of a node in an expression graph */
1046 extern
1048  SCIP_EXPRGRAPHNODE* node /**< expression graph node */
1049  );
1050 
1051 /** gets number of parents of a node in an expression graph */
1052 extern
1054  SCIP_EXPRGRAPHNODE* node /**< expression graph node */
1055  );
1056 
1057 /** gets parents of a node in an expression graph */
1058 extern
1060  SCIP_EXPRGRAPHNODE* node /**< expression graph node */
1061  );
1062 
1063 /** gets depth of node in expression graph */
1064 extern
1066  SCIP_EXPRGRAPHNODE* node /**< expression graph node */
1067  );
1068 
1069 /** gets position of node in expression graph at its depth level */
1070 extern
1072  SCIP_EXPRGRAPHNODE* node /**< expression graph node */
1073  );
1074 
1075 /** gets operator of a node in an expression graph */
1076 extern
1078  SCIP_EXPRGRAPHNODE* node /**< expression graph node */
1079  );
1080 
1081 /** gives index belonging to a SCIP_EXPR_VARIDX or SCIP_EXPR_PARAM operand */
1082 extern
1084  SCIP_EXPRGRAPHNODE* node /**< expression graph node */
1085  );
1086 
1087 /** gives real belonging to a SCIP_EXPR_CONST operand */
1088 extern
1090  SCIP_EXPRGRAPHNODE* node /**< expression graph node */
1091  );
1092 
1093 /** gives variable belonging to a SCIP_EXPR_VARIDX expression */
1094 extern
1096  SCIP_EXPRGRAPH* exprgraph, /**< expression graph */
1097  SCIP_EXPRGRAPHNODE* node /**< expression graph node */
1098  );
1099 
1100 /** gives exponent belonging to a SCIP_EXPR_REALPOWER expression */
1101 extern
1103  SCIP_EXPRGRAPHNODE* node /**< expression graph node */
1104  );
1105 
1106 /** gives exponent belonging to a SCIP_EXPR_INTPOWER expression */
1107 extern
1109  SCIP_EXPRGRAPHNODE* node /**< expression graph node */
1110  );
1111 
1112 /** gives exponent belonging to a SCIP_EXPR_SIGNPOWER expression */
1113 extern
1115  SCIP_EXPRGRAPHNODE* node /**< expression graph node */
1116  );
1117 
1118 /** gives linear coefficients belonging to a SCIP_EXPR_LINEAR expression */
1119 extern
1121  SCIP_EXPRGRAPHNODE* node /**< expression graph node */
1122  );
1123 
1124 /** gives constant belonging to a SCIP_EXPR_LINEAR expression */
1125 extern
1127  SCIP_EXPRGRAPHNODE* node /**< expression graph node */
1128  );
1129 
1130 /** gives constant belonging to a SCIP_EXPR_QUADRATIC expression */
1131 extern
1133  SCIP_EXPRGRAPHNODE* node /**< expression graph node */
1134  );
1135 
1136 /** gives linear coefficients belonging to a SCIP_EXPR_QUADRATIC expression, or NULL if all coefficients are 0.0 */
1137 extern
1139  SCIP_EXPRGRAPHNODE* node /**< expression graph node */
1140  );
1141 
1142 /** gives quadratic elements belonging to a SCIP_EXPR_QUADRATIC expression */
1143 extern
1145  SCIP_EXPRGRAPHNODE* node /**< expression graph node */
1146  );
1147 
1148 /** gives number of quadratic elements belonging to a SCIP_EXPR_QUADRATIC expression */
1149 extern
1151  SCIP_EXPRGRAPHNODE* node /**< expression graph node */
1152  );
1153 
1154 /** gives the monomials belonging to a SCIP_EXPR_POLYNOMIAL expression */
1155 extern
1157  SCIP_EXPRGRAPHNODE* node /**< expression graph node */
1158  );
1159 
1160 /** gives the number of monomials belonging to a SCIP_EXPR_POLYNOMIAL expression */
1161 extern
1163  SCIP_EXPRGRAPHNODE* node /**< expression graph node */
1164  );
1165 
1166 /** gives the constant belonging to a SCIP_EXPR_POLYNOMIAL expression */
1167 extern
1169  SCIP_EXPRGRAPHNODE* node /**< expression graph node */
1170  );
1171 
1172 /** gives the curvature of a single monomial belonging to a SCIP_EXPR_POLYNOMIAL expression */
1173 extern
1175  SCIP_EXPRGRAPHNODE* node, /**< expression graph node */
1176  int monomialidx, /**< index of monomial */
1177  SCIP_Real infinity, /**< value for infinity in interval arithmetics */
1178  SCIP_EXPRCURV* curv /**< buffer to store monomial curvature */
1179  );
1180 
1181 /** gives the user data belonging to a SCIP_EXPR_USER expression */
1182 extern
1184  SCIP_EXPRGRAPHNODE* node
1185  );
1186 
1187 /** indicates whether a user expression has the estimator callback defined */
1188 extern
1190  SCIP_EXPRGRAPHNODE* node
1191  );
1192 
1193 /** gets bounds of a node in an expression graph */
1194 extern
1196  SCIP_EXPRGRAPHNODE* node /**< expression graph node */
1197  );
1198 
1199 /** gets value of expression associated to node from last evaluation call */
1200 extern
1202  SCIP_EXPRGRAPHNODE* node /**< expression graph node */
1203  );
1204 
1205 /** gets curvature of expression associated to node from last curvature check call */
1206 extern
1208  SCIP_EXPRGRAPHNODE* node /**< expression graph node */
1209  );
1210 
1211 #ifdef NDEBUG
1212 
1213 /* In optimized mode, the function calls are overwritten by defines to reduce the number of function calls and
1214  * speed up the algorithms.
1215  */
1216 
1217 #define SCIPexprgraphCaptureNode(node) do { ++(node)->nuses; } while( FALSE )
1218 #define SCIPexprgraphIsNodeEnabled(node) (node)->enabled
1219 #define SCIPexprgraphGetNodeNChildren(node) (node)->nchildren
1220 #define SCIPexprgraphGetNodeChildren(node) (node)->children
1221 #define SCIPexprgraphGetNodeNParents(node) (node)->nparents
1222 #define SCIPexprgraphGetNodeParents(node) (node)->parents
1223 #define SCIPexprgraphGetNodeDepth(node) (node)->depth
1224 #define SCIPexprgraphGetNodePosition(node) (node)->pos
1225 #define SCIPexprgraphGetNodeOperator(node) (node)->op
1226 #define SCIPexprgraphGetNodeOperatorIndex(node) (node)->data.intval
1227 #define SCIPexprgraphGetNodeOperatorReal(node) (node)->data.dbl
1228 #define SCIPexprgraphGetNodeVar(exprgraph, node) (exprgraph)->vars[(node)->data.intval]
1229 #define SCIPexprgraphGetNodeRealPowerExponent(node) (node)->data.dbl
1230 #define SCIPexprgraphGetNodeIntPowerExponent(node) (node)->data.intval
1231 #define SCIPexprgraphGetNodeSignPowerExponent(node) (node)->data.dbl
1232 #define SCIPexprgraphGetNodeLinearCoefs(node) ((SCIP_Real*)(node)->data.data)
1233 #define SCIPexprgraphGetNodeLinearConstant(node) (((SCIP_Real*)(node)->data.data)[(node)->nchildren])
1234 #define SCIPexprgraphGetNodeQuadraticConstant(node) ((SCIP_EXPRDATA_QUADRATIC*)(node)->data.data)->constant
1235 #define SCIPexprgraphGetNodeQuadraticLinearCoefs(node) ((SCIP_EXPRDATA_QUADRATIC*)(node)->data.data)->lincoefs
1236 #define SCIPexprgraphGetNodeQuadraticQuadElements(node) ((SCIP_EXPRDATA_QUADRATIC*)(node)->data.data)->quadelems
1237 #define SCIPexprgraphGetNodeQuadraticNQuadElements(node) ((SCIP_EXPRDATA_QUADRATIC*)(node)->data.data)->nquadelems
1238 #define SCIPexprgraphGetNodePolynomialMonomials(node) ((SCIP_EXPRDATA_POLYNOMIAL*)(node)->data.data)->monomials
1239 #define SCIPexprgraphGetNodePolynomialNMonomials(node) ((SCIP_EXPRDATA_POLYNOMIAL*)(node)->data.data)->nmonomials
1240 #define SCIPexprgraphGetNodePolynomialConstant(node) ((SCIP_EXPRDATA_POLYNOMIAL*)(node)->data.data)->constant
1241 #define SCIPexprgraphGetNodeUserData(node) ((SCIP_EXPRDATA_USER*)(node)->data.data)->userdata
1242 #define SCIPexprgraphHasNodeUserEstimator(node) (((SCIP_EXPRDATA_USER*)node->data.data)->estimate != NULL)
1243 #define SCIPexprgraphGetNodeBounds(node) (node)->bounds
1244 #define SCIPexprgraphGetNodeVal(node) (node)->value
1245 #define SCIPexprgraphGetNodeCurvature(node) (node)->curv
1246 
1247 #endif
1248 
1249 /** creates an expression graph node */
1250 extern
1252  BMS_BLKMEM* blkmem, /**< block memory */
1253  SCIP_EXPRGRAPHNODE** node, /**< buffer to store expression graph node */
1254  SCIP_EXPROP op, /**< operator type of expression */
1255  ...
1256  );
1257 
1258 /** creates an expression graph node for a linear expression */
1259 extern
1261  BMS_BLKMEM* blkmem, /**< block memory */
1262  SCIP_EXPRGRAPHNODE** node, /**< buffer to store expression graph node */
1263  int ncoefs, /**< number of coefficients */
1264  SCIP_Real* coefs, /**< coefficients of linear expression */
1265  SCIP_Real constant /**< constant of linear expression */
1266  );
1267 
1268 /** creates an expression graph node for a quadratic expression */
1269 extern
1271  BMS_BLKMEM* blkmem, /**< block memory */
1272  SCIP_EXPRGRAPHNODE** node, /**< buffer to store expression graph node */
1273  int nchildren, /**< number of children */
1274  SCIP_Real* lincoefs, /**< linear coefficients for children, or NULL */
1275  int nquadelems, /**< number of quadratic elements */
1276  SCIP_QUADELEM* quadelems, /**< quadratic elements, or NULL if nquadelems == 0 */
1277  SCIP_Real constant /**< constant */
1278  );
1279 
1280 /** creates an expression graph node for a polynomial expression */
1281 extern
1283  BMS_BLKMEM* blkmem, /**< block memory */
1284  SCIP_EXPRGRAPHNODE** node, /**< buffer to store expression graph node */
1285  int nmonomials, /**< number of monomials */
1286  SCIP_EXPRDATA_MONOMIAL** monomials, /**< monomials */
1287  SCIP_Real constant, /**< constant of polynomial */
1288  SCIP_Bool copymonomials /**< whether to copy monomials or to assume ownership */
1289  );
1290 
1291 /** adds monomials to an expression graph node that is a polynomial expression */
1292 extern
1294  BMS_BLKMEM* blkmem, /**< block memory */
1295  SCIP_EXPRGRAPHNODE* node, /**< store expression graph node with polynomial operator */
1296  int nmonomials, /**< number of monomials */
1297  SCIP_EXPRDATA_MONOMIAL** monomials, /**< monomials */
1298  SCIP_Bool copymonomials /**< whether to copy monomials or to assume ownership */
1299  );
1300 
1301 /** creates an expression graph node for a user expression */
1302 extern
1304  BMS_BLKMEM* blkmem, /**< block memory */
1305  SCIP_EXPRGRAPHNODE** node, /**< buffer to store expression graph node */
1306  SCIP_USEREXPRDATA* data, /**< user data for expression, node assumes ownership */
1307  SCIP_EXPRINTCAPABILITY evalcapability, /**< evaluation capability */
1308  SCIP_DECL_USEREXPREVAL ((*eval)), /**< evaluation function */
1309  SCIP_DECL_USEREXPRINTEVAL ((*inteval)), /**< interval evaluation function */
1310  SCIP_DECL_USEREXPRCURV ((*curv)), /**< curvature check function */
1311  SCIP_DECL_USEREXPRPROP ((*prop)), /**< interval propagation function */
1312  SCIP_DECL_USEREXPRESTIMATE ((*estimate)), /**< estimation function, or NULL if convex, concave, or not implemented */
1313  SCIP_DECL_USEREXPRCOPYDATA ((*copydata)), /**< expression data copy function, or NULL if nothing to copy */
1314  SCIP_DECL_USEREXPRFREEDATA ((*freedata)), /**< expression data free function, or NULL if nothing to free */
1315  SCIP_DECL_USEREXPRPRINT ((*print)) /**< expression print function, or NULL for default string "user" */
1316  );
1317 
1318 /** given a node of an expression graph, splitup a linear part which variables are not used somewhere else in the same expression
1319  * E.g., if the expression is 1 + x + y + y^2, one gets 1 + x and the node remains at y + y^2.
1320  * If the node is a linear expression, it may be freed.
1321  * If it is not linear, the node may change, i.e., the remaining nonlinear part may be stored in a new node.
1322  * It is assumed that the user had captured the node.
1323  * It is assumed that the expression graph has been simplified before.
1324  */
1325 extern
1327  SCIP_EXPRGRAPH* exprgraph, /**< expression graph */
1328  SCIP_EXPRGRAPHNODE** node, /**< expression graph node where to splitup linear part */
1329  int linvarssize, /**< length of linvars and lincoefs arrays */
1330  int* nlinvars, /**< buffer to store length of linear term that have been splitup */
1331  void** linvars, /**< buffer to store variables of linear part */
1332  SCIP_Real* lincoefs, /**< buffer to store coefficients of linear part */
1333  SCIP_Real* constant /**< buffer to store constant part */
1334  );
1335 
1336 /** moves parents from a one node to another node
1337  * in other words, replaces the child srcnode by targetnode in all parents of srcnode
1338  * srcnode may be freed, if not captured
1339  * it is assumes that targetnode represents the same expression as srcnode
1340  */
1341 extern
1343  SCIP_EXPRGRAPH* exprgraph, /**< expression graph */
1344  SCIP_EXPRGRAPHNODE** srcnode, /**< node which parents to move */
1345  SCIP_EXPRGRAPHNODE* targetnode /**< node where to move parents to */
1346  );
1347 
1348 /** releases node, i.e., decreases number of uses
1349  * node is freed if no parents and no other uses
1350  * children are recursively released if they have no other parents
1351  * nodes that are removed are also freed
1352  * if node correspond to a variable, then the variable is removed from the expression graph
1353  * similar for constants
1354  */
1355 extern
1357  SCIP_EXPRGRAPH* exprgraph, /**< expression graph */
1358  SCIP_EXPRGRAPHNODE** node /**< expression graph node to release */
1359  );
1360 
1361 /** frees a node of an expression graph */
1362 extern
1364  BMS_BLKMEM* blkmem, /**< block memory */
1365  SCIP_EXPRGRAPHNODE** node /**< pointer to expression graph node that should be freed */
1366  );
1367 
1368 /** enables a node and recursively all its children in an expression graph */
1369 extern
1371  SCIP_EXPRGRAPH* exprgraph, /**< expression graph */
1372  SCIP_EXPRGRAPHNODE* node /**< expression graph node to enable */
1373  );
1374 
1375 /** disables a node and recursively all children which have no enabled parents in an expression graph */
1376 extern
1378  SCIP_EXPRGRAPH* exprgraph, /**< expression graph */
1379  SCIP_EXPRGRAPHNODE* node /**< expression graph node to enable */
1380  );
1381 
1382 /** returns whether the node has siblings in the expression graph */
1383 extern
1385  SCIP_EXPRGRAPHNODE* node /**< expression graph node */
1386  );
1387 
1388 /** returns whether all children of an expression graph node are variable nodes
1389  * gives TRUE for nodes without children
1390  */
1391 extern
1393  SCIP_EXPRGRAPHNODE* node /**< expression graph node */
1394  );
1395 
1396 /** returns whether the node has an ancestor which has a nonlinear expression operand */
1397 extern
1399  SCIP_EXPRGRAPHNODE* node /**< expression graph node */
1400  );
1401 
1402 /** prints an expression graph node */
1403 extern
1405  SCIP_EXPRGRAPHNODE* node, /**< expression graph node */
1406  SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
1407  FILE* file /**< file to print to, or NULL for stdout */
1408  );
1409 
1410 /** tightens the bounds in a node of the graph
1411  * preparation for reverse propagation
1412  * sets bound status to SCIP_EXPRBOUNDSTATUS_TIGHTENEDBYPARENTRECENT if tightening is strong enough and not cutoff
1413  */
1414 extern
1416  SCIP_EXPRGRAPH* exprgraph, /**< expression graph */
1417  SCIP_EXPRGRAPHNODE* node, /**< node in expression graph with no parents */
1418  SCIP_INTERVAL nodebounds, /**< new bounds for node */
1419  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) */
1420  SCIP_Real infinity, /**< value for infinity in interval arithmetics */
1421  SCIP_Bool* cutoff /**< buffer to store whether a node's bounds were propagated to an empty interval */
1422  );
1423 
1424 /** ensures that bounds and curvature information in a node is uptodate
1425  * assumes that bounds and curvature in children are uptodate
1426  */
1427 extern
1429  SCIP_EXPRGRAPHNODE* node, /**< expression graph node */
1430  SCIP_Real infinity, /**< value for infinity in interval arithmetics */
1431  SCIP_Real minstrength, /**< minimal required relative bound strengthening to trigger a bound recalculation in parent nodes */
1432  SCIP_Bool clearreverseprop /**< whether to reset bound tightenings from reverse propagation */
1433  );
1434 
1435 /**@} */
1436 
1437 /**@name Expression graph methods */
1438 /**@{ */
1439 
1440 /** get current maximal depth of expression graph */
1441 extern
1443  SCIP_EXPRGRAPH* exprgraph /**< expression graph */
1444  );
1445 
1446 /** gets array with number of nodes at each depth of expression graph */
1447 extern
1449  SCIP_EXPRGRAPH* exprgraph /**< expression graph */
1450  );
1451 
1452 /** gets nodes of expression graph, one array per depth */
1453 extern
1455  SCIP_EXPRGRAPH* exprgraph /**< expression graph */
1456  );
1457 
1458 /** gets number of variables in expression graph */
1459 extern
1461  SCIP_EXPRGRAPH* exprgraph /**< pointer to expression graph that should be freed */
1462  );
1463 
1464 /** gets array of variables in expression graph */
1465 extern
1466 void** SCIPexprgraphGetVars(
1467  SCIP_EXPRGRAPH* exprgraph /**< pointer to expression graph that should be freed */
1468  );
1469 
1470 /** gets array of expression graph nodes corresponding to variables */
1471 extern
1473  SCIP_EXPRGRAPH* exprgraph /**< pointer to expression graph that should be freed */
1474  );
1475 
1476 /** sets value for a single variable given as expression graph node */
1477 extern
1479  SCIP_EXPRGRAPHNODE* varnode, /**< expression graph node corresponding to variable */
1480  SCIP_Real value /**< new value for variable */
1481  );
1482 
1483 /** sets bounds for variables */
1484 extern
1486  SCIP_EXPRGRAPH* exprgraph, /**< expression graph */
1487  SCIP_INTERVAL* varbounds /**< new bounds for variables */
1488  );
1489 
1490 /** sets bounds for a single variable */
1491 extern
1493  SCIP_EXPRGRAPH* exprgraph, /**< expression graph */
1494  void* var, /**< variable */
1495  SCIP_INTERVAL varbounds /**< new bounds of variable */
1496  );
1497 
1498 /** sets bounds for a single variable given as expression graph node */
1499 extern
1501  SCIP_EXPRGRAPH* exprgraph, /**< expression graph */
1502  SCIP_EXPRGRAPHNODE* varnode, /**< expression graph node corresponding to variable */
1503  SCIP_INTERVAL varbounds /**< new bounds of variable */
1504  );
1505 
1506 /** sets lower bound for a single variable given as expression graph node */
1507 extern
1509  SCIP_EXPRGRAPH* exprgraph, /**< expression graph */
1510  SCIP_EXPRGRAPHNODE* varnode, /**< expression graph node corresponding to variable */
1511  SCIP_Real lb /**< new lower bound for variable */
1512  );
1513 
1514 /** sets upper bound for a single variable given as expression graph node */
1515 extern
1517  SCIP_EXPRGRAPH* exprgraph, /**< expression graph */
1518  SCIP_EXPRGRAPHNODE* varnode, /**< expression graph node corresponding to variable */
1519  SCIP_Real ub /**< new upper bound for variable */
1520  );
1521 
1522 /** gets bounds that are stored for all variables */
1523 extern
1525  SCIP_EXPRGRAPH* exprgraph /**< expression graph */
1526  );
1527 
1528 #ifdef NDEBUG
1529 
1530 /* In optimized mode, the function calls are overwritten by defines to reduce the number of function calls and
1531  * speed up the algorithms.
1532  */
1533 
1534 #define SCIPexprgraphGetDepth(exprgraph) (exprgraph)->depth
1535 #define SCIPexprgraphGetNNodes(exprgraph) (exprgraph)->nnodes
1536 #define SCIPexprgraphGetNodes(exprgraph) (exprgraph)->nodes
1537 #define SCIPexprgraphGetNVars(exprgraph) (exprgraph)->nvars
1538 #define SCIPexprgraphGetVars(exprgraph) (exprgraph)->vars
1539 #define SCIPexprgraphGetVarNodes(exprgraph) (exprgraph)->varnodes
1540 #define SCIPexprgraphSetVarNodeValue(varnode, newvalue) do { (varnode)->value = newvalue; } while (FALSE)
1541 #define SCIPexprgraphSetVarsBounds(exprgraph, newvarbounds) BMScopyMemoryArray((exprgraph)->varbounds, newvarbounds, (exprgraph)->nvars)
1542 #define SCIPexprgraphSetVarBounds(exprgraph, var, newvarbounds) do { (exprgraph)->varbounds[(int)(size_t)SCIPhashmapGetImage((exprgraph)->varidxs, var)] = newvarbounds; } while (FALSE)
1543 #define SCIPexprgraphSetVarNodeBounds(exprgraph, varnode, newvarbounds) do { (exprgraph)->varbounds[(varnode)->data.intval] = newvarbounds; } while (FALSE)
1544 #define SCIPexprgraphSetVarNodeLb(exprgraph, varnode, lb) do { (exprgraph)->varbounds[(varnode)->data.intval].inf = lb; } while (FALSE)
1545 #define SCIPexprgraphSetVarNodeUb(exprgraph, varnode, ub) do { (exprgraph)->varbounds[(varnode)->data.intval].sup = ub; } while (FALSE)
1546 #define SCIPexprgraphGetVarsBounds(exprgraph) (exprgraph)->varbounds
1547 
1548 #endif
1549 
1550 /** creates an empty expression graph */
1551 extern
1553  BMS_BLKMEM* blkmem, /**< block memory */
1554  SCIP_EXPRGRAPH** exprgraph, /**< buffer to store pointer to expression graph */
1555  int varssizeinit, /**< minimal initial size for variables array, or -1 to choose automatically */
1556  int depthinit, /**< minimal initial depth of expression graph, or -1 to choose automatically */
1557  SCIP_DECL_EXPRGRAPHVARADDED((*exprgraphvaradded)), /**< callback method to invoke when a variable has been added to the expression graph, or NULL if not needed */
1558  SCIP_DECL_EXPRGRAPHVARREMOVE((*exprgraphvarremove)), /**< callback method to invoke when a variable will be removed from the expression graph, or NULL if not needed */
1559  SCIP_DECL_EXPRGRAPHVARCHGIDX((*exprgraphvarchgidx)), /**< callback method to invoke when a variable changes its index in the expression graph, or NULL if not needed */
1560  void* userdata /**< user data to pass to callback functions */
1561  );
1562 
1563 /** frees an expression graph */
1564 extern
1566  SCIP_EXPRGRAPH** exprgraph /**< pointer to expression graph that should be freed */
1567  );
1568 
1569 /** adds an expression graph node to an expression graph
1570  * expression graph assumes ownership of node
1571  * children are notified about new parent
1572  * depth will be chosen to be the maximum of mindepth and the depth of all children plus one
1573  */
1574 extern
1576  SCIP_EXPRGRAPH* exprgraph, /**< expression graph */
1577  SCIP_EXPRGRAPHNODE* node, /**< expression graph node to add */
1578  int mindepth, /**< minimal depth in expression graph where to add node, e.g., 0 or smaller to choose automatically */
1579  int nchildren, /**< number of children */
1580  SCIP_EXPRGRAPHNODE** children /**< children nodes, or NULL if no children */
1581  );
1582 
1583 /** adds variables to an expression graph, if not existing yet
1584  * also already existing nodes are enabled
1585  */
1586 extern
1588  SCIP_EXPRGRAPH* exprgraph, /**< expression graph */
1589  int nvars, /**< number of variables to add */
1590  void** vars, /**< variables to add */
1591  SCIP_EXPRGRAPHNODE** varnodes /**< array to store nodes corresponding to variables, or NULL if not of interest */
1592  );
1593 
1594 /** adds a constant to an expression graph, if not existing yet
1595  * also already existing nodes are enabled
1596  */
1598  SCIP_EXPRGRAPH* exprgraph, /**< expression graph */
1599  SCIP_Real constant, /**< constant to add */
1600  SCIP_EXPRGRAPHNODE** constnode /**< buffer to store pointer to expression graph node corresponding to constant */
1601  );
1602 
1603 /** adds sum of expression trees into expression graph
1604  * node will also be captured
1605  */
1606 extern
1608  SCIP_EXPRGRAPH* exprgraph, /**< expression graph */
1609  int nexprtrees, /**< number of expression trees to add */
1610  SCIP_EXPRTREE** exprtrees, /**< expression trees that should be added */
1611  SCIP_Real* coefs, /**< coefficients of expression trees, or NULL if all 1.0 */
1612  SCIP_EXPRGRAPHNODE** rootnode, /**< buffer to store expression graph node corresponding to root of expression tree */
1613  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) */
1614  );
1615 
1616 /** replaces variable in expression graph by a linear sum of variables
1617  * variables will be added if not in the graph yet
1618  */
1619 extern
1621  SCIP_EXPRGRAPH* exprgraph, /**< expression graph */
1622  void* var, /**< variable to replace */
1623  int ncoefs, /**< number of coefficients in linear term */
1624  SCIP_Real* coefs, /**< coefficients in linear term, or NULL if ncoefs == 0 */
1625  void** vars, /**< variables in linear term */
1626  SCIP_Real constant /**< constant offset */
1627  );
1628 
1629 /** finds expression graph node corresponding to a variable */
1630 extern
1632  SCIP_EXPRGRAPH* exprgraph, /**< expression graph */
1633  void* var, /**< variable to search for */
1634  SCIP_EXPRGRAPHNODE** varnode /**< buffer to store node corresponding to variable, if found, or NULL if not found */
1635  );
1636 
1637 /** finds expression graph node corresponding to a constant */
1638 extern
1640  SCIP_EXPRGRAPH* exprgraph, /**< expression graph */
1641  SCIP_Real constant, /**< constant to search for */
1642  SCIP_EXPRGRAPHNODE** constnode /**< buffer to store node corresponding to constant, if found, or NULL if not found */
1643  );
1644 
1645 /** prints an expression graph in dot format */
1646 extern
1648  SCIP_EXPRGRAPH* exprgraph, /**< expression graph */
1649  SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
1650  FILE* file, /**< file to print to, or NULL for stdout */
1651  const char** varnames /**< variable names, or NULL for generic names */
1652  );
1653 
1654 /** evaluates nodes of expression graph for given values of variables */
1655 extern
1657  SCIP_EXPRGRAPH* exprgraph, /**< expression graph */
1658  SCIP_Real* varvals /**< values for variables */
1659  );
1660 
1661 /** propagates bound changes in variables forward through the expression graph */
1662 extern
1664  SCIP_EXPRGRAPH* exprgraph, /**< expression graph */
1665  SCIP_Real infinity, /**< value for infinity in interval arithmetics */
1666  SCIP_Bool clearreverseprop, /**< whether to reset bound tightenings from reverse propagation */
1667  SCIP_Bool* domainerror /**< buffer to store whether a node with empty bounds has been found, propagation is interrupted in this case */
1668  );
1669 
1670 /** propagates bound changes in nodes backward through the graph
1671  * new bounds are not stored in varbounds, but only in nodes corresponding to variables
1672  * NOTE: it is assumed that SCIPexprgraphPropagateVarBounds was called before if variable bounds were relaxed
1673  */
1674 extern
1676  SCIP_EXPRGRAPH* exprgraph, /**< expression graph */
1677  SCIP_Real infinity, /**< value for infinity in interval arithmetics */
1678  SCIP_Real minstrength, /**< minimal required relative bound strengthening in a node to trigger a propagation into children nodes */
1679  SCIP_Bool* cutoff /**< buffer to store whether a node's bounds were propagated to an empty interval */
1680  );
1681 
1682 /** updates curvature information in expression graph nodes w.r.t. currently stored variable bounds
1683  * implies update of bounds in expression graph
1684  */
1685 extern
1687  SCIP_EXPRGRAPH* exprgraph, /**< expression graph */
1688  SCIP_Real infinity, /**< value for infinity in interval arithmetics */
1689  SCIP_Bool clearreverseprop /**< whether to reset bound tightenings from reverse propagation */
1690  );
1691 
1692 /** aims at simplifying an expression graph
1693  * 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))
1694  */
1695 extern
1697  SCIP_EXPRGRAPH* exprgraph, /**< expression graph */
1698  SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
1699  SCIP_Real eps, /**< threshold, under which positive values are treat as 0 */
1700  int maxexpansionexponent,/**< maximal exponent for which we still expand non-monomial polynomials */
1701  SCIP_Bool* havechange, /**< buffer to indicate whether the graph has been modified */
1702  SCIP_Bool* domainerror /**< buffer to indicate whether a domain error has been encountered, i.e., some expressions turned into NaN */
1703  );
1704 
1705 /** creates an expression tree from a given node in an expression graph */
1706 extern
1708  SCIP_EXPRGRAPH* exprgraph, /**< expression graph */
1709  SCIP_EXPRGRAPHNODE* rootnode, /**< expression graph node that should represent root of expression tree */
1710  SCIP_EXPRTREE** exprtree /**< buffer to store pointer to created expression tree */
1711  );
1712 
1713 /** creates a sum of expression trees with pairwise disjoint variables from a given node in an expression graph
1714  * Giving SCIPexprgraphGetNodeNChildren() for exprtreesize is always sufficient.
1715  */
1716 extern
1718  SCIP_EXPRGRAPH* exprgraph, /**< expression graph */
1719  SCIP_EXPRGRAPHNODE* node, /**< expression graph node which represents expression to get */
1720  int exprtreessize, /**< length of exprtrees and exprtreecoefs arrays, need to be at least one */
1721  int* nexprtrees, /**< buffer to store number of expression trees */
1722  SCIP_EXPRTREE** exprtrees, /**< array where to store expression trees */
1723  SCIP_Real* exprtreecoefs /**< array where to store coefficients of expression trees */
1724  );
1725 
1726 /** returns how often expression graph variables are used in a subtree of the expression graph */
1727 extern
1729  SCIP_EXPRGRAPH* exprgraph, /**< expression graph */
1730  SCIP_EXPRGRAPHNODE* node, /**< root node of expression graph subtree */
1731  int* varsusage /**< array where to count usage of variables, length must be at least the number of variables in the graph */
1732  );
1733 
1734 /** gives the number of summands which the expression of an expression graph node consists of */
1735 extern
1737  SCIP_EXPRGRAPHNODE* node /**< expression graph node */
1738  );
1739 
1740 /** creates a sum of expression trees, possibly sharing variables, from a given node in an expression graph */
1741 extern
1743  SCIP_EXPRGRAPH* exprgraph, /**< expression graph */
1744  SCIP_EXPRGRAPHNODE* node, /**< expression graph node which represents expression to get */
1745  int exprtreessize, /**< length of exprtrees and exptreecoefs arrays, should be at least SCIPexprgraphGetSumTreesNSummands() */
1746  int* nexprtrees, /**< buffer to store number of expression trees */
1747  SCIP_EXPRTREE** exprtrees, /**< array where to store expression trees */
1748  SCIP_Real* exprtreecoefs /**< array where to store coefficients of expression trees */
1749  );
1750 
1751 /**@} */
1752 
1753 #ifdef __cplusplus
1754 }
1755 #endif
1756 
1757 #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:6246
SCIP_EXPRCURV SCIPexprcurvNegate(SCIP_EXPRCURV curvature)
Definition: expr.c:214
int SCIPexprgraphGetNodeIntPowerExponent(SCIP_EXPRGRAPHNODE *node)
Definition: expr.c:13065
void ** SCIPexprgraphGetVars(SCIP_EXPRGRAPH *exprgraph)
Definition: expr.c:14933
SCIP_RETCODE SCIPexprMultiplyPolynomialByPolynomial(BMS_BLKMEM *blkmem, SCIP_EXPR *expr, SCIP_EXPR *factor, int *childmap)
Definition: expr.c:6739
void SCIPexprgraphDisableNode(SCIP_EXPRGRAPH *exprgraph, SCIP_EXPRGRAPHNODE *node)
Definition: expr.c:14554
SCIP_RETCODE SCIPexprgraphAddConst(SCIP_EXPRGRAPH *exprgraph, SCIP_Real constant, SCIP_EXPRGRAPHNODE **constnode)
Definition: expr.c:15310
SCIP_RETCODE SCIPexprgraphGetNodePolynomialMonomialCurvature(SCIP_EXPRGRAPHNODE *node, int monomialidx, SCIP_Real infinity, SCIP_EXPRCURV *curv)
Definition: expr.c:13197
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:8907
void SCIPquadelemSqueeze(SCIP_QUADELEM *quadelems, int nquadelems, int *nquadelemsnew)
Definition: expr.c:9270
SCIP_RETCODE SCIPexprtreeEval(SCIP_EXPRTREE *tree, SCIP_Real *varvals, SCIP_Real *val)
Definition: expr.c:8723
int SCIPexprgraphGetNodeNParents(SCIP_EXPRGRAPHNODE *node)
Definition: expr.c:12967
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:6584
SCIP_QUADELEM * SCIPexprgraphGetNodeQuadraticQuadElements(SCIP_EXPRGRAPHNODE *node)
Definition: expr.c:13134
int SCIPexprGetNChildren(SCIP_EXPR *expr)
Definition: expr.c:5703
void SCIPexprtreeSetInterpreterData(SCIP_EXPRTREE *tree, SCIP_EXPRINTDATA *interpreterdata)
Definition: expr.c:8667
void SCIPexprFreeMonomial(BMS_BLKMEM *blkmem, SCIP_EXPRDATA_MONOMIAL **monomial)
Definition: expr.c:7092
SCIP_QUADELEM * SCIPexprGetQuadElements(SCIP_EXPR *expr)
Definition: expr.c:5815
#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:5962
int SCIPexprgraphGetNodePolynomialNMonomials(SCIP_EXPRGRAPHNODE *node)
Definition: expr.c:13170
SCIP_Real SCIPexprGetMonomialCoef(SCIP_EXPRDATA_MONOMIAL *monomial)
Definition: expr.c:5900
void SCIPexprtreePrint(SCIP_EXPRTREE *tree, SCIP_MESSAGEHDLR *messagehdlr, FILE *file, const char **varnames, const char **paramnames)
Definition: expr.c:8756
#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:6956
SCIP_Real SCIPexprgraphGetNodeLinearConstant(SCIP_EXPRGRAPHNODE *node)
Definition: expr.c:13098
void SCIPexprgraphSetVarsBounds(SCIP_EXPRGRAPH *exprgraph, SCIP_INTERVAL *varbounds)
Definition: expr.c:14965
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:13564
void SCIPexprChgMonomialCoef(SCIP_EXPRDATA_MONOMIAL *monomial, SCIP_Real newcoef)
Definition: expr.c:6851
SCIP_RETCODE SCIPexprgraphGetSumTrees(SCIP_EXPRGRAPH *exprgraph, SCIP_EXPRGRAPHNODE *node, int exprtreessize, int *nexprtrees, SCIP_EXPRTREE **exprtrees, SCIP_Real *exprtreecoefs)
Definition: expr.c:16745
void SCIPexprPrint(SCIP_EXPR *expr, SCIP_MESSAGEHDLR *messagehdlr, FILE *file, const char **varnames, const char **paramnames, SCIP_Real *paramvals)
Definition: expr.c:8225
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:13440
int SCIPexprgraphGetSumTreesNSummands(SCIP_EXPRGRAPHNODE *node)
Definition: expr.c:16709
SCIP_Bool SCIPexprAreMonomialsEqual(SCIP_EXPRDATA_MONOMIAL *monomial1, SCIP_EXPRDATA_MONOMIAL *monomial2, SCIP_Real eps)
Definition: expr.c:6820
data definitions for expressions and expression trees
int SCIPexprgraphGetNodeQuadraticNQuadElements(SCIP_EXPRGRAPHNODE *node)
Definition: expr.c:13146
SCIP_Real * SCIPexprGetMonomialExponents(SCIP_EXPRDATA_MONOMIAL *monomial)
Definition: expr.c:5930
void SCIPexprReindexVars(SCIP_EXPR *expr, int *newindices)
Definition: expr.c:8183
int SCIPexprtreeGetNVars(SCIP_EXPRTREE *tree)
Definition: expr.c:8612
SCIP_RETCODE SCIPexprgraphFree(SCIP_EXPRGRAPH **exprgraph)
Definition: expr.c:15104
void SCIPexprgraphSetVarNodeUb(SCIP_EXPRGRAPH *exprgraph, SCIP_EXPRGRAPHNODE *varnode, SCIP_Real ub)
Definition: expr.c:15037
SCIP_RETCODE SCIPexprSubstituteVars(BMS_BLKMEM *blkmem, SCIP_EXPR *expr, SCIP_EXPR **substexprs)
Definition: expr.c:8145
SCIP_RETCODE SCIPexprgraphCreateNodePolynomial(BMS_BLKMEM *blkmem, SCIP_EXPRGRAPHNODE **node, int nmonomials, SCIP_EXPRDATA_MONOMIAL **monomials, SCIP_Real constant, SCIP_Bool copymonomials)
Definition: expr.c:13466
SCIP_RETCODE SCIPexprgraphUpdateNodeBoundsCurvature(SCIP_EXPRGRAPHNODE *node, SCIP_Real infinity, SCIP_Real minstrength, SCIP_Bool clearreverseprop)
Definition: expr.c:14742
SCIP_EXPRGRAPHNODE ** SCIPexprgraphGetVarNodes(SCIP_EXPRGRAPH *exprgraph)
Definition: expr.c:14943
void SCIPexprgraphFreeNode(BMS_BLKMEM *blkmem, SCIP_EXPRGRAPHNODE **node)
Definition: expr.c:14502
SCIP_RETCODE SCIPexprgraphGetSeparableTrees(SCIP_EXPRGRAPH *exprgraph, SCIP_EXPRGRAPHNODE *node, int exprtreessize, int *nexprtrees, SCIP_EXPRTREE **exprtrees, SCIP_Real *exprtreecoefs)
Definition: expr.c:16259
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:7907
SCIP_RETCODE SCIPexprAddMonomialFactors(BMS_BLKMEM *blkmem, SCIP_EXPRDATA_MONOMIAL *monomial, int nfactors, int *childidxs, SCIP_Real *exponents)
Definition: expr.c:6862
SCIP_Real SCIPexprGetSignPowerExponent(SCIP_EXPR *expr)
Definition: expr.c:5778
void * SCIPexprgraphGetNodeVar(SCIP_EXPRGRAPH *exprgraph, SCIP_EXPRGRAPHNODE *node)
Definition: expr.c:13039
SCIP_RETCODE SCIPexprCopyDeep(BMS_BLKMEM *blkmem, SCIP_EXPR **targetexpr, SCIP_EXPR *sourceexpr)
Definition: expr.c:6141
#define SCIP_DECL_USEREXPRINTEVAL(x)
Definition: type_expr.h:259
SCIP_EXPRCURV SCIPexprgraphGetNodeCurvature(SCIP_EXPRGRAPHNODE *node)
Definition: expr.c:13321
void * SCIPexprGetOpData(SCIP_EXPR *expr)
Definition: expr.c:5745
SCIP_RETCODE SCIPexprgraphNodePolynomialAddMonomials(BMS_BLKMEM *blkmem, SCIP_EXPRGRAPHNODE *node, int nmonomials, SCIP_EXPRDATA_MONOMIAL **monomials, SCIP_Bool copymonomials)
Definition: expr.c:13491
SCIP_Bool SCIPexprHasParam(SCIP_EXPR *expr)
Definition: expr.c:7213
SCIP_EXPRINTDATA * SCIPexprtreeGetInterpreterData(SCIP_EXPRTREE *tree)
Definition: expr.c:8657
int SCIPexprGetNMonomials(SCIP_EXPR *expr)
Definition: expr.c:5876
SCIP_RETCODE SCIPexprgraphAddExprtreeSum(SCIP_EXPRGRAPH *exprgraph, int nexprtrees, SCIP_EXPRTREE **exprtrees, SCIP_Real *coefs, SCIP_EXPRGRAPHNODE **rootnode, SCIP_Bool *rootnodeisnew)
Definition: expr.c:15357
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:7795
SCIP_Bool SCIPexprgraphAreAllNodeChildrenVars(SCIP_EXPRGRAPHNODE *node)
Definition: expr.c:14611
void SCIPexprgraphSetVarNodeBounds(SCIP_EXPRGRAPH *exprgraph, SCIP_EXPRGRAPHNODE *varnode, SCIP_INTERVAL varbounds)
Definition: expr.c:14997
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:6632
int SCIPexprgraphGetNodeDepth(SCIP_EXPRGRAPHNODE *node)
Definition: expr.c:12987
int SCIPexprGetNQuadElements(SCIP_EXPR *expr)
Definition: expr.c:5852
SCIP_INTERVAL * SCIPexprgraphGetVarsBounds(SCIP_EXPRGRAPH *exprgraph)
Definition: expr.c:15057
SCIP_EXPR ** SCIPexprGetChildren(SCIP_EXPR *expr)
Definition: expr.c:5713
real eps
SCIP_RETCODE SCIPexprtreeGetMaxDegree(SCIP_EXPRTREE *tree, int *maxdegree)
Definition: expr.c:8710
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_RETCODE SCIPexprParse(BMS_BLKMEM *blkmem, SCIP_MESSAGEHDLR *messagehdlr, SCIP_EXPR **expr, const char *str, const char *lastchar, int *nvars, int *varnames, int varnameslength)
Definition: expr.c:8538
SCIP_Bool SCIPexprgraphHasNodeNonlinearAncestor(SCIP_EXPRGRAPHNODE *node)
Definition: expr.c:14627
void SCIPexprSortQuadElems(SCIP_EXPR *expr)
Definition: expr.c:6620
SCIP_EXPRGRAPHNODE ** SCIPexprgraphGetNodeParents(SCIP_EXPRGRAPHNODE *node)
Definition: expr.c:12977
SCIP_RETCODE SCIPexprEvalInt(SCIP_EXPR *expr, SCIP_Real infinity, SCIP_INTERVAL *varvals, SCIP_Real *param, SCIP_INTERVAL *val)
Definition: expr.c:7927
#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:7866
void SCIPexprSortMonomialFactors(SCIP_EXPRDATA_MONOMIAL *monomial)
Definition: expr.c:7116
int * SCIPexprGetMonomialChildIndices(SCIP_EXPRDATA_MONOMIAL *monomial)
Definition: expr.c:5920
SCIP_RETCODE SCIPexprtreeFree(SCIP_EXPRTREE **tree)
Definition: expr.c:8852
SCIP_RETCODE SCIPexprgraphPrintDot(SCIP_EXPRGRAPH *exprgraph, SCIP_MESSAGEHDLR *messagehdlr, FILE *file, const char **varnames)
Definition: expr.c:15746
SCIP_Real SCIPexprGetQuadConstant(SCIP_EXPR *expr)
Definition: expr.c:5827
SCIP_Bool SCIPexprAreEqual(SCIP_EXPR *expr1, SCIP_EXPR *expr2, SCIP_Real eps)
Definition: expr.c:7580
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:8602
SCIP_RETCODE SCIPexprPolynomialPower(BMS_BLKMEM *blkmem, SCIP_EXPR *expr, int exponent)
Definition: expr.c:6785
SCIP_RETCODE SCIPexprAddToLinear(BMS_BLKMEM *blkmem, SCIP_EXPR *expr, int nchildren, SCIP_Real *coefs, SCIP_EXPR **children, SCIP_Real constant)
Definition: expr.c:6539
SCIP_RETCODE SCIPexprtreeFreeInterpreterData(SCIP_EXPRTREE *tree)
Definition: expr.c:8680
SCIP_RETCODE SCIPexprgraphEval(SCIP_EXPRGRAPH *exprgraph, SCIP_Real *varvals)
Definition: expr.c:15795
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:13510
SCIP_RETCODE SCIPexprgraphMoveNodeParents(SCIP_EXPRGRAPH *exprgraph, SCIP_EXPRGRAPHNODE **srcnode, SCIP_EXPRGRAPHNODE *targetnode)
Definition: expr.c:14376
void SCIPexprMergeMonomials(BMS_BLKMEM *blkmem, SCIP_EXPR *expr, SCIP_Real eps, SCIP_Bool mergefactors)
Definition: expr.c:6805
SCIP_Real SCIPexprgraphGetNodeRealPowerExponent(SCIP_EXPRGRAPHNODE *node)
Definition: expr.c:13054
int SCIPexprgraphGetNodePosition(SCIP_EXPRGRAPHNODE *node)
Definition: expr.c:12997
SCIP_RETCODE SCIPexprtreeEvalInt(SCIP_EXPRTREE *tree, SCIP_Real infinity, SCIP_INTERVAL *varvals, SCIP_INTERVAL *val)
Definition: expr.c:8739
SCIP_RETCODE SCIPexprgraphCreateNodeLinear(BMS_BLKMEM *blkmem, SCIP_EXPRGRAPHNODE **node, int ncoefs, SCIP_Real *coefs, SCIP_Real constant)
Definition: expr.c:13414
SCIP_EXPROP SCIPexprgraphGetNodeOperator(SCIP_EXPRGRAPHNODE *node)
Definition: expr.c:13007
SCIP_RETCODE SCIPexprgraphAddNode(SCIP_EXPRGRAPH *exprgraph, SCIP_EXPRGRAPHNODE *node, int mindepth, int nchildren, SCIP_EXPRGRAPHNODE **children)
Definition: expr.c:15153
SCIP_RETCODE SCIPexprEvalUser(SCIP_EXPR *expr, SCIP_Real *argvals, SCIP_Real *val, SCIP_Real *gradient, SCIP_Real *hessian)
Definition: expr.c:7969
SCIP_EXPRDATA_MONOMIAL ** SCIPexprGetMonomials(SCIP_EXPR *expr)
Definition: expr.c:5864
void SCIPexprgraphEnableNode(SCIP_EXPRGRAPH *exprgraph, SCIP_EXPRGRAPHNODE *node)
Definition: expr.c:14527
void SCIPexprMultiplyPolynomialByConstant(BMS_BLKMEM *blkmem, SCIP_EXPR *expr, SCIP_Real factor)
Definition: expr.c:6702
SCIP_RETCODE SCIPexprgraphCheckCurvature(SCIP_EXPRGRAPH *exprgraph, SCIP_Real infinity, SCIP_Bool clearreverseprop)
Definition: expr.c:15902
SCIP_RETCODE SCIPexprEvalShallow(SCIP_EXPR *expr, SCIP_Real *argvals, SCIP_Real *varvals, SCIP_Real *param, SCIP_Real *val)
Definition: expr.c:7847
#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:6689
SCIP_RETCODE SCIPexprGetMaxDegree(SCIP_EXPR *expr, int *maxdegree)
Definition: expr.c:7232
SCIP_Real SCIPexprGetOpReal(SCIP_EXPR *expr)
Definition: expr.c:5734
SCIP_Bool SCIPexprtreeHasParam(SCIP_EXPRTREE *tree)
Definition: expr.c:8694
void SCIPexprFreeShallow(BMS_BLKMEM *blkmem, SCIP_EXPR **expr)
Definition: expr.c:6221
SCIP_RETCODE SCIPexprEvalIntUser(SCIP_EXPR *expr, SCIP_Real infinity, SCIP_INTERVAL *argvals, SCIP_INTERVAL *val, SCIP_INTERVAL *gradient, SCIP_INTERVAL *hessian)
Definition: expr.c:7992
int SCIPexprgraphGetNVars(SCIP_EXPRGRAPH *exprgraph)
Definition: expr.c:14923
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:7153
#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:5756
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:8107
int SCIPexprGetMonomialNFactors(SCIP_EXPRDATA_MONOMIAL *monomial)
Definition: expr.c:5910
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:9218
void SCIPexprFreeDeep(BMS_BLKMEM *blkmem, SCIP_EXPR **expr)
Definition: expr.c:6183
SCIP_EXPRCURV SCIPexprcurvAdd(SCIP_EXPRCURV curv1, SCIP_EXPRCURV curv2)
Definition: expr.c:205
int SCIPexprGetOpIndex(SCIP_EXPR *expr)
Definition: expr.c:5723
int SCIPexprgraphGetNodeOperatorIndex(SCIP_EXPRGRAPHNODE *node)
Definition: expr.c:13017
SCIP_RETCODE SCIPexprMultiplyMonomialByMonomial(BMS_BLKMEM *blkmem, SCIP_EXPRDATA_MONOMIAL *monomial, SCIP_EXPRDATA_MONOMIAL *factor, int *childmap)
Definition: expr.c:6891
SCIP_RETCODE SCIPexprtreeSubstituteVars(SCIP_EXPRTREE *tree, SCIP_EXPR **substexprs)
Definition: expr.c:9029
void SCIPexprgraphTightenNodeBounds(SCIP_EXPRGRAPH *exprgraph, SCIP_EXPRGRAPHNODE *node, SCIP_INTERVAL nodebounds, SCIP_Real minstrength, SCIP_Real infinity, SCIP_Bool *cutoff)
Definition: expr.c:14680
SCIP_Real SCIPexprGetPolynomialConstant(SCIP_EXPR *expr)
Definition: expr.c:5888
SCIP_USEREXPRDATA * SCIPexprGetUserData(SCIP_EXPR *expr)
Definition: expr.c:5940
SCIP_Bool SCIPexprHasUserEstimator(SCIP_EXPR *expr)
Definition: expr.c:5951
void SCIPexprgraphSetVarBounds(SCIP_EXPRGRAPH *exprgraph, void *var, SCIP_INTERVAL varbounds)
Definition: expr.c:14977
SCIP_Real * SCIPexprtreeGetParamVals(SCIP_EXPRTREE *tree)
Definition: expr.c:8632
int * SCIPexprgraphGetNNodes(SCIP_EXPRGRAPH *exprgraph)
Definition: expr.c:14903
SCIP_RETCODE SCIPexprgraphReleaseNode(SCIP_EXPRGRAPH *exprgraph, SCIP_EXPRGRAPHNODE **node)
Definition: expr.c:14408
SCIP_Real SCIPexprgraphGetNodeSignPowerExponent(SCIP_EXPRGRAPHNODE *node)
Definition: expr.c:13076
SCIP_RETCODE SCIPexprgraphSimplify(SCIP_EXPRGRAPH *exprgraph, SCIP_MESSAGEHDLR *messagehdlr, SCIP_Real eps, int maxexpansionexponent, SCIP_Bool *havechange, SCIP_Bool *domainerror)
Definition: expr.c:15945
SCIP_RETCODE SCIPexprMultiplyPolynomialByMonomial(BMS_BLKMEM *blkmem, SCIP_EXPR *expr, SCIP_EXPRDATA_MONOMIAL *factor, int *childmap)
Definition: expr.c:6716
SCIP_RETCODE SCIPexprgraphGetTree(SCIP_EXPRGRAPH *exprgraph, SCIP_EXPRGRAPHNODE *rootnode, SCIP_EXPRTREE **exprtree)
Definition: expr.c:16206
void SCIPexprgraphSetVarNodeValue(SCIP_EXPRGRAPHNODE *varnode, SCIP_Real value)
Definition: expr.c:14953
SCIP_RETCODE SCIPexprtreeCheckCurvature(SCIP_EXPRTREE *tree, SCIP_Real infinity, SCIP_INTERVAL *varbounds, SCIP_EXPRCURV *curv, SCIP_INTERVAL *bounds)
Definition: expr.c:9003
SCIP_RETCODE SCIPexprtreeCopy(BMS_BLKMEM *blkmem, SCIP_EXPRTREE **targettree, SCIP_EXPRTREE *sourcetree)
Definition: expr.c:8812
const char * SCIPexprcurvGetName(SCIP_EXPRCURV curv)
Definition: expr.c:474
int SCIPexprgraphGetNodeNChildren(SCIP_EXPRGRAPHNODE *node)
Definition: expr.c:12947
SCIP_Real * SCIPexprgraphGetNodeLinearCoefs(SCIP_EXPRGRAPHNODE *node)
Definition: expr.c:13087
#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:5973
SCIP_RETCODE SCIPexprgraphPropagateVarBounds(SCIP_EXPRGRAPH *exprgraph, SCIP_Real infinity, SCIP_Bool clearreverseprop, SCIP_Bool *domainerror)
Definition: expr.c:15816
enum SCIP_ExprCurv SCIP_EXPRCURV
Definition: type_expr.h:93
SCIP_Bool SCIPexprgraphHasNodeSibling(SCIP_EXPRGRAPHNODE *node)
Definition: expr.c:14592
SCIP_Bool SCIPexprgraphHasNodeUserEstimator(SCIP_EXPRGRAPHNODE *node)
Definition: expr.c:13289
void SCIPexprgraphSetVarNodeLb(SCIP_EXPRGRAPH *exprgraph, SCIP_EXPRGRAPHNODE *varnode, SCIP_Real lb)
Definition: expr.c:15017
SCIP_RETCODE SCIPexprAddMonomials(BMS_BLKMEM *blkmem, SCIP_EXPR *expr, int nmonomials, SCIP_EXPRDATA_MONOMIAL **monomials, SCIP_Bool copymonomials)
Definition: expr.c:6667
SCIP_USEREXPRDATA * SCIPexprgraphGetNodeUserData(SCIP_EXPRGRAPHNODE *node)
Definition: expr.c:13277
int SCIPexprtreeGetNParams(SCIP_EXPRTREE *tree)
Definition: expr.c:8622
SCIP_Bool SCIPexprgraphFindVarNode(SCIP_EXPRGRAPH *exprgraph, void *var, SCIP_EXPRGRAPHNODE **varnode)
Definition: expr.c:15669
int SCIPexprgraphGetDepth(SCIP_EXPRGRAPH *exprgraph)
Definition: expr.c:14893
SCIP_RETCODE SCIPexprtreeSimplify(SCIP_EXPRTREE *tree, SCIP_MESSAGEHDLR *messagehdlr, SCIP_Real eps, int maxexpansionexponent, int *nlinvars, int *linidxs, SCIP_Real *lincoefs)
Definition: expr.c:8926
SCIP_Real SCIPexprgraphGetNodeOperatorReal(SCIP_EXPRGRAPHNODE *node)
Definition: expr.c:13028
SCIP_Real SCIPexprgraphGetNodePolynomialConstant(SCIP_EXPRGRAPHNODE *node)
Definition: expr.c:13182
void SCIPexprgraphCaptureNode(SCIP_EXPRGRAPHNODE *node)
Definition: expr.c:12925
SCIP_Bool SCIPexprgraphFindConstNode(SCIP_EXPRGRAPH *exprgraph, SCIP_Real constant, SCIP_EXPRGRAPHNODE **constnode)
Definition: expr.c:15698
SCIP_RETCODE SCIPexprMulConstant(BMS_BLKMEM *blkmem, SCIP_EXPR **expr, SCIP_EXPR *term, SCIP_Real factor)
Definition: expr.c:6404
type definitions for expressions and expression trees
void SCIPexprgraphPrintNode(SCIP_EXPRGRAPHNODE *node, SCIP_MESSAGEHDLR *messagehdlr, FILE *file)
Definition: expr.c:14664
public methods for message output
void SCIPquadelemSort(SCIP_QUADELEM *quadelems, int nquadelems)
Definition: expr.c:9193
SCIP_RETCODE SCIPexprgraphCreateNode(BMS_BLKMEM *blkmem, SCIP_EXPRGRAPHNODE **node, SCIP_EXPROP op,...)
Definition: expr.c:13331
void SCIPexprReindexParams(SCIP_EXPR *expr, int *newindices)
Definition: expr.c:8204
SCIP_EXPROP SCIPexprGetOperator(SCIP_EXPR *expr)
Definition: expr.c:5693
#define SCIP_DECL_USEREXPRCOPYDATA(x)
Definition: type_expr.h:291
#define SCIP_Real
Definition: def.h:149
int SCIPexprGetIntPowerExponent(SCIP_EXPR *expr)
Definition: expr.c:5767
SCIP_RETCODE SCIPexprgraphReplaceVarByLinearSum(SCIP_EXPRGRAPH *exprgraph, void *var, int ncoefs, SCIP_Real *coefs, void **vars, SCIP_Real constant)
Definition: expr.c:15497
void SCIPexprGetVarsUsage(SCIP_EXPR *expr, int *varsusage)
Definition: expr.c:7557
void SCIPexprgraphPropagateNodeBounds(SCIP_EXPRGRAPH *exprgraph, SCIP_Real infinity, SCIP_Real minstrength, SCIP_Bool *cutoff)
Definition: expr.c:15870
SCIP_Real SCIPexprGetLinearConstant(SCIP_EXPR *expr)
Definition: expr.c:5802
SCIP_EXPRGRAPHNODE *** SCIPexprgraphGetNodes(SCIP_EXPRGRAPH *exprgraph)
Definition: expr.c:14913
SCIP_RETCODE SCIPexprtreeCreate(BMS_BLKMEM *blkmem, SCIP_EXPRTREE **tree, SCIP_EXPR *root, int nvars, int nparams, SCIP_Real *params)
Definition: expr.c:8771
void SCIPexprMonomialPower(SCIP_EXPRDATA_MONOMIAL *monomial, int exponent)
Definition: expr.c:6926
SCIP_EXPRDATA_MONOMIAL ** SCIPexprgraphGetNodePolynomialMonomials(SCIP_EXPRGRAPHNODE *node)
Definition: expr.c:13158
SCIP_EXPRGRAPHNODE ** SCIPexprgraphGetNodeChildren(SCIP_EXPRGRAPHNODE *node)
Definition: expr.c:12957
void SCIPexprtreeSetParamVal(SCIP_EXPRTREE *tree, int paramidx, SCIP_Real paramval)
Definition: expr.c:8642
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:7035
SCIP_Real * SCIPexprGetLinearCoefs(SCIP_EXPR *expr)
Definition: expr.c:5789
SCIP_Bool SCIPexprFindMonomialFactor(SCIP_EXPRDATA_MONOMIAL *monomial, int childidx, int *pos)
Definition: expr.c:7136
SCIP_Real * SCIPexprgraphGetNodeQuadraticLinearCoefs(SCIP_EXPRGRAPHNODE *node)
Definition: expr.c:13122
SCIP_RETCODE SCIPexprtreeAddExpr(SCIP_EXPRTREE *tree, SCIP_EXPR *expr, SCIP_Bool copyexpr)
Definition: expr.c:8980
SCIP_Real SCIPexprgraphGetNodeQuadraticConstant(SCIP_EXPRGRAPHNODE *node)
Definition: expr.c:13110
common defines and data types used in all packages of SCIP
struct BMS_BlkMem BMS_BLKMEM
Definition: memory.h:419
SCIP_RETCODE SCIPexprCheckCurvature(SCIP_EXPR *expr, SCIP_Real infinity, SCIP_INTERVAL *varbounds, SCIP_Real *param, SCIP_EXPRCURV *curv, SCIP_INTERVAL *bounds)
Definition: expr.c:8062
void SCIPexprgraphGetSubtreeVarsUsage(SCIP_EXPRGRAPH *exprgraph, SCIP_EXPRGRAPHNODE *node, int *varsusage)
Definition: expr.c:16693
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:6502
SCIP_Real SCIPexprgraphGetNodeVal(SCIP_EXPRGRAPHNODE *node)
Definition: expr.c:13311
#define SCIP_DECL_USEREXPRFREEDATA(x)
Definition: type_expr.h:299
SCIP_RETCODE SCIPexprtreeSetParams(SCIP_EXPRTREE *tree, int nparams, SCIP_Real *paramvals)
Definition: expr.c:8876
SCIP_RETCODE SCIPexprgraphAddVars(SCIP_EXPRGRAPH *exprgraph, int nvars, void **vars, SCIP_EXPRGRAPHNODE **varnodes)
Definition: expr.c:15237
SCIP_Bool SCIPexprgraphIsNodeEnabled(SCIP_EXPRGRAPHNODE *node)
Definition: expr.c:12937
void SCIPexprSortMonomials(SCIP_EXPR *expr)
Definition: expr.c:7023
SCIP_Real * SCIPexprGetQuadLinearCoefs(SCIP_EXPR *expr)
Definition: expr.c:5840
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:15065
#define SCIP_DECL_EXPRGRAPHVARCHGIDX(x)
Definition: type_expr.h:203
SCIP_INTERVAL SCIPexprgraphGetNodeBounds(SCIP_EXPRGRAPHNODE *node)
Definition: expr.c:13301
memory allocation routines