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-2022 Konrad-Zuse-Zentrum */
7 /* fuer Informationstechnik Berlin */
8 /* */
9 /* SCIP is distributed under the terms of the ZIB Academic License. */
10 /* */
11 /* You should have received a copy of the ZIB Academic License */
12 /* along with SCIP; see the file COPYING. If not visit scip.zib.de. */
13 /* */
14 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
15 
16 /**@file pub_expr.h
17  * @ingroup PUBLICCOREAPI
18  * @brief public functions to work with algebraic expressions
19  * @author Ksenia Bestuzheva
20  * @author Benjamin Mueller
21  * @author Felipe Serrano
22  * @author Stefan Vigerske
23  */
24 
25 #ifndef SCIP_PUB_EXPR_H_
26 #define SCIP_PUB_EXPR_H_
27 
28 #include "scip/def.h"
29 #include "scip/type_expr.h"
30 #include "scip/type_misc.h"
31 
32 #ifdef NDEBUG
33 #include "scip/struct_expr.h"
34 #endif
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 
40 /**@addtogroup PublicExprHandlerMethods
41  * @{
42  */
43 
44 /** set the expression handler callbacks to copy and free an expression handler */
45 SCIP_EXPORT
47  SCIP_EXPRHDLR* exprhdlr, /**< expression handler */
48  SCIP_DECL_EXPRCOPYHDLR((*copyhdlr)), /**< handler copy callback (can be NULL) */
49  SCIP_DECL_EXPRFREEHDLR((*freehdlr)) /**< handler free callback (can be NULL) */
50 );
51 
52 /** set the expression handler callbacks to copy and free expression data */
53 SCIP_EXPORT
55  SCIP_EXPRHDLR* exprhdlr, /**< expression handler */
56  SCIP_DECL_EXPRCOPYDATA((*copydata)), /**< expression data copy callback (can be NULL for expressions without data) */
57  SCIP_DECL_EXPRFREEDATA((*freedata)) /**< expression data free callback (can be NULL if data does not need to be freed) */
58 );
59 
60 /** set the print callback of an expression handler */
61 SCIP_EXPORT
63  SCIP_EXPRHDLR* exprhdlr, /**< expression handler */
64  SCIP_DECL_EXPRPRINT((*print)) /**< print callback (can be NULL) */
65 );
66 
67 /** set the parse callback of an expression handler */
68 SCIP_EXPORT
70  SCIP_EXPRHDLR* exprhdlr, /**< expression handler */
71  SCIP_DECL_EXPRPARSE((*parse)) /**< parse callback (can be NULL) */
72 );
73 
74 /** set the curvature detection callback of an expression handler */
75 SCIP_EXPORT
77  SCIP_EXPRHDLR* exprhdlr, /**< expression handler */
78  SCIP_DECL_EXPRCURVATURE((*curvature)) /**< curvature detection callback (can be NULL) */
79 );
80 
81 /** set the monotonicity detection callback of an expression handler */
82 SCIP_EXPORT
84  SCIP_EXPRHDLR* exprhdlr, /**< expression handler */
85  SCIP_DECL_EXPRMONOTONICITY((*monotonicity)) /**< monotonicity detection callback (can be NULL) */
86 );
87 
88 /** set the integrality detection callback of an expression handler */
89 SCIP_EXPORT
91  SCIP_EXPRHDLR* exprhdlr, /**< expression handler */
92  SCIP_DECL_EXPRINTEGRALITY((*integrality)) /**< integrality detection callback (can be NULL) */
93 );
94 
95 /** set the hash callback of an expression handler */
96 SCIP_EXPORT
98  SCIP_EXPRHDLR* exprhdlr, /**< expression handler */
99  SCIP_DECL_EXPRHASH((*hash)) /**< hash callback (can be NULL) */
100 );
101 
102 /** set the compare callback of an expression handler */
103 SCIP_EXPORT
105  SCIP_EXPRHDLR* exprhdlr, /**< expression handler */
106  SCIP_DECL_EXPRCOMPARE((*compare)) /**< compare callback (can be NULL) */
107 );
108 
109 /** set differentiation callbacks of an expression handler */
110 SCIP_EXPORT
112  SCIP_EXPRHDLR* exprhdlr, /**< expression handler */
113  SCIP_DECL_EXPRBWDIFF((*bwdiff)), /**< backward derivative evaluation callback (can be NULL) */
114  SCIP_DECL_EXPRFWDIFF((*fwdiff)), /**< forward derivative evaluation callback (can be NULL) */
115  SCIP_DECL_EXPRBWFWDIFF((*bwfwdiff)) /**< backward-forward derivative evaluation callback (can be NULL) */
116 );
117 
118 /** set the interval evaluation callback of an expression handler */
119 SCIP_EXPORT
121  SCIP_EXPRHDLR* exprhdlr, /**< expression handler */
122  SCIP_DECL_EXPRINTEVAL((*inteval)) /**< interval evaluation callback (can be NULL) */
123 );
124 
125 /** set the simplify callback of an expression handler */
126 SCIP_EXPORT
128  SCIP_EXPRHDLR* exprhdlr, /**< expression handler */
129  SCIP_DECL_EXPRSIMPLIFY((*simplify)) /**< simplify callback (can be NULL) */
130 );
131 
132 /** set the reverse propagation callback of an expression handler */
133 SCIP_EXPORT
135  SCIP_EXPRHDLR* exprhdlr, /**< expression handler */
136  SCIP_DECL_EXPRREVERSEPROP((*reverseprop)) /**< reverse propagation callback (can be NULL) */
137 );
138 
139 /** set the estimation callbacks of an expression handler */
140 SCIP_EXPORT
142  SCIP_EXPRHDLR* exprhdlr, /**< expression handler */
143  SCIP_DECL_EXPRINITESTIMATES((*initestimates)), /**< initial estimators callback (can be NULL) */
144  SCIP_DECL_EXPRESTIMATE((*estimate)) /**< estimator callback (can be NULL) */
145 );
146 
147 /** gives the name of an expression handler */
148 SCIP_EXPORT
149 const char* SCIPexprhdlrGetName(
150  SCIP_EXPRHDLR* exprhdlr /**< expression handler */
151 );
152 
153 /** gives the description of an expression handler (can be NULL) */
154 SCIP_EXPORT
155 const char* SCIPexprhdlrGetDescription(
156  SCIP_EXPRHDLR* exprhdlr /**< expression handler */
157 );
158 
159 /** gives the precedence of an expression handler */
160 SCIP_EXPORT
161 unsigned int SCIPexprhdlrGetPrecedence(
162  SCIP_EXPRHDLR* exprhdlr /**< expression handler */
163 );
164 
165 /** gives the data of an expression handler */
166 SCIP_EXPORT
168  SCIP_EXPRHDLR* exprhdlr /**< expression handler */
169 );
170 
171 /** returns whether expression handler implements the print callback */
172 SCIP_EXPORT
174  SCIP_EXPRHDLR* exprhdlr /**< expression handler */
175  );
176 
177 /** returns whether expression handler implements the backward differentiation callback */
178 SCIP_EXPORT
180  SCIP_EXPRHDLR* exprhdlr /**< expression handler */
181  );
182 
183 /** returns whether expression handler implements the forward differentiation callback */
184 SCIP_EXPORT
186  SCIP_EXPRHDLR* exprhdlr /**< expression handler */
187  );
188 
189 /** returns whether expression handler implements the interval evaluation callback */
190 SCIP_EXPORT
192  SCIP_EXPRHDLR* exprhdlr /**< expression handler */
193  );
194 
195 /** returns whether expression handler implements the estimator callback */
196 SCIP_EXPORT
198  SCIP_EXPRHDLR* exprhdlr /**< expression handler */
199  );
200 
201 /** returns whether expression handler implements the initial estimators callback */
202 SCIP_EXPORT
204  SCIP_EXPRHDLR* exprhdlr /**< expression handler */
205  );
206 
207 /** returns whether expression handler implements the simplification callback */
208 SCIP_EXPORT
210  SCIP_EXPRHDLR* exprhdlr /**< expression handler */
211  );
212 
213 /** returns whether expression handler implements the curvature callback */
214 SCIP_EXPORT
216  SCIP_EXPRHDLR* exprhdlr /**< expression handler */
217  );
218 
219 /** returns whether expression handler implements the monotonicity callback */
220 SCIP_EXPORT
222  SCIP_EXPRHDLR* exprhdlr /**< expression handler */
223  );
224 
225 /** returns whether expression handler implements the reverse propagation callback */
226 SCIP_EXPORT
228  SCIP_EXPRHDLR* exprhdlr /**< expression handler */
229  );
230 
231 /** compares two expression handler w.r.t. their name */
232 SCIP_EXPORT
233 SCIP_DECL_SORTPTRCOMP(SCIPexprhdlrComp);
234 
235 /**@name Expression Handler Statistics */
236 /**@{ */
237 
238 /** gets number of times an expression has been created with given expression handler */
239 SCIP_EXPORT
240 unsigned int SCIPexprhdlrGetNCreated(
241  SCIP_EXPRHDLR* exprhdlr /**< expression handler */
242  );
243 
244 /** gets number of times the interval evaluation callback was called */
245 SCIP_EXPORT
247  SCIP_EXPRHDLR* exprhdlr /**< expression handler */
248  );
249 
250 /** gets time spend in interval evaluation callback */
251 SCIP_EXPORT
253  SCIP_EXPRHDLR* exprhdlr /**< expression handler */
254  );
255 
256 /** gets number of times the reverse propagation callback was called */
257 SCIP_EXPORT
259  SCIP_EXPRHDLR* exprhdlr /**< expression handler */
260  );
261 
262 /** gets time spend in reverse propagation callback */
263 SCIP_EXPORT
265  SCIP_EXPRHDLR* exprhdlr /**< expression handler */
266  );
267 
268 /** gets number of times an empty interval was found in reverse propagation */
269 SCIP_EXPORT
271  SCIP_EXPRHDLR* exprhdlr /**< expression handler */
272  );
273 
274 /** gets number of times a bound reduction was found in reverse propagation (and accepted by caller) */
275 SCIP_EXPORT
277  SCIP_EXPRHDLR* exprhdlr /**< expression handler */
278  );
279 
280 /** increments the domain reductions count of an expression handler */
281 SCIP_EXPORT
283  SCIP_EXPRHDLR* exprhdlr, /**< expression handler */
284  int nreductions /**< number of reductions to add to counter */
285  );
286 
287 /** gets number of times the estimation callback was called */
288 SCIP_EXPORT
290  SCIP_EXPRHDLR* exprhdlr /**< expression handler */
291  );
292 
293 /** gets time spend in estimation callback */
294 SCIP_EXPORT
296  SCIP_EXPRHDLR* exprhdlr /**< expression handler */
297  );
298 
299 /** gets number of times branching candidates reported by of this expression handler were used to assemble branching candidates
300  *
301  * that is, how often did we consider branching on a child of this expression
302  */
303 SCIP_EXPORT
305  SCIP_EXPRHDLR* exprhdlr /**< expression handler */
306  );
307 
308 /** increments the branching candidates count of an expression handler */
309 SCIP_EXPORT
311  SCIP_EXPRHDLR* exprhdlr /**< expression handler */
312  );
313 
314 /** gets number of times the simplify callback was called */
315 SCIP_EXPORT
317  SCIP_EXPRHDLR* exprhdlr /**< expression handler */
318  );
319 
320 /** gets time spend in simplify callback */
321 SCIP_EXPORT
323  SCIP_EXPRHDLR* exprhdlr /**< expression handler */
324  );
325 
326 /** gets number of times the simplify callback found a simplification */
327 SCIP_EXPORT
329  SCIP_EXPRHDLR* exprhdlr /**< expression handler */
330  );
331 
332 /** @} */ /* expression handler statistics */
333 
334 #ifdef NDEBUG
335 
336 /* If NDEBUG is defined, the function calls are overwritten by defines to reduce the number of function calls and
337  * speed up the algorithms.
338  */
339 
340 #define SCIPexprhdlrSetCopyFreeHdlr(exprhdlr, copyhdlr_, freehdlr_) do { (exprhdlr)->copyhdlr = copyhdlr_; (exprhdlr)->freehdlr = freehdlr_; } while (FALSE)
341 #define SCIPexprhdlrSetCopyFreeData(exprhdlr, copydata_, freedata_) do { (exprhdlr)->copydata = copydata_; (exprhdlr)->freedata = freedata_; } while (FALSE)
342 #define SCIPexprhdlrSetPrint(exprhdlr, print_) (exprhdlr)->print = print_
343 #define SCIPexprhdlrSetParse(exprhdlr, parse_) (exprhdlr)->parse = parse_
344 #define SCIPexprhdlrSetCurvature(exprhdlr, curvature_) (exprhdlr)->curvature = curvature_
345 #define SCIPexprhdlrSetMonotonicity(exprhdlr, monotonicity_) (exprhdlr)->monotonicity = monotonicity_
346 #define SCIPexprhdlrSetIntegrality(exprhdlr, integrality_) (exprhdlr)->integrality = integrality_
347 #define SCIPexprhdlrSetHash(exprhdlr, hash_) (exprhdlr)->hash = hash_
348 #define SCIPexprhdlrSetCompare(exprhdlr, compare_) (exprhdlr)->compare = compare_
349 #define SCIPexprhdlrSetDiff(exprhdlr, bwdiff_, fwdiff_, bwfwdiff_) do { (exprhdlr)->bwdiff = bwdiff_; (exprhdlr)->fwdiff = fwdiff_; (exprhdlr)->bwfwdiff = bwfwdiff_; } while (FALSE)
350 #define SCIPexprhdlrSetIntEval(exprhdlr, inteval_) (exprhdlr)->inteval = inteval_
351 #define SCIPexprhdlrSetSimplify(exprhdlr, simplify_) (exprhdlr)->simplify = simplify_
352 #define SCIPexprhdlrSetReverseProp(exprhdlr, reverseprop_) (exprhdlr)->reverseprop = reverseprop_
353 #define SCIPexprhdlrSetEstimate(exprhdlr, initestimates_, estimate_) do { (exprhdlr)->initestimates = initestimates_; (exprhdlr)->estimate = estimate_; } while (FALSE)
354 #define SCIPexprhdlrGetName(exprhdlr) (exprhdlr)->name
355 #define SCIPexprhdlrGetDescription(exprhdlr) (exprhdlr)->desc
356 #define SCIPexprhdlrGetPrecedence(exprhdlr) (exprhdlr)->precedence
357 #define SCIPexprhdlrGetData(exprhdlr) (exprhdlr)->data
358 #define SCIPexprhdlrHasPrint(exprhdlr) ((exprhdlr)->print != NULL)
359 #define SCIPexprhdlrHasBwdiff(exprhdlr) ((exprhdlr)->bwdiff != NULL)
360 #define SCIPexprhdlrHasFwdiff(exprhdlr) ((exprhdlr)->fwdiff != NULL)
361 #define SCIPexprhdlrHasIntEval(exprhdlr) ((exprhdlr)->inteval != NULL)
362 #define SCIPexprhdlrHasEstimate(exprhdlr) ((exprhdlr)->estimate != NULL)
363 #define SCIPexprhdlrHasInitEstimates(exprhdlr) ((exprhdlr)->initestimates != NULL)
364 #define SCIPexprhdlrHasSimplify(exprhdlr) ((exprhdlr)->simplify != NULL)
365 #define SCIPexprhdlrHasCurvature(exprhdlr) ((exprhdlr)->curvature != NULL)
366 #define SCIPexprhdlrHasMonotonicity(exprhdlr) ((exprhdlr)->monotonicity != NULL)
367 #define SCIPexprhdlrHasReverseProp(exprhdlr) ((exprhdlr)->reverseprop != NULL)
368 #define SCIPexprhdlrGetNCreated(exprhdlr) (exprhdlr)->ncreated
369 #define SCIPexprhdlrGetNIntevalCalls(exprhdlr) (exprhdlr)->nintevalcalls
370 #define SCIPexprhdlrGetIntevalTime(exprhdlr) SCIPclockGetTime((exprhdlr)->intevaltime)
371 #define SCIPexprhdlrGetNReversepropCalls(exprhdlr) (exprhdlr)->npropcalls
372 #define SCIPexprhdlrGetReversepropTime(exprhdlr) SCIPclockGetTime((exprhdlr)->proptime)
373 #define SCIPexprhdlrGetNCutoffs(exprhdlr) (exprhdlr)->ncutoffs
374 #define SCIPexprhdlrGetNDomainReductions(exprhdlr) (exprhdlr)->ndomreds
375 #define SCIPexprhdlrIncrementNDomainReductions(exprhdlr, nreductions) (exprhdlr)->ndomreds += nreductions
376 #define SCIPexprhdlrGetNEstimateCalls(exprhdlr) (exprhdlr)->nestimatecalls
377 #define SCIPexprhdlrGetEstimateTime(exprhdlr) SCIPclockGetTime((exprhdlr)->estimatetime)
378 #define SCIPexprhdlrGetNBranchings(exprhdlr) (exprhdlr)->nbranchscores
379 #define SCIPexprhdlrIncrementNBranchings(exprhdlr) ++(exprhdlr)->nbranchscores
380 #define SCIPexprhdlrGetNSimplifyCalls(exprhdlr) (exprhdlr)->nsimplifycalls
381 #define SCIPexprhdlrGetSimplifyTime(exprhdlr) SCIPclockGetTime((exprhdlr)->simplifytime)
382 #define SCIPexprhdlrGetNSimplifications(exprhdlr) (exprhdlr)->nsimplified
383 #endif
384 
385 
386 /** @} */ /* expression handler methods */
387 
388 /**@defgroup PublicExprMethods Expressions
389  * @ingroup DataStructures
390  * @brief an algebraic expression used for nonlinear constraints and NLPs
391  *
392  *@{
393  */
394 
395 /**@name Expressions */
396 /**@{ */
397 
398 /** gets the number of times the expression is currently captured */
399 SCIP_EXPORT
400 int SCIPexprGetNUses(
401  SCIP_EXPR* expr /**< expression */
402  );
403 
404 /** gives the number of children of an expression */
405 SCIP_EXPORT
407  SCIP_EXPR* expr /**< expression */
408  );
409 
410 /** gives the children of an expression (can be NULL if no children) */
411 SCIP_EXPORT
413  SCIP_EXPR* expr /**< expression */
414  );
415 
416 /** gets the expression handler of an expression
417  *
418  * This identifies the type of the expression (sum, variable, ...).
419  */
420 SCIP_EXPORT
422  SCIP_EXPR* expr /**< expression */
423  );
424 
425 /** gets the expression data of an expression */
426 SCIP_EXPORT
428  SCIP_EXPR* expr /**< expression */
429  );
430 
431 /** sets the expression data of an expression
432  *
433  * The pointer to possible old data is overwritten and the
434  * freedata-callback is not called before.
435  * This function is intended to be used by expression handler only.
436  */
437 SCIP_EXPORT
438 void SCIPexprSetData(
439  SCIP_EXPR* expr, /**< expression */
440  SCIP_EXPRDATA* exprdata /**< expression data to be set (can be NULL) */
441  );
442 
443 /** gets the data that the owner of an expression has stored in an expression */
444 SCIP_EXPORT
446  SCIP_EXPR* expr /**< expression */
447  );
448 
449 /** gives the value from the last evaluation of an expression (or SCIP_INVALID if there was an eval error)
450  *
451  * @see SCIPevalExpr
452  */
453 SCIP_EXPORT
455  SCIP_EXPR* expr /**< expression */
456  );
457 
458 /** gives the evaluation tag from the last evaluation, or 0
459  *
460  * @see SCIPevalExpr
461  */
462 SCIP_EXPORT
464  SCIP_EXPR* expr /**< expression */
465  );
466 
467 /** returns the derivative stored in an expression (or SCIP_INVALID if there was an evaluation error)
468  *
469  * @see SCIPevalExprGradient
470  */
471 SCIP_EXPORT
473  SCIP_EXPR* expr /**< expression */
474  );
475 
476 /** gives the value of directional derivative from the last evaluation of a directional derivative of expression
477  * (or SCIP_INVALID if there was an error)
478  *
479  * @see SCIPevalExprHessianDir
480  */
481 SCIP_EXPORT
483  SCIP_EXPR* expr /**< expression */
484  );
485 
486 /** gives the value of directional derivative from the last evaluation of a directional derivative of derivative
487  * of root (or SCIP_INVALID if there was an error)
488  *
489  * @see SCIPevalExprHessianDir
490  */
491 SCIP_EXPORT
493  SCIP_EXPR* expr /**< expression */
494  );
495 
496 /** returns the difftag stored in an expression
497  *
498  * can be used to check whether partial derivative value is valid
499  *
500  * @see SCIPevalExprGradient
501  */
502 SCIP_EXPORT
504  SCIP_EXPR* expr /**< expression */
505  );
506 
507 /** returns the activity that is currently stored for an expression
508  *
509  * @see SCIPevalExprActivity
510  */
511 SCIP_EXPORT
513  SCIP_EXPR* expr /**< expression */
514  );
515 
516 /** returns the tag associated with the activity of the expression
517  *
518  * It can depend on the owner of the expression how to interpret this tag.
519  * SCIPevalExprActivity() compares with `stat->domchgcount`.
520  *
521  * @see SCIPevalExprActivity
522  */
523 SCIP_EXPORT
525  SCIP_EXPR* expr /**< expression */
526  );
527 
528 /** set the activity with tag for an expression */
529 SCIP_EXPORT
531  SCIP_EXPR* expr, /**< expression */
532  SCIP_INTERVAL activity, /**< new activity */
533  SCIP_Longint activitytag /**< tag associated with activity */
534  );
535 
536 /** returns the curvature of an expression
537  *
538  * @note Call SCIPcomputeExprCurvature() before calling this function.
539  */
540 SCIP_EXPORT
542  SCIP_EXPR* expr /**< expression */
543  );
544 
545 /** sets the curvature of an expression */
546 SCIP_EXPORT
548  SCIP_EXPR* expr, /**< expression */
549  SCIP_EXPRCURV curvature /**< curvature of the expression */
550  );
551 
552 /** returns whether an expression is integral */
553 SCIP_EXPORT
555  SCIP_EXPR* expr /**< expression */
556  );
557 
558 /** sets the integrality flag of an expression */
559 SCIP_EXPORT
561  SCIP_EXPR* expr, /**< expression */
562  SCIP_Bool isintegral /**< integrality of the expression */
563  );
564 
565 /** @} */
566 
567 /**@name Quadratic Expressions */
568 /**@{ */
569 
570 /** gives the coefficients and expressions that define a quadratic expression
571  *
572  * It can return the constant part, the number, arguments, and coefficients of the purely linear part
573  * and the number of quadratic terms and bilinear terms.
574  * Note that for arguments that appear in the quadratic part, a linear coefficient is
575  * stored with the quadratic term.
576  * Use SCIPexprGetQuadraticQuadTerm() and SCIPexprGetQuadraticBilinTerm()
577  * to access the data for a quadratic or bilinear term.
578  *
579  * It can also return the eigenvalues and the eigenvectors of the matrix \f$Q\f$ when the quadratic is written
580  * as \f$x^T Q x + b^T x + c^T y + d\f$, where \f$c^T y\f$ defines the purely linear part.
581  * Note, however, that to have access to them one needs to call SCIPcomputeExprQuadraticCurvature()
582  * with `storeeigeninfo=TRUE`. If the eigen information was not stored or it failed to be computed,
583  * `eigenvalues` and `eigenvectors` will be set to NULL.
584  *
585  * This function returns pointers to internal data in linexprs and lincoefs.
586  * The user must not change this data.
587  */
588 SCIP_EXPORT
590  SCIP_EXPR* expr, /**< quadratic expression */
591  SCIP_Real* constant, /**< buffer to store constant term, or NULL */
592  int* nlinexprs, /**< buffer to store number of expressions that appear linearly, or NULL */
593  SCIP_EXPR*** linexprs, /**< buffer to store pointer to array of expressions that appear linearly, or NULL */
594  SCIP_Real** lincoefs, /**< buffer to store pointer to array of coefficients of expressions that appear linearly, or NULL */
595  int* nquadexprs, /**< buffer to store number of expressions in quadratic terms, or NULL */
596  int* nbilinexprs, /**< buffer to store number of bilinear expressions terms, or NULL */
597  SCIP_Real** eigenvalues, /**< buffer to store pointer to array of eigenvalues of Q, or NULL */
598  SCIP_Real** eigenvectors /**< buffer to store pointer to array of eigenvectors of Q, or NULL */
599  );
600 
601 /** gives the data of a quadratic expression term
602  *
603  * For a term \f$a \cdot \text{expr}^2 + b \cdot \text{expr} + \sum_i (c_i \cdot \text{expr} \cdot \text{otherexpr}_i)\f$, returns
604  * `expr`, \f$a\f$, \f$b\f$, the number of summands, and indices of bilinear terms in the quadratic expressions `bilinexprterms`.
605  *
606  * This function returns pointers to internal data in adjbilin.
607  * The user must not change this data.
608  */
609 SCIP_EXPORT
611  SCIP_EXPR* quadexpr, /**< quadratic expression */
612  int termidx, /**< index of quadratic term */
613  SCIP_EXPR** expr, /**< buffer to store pointer to argument expression (the 'x') of this term, or NULL */
614  SCIP_Real* lincoef, /**< buffer to store linear coefficient of variable, or NULL */
615  SCIP_Real* sqrcoef, /**< buffer to store square coefficient of variable, or NULL */
616  int* nadjbilin, /**< buffer to store number of bilinear terms this variable is involved in, or NULL */
617  int** adjbilin, /**< buffer to store pointer to indices of associated bilinear terms, or NULL */
618  SCIP_EXPR** sqrexpr /**< buffer to store pointer to square expression (the 'x^2') of this term or NULL if no square expression, or NULL */
619  );
620 
621 /** gives the data of a bilinear expression term
622  *
623  * For a term a*expr1*expr2, returns expr1, expr2, a, and
624  * the position of the quadratic expression term that uses expr2 in the quadratic expressions `quadexprterms`.
625  */
626 SCIP_EXPORT
628  SCIP_EXPR* expr, /**< quadratic expression */
629  int termidx, /**< index of bilinear term */
630  SCIP_EXPR** expr1, /**< buffer to store first factor, or NULL */
631  SCIP_EXPR** expr2, /**< buffer to store second factor, or NULL */
632  SCIP_Real* coef, /**< buffer to coefficient, or NULL */
633  int* pos2, /**< buffer to position of expr2 in quadexprterms array of quadratic expression, or NULL */
634  SCIP_EXPR** prodexpr /**< buffer to store pointer to expression that is product if first and second factor, or NULL */
635  );
636 
637 /** returns whether all expressions that are used in a quadratic expression are variable expressions
638  *
639  * @return TRUE iff all `linexprs` and `quadexprterms[.].expr` are variable expressions
640  */
641 SCIP_EXPORT
643  SCIP_EXPR* expr /**< quadratic expression */
644  );
645 
646 /** @} */
647 
648 #ifdef NDEBUG
649 #define SCIPexprGetNUses(expr) (expr)->nuses
650 #define SCIPexprGetNChildren(expr) (expr)->nchildren
651 #define SCIPexprGetChildren(expr) (expr)->children
652 #define SCIPexprGetHdlr(expr) (expr)->exprhdlr
653 #define SCIPexprGetData(expr) (expr)->exprdata
654 #define SCIPexprSetData(expr, exprdata_) (expr)->exprdata = exprdata_
655 #define SCIPexprGetOwnerData(expr) (expr)->ownerdata
656 #define SCIPexprGetEvalValue(expr) (expr)->evalvalue
657 #define SCIPexprGetEvalTag(expr) (expr)->evaltag
658 #define SCIPexprGetDerivative(expr) (expr)->derivative
659 #define SCIPexprGetDot(expr) (expr)->dot
660 #define SCIPexprGetBardot(expr) (expr)->bardot
661 #define SCIPexprGetDiffTag(expr) (expr)->difftag
662 #define SCIPexprGetActivity(expr) (expr)->activity
663 #define SCIPexprGetActivityTag(expr) (expr)->activitytag
664 #define SCIPexprSetActivity(expr, activity_, activitytag_) do { (expr)->activity = activity_; (expr)->activitytag = activitytag_; } while (FALSE)
665 #define SCIPexprGetCurvature(expr) (expr)->curvature
666 #define SCIPexprSetCurvature(expr, curvature_) (expr)->curvature = curvature_
667 #define SCIPexprIsIntegral(expr) (expr)->isintegral
668 #define SCIPexprSetIntegrality(expr, isintegral_) expr->isintegral = isintegral_
669 #define SCIPexprAreQuadraticExprsVariables(expr) (expr)->quaddata->allexprsarevars
670 #endif
671 
672 /**@name Core Expression Handlers */
673 /**@{ */
674 /* these are here to have them accessible also in the expr core
675  * so these cannot make use of SCIP pointer
676  */
677 
678 /** gets the variable of a variable expression */
679 SCIP_EXPORT
681  SCIP_EXPR* expr /**< var expression */
682  );
683 
684 /** gets the value of a constant value expression */
685 SCIP_EXPORT
687  SCIP_EXPR* expr /**< value expression */
688  );
689 
690 /** gets the coefficients of a summation expression */
691 SCIP_EXPORT
693  SCIP_EXPR* expr /**< sum expression */
694  );
695 
696 /** gets the constant of a summation expression */
697 SCIP_EXPORT
699  SCIP_EXPR* expr /**< sum expression */
700  );
701 
702 /** gets the constant coefficient of a product expression */
703 SCIP_EXPORT
705  SCIP_EXPR* expr /**< product expression */
706  );
707 
708 /** gets the exponent of a power or signed power expression */
709 SCIP_EXPORT
711  SCIP_EXPR* expr /**< (signed) power expression */
712  );
713 
714 #ifdef NDEBUG
715 #define SCIPgetVarExprVar(expr) ((SCIP_VAR*)SCIPexprGetData(expr))
716 #endif
717 
718 /**@} */
719 
720 
721 /**@name Expression Iterator
722  *
723  * @anchor SCIP_EXPRITER_DFS
724  * More details on the DFS mode:
725  * Many algorithms over expression trees need to traverse the tree in depth-first manner and a
726  * natural way of implementing these algorithms is by using recursion.
727  * In general, a function which traverses the tree in depth-first looks like
728  * <pre>
729  * fun( expr )
730  * enterexpr()
731  * continue skip or abort
732  * for( child in expr->children )
733  * visitingchild()
734  * continue skip or abort
735  * fun(child, data, proceed)
736  * visitedchild()
737  * continue skip or abort
738  * leaveexpr()
739  * </pre>
740  * Given that some expressions might be quite deep we provide this functionality in an iterative fashion.
741  *
742  * Consider an expression (x*y) + z + log(x-y).
743  * The corresponding expression graph is
744  * <pre>
745  * [+]
746  * / | \
747  * [*] | [log]
748  * / \ | |
749  * / \ | [-]
750  * | | | / \
751  * [x] [y] [z] [x] [y]
752  * </pre>
753  * (where [x] and [y] are actually the same expression).
754  *
755  * If a pointer to the [+] expression is given as root to this expression, it will iterate
756  * the graph in a depth-first manner and stop at various stages.
757  * - When entering an expression, it stops in the \ref SCIP_EXPRITER_ENTEREXPR stage.
758  * The SCIPexpriterGetParentDFS() function indicates from where the expression has been entered (NULL for the root expression).
759  * - Before visiting a child of an expression, it stops in the \ref SCIP_EXPRITER_VISITINGCHILD stage.
760  * The SCIPexpriterGetChildIdxDFS() function returns which child will be visited (as an index in the current expr's children array).
761  * Use SCIPexpriterGetChildExprDFS() to obtain the corresponding expression.
762  * - When returning from visiting a child of an expression, it stops in the \ref SCIP_EXPRITER_VISITEDCHILD stage.
763  * Again the SCIPexpriterGetChildExprDFS() function returns which child has been visited.
764  * - When leaving an expression, it stops in the \ref SCIP_EXPRITER_LEAVEEXPR stage.
765  *
766  * Thus, for the above expression, the expression are visited in the following order and stages:
767  * - `enterexpr([+])`
768  * - `visitingchild([+])`, currentchild = 0
769  * - `enterexpr([*])`
770  * - `visitingchild([*])`, currentchild = 0
771  * - `enterexpr([x])`
772  * - `leaveexpr([x])`
773  * - `visitedchild([*])`, currentchild = 0
774  * - `visitingchild([*])`, currentchild = 1
775  * - `enterexpr([y])`
776  * - `leaveexpr([y])`
777  * - `visitedchild([*])`, currentchild = 1
778  * - `leaveexpr([*])`
779  * - `visitedchild([+])`, currentchild = 0
780  * - `visitingchild([+])`, currentchild = 1
781  * - `enterexpr([z])`
782  * - `leaveexpr([z])`
783  * - `visitedchild([+])`, currentchild = 1
784  * - `visitingchild([+])`, currentchild = 2
785  * - `enterexpr([log])`
786  * - `visitingchild([log])`, currentchild = 0
787  * - `enterexpr([-])`
788  * - `visitingchild([-])`, currentchild = 0
789  * - `enterexpr([x])`
790  * - `leaveexpr([x])`
791  * - `visitedchild([-])`, currentchild = 0
792  * - `visitingchild([-])`, currentchild = 1
793  * - `enterexpr([y])`
794  * - `leaveexpr([y])`
795  * - `visitedchild([-])`, currentchild = 1
796  * - `leaveexpr([-])`
797  * - `visitedchild([log])`, currentchild = 0
798  * - `leaveexpr([log])`
799  * - `visitedchild([+])` currentchild = 2
800  * - `leaveexpr([+])`
801  *
802  * The caller can direct the iterator to skip parts of the tree:
803  * - If calling SCIPexpriterSkipDFS() in SCIP_EXPRITER_ENTEREXPR stage, all children of that expression will be skipped. The SCIP_EXPRITER_LEAVEEXPR stage will still be next.
804  * - If calling SCIPexpriterSkipDFS() in SCIP_EXPRITER_VISITINGCHILD stage, visiting the current child will be skipped.
805  * - If calling SCIPexpriterSkipDFS() in SCIP_EXPRITER_VISITEDCHILD child, visiting the remaining children will be skipped.
806  *
807  * @{
808  */
809 
810 /** returns whether expression iterator is currently initialized */
811 SCIP_EXPORT
813  SCIP_EXPRITER* iterator /**< expression iterator */
814  );
815 
816 /** initializes an expression iterator
817  *
818  * @note If `expr` is NULL, then iterator will be set into ended-state (SCIPexpriterIsEnd() is TRUE). Useful if following with SCIPexpriterRestartDFS().
819  *
820  * If type is DFS, then `stopstages` will be set to \ref SCIP_EXPRITER_ENTEREXPR.
821  * Use `SCIPexpriterSetStagesDFS` to change this.
822  */
823 SCIP_EXPORT
825  SCIP_EXPRITER* iterator, /**< expression iterator */
826  SCIP_EXPR* expr, /**< expression of the iterator, can be NULL */
827  SCIP_EXPRITER_TYPE type, /**< type of expression iterator */
828  SCIP_Bool allowrevisit /**< whether expression are allowed to be visited more than once */
829  );
830 
831 /** restarts an already initialized expression iterator in DFS mode
832  *
833  * The expression iterator will continue from the given expression, not revisiting expressions that
834  * this iterator has already been visited (if initialized with `allowrevisit=FALSE`) and giving access
835  * to the same iterator specified expression data that may have been set already.
836  * Also the stop-stages are not reset.
837  *
838  * If revisiting is forbidden and given expr has already been visited, then the iterator will behave
839  * as on the end of iteration (SCIPexpriterIsEnd() is TRUE).
840  * If the enterexpr stage is not one of the stop stages, then the iterator will be moved forward
841  * (SCIPexpriterGetNext() is called).
842  *
843  * @return The current expression.
844  */
845 SCIP_EXPORT
847  SCIP_EXPRITER* iterator, /**< expression iterator */
848  SCIP_EXPR* expr /**< expression of the iterator */
849  );
850 
851 /** specifies in which stages to stop a DFS iterator
852  *
853  * Parameter `stopstages` should be a bitwise OR of different \ref SCIP_EXPRITER_STAGE values
854  *
855  * If the current stage is not one of the `stopstages`, then the iterator will be moved on.
856  */
857 SCIP_EXPORT
859  SCIP_EXPRITER* iterator, /**< expression iterator */
860  SCIP_EXPRITER_STAGE stopstages /**< the stages in which to stop when iterating via DFS */
861  );
862 
863 /** gets the current expression that the expression iterator points to */
864 SCIP_EXPORT
866  SCIP_EXPRITER* iterator /**< expression iterator */
867  );
868 
869 /** gets the current stage that the expression iterator is in when using DFS
870  *
871  * If the iterator has finished (SCIPexpriterIsEnd() is TRUE), then the stage is undefined.
872  */
873 SCIP_EXPORT
875  SCIP_EXPRITER* iterator /**< expression iterator */
876  );
877 
878 /** gets the index of the child that the expression iterator considers when in DFS mode and stage \ref SCIP_EXPRITER_VISITINGCHILD or \ref SCIP_EXPRITER_VISITEDCHILD */
879 SCIP_EXPORT
881  SCIP_EXPRITER* iterator /**< expression iterator */
882  );
883 
884 /** gets the child expression that the expression iterator considers when in DFS mode and stage \ref SCIP_EXPRITER_VISITINGCHILD or \ref SCIP_EXPRITER_VISITEDCHILD */
885 SCIP_EXPORT
887  SCIP_EXPRITER* iterator /**< expression iterator */
888  );
889 
890 /** gives the parent of the current expression of an expression iteration if in DFS mode
891  *
892  * @return the expression from which the current expression has been accessed
893  */
894 SCIP_EXPORT
896  SCIP_EXPRITER* iterator /**< expression iterator */
897  );
898 
899 /** gives the iterator specific user data of the current expression
900  *
901  * @note The expression iterator mode must be DFS or another mode with allowrevisit=FALSE
902  */
903 SCIP_EXPORT
905  SCIP_EXPRITER* iterator /**< expression iterator */
906  );
907 
908 /** gives the iterator specific user data of the current expressions current child
909  *
910  * @note The expression iterator mode must be in DFS mode and stage \ref SCIP_EXPRITER_VISITINGCHILD or \ref SCIP_EXPRITER_VISITEDCHILD
911  */
912 SCIP_EXPORT
914  SCIP_EXPRITER* iterator /**< expression iterator */
915  );
916 
917 /** gives the iterator specific user data of a given expression
918  *
919  * @note The expression iterator mode must be DFS or another mode with allowrevisit=FALSE
920  */
921 SCIP_EXPORT
923  SCIP_EXPRITER* iterator, /**< expression iterator */
924  SCIP_EXPR* expr /**< expression for which to get the userdata of this iterator */
925  );
926 
927 /** sets the iterator specific user data of the current expression for an expression iteration if in DFS mode
928  *
929  * @note The expression iterator mode must be DFS or another mode with allowrevisit=FALSE
930  */
931 SCIP_EXPORT
933  SCIP_EXPRITER* iterator, /**< expression iterator */
934  SCIP_EXPRITER_USERDATA userdata /**< data to be stored */
935  );
936 
937 /** sets the iterator specific user data of a given expression
938  *
939  * @note The expression iterator mode must be DFS or another mode with allowrevisit=FALSE
940  */
941 SCIP_EXPORT
943  SCIP_EXPRITER* iterator, /**< expression iterator */
944  SCIP_EXPR* expr, /**< expression where to set iterator data */
945  SCIP_EXPRITER_USERDATA userdata /**< data to be stored in current child */
946  );
947 
948 /** sets the iterator specific user data of the current expressions current child
949  *
950  * @note The expression iterator mode must be in DFS mode and stage \ref SCIP_EXPRITER_VISITINGCHILD or \ref SCIP_EXPRITER_VISITEDCHILD
951  */
952 SCIP_EXPORT
954  SCIP_EXPRITER* iterator, /**< expression iterator */
955  SCIP_EXPRITER_USERDATA userdata /**< data to be stored in current child */
956  );
957 
958 /** moves the iterator to the next expression according to the mode of the expression iterator
959  *
960  * @return the next expression, if any, and NULL otherwise
961  */
962 SCIP_EXPORT
964  SCIP_EXPRITER* iterator /**< expression iterator */
965  );
966 
967 /** moves a DFS iterator to one of the next expressions
968  *
969  * - If in \ref SCIP_EXPRITER_ENTEREXPR stage, then all children of that expression will be skipped.
970  * If \ref SCIP_EXPRITER_LEAVEEXPR is one of the `stopstages`, then it will be the next stage. Otherwise, the iterator will move further on (go to the parent, etc).
971  * - If in \ref SCIP_EXPRITER_VISITINGCHILD stage, then the child that was going to be visited next will be skipped and the iterator will be moved on to the next child (if any).
972  * - If in \ref SCIP_EXPRITER_VISITEDCHILD stage, then all remaining children will be skipped and we move on to the \ref SCIP_EXPRITER_LEAVEEXPR stage (if a stop stage, otherwise further on).
973  * - It is not allowed to call this function when in \ref SCIP_EXPRITER_LEAVEEXPR stage.
974  *
975  * @return the next expression, if any, and NULL otherwise
976  */
977 SCIP_EXPORT
979  SCIP_EXPRITER* iterator /**< expression iterator */
980  );
981 
982 /** returns whether the iterator visited all expressions already */
983 SCIP_EXPORT
985  SCIP_EXPRITER* iterator /**< expression iterator */
986  );
987 
988 #ifdef NDEBUG
989 #define SCIPexpriterIsInit(iterator) (iterator)->initialized
990 #define SCIPexpriterGetCurrent(iterator) (iterator)->curr
991 #define SCIPexpriterGetStageDFS(iterator) (iterator)->dfsstage
992 #define SCIPexpriterGetChildIdxDFS(iterator) (iterator)->curr->iterdata[(iterator)->iterindex].currentchild
993 #define SCIPexpriterGetChildExprDFS(iterator) (iterator)->curr->children[(iterator)->curr->iterdata[(iterator)->iterindex].currentchild]
994 #define SCIPexpriterGetParentDFS(iterator) (iterator)->curr->iterdata[(iterator)->iterindex].parent
995 #define SCIPexpriterGetCurrentUserData(iterator) (iterator)->curr->iterdata[(iterator)->iterindex].userdata
996 #define SCIPexpriterGetChildUserDataDFS(iterator) (iterator)->curr->children[(iterator)->curr->iterdata[(iterator)->iterindex].currentchild]->iterdata[(iterator)->iterindex].userdata
997 #define SCIPexpriterGetExprUserData(iterator, expr) (expr)->iterdata[(iterator)->iterindex].userdata
998 #define SCIPexpriterSetCurrentUserData(iterator, userdata_) (iterator)->curr->iterdata[(iterator)->iterindex].userdata = userdata_
999 #define SCIPexpriterSetExprUserData(iterator, expr, userdata_) (expr)->iterdata[(iterator)->iterindex].userdata = userdata_
1000 #define SCIPexpriterSetChildUserData(iterator, userdata_) (iterator)->curr->children[(iterator)->curr->iterdata[(iterator)->iterindex].currentchild]->iterdata[(iterator)->iterindex].userdata = userdata_
1001 #define SCIPexpriterIsEnd(iterator) ((iterator)->curr == NULL)
1002 #endif
1003 
1004 /** @} */
1005 
1006 /**@name Function Curvature */
1007 /**@{ */
1008 
1009 /** gives curvature for a sum of two functions with given curvature */
1010 SCIP_EXPORT
1012  SCIP_EXPRCURV curv1, /**< curvature of first summand */
1013  SCIP_EXPRCURV curv2 /**< curvature of second summand */
1014  );
1015 
1016 /** gives the curvature for the negation of a function with given curvature */
1017 SCIP_EXPORT
1019  SCIP_EXPRCURV curvature /**< curvature of function */
1020  );
1021 
1022 /** gives curvature for a functions with given curvature multiplied by a constant factor */
1023 SCIP_EXPORT
1025  SCIP_Real factor, /**< constant factor */
1026  SCIP_EXPRCURV curvature /**< curvature of other factor */
1027  );
1028 
1029 /** gives curvature for base^exponent for given bounds and curvature of base-function and constant exponent */
1030 SCIP_EXPORT
1032  SCIP_INTERVAL basebounds, /**< bounds on base function */
1033  SCIP_EXPRCURV basecurv, /**< curvature of base function */
1034  SCIP_Real exponent /**< exponent */
1035  );
1036 
1037 /** gives required curvature for base so that base^exponent has given curvature under given bounds on base and constant exponent
1038  *
1039  * returns curvature unknown if expected curvature cannot be obtained
1040  */
1041 SCIP_EXPORT
1043  SCIP_INTERVAL basebounds, /**< bounds on base function */
1044  SCIP_Real exponent, /**< exponent, must not be 0 */
1045  SCIP_EXPRCURV powercurv /**< expected curvature for power */
1046  );
1047 
1048 /** gives curvature for a monomial with given curvatures and bounds for each factor
1049  *
1050  * See Maranas and Floudas, Finding All Solutions of Nonlinearly Constrained Systems of Equations, JOGO 7, 1995
1051  * for the categorization in the case that all factors are linear.
1052  *
1053  * Exponents can also be negative or rational.
1054  */
1055 SCIP_EXPORT
1057  int nfactors, /**< number of factors in monomial */
1058  SCIP_Real* exponents, /**< exponents in monomial, or NULL if all 1.0 */
1059  int* factoridxs, /**< indices of factors, or NULL if identity mapping */
1060  SCIP_EXPRCURV* factorcurv, /**< curvature of each factor */
1061  SCIP_INTERVAL* factorbounds /**< bounds of each factor */
1062  );
1063 
1064 /** for a monomial with given bounds for each factor, gives condition on the curvature of each factor, so that monomial has a requested curvature, if possible
1065  *
1066  * @return whether `monomialcurv` can be achieved
1067  */
1068 SCIP_EXPORT
1070  SCIP_EXPRCURV monomialcurv, /**< desired curvature */
1071  int nfactors, /**< number of factors in monomial */
1072  SCIP_Real* exponents, /**< exponents in monomial, or NULL if all 1.0 */
1073  SCIP_INTERVAL* factorbounds, /**< bounds of each factor */
1074  SCIP_EXPRCURV* factorcurv /**< buffer to store required curvature of each factor */
1075  );
1076 
1077 /** gives name as string for a curvature */
1078 SCIP_EXPORT
1079 const char* SCIPexprcurvGetName(
1080  SCIP_EXPRCURV curv /**< curvature */
1081  );
1082 
1083 #ifdef NDEBUG
1084 #define SCIPexprcurvAdd(curv1, curv2) ((SCIP_EXPRCURV) ((curv1) & (curv2)))
1085 #define SCIPexprcurvNegate(curvature) (((curvature) == SCIP_EXPRCURV_CONCAVE) ? SCIP_EXPRCURV_CONVEX : ((curvature) == SCIP_EXPRCURV_CONVEX) ? SCIP_EXPRCURV_CONCAVE : (curvature))
1086 #define SCIPexprcurvMultiply(factor, curvature) (((factor) == 0.0) ? SCIP_EXPRCURV_LINEAR : (factor) > 0.0 ? (curvature) : SCIPexprcurvNegate(curvature))
1087 #endif
1088 
1089 /**@} */
1090 
1091 /**@} */
1092 
1093 #ifdef __cplusplus
1094 }
1095 #endif
1096 
1097 #endif /* SCIP_PUB_EXPR_H_ */
SCIP_Longint SCIPexprhdlrGetNSimplifyCalls(SCIP_EXPRHDLR *exprhdlr)
Definition: expr.c:797
SCIP_Longint SCIPexprhdlrGetNEstimateCalls(SCIP_EXPRHDLR *exprhdlr)
Definition: expr.c:753
void SCIPexprGetQuadraticData(SCIP_EXPR *expr, SCIP_Real *constant, int *nlinexprs, SCIP_EXPR ***linexprs, SCIP_Real **lincoefs, int *nquadexprs, int *nbilinexprs, SCIP_Real **eigenvalues, SCIP_Real **eigenvectors)
Definition: expr.c:4055
const char * SCIPexprcurvGetName(SCIP_EXPRCURV curv)
Definition: exprcurv.c:576
SCIP_RETCODE SCIPexpriterInit(SCIP_EXPRITER *iterator, SCIP_EXPR *expr, SCIP_EXPRITER_TYPE type, SCIP_Bool allowrevisit)
Definition: expriter.c:491
SCIP_EXPR_OWNERDATA * SCIPexprGetOwnerData(SCIP_EXPR *expr)
Definition: expr.c:3859
void SCIPexprSetIntegrality(SCIP_EXPR *expr, SCIP_Bool isintegral)
Definition: expr.c:4027
#define SCIP_DECL_EXPRPRINT(x)
Definition: type_expr.h:277
#define SCIP_DECL_EXPRMONOTONICITY(x)
Definition: type_expr.h:346
SCIP_Bool SCIPexprhdlrHasFwdiff(SCIP_EXPRHDLR *exprhdlr)
Definition: expr.c:585
type definitions for miscellaneous datastructures
int SCIPexprGetNChildren(SCIP_EXPR *expr)
Definition: expr.c:3798
SCIP_EXPR * SCIPexpriterGetParentDFS(SCIP_EXPRITER *iterator)
Definition: expriter.c:730
#define SCIP_DECL_EXPRINITESTIMATES(x)
Definition: type_expr.h:596
void SCIPexprhdlrSetDiff(SCIP_EXPRHDLR *exprhdlr, SCIP_DECL_EXPRBWDIFF((*bwdiff)), SCIP_DECL_EXPRFWDIFF((*fwdiff)), SCIP_DECL_EXPRBWFWDIFF((*bwfwdiff)))
Definition: expr.c:464
const char * SCIPexprhdlrGetName(SCIP_EXPRHDLR *exprhdlr)
Definition: expr.c:525
SCIP_Real SCIPgetConstantExprSum(SCIP_EXPR *expr)
Definition: expr_sum.c:1172
SCIP_EXPR * SCIPexpriterSkipDFS(SCIP_EXPRITER *iterator)
Definition: expriter.c:920
SCIP_EXPRCURV SCIPexprcurvNegate(SCIP_EXPRCURV curvature)
Definition: exprcurv.c:52
#define SCIP_DECL_EXPRFWDIFF(x)
Definition: type_expr.h:468
#define SCIP_DECL_EXPRREVERSEPROP(x)
Definition: type_expr.h:645
void SCIPexprhdlrSetParse(SCIP_EXPRHDLR *exprhdlr, SCIP_DECL_EXPRPARSE((*parse)))
Definition: expr.c:398
structure definitions related to algebraic expressions
SCIP_EXPRHDLRDATA * SCIPexprhdlrGetData(SCIP_EXPRHDLR *exprhdlr)
Definition: expr.c:555
SCIP_Bool SCIPexprhdlrHasPrint(SCIP_EXPRHDLR *exprhdlr)
Definition: expr.c:565
void SCIPexprSetCurvature(SCIP_EXPR *expr, SCIP_EXPRCURV curvature)
Definition: expr.c:4006
SCIP_Bool SCIPexprhdlrHasBwdiff(SCIP_EXPRHDLR *exprhdlr)
Definition: expr.c:575
struct SCIP_ExprData SCIP_EXPRDATA
Definition: type_expr.h:44
SCIP_EXPRCURV SCIPexprcurvPower(SCIP_INTERVAL basebounds, SCIP_EXPRCURV basecurv, SCIP_Real exponent)
Definition: exprcurv.c:91
SCIP_Real SCIPgetExponentExprPow(SCIP_EXPR *expr)
Definition: expr_pow.c:3343
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:54
SCIP_Real SCIPexprhdlrGetEstimateTime(SCIP_EXPRHDLR *exprhdlr)
Definition: expr.c:763
SCIP_EXPRITER_TYPE
Definition: type_expr.h:687
void SCIPexpriterSetChildUserData(SCIP_EXPRITER *iterator, SCIP_EXPRITER_USERDATA userdata)
Definition: expriter.c:828
SCIP_Bool SCIPexpriterIsInit(SCIP_EXPRITER *iterator)
Definition: expriter.c:475
void SCIPexprhdlrSetHash(SCIP_EXPRHDLR *exprhdlr, SCIP_DECL_EXPRHASH((*hash)))
Definition: expr.c:442
SCIP_INTERVAL SCIPexprGetActivity(SCIP_EXPR *expr)
Definition: expr.c:3954
SCIP_EXPRITER_USERDATA SCIPexpriterGetChildUserDataDFS(SCIP_EXPRITER *iterator)
Definition: expriter.c:761
void SCIPexprhdlrSetIntegrality(SCIP_EXPRHDLR *exprhdlr, SCIP_DECL_EXPRINTEGRALITY((*integrality)))
Definition: expr.c:431
SCIP_Real SCIPexprhdlrGetSimplifyTime(SCIP_EXPRHDLR *exprhdlr)
Definition: expr.c:807
SCIP_EXPRITER_USERDATA SCIPexpriterGetCurrentUserData(SCIP_EXPRITER *iterator)
Definition: expriter.c:746
SCIP_Real SCIPexprhdlrGetIntevalTime(SCIP_EXPRHDLR *exprhdlr)
Definition: expr.c:691
#define SCIP_DECL_EXPRFREEDATA(x)
Definition: type_expr.h:256
SCIP_Bool SCIPexprAreQuadraticExprsVariables(SCIP_EXPR *expr)
Definition: expr.c:4183
SCIP_EXPR * SCIPexpriterGetCurrent(SCIP_EXPRITER *iterator)
Definition: expriter.c:673
struct SCIP_Expr_OwnerData SCIP_EXPR_OWNERDATA
Definition: type_expr.h:68
SCIP_EXPRCURV SCIPexprcurvPowerInv(SCIP_INTERVAL basebounds, SCIP_Real exponent, SCIP_EXPRCURV powercurv)
Definition: exprcurv.c:199
SCIP_EXPRITER_USERDATA SCIPexpriterGetExprUserData(SCIP_EXPRITER *iterator, SCIP_EXPR *expr)
Definition: expriter.c:780
SCIP_EXPRDATA * SCIPexprGetData(SCIP_EXPR *expr)
Definition: expr.c:3831
SCIP_EXPR ** SCIPexprGetChildren(SCIP_EXPR *expr)
Definition: expr.c:3808
SCIP_Real * SCIPgetCoefsExprSum(SCIP_EXPR *expr)
Definition: expr_sum.c:1157
#define SCIP_DECL_EXPRPARSE(x)
Definition: type_expr.h:300
SCIP_Longint SCIPexprGetActivityTag(SCIP_EXPR *expr)
Definition: expr.c:3970
SCIP_Real SCIPexprGetEvalValue(SCIP_EXPR *expr)
Definition: expr.c:3872
SCIP_Real SCIPexprGetDerivative(SCIP_EXPR *expr)
Definition: expr.c:3898
SCIP_Bool SCIPexprhdlrHasMonotonicity(SCIP_EXPRHDLR *exprhdlr)
Definition: expr.c:645
SCIP_VAR * SCIPgetVarExprVar(SCIP_EXPR *expr)
Definition: expr_var.c:403
SCIP_Longint SCIPexprhdlrGetNSimplifications(SCIP_EXPRHDLR *exprhdlr)
Definition: expr.c:817
SCIP_Bool SCIPexprhdlrHasEstimate(SCIP_EXPRHDLR *exprhdlr)
Definition: expr.c:605
void print(const Container &container, const std::string &prefix="", const std::string &suffix="", std::ostream &os=std::cout, bool negate=false, int prec=6)
void SCIPexprGetQuadraticQuadTerm(SCIP_EXPR *quadexpr, int termidx, SCIP_EXPR **expr, SCIP_Real *lincoef, SCIP_Real *sqrcoef, int *nadjbilin, int **adjbilin, SCIP_EXPR **sqrexpr)
Definition: expr.c:4102
SCIP_EXPRCURV SCIPexprcurvAdd(SCIP_EXPRCURV curv1, SCIP_EXPRCURV curv2)
Definition: exprcurv.c:43
SCIP_Real SCIPexprGetBardot(SCIP_EXPR *expr)
Definition: expr.c:3926
SCIP_Longint SCIPexprGetDiffTag(SCIP_EXPR *expr)
Definition: expr.c:3941
SCIP_Real SCIPexprGetDot(SCIP_EXPR *expr)
Definition: expr.c:3912
#define SCIP_DECL_EXPRFREEHDLR(x)
Definition: type_expr.h:212
int SCIPexpriterGetChildIdxDFS(SCIP_EXPRITER *iterator)
Definition: expriter.c:697
SCIP_Bool SCIPexprhdlrHasCurvature(SCIP_EXPRHDLR *exprhdlr)
Definition: expr.c:635
SCIP_Longint SCIPexprGetEvalTag(SCIP_EXPR *expr)
Definition: expr.c:3885
SCIP_Bool SCIPexprhdlrHasIntEval(SCIP_EXPRHDLR *exprhdlr)
Definition: expr.c:595
void SCIPexprhdlrSetCopyFreeHdlr(SCIP_EXPRHDLR *exprhdlr, SCIP_DECL_EXPRCOPYHDLR((*copyhdlr)), SCIP_DECL_EXPRFREEHDLR((*freehdlr)))
Definition: expr.c:359
SCIP_EXPRCURV SCIPexprGetCurvature(SCIP_EXPR *expr)
Definition: expr.c:3996
SCIP_Real SCIPgetCoefExprProduct(SCIP_EXPR *expr)
#define SCIP_DECL_EXPRINTEVAL(x)
Definition: type_expr.h:527
#define SCIP_Bool
Definition: def.h:84
SCIP_EXPR * SCIPexpriterRestartDFS(SCIP_EXPRITER *iterator, SCIP_EXPR *expr)
Definition: expriter.c:620
SCIP_Bool SCIPexprhdlrHasReverseProp(SCIP_EXPRHDLR *exprhdlr)
Definition: expr.c:655
SCIP_EXPRCURV
Definition: type_expr.h:48
void SCIPexprhdlrSetMonotonicity(SCIP_EXPRHDLR *exprhdlr, SCIP_DECL_EXPRMONOTONICITY((*monotonicity)))
Definition: expr.c:420
SCIP_Longint SCIPexprhdlrGetNCutoffs(SCIP_EXPRHDLR *exprhdlr)
Definition: expr.c:721
void SCIPexpriterSetExprUserData(SCIP_EXPRITER *iterator, SCIP_EXPR *expr, SCIP_EXPRITER_USERDATA userdata)
Definition: expriter.c:812
#define SCIP_DECL_EXPRINTEGRALITY(x)
Definition: type_expr.h:363
#define SCIP_DECL_EXPRBWDIFF(x)
Definition: type_expr.h:437
SCIP_Bool SCIPexprcurvMonomialInv(SCIP_EXPRCURV monomialcurv, int nfactors, SCIP_Real *exponents, SCIP_INTERVAL *factorbounds, SCIP_EXPRCURV *factorcurv)
Definition: exprcurv.c:447
void SCIPexprhdlrSetReverseProp(SCIP_EXPRHDLR *exprhdlr, SCIP_DECL_EXPRREVERSEPROP((*reverseprop)))
Definition: expr.c:501
SCIP_Longint SCIPexprhdlrGetNDomainReductions(SCIP_EXPRHDLR *exprhdlr)
Definition: expr.c:731
SCIP_Bool SCIPexprIsIntegral(SCIP_EXPR *expr)
Definition: expr.c:4017
SCIP_EXPRCURV SCIPexprcurvMonomial(int nfactors, SCIP_Real *exponents, int *factoridxs, SCIP_EXPRCURV *factorcurv, SCIP_INTERVAL *factorbounds)
Definition: exprcurv.c:321
SCIP_EXPR * SCIPexpriterGetNext(SCIP_EXPRITER *iterator)
Definition: expriter.c:848
SCIP_EXPR * SCIPexpriterGetChildExprDFS(SCIP_EXPRITER *iterator)
Definition: expriter.c:711
struct SCIP_ExprhdlrData SCIP_EXPRHDLRDATA
Definition: type_expr.h:183
SCIP_EXPRHDLR * SCIPexprGetHdlr(SCIP_EXPR *expr)
Definition: expr.c:3821
void SCIPexprhdlrSetPrint(SCIP_EXPRHDLR *exprhdlr, SCIP_DECL_EXPRPRINT((*print)))
Definition: expr.c:387
void SCIPexprhdlrSetCopyFreeData(SCIP_EXPRHDLR *exprhdlr, SCIP_DECL_EXPRCOPYDATA((*copydata)), SCIP_DECL_EXPRFREEDATA((*freedata)))
Definition: expr.c:372
#define SCIP_DECL_EXPRCURVATURE(x)
Definition: type_expr.h:328
void SCIPexpriterSetStagesDFS(SCIP_EXPRITER *iterator, SCIP_EXPRITER_STAGE stopstages)
Definition: expriter.c:654
SCIP_Longint SCIPexprhdlrGetNIntevalCalls(SCIP_EXPRHDLR *exprhdlr)
Definition: expr.c:681
#define SCIP_DECL_EXPRCOMPARE(x)
Definition: type_expr.h:398
void SCIPexprhdlrSetCompare(SCIP_EXPRHDLR *exprhdlr, SCIP_DECL_EXPRCOMPARE((*compare)))
Definition: expr.c:453
#define SCIP_DECL_EXPRSIMPLIFY(x)
Definition: type_expr.h:620
SCIP_Longint SCIPexprhdlrGetNReversepropCalls(SCIP_EXPRHDLR *exprhdlr)
Definition: expr.c:701
unsigned int SCIPexprhdlrGetPrecedence(SCIP_EXPRHDLR *exprhdlr)
Definition: expr.c:545
void SCIPexprhdlrSetCurvature(SCIP_EXPRHDLR *exprhdlr, SCIP_DECL_EXPRCURVATURE((*curvature)))
Definition: expr.c:409
void SCIPexprSetData(SCIP_EXPR *expr, SCIP_EXPRDATA *exprdata)
Definition: expr.c:3846
#define SCIP_DECL_SORTPTRCOMP(x)
Definition: type_misc.h:179
SCIP_Bool SCIPexprhdlrHasInitEstimates(SCIP_EXPRHDLR *exprhdlr)
Definition: expr.c:615
void SCIPexprhdlrIncrementNDomainReductions(SCIP_EXPRHDLR *exprhdlr, int nreductions)
Definition: expr.c:741
type and macro definitions related to algebraic expressions
SCIP_EXPRITER_STAGE SCIPexpriterGetStageDFS(SCIP_EXPRITER *iterator)
Definition: expriter.c:686
void SCIPexpriterSetCurrentUserData(SCIP_EXPRITER *iterator, SCIP_EXPRITER_USERDATA userdata)
Definition: expriter.c:796
SCIP_Longint SCIPexprhdlrGetNBranchings(SCIP_EXPRHDLR *exprhdlr)
Definition: expr.c:777
void SCIPexprGetQuadraticBilinTerm(SCIP_EXPR *expr, int termidx, SCIP_EXPR **expr1, SCIP_EXPR **expr2, SCIP_Real *coef, int *pos2, SCIP_EXPR **prodexpr)
Definition: expr.c:4145
#define SCIP_DECL_EXPRESTIMATE(x)
Definition: type_expr.h:563
#define SCIP_Real
Definition: def.h:177
void SCIPexprSetActivity(SCIP_EXPR *expr, SCIP_INTERVAL activity, SCIP_Longint activitytag)
Definition: expr.c:3980
SCIP_Real SCIPgetValueExprValue(SCIP_EXPR *expr)
Definition: expr_value.c:285
unsigned int SCIPexprhdlrGetNCreated(SCIP_EXPRHDLR *exprhdlr)
Definition: expr.c:671
#define SCIP_Longint
Definition: def.h:162
SCIP_Real SCIPexprhdlrGetReversepropTime(SCIP_EXPRHDLR *exprhdlr)
Definition: expr.c:711
void SCIPexprhdlrSetEstimate(SCIP_EXPRHDLR *exprhdlr, SCIP_DECL_EXPRINITESTIMATES((*initestimates)), SCIP_DECL_EXPRESTIMATE((*estimate)))
Definition: expr.c:512
unsigned int SCIP_EXPRITER_STAGE
Definition: type_expr.h:674
const char * SCIPexprhdlrGetDescription(SCIP_EXPRHDLR *exprhdlr)
Definition: expr.c:535
SCIP_EXPRCURV SCIPexprcurvMultiply(SCIP_Real factor, SCIP_EXPRCURV curvature)
Definition: exprcurv.c:78
common defines and data types used in all packages of SCIP
SCIP_Bool SCIPexpriterIsEnd(SCIP_EXPRITER *iterator)
Definition: expriter.c:959
SCIP_Bool SCIPexprhdlrHasSimplify(SCIP_EXPRHDLR *exprhdlr)
Definition: expr.c:625
#define SCIP_DECL_EXPRCOPYHDLR(x)
Definition: type_expr.h:198
void SCIPexprhdlrIncrementNBranchings(SCIP_EXPRHDLR *exprhdlr)
Definition: expr.c:787
int SCIPexprGetNUses(SCIP_EXPR *expr)
Definition: expr.c:3788
void SCIPexprhdlrSetSimplify(SCIP_EXPRHDLR *exprhdlr, SCIP_DECL_EXPRSIMPLIFY((*simplify)))
Definition: expr.c:490
void SCIPexprhdlrSetIntEval(SCIP_EXPRHDLR *exprhdlr, SCIP_DECL_EXPRINTEVAL((*inteval)))
Definition: expr.c:479
#define SCIP_DECL_EXPRCOPYDATA(x)
Definition: type_expr.h:237
#define SCIP_DECL_EXPRHASH(x)
Definition: type_expr.h:379
#define SCIP_DECL_EXPRBWFWDIFF(x)
Definition: type_expr.h:508