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 to evaluate the expression at a given solution.
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  * @attention SCIPcheckExprQuadratic() needs to be called first to check whether expression is quadratic and initialize the data of the quadratic representation.
589  */
590 SCIP_EXPORT
592  SCIP_EXPR* expr, /**< quadratic expression */
593  SCIP_Real* constant, /**< buffer to store constant term, or NULL */
594  int* nlinexprs, /**< buffer to store number of expressions that appear linearly, or NULL */
595  SCIP_EXPR*** linexprs, /**< buffer to store pointer to array of expressions that appear linearly, or NULL */
596  SCIP_Real** lincoefs, /**< buffer to store pointer to array of coefficients of expressions that appear linearly, or NULL */
597  int* nquadexprs, /**< buffer to store number of expressions in quadratic terms, or NULL */
598  int* nbilinexprs, /**< buffer to store number of bilinear expressions terms, or NULL */
599  SCIP_Real** eigenvalues, /**< buffer to store pointer to array of eigenvalues of Q, or NULL */
600  SCIP_Real** eigenvectors /**< buffer to store pointer to array of eigenvectors of Q, or NULL */
601  );
602 
603 /** gives the data of a quadratic expression term
604  *
605  * 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
606  * `expr`, \f$a\f$, \f$b\f$, the number of summands, and indices of bilinear terms in the quadratic expressions `bilinexprterms`.
607  *
608  * This function returns pointers to internal data in adjbilin.
609  * The user must not change this data.
610  */
611 SCIP_EXPORT
613  SCIP_EXPR* quadexpr, /**< quadratic expression */
614  int termidx, /**< index of quadratic term */
615  SCIP_EXPR** expr, /**< buffer to store pointer to argument expression (the 'x') of this term, or NULL */
616  SCIP_Real* lincoef, /**< buffer to store linear coefficient of variable, or NULL */
617  SCIP_Real* sqrcoef, /**< buffer to store square coefficient of variable, or NULL */
618  int* nadjbilin, /**< buffer to store number of bilinear terms this variable is involved in, or NULL */
619  int** adjbilin, /**< buffer to store pointer to indices of associated bilinear terms, or NULL */
620  SCIP_EXPR** sqrexpr /**< buffer to store pointer to square expression (the 'x^2') of this term or NULL if no square expression, or NULL */
621  );
622 
623 /** gives the data of a bilinear expression term
624  *
625  * For a term a*expr1*expr2, returns expr1, expr2, a, and
626  * the position of the quadratic expression term that uses expr2 in the quadratic expressions `quadexprterms`.
627  */
628 SCIP_EXPORT
630  SCIP_EXPR* expr, /**< quadratic expression */
631  int termidx, /**< index of bilinear term */
632  SCIP_EXPR** expr1, /**< buffer to store first factor, or NULL */
633  SCIP_EXPR** expr2, /**< buffer to store second factor, or NULL */
634  SCIP_Real* coef, /**< buffer to coefficient, or NULL */
635  int* pos2, /**< buffer to position of expr2 in quadexprterms array of quadratic expression, or NULL */
636  SCIP_EXPR** prodexpr /**< buffer to store pointer to expression that is product if first and second factor, or NULL */
637  );
638 
639 /** returns whether all expressions that are used in a quadratic expression are variable expressions
640  *
641  * @return TRUE iff all `linexprs` and `quadexprterms[.].expr` are variable expressions
642  */
643 SCIP_EXPORT
645  SCIP_EXPR* expr /**< quadratic expression */
646  );
647 
648 /** @} */
649 
650 #ifdef NDEBUG
651 #define SCIPexprGetNUses(expr) (expr)->nuses
652 #define SCIPexprGetNChildren(expr) (expr)->nchildren
653 #define SCIPexprGetChildren(expr) (expr)->children
654 #define SCIPexprGetHdlr(expr) (expr)->exprhdlr
655 #define SCIPexprGetData(expr) (expr)->exprdata
656 #define SCIPexprSetData(expr, exprdata_) (expr)->exprdata = exprdata_
657 #define SCIPexprGetOwnerData(expr) (expr)->ownerdata
658 #define SCIPexprGetEvalValue(expr) (expr)->evalvalue
659 #define SCIPexprGetEvalTag(expr) (expr)->evaltag
660 #define SCIPexprGetDerivative(expr) (expr)->derivative
661 #define SCIPexprGetDot(expr) (expr)->dot
662 #define SCIPexprGetBardot(expr) (expr)->bardot
663 #define SCIPexprGetDiffTag(expr) (expr)->difftag
664 #define SCIPexprGetActivity(expr) (expr)->activity
665 #define SCIPexprGetActivityTag(expr) (expr)->activitytag
666 #define SCIPexprSetActivity(expr, activity_, activitytag_) do { (expr)->activity = activity_; (expr)->activitytag = activitytag_; } while (FALSE)
667 #define SCIPexprGetCurvature(expr) (expr)->curvature
668 #define SCIPexprSetCurvature(expr, curvature_) (expr)->curvature = curvature_
669 #define SCIPexprIsIntegral(expr) (expr)->isintegral
670 #define SCIPexprSetIntegrality(expr, isintegral_) expr->isintegral = isintegral_
671 #define SCIPexprAreQuadraticExprsVariables(expr) (expr)->quaddata->allexprsarevars
672 #endif
673 
674 /**@name Core Expression Handlers */
675 /**@{ */
676 /* these are here to have them accessible also in the expr core
677  * so these cannot make use of SCIP pointer
678  */
679 
680 /** gets the variable of a variable expression */
681 SCIP_EXPORT
683  SCIP_EXPR* expr /**< var expression */
684  );
685 
686 /** gets the value of a constant value expression */
687 SCIP_EXPORT
689  SCIP_EXPR* expr /**< value expression */
690  );
691 
692 /** gets the coefficients of a summation expression */
693 SCIP_EXPORT
695  SCIP_EXPR* expr /**< sum expression */
696  );
697 
698 /** gets the constant of a summation expression */
699 SCIP_EXPORT
701  SCIP_EXPR* expr /**< sum expression */
702  );
703 
704 /** gets the constant coefficient of a product expression */
705 SCIP_EXPORT
707  SCIP_EXPR* expr /**< product expression */
708  );
709 
710 /** gets the exponent of a power or signed power expression */
711 SCIP_EXPORT
713  SCIP_EXPR* expr /**< (signed) power expression */
714  );
715 
716 #ifdef NDEBUG
717 #define SCIPgetVarExprVar(expr) ((SCIP_VAR*)SCIPexprGetData(expr))
718 #endif
719 
720 /**@} */
721 
722 
723 /**@name Expression Iterator
724  *
725  * @anchor SCIP_EXPRITER_DFS
726  * More details on the DFS mode:
727  * Many algorithms over expression trees need to traverse the tree in depth-first manner and a
728  * natural way of implementing these algorithms is by using recursion.
729  * In general, a function which traverses the tree in depth-first looks like
730  * <pre>
731  * fun( expr )
732  * enterexpr()
733  * continue skip or abort
734  * for( child in expr->children )
735  * visitingchild()
736  * continue skip or abort
737  * fun(child, data, proceed)
738  * visitedchild()
739  * continue skip or abort
740  * leaveexpr()
741  * </pre>
742  * Given that some expressions might be quite deep we provide this functionality in an iterative fashion.
743  *
744  * Consider an expression (x*y) + z + log(x-y).
745  * The corresponding expression graph is
746  * <pre>
747  * [+]
748  * / | \
749  * [*] | [log]
750  * / \ | |
751  * / \ | [-]
752  * | | | / \
753  * [x] [y] [z] [x] [y]
754  * </pre>
755  * (where [x] and [y] are actually the same expression).
756  *
757  * If a pointer to the [+] expression is given as root to this expression, it will iterate
758  * the graph in a depth-first manner and stop at various stages.
759  * - When entering an expression, it stops in the \ref SCIP_EXPRITER_ENTEREXPR stage.
760  * The SCIPexpriterGetParentDFS() function indicates from where the expression has been entered (NULL for the root expression).
761  * - Before visiting a child of an expression, it stops in the \ref SCIP_EXPRITER_VISITINGCHILD stage.
762  * The SCIPexpriterGetChildIdxDFS() function returns which child will be visited (as an index in the current expr's children array).
763  * Use SCIPexpriterGetChildExprDFS() to obtain the corresponding expression.
764  * - When returning from visiting a child of an expression, it stops in the \ref SCIP_EXPRITER_VISITEDCHILD stage.
765  * Again the SCIPexpriterGetChildExprDFS() function returns which child has been visited.
766  * - When leaving an expression, it stops in the \ref SCIP_EXPRITER_LEAVEEXPR stage.
767  *
768  * Thus, for the above expression, the expression are visited in the following order and stages:
769  * - `enterexpr([+])`
770  * - `visitingchild([+])`, currentchild = 0
771  * - `enterexpr([*])`
772  * - `visitingchild([*])`, currentchild = 0
773  * - `enterexpr([x])`
774  * - `leaveexpr([x])`
775  * - `visitedchild([*])`, currentchild = 0
776  * - `visitingchild([*])`, currentchild = 1
777  * - `enterexpr([y])`
778  * - `leaveexpr([y])`
779  * - `visitedchild([*])`, currentchild = 1
780  * - `leaveexpr([*])`
781  * - `visitedchild([+])`, currentchild = 0
782  * - `visitingchild([+])`, currentchild = 1
783  * - `enterexpr([z])`
784  * - `leaveexpr([z])`
785  * - `visitedchild([+])`, currentchild = 1
786  * - `visitingchild([+])`, currentchild = 2
787  * - `enterexpr([log])`
788  * - `visitingchild([log])`, currentchild = 0
789  * - `enterexpr([-])`
790  * - `visitingchild([-])`, currentchild = 0
791  * - `enterexpr([x])`
792  * - `leaveexpr([x])`
793  * - `visitedchild([-])`, currentchild = 0
794  * - `visitingchild([-])`, currentchild = 1
795  * - `enterexpr([y])`
796  * - `leaveexpr([y])`
797  * - `visitedchild([-])`, currentchild = 1
798  * - `leaveexpr([-])`
799  * - `visitedchild([log])`, currentchild = 0
800  * - `leaveexpr([log])`
801  * - `visitedchild([+])` currentchild = 2
802  * - `leaveexpr([+])`
803  *
804  * The caller can direct the iterator to skip parts of the tree:
805  * - 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.
806  * - If calling SCIPexpriterSkipDFS() in SCIP_EXPRITER_VISITINGCHILD stage, visiting the current child will be skipped.
807  * - If calling SCIPexpriterSkipDFS() in SCIP_EXPRITER_VISITEDCHILD child, visiting the remaining children will be skipped.
808  *
809  * @{
810  */
811 
812 /** returns whether expression iterator is currently initialized */
813 SCIP_EXPORT
815  SCIP_EXPRITER* iterator /**< expression iterator */
816  );
817 
818 /** initializes an expression iterator
819  *
820  * @note If `expr` is NULL, then iterator will be set into ended-state (SCIPexpriterIsEnd() is TRUE). Useful if following with SCIPexpriterRestartDFS().
821  *
822  * If type is DFS, then `stopstages` will be set to \ref SCIP_EXPRITER_ENTEREXPR.
823  * Use `SCIPexpriterSetStagesDFS` to change this.
824  */
825 SCIP_EXPORT
827  SCIP_EXPRITER* iterator, /**< expression iterator */
828  SCIP_EXPR* expr, /**< expression of the iterator, can be NULL */
829  SCIP_EXPRITER_TYPE type, /**< type of expression iterator */
830  SCIP_Bool allowrevisit /**< whether expression are allowed to be visited more than once */
831  );
832 
833 /** restarts an already initialized expression iterator in DFS mode
834  *
835  * The expression iterator will continue from the given expression, not revisiting expressions that
836  * this iterator has already been visited (if initialized with `allowrevisit=FALSE`) and giving access
837  * to the same iterator specified expression data that may have been set already.
838  * Also the stop-stages are not reset.
839  *
840  * If revisiting is forbidden and given expr has already been visited, then the iterator will behave
841  * as on the end of iteration (SCIPexpriterIsEnd() is TRUE).
842  * If the enterexpr stage is not one of the stop stages, then the iterator will be moved forward
843  * (SCIPexpriterGetNext() is called).
844  *
845  * @return The current expression.
846  */
847 SCIP_EXPORT
849  SCIP_EXPRITER* iterator, /**< expression iterator */
850  SCIP_EXPR* expr /**< expression of the iterator */
851  );
852 
853 /** specifies in which stages to stop a DFS iterator
854  *
855  * Parameter `stopstages` should be a bitwise OR of different \ref SCIP_EXPRITER_STAGE values
856  *
857  * If the current stage is not one of the `stopstages`, then the iterator will be moved on.
858  */
859 SCIP_EXPORT
861  SCIP_EXPRITER* iterator, /**< expression iterator */
862  SCIP_EXPRITER_STAGE stopstages /**< the stages in which to stop when iterating via DFS */
863  );
864 
865 /** gets the current expression that the expression iterator points to */
866 SCIP_EXPORT
868  SCIP_EXPRITER* iterator /**< expression iterator */
869  );
870 
871 /** gets the current stage that the expression iterator is in when using DFS
872  *
873  * If the iterator has finished (SCIPexpriterIsEnd() is TRUE), then the stage is undefined.
874  */
875 SCIP_EXPORT
877  SCIP_EXPRITER* iterator /**< expression iterator */
878  );
879 
880 /** 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 */
881 SCIP_EXPORT
883  SCIP_EXPRITER* iterator /**< expression iterator */
884  );
885 
886 /** gets the child expression that the expression iterator considers when in DFS mode and stage \ref SCIP_EXPRITER_VISITINGCHILD or \ref SCIP_EXPRITER_VISITEDCHILD */
887 SCIP_EXPORT
889  SCIP_EXPRITER* iterator /**< expression iterator */
890  );
891 
892 /** gives the parent of the current expression of an expression iteration if in DFS mode
893  *
894  * @return the expression from which the current expression has been accessed
895  */
896 SCIP_EXPORT
898  SCIP_EXPRITER* iterator /**< expression iterator */
899  );
900 
901 /** gives the iterator specific user data of the current expression
902  *
903  * @note The expression iterator mode must be DFS or another mode with allowrevisit=FALSE
904  */
905 SCIP_EXPORT
907  SCIP_EXPRITER* iterator /**< expression iterator */
908  );
909 
910 /** gives the iterator specific user data of the current expressions current child
911  *
912  * @note The expression iterator mode must be in DFS mode and stage \ref SCIP_EXPRITER_VISITINGCHILD or \ref SCIP_EXPRITER_VISITEDCHILD
913  */
914 SCIP_EXPORT
916  SCIP_EXPRITER* iterator /**< expression iterator */
917  );
918 
919 /** gives the iterator specific user data of a given expression
920  *
921  * @note The expression iterator mode must be DFS or another mode with allowrevisit=FALSE
922  */
923 SCIP_EXPORT
925  SCIP_EXPRITER* iterator, /**< expression iterator */
926  SCIP_EXPR* expr /**< expression for which to get the userdata of this iterator */
927  );
928 
929 /** sets the iterator specific user data of the current expression for an expression iteration if in DFS mode
930  *
931  * @note The expression iterator mode must be DFS or another mode with allowrevisit=FALSE
932  */
933 SCIP_EXPORT
935  SCIP_EXPRITER* iterator, /**< expression iterator */
936  SCIP_EXPRITER_USERDATA userdata /**< data to be stored */
937  );
938 
939 /** sets the iterator specific user data of a given expression
940  *
941  * @note The expression iterator mode must be DFS or another mode with allowrevisit=FALSE
942  */
943 SCIP_EXPORT
945  SCIP_EXPRITER* iterator, /**< expression iterator */
946  SCIP_EXPR* expr, /**< expression where to set iterator data */
947  SCIP_EXPRITER_USERDATA userdata /**< data to be stored in current child */
948  );
949 
950 /** sets the iterator specific user data of the current expressions current child
951  *
952  * @note The expression iterator mode must be in DFS mode and stage \ref SCIP_EXPRITER_VISITINGCHILD or \ref SCIP_EXPRITER_VISITEDCHILD
953  */
954 SCIP_EXPORT
956  SCIP_EXPRITER* iterator, /**< expression iterator */
957  SCIP_EXPRITER_USERDATA userdata /**< data to be stored in current child */
958  );
959 
960 /** moves the iterator to the next expression according to the mode of the expression iterator
961  *
962  * @return the next expression, if any, and NULL otherwise
963  */
964 SCIP_EXPORT
966  SCIP_EXPRITER* iterator /**< expression iterator */
967  );
968 
969 /** moves a DFS iterator to one of the next expressions
970  *
971  * - If in \ref SCIP_EXPRITER_ENTEREXPR stage, then all children of that expression will be skipped.
972  * 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).
973  * - 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).
974  * - 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).
975  * - It is not allowed to call this function when in \ref SCIP_EXPRITER_LEAVEEXPR stage.
976  *
977  * @return the next expression, if any, and NULL otherwise
978  */
979 SCIP_EXPORT
981  SCIP_EXPRITER* iterator /**< expression iterator */
982  );
983 
984 /** returns whether the iterator visited all expressions already */
985 SCIP_EXPORT
987  SCIP_EXPRITER* iterator /**< expression iterator */
988  );
989 
990 #ifdef NDEBUG
991 #define SCIPexpriterIsInit(iterator) (iterator)->initialized
992 #define SCIPexpriterGetCurrent(iterator) (iterator)->curr
993 #define SCIPexpriterGetStageDFS(iterator) (iterator)->dfsstage
994 #define SCIPexpriterGetChildIdxDFS(iterator) (iterator)->curr->iterdata[(iterator)->iterindex].currentchild
995 #define SCIPexpriterGetChildExprDFS(iterator) (iterator)->curr->children[(iterator)->curr->iterdata[(iterator)->iterindex].currentchild]
996 #define SCIPexpriterGetParentDFS(iterator) (iterator)->curr->iterdata[(iterator)->iterindex].parent
997 #define SCIPexpriterGetCurrentUserData(iterator) (iterator)->curr->iterdata[(iterator)->iterindex].userdata
998 #define SCIPexpriterGetChildUserDataDFS(iterator) (iterator)->curr->children[(iterator)->curr->iterdata[(iterator)->iterindex].currentchild]->iterdata[(iterator)->iterindex].userdata
999 #define SCIPexpriterGetExprUserData(iterator, expr) (expr)->iterdata[(iterator)->iterindex].userdata
1000 #define SCIPexpriterSetCurrentUserData(iterator, userdata_) (iterator)->curr->iterdata[(iterator)->iterindex].userdata = userdata_
1001 #define SCIPexpriterSetExprUserData(iterator, expr, userdata_) (expr)->iterdata[(iterator)->iterindex].userdata = userdata_
1002 #define SCIPexpriterSetChildUserData(iterator, userdata_) (iterator)->curr->children[(iterator)->curr->iterdata[(iterator)->iterindex].currentchild]->iterdata[(iterator)->iterindex].userdata = userdata_
1003 #define SCIPexpriterIsEnd(iterator) ((iterator)->curr == NULL)
1004 #endif
1005 
1006 /** @} */
1007 
1008 /**@name Function Curvature */
1009 /**@{ */
1010 
1011 /** gives curvature for a sum of two functions with given curvature */
1012 SCIP_EXPORT
1014  SCIP_EXPRCURV curv1, /**< curvature of first summand */
1015  SCIP_EXPRCURV curv2 /**< curvature of second summand */
1016  );
1017 
1018 /** gives the curvature for the negation of a function with given curvature */
1019 SCIP_EXPORT
1021  SCIP_EXPRCURV curvature /**< curvature of function */
1022  );
1023 
1024 /** gives curvature for a functions with given curvature multiplied by a constant factor */
1025 SCIP_EXPORT
1027  SCIP_Real factor, /**< constant factor */
1028  SCIP_EXPRCURV curvature /**< curvature of other factor */
1029  );
1030 
1031 /** gives curvature for base^exponent for given bounds and curvature of base-function and constant exponent */
1032 SCIP_EXPORT
1034  SCIP_INTERVAL basebounds, /**< bounds on base function */
1035  SCIP_EXPRCURV basecurv, /**< curvature of base function */
1036  SCIP_Real exponent /**< exponent */
1037  );
1038 
1039 /** gives required curvature for base so that base^exponent has given curvature under given bounds on base and constant exponent
1040  *
1041  * returns curvature unknown if expected curvature cannot be obtained
1042  */
1043 SCIP_EXPORT
1045  SCIP_INTERVAL basebounds, /**< bounds on base function */
1046  SCIP_Real exponent, /**< exponent, must not be 0 */
1047  SCIP_EXPRCURV powercurv /**< expected curvature for power */
1048  );
1049 
1050 /** gives curvature for a monomial with given curvatures and bounds for each factor
1051  *
1052  * See Maranas and Floudas, Finding All Solutions of Nonlinearly Constrained Systems of Equations, JOGO 7, 1995
1053  * for the categorization in the case that all factors are linear.
1054  *
1055  * Exponents can also be negative or rational.
1056  */
1057 SCIP_EXPORT
1059  int nfactors, /**< number of factors in monomial */
1060  SCIP_Real* exponents, /**< exponents in monomial, or NULL if all 1.0 */
1061  int* factoridxs, /**< indices of factors, or NULL if identity mapping */
1062  SCIP_EXPRCURV* factorcurv, /**< curvature of each factor */
1063  SCIP_INTERVAL* factorbounds /**< bounds of each factor */
1064  );
1065 
1066 /** 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
1067  *
1068  * @return whether `monomialcurv` can be achieved
1069  */
1070 SCIP_EXPORT
1072  SCIP_EXPRCURV monomialcurv, /**< desired curvature */
1073  int nfactors, /**< number of factors in monomial */
1074  SCIP_Real* exponents, /**< exponents in monomial, or NULL if all 1.0 */
1075  SCIP_INTERVAL* factorbounds, /**< bounds of each factor */
1076  SCIP_EXPRCURV* factorcurv /**< buffer to store required curvature of each factor */
1077  );
1078 
1079 /** gives name as string for a curvature */
1080 SCIP_EXPORT
1081 const char* SCIPexprcurvGetName(
1082  SCIP_EXPRCURV curv /**< curvature */
1083  );
1084 
1085 #ifdef NDEBUG
1086 #define SCIPexprcurvAdd(curv1, curv2) ((SCIP_EXPRCURV) ((curv1) & (curv2)))
1087 #define SCIPexprcurvNegate(curvature) (((curvature) == SCIP_EXPRCURV_CONCAVE) ? SCIP_EXPRCURV_CONVEX : ((curvature) == SCIP_EXPRCURV_CONVEX) ? SCIP_EXPRCURV_CONCAVE : (curvature))
1088 #define SCIPexprcurvMultiply(factor, curvature) (((factor) == 0.0) ? SCIP_EXPRCURV_LINEAR : (factor) > 0.0 ? (curvature) : SCIPexprcurvNegate(curvature))
1089 #endif
1090 
1091 /**@} */
1092 
1093 /**@} */
1094 
1095 #ifdef __cplusplus
1096 }
1097 #endif
1098 
1099 #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:4057
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:4185
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:407
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:4104
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:4147
#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