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