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-2025 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 implied integrality of an expression */
    576SCIP_EXPORT
    578 SCIP_EXPR* expr /**< expression */
    579 );
    580
    581/** returns whether an expression is integral, i.e. whether the integrality flag is not equal to SCIP_IMPLINTTYPE_NONE */
    582SCIP_EXPORT
    584 SCIP_EXPR* expr /**< expression */
    585 );
    586
    587/** sets the integrality flag of an expression */
    588SCIP_EXPORT
    590 SCIP_EXPR* expr, /**< expression */
    591 SCIP_IMPLINTTYPE integrality /**< integrality level of the expression */
    592 );
    593
    594/** @} */
    595
    596/**@name Quadratic Expressions */
    597/**@{ */
    598
    599/** gives the coefficients and expressions that define a quadratic expression
    600 *
    601 * It can return the constant part, the number, arguments, and coefficients of the purely linear part
    602 * and the number of quadratic terms and bilinear terms.
    603 * Note that for arguments that appear in the quadratic part, a linear coefficient is
    604 * stored with the quadratic term.
    605 * Use SCIPexprGetQuadraticQuadTerm() and SCIPexprGetQuadraticBilinTerm()
    606 * to access the data for a quadratic or bilinear term.
    607 *
    608 * It can also return the eigenvalues and the eigenvectors of the matrix \f$Q\f$ when the quadratic is written
    609 * 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.
    610 * Note, however, that to have access to them one needs to call SCIPcomputeExprQuadraticCurvature()
    611 * with `storeeigeninfo=TRUE`. If the eigen information was not stored or it failed to be computed,
    612 * `eigenvalues` and `eigenvectors` will be set to NULL.
    613 *
    614 * This function returns pointers to internal data in linexprs and lincoefs.
    615 * The user must not change this data.
    616 *
    617 * @attention SCIPcheckExprQuadratic() needs to be called first to check whether expression is quadratic and initialize the data of the quadratic representation.
    618 */
    619SCIP_EXPORT
    621 SCIP_EXPR* expr, /**< quadratic expression */
    622 SCIP_Real* constant, /**< buffer to store constant term, or NULL */
    623 int* nlinexprs, /**< buffer to store number of expressions that appear linearly, or NULL */
    624 SCIP_EXPR*** linexprs, /**< buffer to store pointer to array of expressions that appear linearly, or NULL */
    625 SCIP_Real** lincoefs, /**< buffer to store pointer to array of coefficients of expressions that appear linearly, or NULL */
    626 int* nquadexprs, /**< buffer to store number of expressions in quadratic terms, or NULL */
    627 int* nbilinexprs, /**< buffer to store number of bilinear expressions terms, or NULL */
    628 SCIP_Real** eigenvalues, /**< buffer to store pointer to array of eigenvalues of Q, or NULL */
    629 SCIP_Real** eigenvectors /**< buffer to store pointer to array of eigenvectors of Q, or NULL */
    630 );
    631
    632/** gives the data of a quadratic expression term
    633 *
    634 * 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
    635 * `expr`, \f$a\f$, \f$b\f$, the number of summands, and indices of bilinear terms in the quadratic expressions `bilinexprterms`.
    636 *
    637 * This function returns pointers to internal data in adjbilin.
    638 * The user must not change this data.
    639 */
    640SCIP_EXPORT
    642 SCIP_EXPR* quadexpr, /**< quadratic expression */
    643 int termidx, /**< index of quadratic term */
    644 SCIP_EXPR** expr, /**< buffer to store pointer to argument expression (the 'x') of this term, or NULL */
    645 SCIP_Real* lincoef, /**< buffer to store linear coefficient of variable, or NULL */
    646 SCIP_Real* sqrcoef, /**< buffer to store square coefficient of variable, or NULL */
    647 int* nadjbilin, /**< buffer to store number of bilinear terms this variable is involved in, or NULL */
    648 int** adjbilin, /**< buffer to store pointer to indices of associated bilinear terms, or NULL */
    649 SCIP_EXPR** sqrexpr /**< buffer to store pointer to square expression (the 'x^2') of this term or NULL if no square expression, or NULL */
    650 );
    651
    652/** gives the data of a bilinear expression term
    653 *
    654 * For a term a*expr1*expr2, returns expr1, expr2, a, and
    655 * the position of the quadratic expression term that uses expr2 in the quadratic expressions `quadexprterms`.
    656 */
    657SCIP_EXPORT
    659 SCIP_EXPR* expr, /**< quadratic expression */
    660 int termidx, /**< index of bilinear term */
    661 SCIP_EXPR** expr1, /**< buffer to store first factor, or NULL */
    662 SCIP_EXPR** expr2, /**< buffer to store second factor, or NULL */
    663 SCIP_Real* coef, /**< buffer to coefficient, or NULL */
    664 int* pos2, /**< buffer to position of expr2 in quadexprterms array of quadratic expression, or NULL */
    665 SCIP_EXPR** prodexpr /**< buffer to store pointer to expression that is product if first and second factor, or NULL */
    666 );
    667
    668/** returns whether all expressions that are used in a quadratic expression are variable expressions
    669 *
    670 * @return TRUE iff all `linexprs` and `quadexprterms[.].expr` are variable expressions
    671 */
    672SCIP_EXPORT
    674 SCIP_EXPR* expr /**< quadratic expression */
    675 );
    676
    677/** @} */
    678
    679#ifdef NDEBUG
    680#define SCIPexprGetNUses(expr) (expr)->nuses
    681#define SCIPexprGetNChildren(expr) (expr)->nchildren
    682#define SCIPexprGetChildren(expr) (expr)->children
    683#define SCIPexprGetHdlr(expr) (expr)->exprhdlr
    684#define SCIPexprGetData(expr) (expr)->exprdata
    685#define SCIPexprSetData(expr, exprdata_) (expr)->exprdata = exprdata_
    686#define SCIPexprGetOwnerData(expr) (expr)->ownerdata
    687#define SCIPexprGetEvalValue(expr) (expr)->evalvalue
    688#define SCIPexprGetEvalTag(expr) (expr)->evaltag
    689#define SCIPexprGetDerivative(expr) (expr)->derivative
    690#define SCIPexprGetDot(expr) (expr)->dot
    691#define SCIPexprGetBardot(expr) (expr)->bardot
    692#define SCIPexprGetDiffTag(expr) (expr)->difftag
    693#define SCIPexprGetActivity(expr) (expr)->activity
    694#define SCIPexprGetActivityTag(expr) (expr)->activitytag
    695#define SCIPexprSetActivity(expr, activity_, activitytag_) do { (expr)->activity = activity_; (expr)->activitytag = activitytag_; } while (FALSE)
    696#define SCIPexprGetCurvature(expr) (expr)->curvature
    697#define SCIPexprSetCurvature(expr, curvature_) (expr)->curvature = curvature_
    698#define SCIPexprGetIntegrality(expr) (expr)->integrality
    699#define SCIPexprIsIntegral(expr) ((expr)->integrality != SCIP_IMPLINTTYPE_NONE)
    700#define SCIPexprSetIntegrality(expr, integrality_) (expr)->integrality = integrality_
    701#define SCIPexprAreQuadraticExprsVariables(expr) (expr)->quaddata->allexprsarevars
    702#endif
    703
    704/**@name Core Expression Handlers */
    705/**@{ */
    706/* these are here to have them accessible also in the expr core
    707 * so these cannot make use of SCIP pointer
    708 */
    709
    710/** gets the variable of a variable expression */
    711SCIP_EXPORT
    713 SCIP_EXPR* expr /**< var expression */
    714 );
    715
    716/** gets the value of a constant value expression */
    717SCIP_EXPORT
    719 SCIP_EXPR* expr /**< value expression */
    720 );
    721
    722/** gets the coefficients of a summation expression */
    723SCIP_EXPORT
    725 SCIP_EXPR* expr /**< sum expression */
    726 );
    727
    728/** gets the constant of a summation expression */
    729SCIP_EXPORT
    731 SCIP_EXPR* expr /**< sum expression */
    732 );
    733
    734/** gets the constant coefficient of a product expression */
    735SCIP_EXPORT
    737 SCIP_EXPR* expr /**< product expression */
    738 );
    739
    740/** gets the exponent of a power or signed power expression */
    741SCIP_EXPORT
    743 SCIP_EXPR* expr /**< (signed) power expression */
    744 );
    745
    746#ifdef NDEBUG
    747#define SCIPgetVarExprVar(expr) ((SCIP_VAR*)SCIPexprGetData(expr))
    748#endif
    749
    750/**@} */
    751
    752
    753/**@name Expression Iterator
    754 *
    755 * @anchor SCIP_EXPRITER_DFS
    756 * More details on the DFS mode:
    757 * Many algorithms over expression trees need to traverse the tree in depth-first manner and a
    758 * natural way of implementing these algorithms is by using recursion.
    759 * In general, a function which traverses the tree in depth-first looks like
    760 * <pre>
    761 * fun( expr )
    762 * enterexpr()
    763 * continue skip or abort
    764 * for( child in expr->children )
    765 * visitingchild()
    766 * continue skip or abort
    767 * fun(child, data, proceed)
    768 * visitedchild()
    769 * continue skip or abort
    770 * leaveexpr()
    771 * </pre>
    772 * Given that some expressions might be quite deep we provide this functionality in an iterative fashion.
    773 *
    774 * Consider an expression (x*y) + z + log(x-y).
    775 * The corresponding expression graph is
    776 * <pre>
    777 * [+]
    778 * / | \
    779 * [*] | [log]
    780 * / \ | |
    781 * / \ | [-]
    782 * | | | / \
    783 * [x] [y] [z] [x] [y]
    784 * </pre>
    785 * (where [x] and [y] are actually the same expression).
    786 *
    787 * If a pointer to the [+] expression is given as root to this expression, it will iterate
    788 * the graph in a depth-first manner and stop at various stages.
    789 * - When entering an expression, it stops in the \ref SCIP_EXPRITER_ENTEREXPR stage.
    790 * The SCIPexpriterGetParentDFS() function indicates from where the expression has been entered (NULL for the root expression).
    791 * - Before visiting a child of an expression, it stops in the \ref SCIP_EXPRITER_VISITINGCHILD stage.
    792 * The SCIPexpriterGetChildIdxDFS() function returns which child will be visited (as an index in the current expr's children array).
    793 * Use SCIPexpriterGetChildExprDFS() to obtain the corresponding expression.
    794 * - When returning from visiting a child of an expression, it stops in the \ref SCIP_EXPRITER_VISITEDCHILD stage.
    795 * Again the SCIPexpriterGetChildExprDFS() function returns which child has been visited.
    796 * - When leaving an expression, it stops in the \ref SCIP_EXPRITER_LEAVEEXPR stage.
    797 *
    798 * Thus, for the above expression, the expression are visited in the following order and stages:
    799 * - `enterexpr([+])`
    800 * - `visitingchild([+])`, currentchild = 0
    801 * - `enterexpr([*])`
    802 * - `visitingchild([*])`, currentchild = 0
    803 * - `enterexpr([x])`
    804 * - `leaveexpr([x])`
    805 * - `visitedchild([*])`, currentchild = 0
    806 * - `visitingchild([*])`, currentchild = 1
    807 * - `enterexpr([y])`
    808 * - `leaveexpr([y])`
    809 * - `visitedchild([*])`, currentchild = 1
    810 * - `leaveexpr([*])`
    811 * - `visitedchild([+])`, currentchild = 0
    812 * - `visitingchild([+])`, currentchild = 1
    813 * - `enterexpr([z])`
    814 * - `leaveexpr([z])`
    815 * - `visitedchild([+])`, currentchild = 1
    816 * - `visitingchild([+])`, currentchild = 2
    817 * - `enterexpr([log])`
    818 * - `visitingchild([log])`, currentchild = 0
    819 * - `enterexpr([-])`
    820 * - `visitingchild([-])`, currentchild = 0
    821 * - `enterexpr([x])`
    822 * - `leaveexpr([x])`
    823 * - `visitedchild([-])`, currentchild = 0
    824 * - `visitingchild([-])`, currentchild = 1
    825 * - `enterexpr([y])`
    826 * - `leaveexpr([y])`
    827 * - `visitedchild([-])`, currentchild = 1
    828 * - `leaveexpr([-])`
    829 * - `visitedchild([log])`, currentchild = 0
    830 * - `leaveexpr([log])`
    831 * - `visitedchild([+])` currentchild = 2
    832 * - `leaveexpr([+])`
    833 *
    834 * The caller can direct the iterator to skip parts of the tree:
    835 * - 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.
    836 * - If calling SCIPexpriterSkipDFS() in SCIP_EXPRITER_VISITINGCHILD stage, visiting the current child will be skipped.
    837 * - If calling SCIPexpriterSkipDFS() in SCIP_EXPRITER_VISITEDCHILD child, visiting the remaining children will be skipped.
    838 *
    839 * @{
    840 */
    841
    842/** returns whether expression iterator is currently initialized */
    843SCIP_EXPORT
    845 SCIP_EXPRITER* iterator /**< expression iterator */
    846 );
    847
    848/** initializes an expression iterator
    849 *
    850 * @note If `expr` is NULL, then iterator will be set into ended-state (SCIPexpriterIsEnd() is TRUE). Useful if following with SCIPexpriterRestartDFS().
    851 *
    852 * If type is DFS, then `stopstages` will be set to \ref SCIP_EXPRITER_ENTEREXPR.
    853 * Use `SCIPexpriterSetStagesDFS` to change this.
    854 */
    855SCIP_EXPORT
    857 SCIP_EXPRITER* iterator, /**< expression iterator */
    858 SCIP_EXPR* expr, /**< expression of the iterator, can be NULL */
    859 SCIP_EXPRITER_TYPE type, /**< type of expression iterator */
    860 SCIP_Bool allowrevisit /**< whether expression are allowed to be visited more than once */
    861 );
    862
    863/** restarts an already initialized expression iterator in DFS mode
    864 *
    865 * The expression iterator will continue from the given expression, not revisiting expressions that
    866 * this iterator has already been visited (if initialized with `allowrevisit=FALSE`) and giving access
    867 * to the same iterator specified expression data that may have been set already.
    868 * Also the stop-stages are not reset.
    869 *
    870 * If revisiting is forbidden and given expr has already been visited, then the iterator will behave
    871 * as on the end of iteration (SCIPexpriterIsEnd() is TRUE).
    872 * If the enterexpr stage is not one of the stop stages, then the iterator will be moved forward
    873 * (SCIPexpriterGetNext() is called).
    874 *
    875 * @return The current expression.
    876 */
    877SCIP_EXPORT
    879 SCIP_EXPRITER* iterator, /**< expression iterator */
    880 SCIP_EXPR* expr /**< expression of the iterator */
    881 );
    882
    883/** specifies in which stages to stop a DFS iterator
    884 *
    885 * Parameter `stopstages` should be a bitwise OR of different \ref SCIP_EXPRITER_STAGE values
    886 *
    887 * If the current stage is not one of the `stopstages`, then the iterator will be moved on.
    888 */
    889SCIP_EXPORT
    891 SCIP_EXPRITER* iterator, /**< expression iterator */
    892 SCIP_EXPRITER_STAGE stopstages /**< the stages in which to stop when iterating via DFS */
    893 );
    894
    895/** gets the current expression that the expression iterator points to */
    896SCIP_EXPORT
    898 SCIP_EXPRITER* iterator /**< expression iterator */
    899 );
    900
    901/** gets the current stage that the expression iterator is in when using DFS
    902 *
    903 * If the iterator has finished (SCIPexpriterIsEnd() is TRUE), then the stage is undefined.
    904 */
    905SCIP_EXPORT
    907 SCIP_EXPRITER* iterator /**< expression iterator */
    908 );
    909
    910/** 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 */
    911SCIP_EXPORT
    913 SCIP_EXPRITER* iterator /**< expression iterator */
    914 );
    915
    916/** gets the child expression that the expression iterator considers when in DFS mode and stage \ref SCIP_EXPRITER_VISITINGCHILD or \ref SCIP_EXPRITER_VISITEDCHILD */
    917SCIP_EXPORT
    919 SCIP_EXPRITER* iterator /**< expression iterator */
    920 );
    921
    922/** gives the parent of the current expression of an expression iteration if in DFS mode
    923 *
    924 * @return the expression from which the current expression has been accessed
    925 */
    926SCIP_EXPORT
    928 SCIP_EXPRITER* iterator /**< expression iterator */
    929 );
    930
    931/** gives the iterator specific user data of the current expression
    932 *
    933 * @note The expression iterator mode must be DFS or another mode with allowrevisit=FALSE
    934 */
    935SCIP_EXPORT
    937 SCIP_EXPRITER* iterator /**< expression iterator */
    938 );
    939
    940/** gives the iterator specific user data of the current expressions current child
    941 *
    942 * @note The expression iterator mode must be in DFS mode and stage \ref SCIP_EXPRITER_VISITINGCHILD or \ref SCIP_EXPRITER_VISITEDCHILD
    943 */
    944SCIP_EXPORT
    946 SCIP_EXPRITER* iterator /**< expression iterator */
    947 );
    948
    949/** gives the iterator specific user data of a given expression
    950 *
    951 * @note The expression iterator mode must be DFS or another mode with allowrevisit=FALSE
    952 */
    953SCIP_EXPORT
    955 SCIP_EXPRITER* iterator, /**< expression iterator */
    956 SCIP_EXPR* expr /**< expression for which to get the userdata of this iterator */
    957 );
    958
    959/** sets the iterator specific user data of the current expression for an expression iteration if in DFS mode
    960 *
    961 * @note The expression iterator mode must be DFS or another mode with allowrevisit=FALSE
    962 */
    963SCIP_EXPORT
    965 SCIP_EXPRITER* iterator, /**< expression iterator */
    966 SCIP_EXPRITER_USERDATA userdata /**< data to be stored */
    967 );
    968
    969/** sets the iterator specific user data of a given expression
    970 *
    971 * @note The expression iterator mode must be DFS or another mode with allowrevisit=FALSE
    972 */
    973SCIP_EXPORT
    975 SCIP_EXPRITER* iterator, /**< expression iterator */
    976 SCIP_EXPR* expr, /**< expression where to set iterator data */
    977 SCIP_EXPRITER_USERDATA userdata /**< data to be stored in current child */
    978 );
    979
    980/** sets the iterator specific user data of the current expressions current child
    981 *
    982 * @note The expression iterator mode must be in DFS mode and stage \ref SCIP_EXPRITER_VISITINGCHILD or \ref SCIP_EXPRITER_VISITEDCHILD
    983 */
    984SCIP_EXPORT
    986 SCIP_EXPRITER* iterator, /**< expression iterator */
    987 SCIP_EXPRITER_USERDATA userdata /**< data to be stored in current child */
    988 );
    989
    990/** moves the iterator to the next expression according to the mode of the expression iterator
    991 *
    992 * @return the next expression, if any, and NULL otherwise
    993 */
    994SCIP_EXPORT
    996 SCIP_EXPRITER* iterator /**< expression iterator */
    997 );
    998
    999/** moves a DFS iterator to one of the next expressions
    1000 *
    1001 * - If in \ref SCIP_EXPRITER_ENTEREXPR stage, then all children of that expression will be skipped.
    1002 * 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).
    1003 * - 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).
    1004 * - 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).
    1005 * - It is not allowed to call this function when in \ref SCIP_EXPRITER_LEAVEEXPR stage.
    1006 *
    1007 * @return the next expression, if any, and NULL otherwise
    1008 */
    1009SCIP_EXPORT
    1011 SCIP_EXPRITER* iterator /**< expression iterator */
    1012 );
    1013
    1014/** returns whether the iterator visited all expressions already */
    1015SCIP_EXPORT
    1017 SCIP_EXPRITER* iterator /**< expression iterator */
    1018 );
    1019
    1020#ifdef NDEBUG
    1021#define SCIPexpriterIsInit(iterator) (iterator)->initialized
    1022#define SCIPexpriterGetCurrent(iterator) (iterator)->curr
    1023#define SCIPexpriterGetStageDFS(iterator) (iterator)->dfsstage
    1024#define SCIPexpriterGetChildIdxDFS(iterator) (iterator)->curr->iterdata[(iterator)->iterindex].currentchild
    1025#define SCIPexpriterGetChildExprDFS(iterator) (iterator)->curr->children[(iterator)->curr->iterdata[(iterator)->iterindex].currentchild]
    1026#define SCIPexpriterGetParentDFS(iterator) (iterator)->curr->iterdata[(iterator)->iterindex].parent
    1027#define SCIPexpriterGetCurrentUserData(iterator) (iterator)->curr->iterdata[(iterator)->iterindex].userdata
    1028#define SCIPexpriterGetChildUserDataDFS(iterator) (iterator)->curr->children[(iterator)->curr->iterdata[(iterator)->iterindex].currentchild]->iterdata[(iterator)->iterindex].userdata
    1029#define SCIPexpriterGetExprUserData(iterator, expr) (expr)->iterdata[(iterator)->iterindex].userdata
    1030#define SCIPexpriterSetCurrentUserData(iterator, userdata_) (iterator)->curr->iterdata[(iterator)->iterindex].userdata = userdata_
    1031#define SCIPexpriterSetExprUserData(iterator, expr, userdata_) (expr)->iterdata[(iterator)->iterindex].userdata = userdata_
    1032#define SCIPexpriterSetChildUserData(iterator, userdata_) (iterator)->curr->children[(iterator)->curr->iterdata[(iterator)->iterindex].currentchild]->iterdata[(iterator)->iterindex].userdata = userdata_
    1033#define SCIPexpriterIsEnd(iterator) ((iterator)->curr == NULL)
    1034#endif
    1035
    1036/** @} */
    1037
    1038/**@name Function Curvature */
    1039/**@{ */
    1040
    1041/** gives curvature for a sum of two functions with given curvature */
    1042SCIP_EXPORT
    1044 SCIP_EXPRCURV curv1, /**< curvature of first summand */
    1045 SCIP_EXPRCURV curv2 /**< curvature of second summand */
    1046 );
    1047
    1048/** gives the curvature for the negation of a function with given curvature */
    1049SCIP_EXPORT
    1051 SCIP_EXPRCURV curvature /**< curvature of function */
    1052 );
    1053
    1054/** gives curvature for a functions with given curvature multiplied by a constant factor */
    1055SCIP_EXPORT
    1057 SCIP_Real factor, /**< constant factor */
    1058 SCIP_EXPRCURV curvature /**< curvature of other factor */
    1059 );
    1060
    1061/** gives curvature for base^exponent for given bounds and curvature of base-function and constant exponent */
    1062SCIP_EXPORT
    1064 SCIP_INTERVAL basebounds, /**< bounds on base function */
    1065 SCIP_EXPRCURV basecurv, /**< curvature of base function */
    1066 SCIP_Real exponent /**< exponent */
    1067 );
    1068
    1069/** gives required curvature for base so that base^exponent has given curvature under given bounds on base and constant exponent
    1070 *
    1071 * returns curvature unknown if expected curvature cannot be obtained
    1072 */
    1073SCIP_EXPORT
    1075 SCIP_INTERVAL basebounds, /**< bounds on base function */
    1076 SCIP_Real exponent, /**< exponent, must not be 0 */
    1077 SCIP_EXPRCURV powercurv /**< expected curvature for power */
    1078 );
    1079
    1080/** gives curvature for a monomial with given curvatures and bounds for each factor
    1081 *
    1082 * See Maranas and Floudas, Finding All Solutions of Nonlinearly Constrained Systems of Equations, JOGO 7, 1995
    1083 * for the categorization in the case that all factors are linear.
    1084 *
    1085 * Exponents can also be negative or rational.
    1086 */
    1087SCIP_EXPORT
    1089 int nfactors, /**< number of factors in monomial */
    1090 SCIP_Real* exponents, /**< exponents in monomial, or NULL if all 1.0 */
    1091 int* factoridxs, /**< indices of factors, or NULL if identity mapping */
    1092 SCIP_EXPRCURV* factorcurv, /**< curvature of each factor */
    1093 SCIP_INTERVAL* factorbounds /**< bounds of each factor */
    1094 );
    1095
    1096/** 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
    1097 *
    1098 * @return whether `monomialcurv` can be achieved
    1099 */
    1100SCIP_EXPORT
    1102 SCIP_EXPRCURV monomialcurv, /**< desired curvature */
    1103 int nfactors, /**< number of factors in monomial */
    1104 SCIP_Real* exponents, /**< exponents in monomial, or NULL if all 1.0 */
    1105 SCIP_INTERVAL* factorbounds, /**< bounds of each factor */
    1106 SCIP_EXPRCURV* factorcurv /**< buffer to store required curvature of each factor */
    1107 );
    1108
    1109/** gives name as string for a curvature */
    1110SCIP_EXPORT
    1111const char* SCIPexprcurvGetName(
    1112 SCIP_EXPRCURV curv /**< curvature */
    1113 );
    1114
    1115#ifdef NDEBUG
    1116#define SCIPexprcurvAdd(curv1, curv2) ((SCIP_EXPRCURV) ((curv1) & (curv2)))
    1117#define SCIPexprcurvNegate(curvature) (((curvature) == SCIP_EXPRCURV_CONCAVE) ? SCIP_EXPRCURV_CONVEX : ((curvature) == SCIP_EXPRCURV_CONVEX) ? SCIP_EXPRCURV_CONCAVE : (curvature))
    1118#define SCIPexprcurvMultiply(factor, curvature) (((factor) == 0.0) ? SCIP_EXPRCURV_LINEAR : (factor) > 0.0 ? (curvature) : SCIPexprcurvNegate(curvature))
    1119#endif
    1120
    1121/**@} */
    1122
    1123/**@} */
    1124
    1125#ifdef __cplusplus
    1126}
    1127#endif
    1128
    1129#endif /* SCIP_PUB_EXPR_H_ */
    common defines and data types used in all packages of SCIP
    #define SCIP_Longint
    Definition: def.h:141
    #define SCIP_Bool
    Definition: def.h:91
    #define SCIP_Real
    Definition: def.h:156
    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:4054
    SCIP_IMPLINTTYPE SCIPexprGetIntegrality(SCIP_EXPR *expr)
    Definition: expr.c:4091
    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:3920
    int SCIPexprGetNChildren(SCIP_EXPR *expr)
    Definition: expr.c:3872
    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:4226
    SCIP_Real SCIPgetExponentExprPow(SCIP_EXPR *expr)
    Definition: expr_pow.c:3448
    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:4080
    SCIP_EXPR * SCIPexpriterSkipDFS(SCIP_EXPRITER *iterator)
    Definition: expriter.c:930
    SCIP_EXPR_OWNERDATA * SCIPexprGetOwnerData(SCIP_EXPR *expr)
    Definition: expr.c:3933
    SCIP_Real SCIPexprGetDerivative(SCIP_EXPR *expr)
    Definition: expr.c:3972
    SCIP_Longint SCIPexprGetEvalTag(SCIP_EXPR *expr)
    Definition: expr.c:3959
    SCIP_Bool SCIPexprIsIntegral(SCIP_EXPR *expr)
    Definition: expr.c:4101
    SCIP_Bool SCIPexprAreQuadraticExprsVariables(SCIP_EXPR *expr)
    Definition: expr.c:4262
    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:4141
    SCIP_Real * SCIPgetCoefsExprSum(SCIP_EXPR *expr)
    Definition: expr_sum.c:1554
    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:3986
    SCIP_EXPRDATA * SCIPexprGetData(SCIP_EXPR *expr)
    Definition: expr.c:3905
    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
    SCIP_EXPRCURV SCIPexprGetCurvature(SCIP_EXPR *expr)
    Definition: expr.c:4070
    SCIP_EXPR * SCIPexpriterGetParentDFS(SCIP_EXPRITER *iterator)
    Definition: expriter.c:740
    SCIP_Real SCIPgetValueExprValue(SCIP_EXPR *expr)
    Definition: expr_value.c:298
    void SCIPexpriterSetCurrentUserData(SCIP_EXPRITER *iterator, SCIP_EXPRITER_USERDATA userdata)
    Definition: expriter.c:806
    SCIP_Real SCIPexprGetEvalValue(SCIP_EXPR *expr)
    Definition: expr.c:3946
    SCIP_Longint SCIPexprGetActivityTag(SCIP_EXPR *expr)
    Definition: expr.c:4044
    SCIP_EXPR * SCIPexpriterGetNext(SCIP_EXPRITER *iterator)
    Definition: expriter.c:858
    SCIP_Real SCIPexprGetBardot(SCIP_EXPR *expr)
    Definition: expr.c:4000
    SCIP_EXPR ** SCIPexprGetChildren(SCIP_EXPR *expr)
    Definition: expr.c:3882
    SCIP_Real SCIPgetConstantExprSum(SCIP_EXPR *expr)
    Definition: expr_sum.c:1569
    SCIP_VAR * SCIPgetVarExprVar(SCIP_EXPR *expr)
    Definition: expr_var.c:424
    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:4028
    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:4186
    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
    void SCIPexprSetIntegrality(SCIP_EXPR *expr, SCIP_IMPLINTTYPE integrality)
    Definition: expr.c:4111
    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:3862
    SCIP_EXPRITER_USERDATA SCIPexpriterGetExprUserData(SCIP_EXPRITER *iterator, SCIP_EXPR *expr)
    Definition: expriter.c:790
    SCIP_Longint SCIPexprGetDiffTag(SCIP_EXPR *expr)
    Definition: expr.c:4015
    SCIP_EXPRCURV SCIPexprcurvNegate(SCIP_EXPRCURV curvature)
    Definition: exprcurv.c:62
    SCIP_EXPRHDLR * SCIPexprGetHdlr(SCIP_EXPR *expr)
    Definition: expr.c:3895
    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:659
    #define SCIP_DECL_EXPRINITESTIMATES(x)
    Definition: type_expr.h:610
    #define SCIP_DECL_EXPRBWFWDIFF(x)
    Definition: type_expr.h:522
    #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:451
    #define SCIP_DECL_EXPRINTEVAL(x)
    Definition: type_expr.h:541
    #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:412
    #define SCIP_DECL_EXPRSIMPLIFY(x)
    Definition: type_expr.h:634
    #define SCIP_DECL_EXPRFWDIFF(x)
    Definition: type_expr.h:482
    SCIP_EXPRITER_TYPE
    Definition: type_expr.h:715
    #define SCIP_DECL_EXPRHASH(x)
    Definition: type_expr.h:393
    #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:377
    #define SCIP_DECL_EXPRGETSYMDATA(x)
    Definition: type_expr.h:674
    #define SCIP_DECL_EXPRCOPYDATA(x)
    Definition: type_expr.h:249
    #define SCIP_DECL_EXPRESTIMATE(x)
    Definition: type_expr.h:577
    unsigned int SCIP_EXPRITER_STAGE
    Definition: type_expr.h:701
    type definitions for miscellaneous datastructures
    #define SCIP_DECL_SORTPTRCOMP(x)
    Definition: type_misc.h:189
    enum SCIP_Retcode SCIP_RETCODE
    Definition: type_retcode.h:63
    enum SCIP_ImplintType SCIP_IMPLINTTYPE
    Definition: type_var.h:117