SCIP

    Solving Constraint Integer Programs

    expr_log.c
    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-2026 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 expr_log.c
    26 * @ingroup DEFPLUGINS_EXPR
    27 * @brief logarithm expression handler
    28 * @author Stefan Vigerske
    29 * @author Benjamin Mueller
    30 * @author Ksenia Bestuzheva
    31 *
    32 */
    33
    34/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
    35
    36#include "scip/expr_value.h"
    37#include "scip/expr_log.h"
    38
    39#define EXPRHDLR_NAME "log"
    40#define EXPRHDLR_DESC "natural logarithm expression"
    41#define EXPRHDLR_PRECEDENCE 80000
    42#define EXPRHDLR_HASHKEY SCIPcalcFibHash(16273.0)
    43
    44/*
    45 * Data structures
    46 */
    47
    48/** expression handler data */
    49struct SCIP_ExprhdlrData
    50{
    51 SCIP_Real minzerodistance; /**< minimal distance from zero to enforce for child in bound tightening */
    52 SCIP_Bool warnedonpole; /**< whether we warned on enforcing a minimal non-zero bound for child */
    53};
    54
    55/*
    56 * Local methods
    57 */
    58
    59/** computes coefficients of secant of a logarithmic term */
    60static
    62 SCIP* scip, /**< SCIP data structure */
    63 SCIP_Real lb, /**< lower bound on variable */
    64 SCIP_Real ub, /**< upper bound on variable */
    65 SCIP_Real* lincoef, /**< buffer to add coefficient of secant */
    66 SCIP_Real* linconstant, /**< buffer to add constant of secant */
    67 SCIP_Bool* success /**< buffer to set to FALSE if secant has failed due to large numbers or unboundedness */
    68 )
    69{
    70 SCIP_Real coef;
    71 SCIP_Real constant;
    72
    73 assert(scip != NULL);
    74 assert(!SCIPisInfinity(scip, lb));
    75 assert(!SCIPisInfinity(scip, -ub));
    76 assert(SCIPisLE(scip, lb, ub));
    77 assert(lincoef != NULL);
    78 assert(linconstant != NULL);
    79 assert(success != NULL);
    80
    81 if( SCIPisLE(scip, lb, 0.0) || SCIPisInfinity(scip, ub) )
    82 {
    83 /* unboundedness */
    84 *success = FALSE;
    85 return;
    86 }
    87
    88 /* if lb and ub are too close use a safe secant */
    89 if( SCIPisEQ(scip, lb, ub) )
    90 {
    91 coef = 0.0;
    92 constant = log(ub);
    93 }
    94 else
    95 {
    96 coef = (log(ub) - log(lb)) / (ub - lb);
    97 constant = log(ub) - coef * ub;
    98 }
    99
    100 if( SCIPisInfinity(scip, REALABS(coef)) || SCIPisInfinity(scip, REALABS(constant)) )
    101 {
    102 *success = FALSE;
    103 return;
    104 }
    105
    106 *lincoef += coef;
    107 *linconstant += constant;
    108}
    109
    110/** computes coefficients of linearization of a logarithmic term in a reference point */
    111static
    113 SCIP* scip, /**< SCIP data structure */
    114 SCIP_Real refpoint, /**< point for which to compute value of linearization */
    115 SCIP_Bool isint, /**< whether corresponding variable is a discrete variable, and thus linearization could be moved */
    116 SCIP_Real* lincoef, /**< buffer to add coefficient of secant */
    117 SCIP_Real* linconstant, /**< buffer to add constant of secant */
    118 SCIP_Bool* success /**< buffer to set to FALSE if secant has failed due to large numbers or unboundedness */
    119 )
    120{
    121 SCIP_Real constant;
    122 SCIP_Real coef;
    123
    124 assert(scip != NULL);
    125 assert(lincoef != NULL);
    126 assert(linconstant != NULL);
    127 assert(success != NULL);
    128
    129 /* can not compute a valid cut if zero is contained in [lb,ub] */
    130 if( SCIPisInfinity(scip, REALABS(refpoint)) || SCIPisLE(scip, refpoint, 0.0) )
    131 {
    132 *success = FALSE;
    133 return;
    134 }
    135
    136 if( !isint || SCIPisIntegral(scip, refpoint) )
    137 {
    138 assert(refpoint != 0.0);
    139 coef = 1.0 / refpoint;
    140 constant = log(refpoint) - 1.0;
    141 }
    142 else
    143 {
    144 /* log(x) -> secant between f=floor(refpoint) and f+1 = log((f+1.0)/f) * x + log(f) - log((f+1.0)/f) * f */
    145 SCIP_Real f;
    146
    147 f = SCIPfloor(scip, refpoint);
    148 assert(f > 0.0);
    149
    150 coef = log((f+1.0) / f);
    151 constant = log(f) - coef * f;
    152 }
    153
    154 if( SCIPisInfinity(scip, REALABS(coef)) || SCIPisInfinity(scip, REALABS(constant)) )
    155 {
    156 *success = FALSE;
    157 return;
    158 }
    159
    160 *lincoef += coef;
    161 *linconstant += constant;
    162}
    163
    164/*
    165 * Callback methods of expression handler
    166 */
    167
    168/** simplifies a log expression
    169 *
    170 * Evaluates the logarithm function when its child is a value expression.
    171 *
    172 * TODO: split products ?
    173 * TODO: log(exp(*)) = *
    174 */
    175static
    177{ /*lint --e{715}*/
    178 SCIP_EXPR* child;
    179
    180 assert(scip != NULL);
    181 assert(expr != NULL);
    182 assert(simplifiedexpr != NULL);
    183 assert(SCIPexprGetNChildren(expr) == 1);
    184
    185 child = SCIPexprGetChildren(expr)[0];
    186 assert(child != NULL);
    187
    188 /* check for value expression */
    189 /* TODO better handling of non-positive value? */
    191 {
    192 assert(SCIPgetValueExprValue(child) > 0.0);
    193
    194 SCIP_CALL( SCIPcreateExprValue(scip, simplifiedexpr, log(SCIPgetValueExprValue(child)), ownercreate,
    195 ownercreatedata) );
    196 }
    197 else
    198 {
    199 *simplifiedexpr = expr;
    200
    201 /* we have to capture it, since it must simulate a "normal" simplified call in which a new expression is created */
    202 SCIPcaptureExpr(*simplifiedexpr);
    203 }
    204
    205 return SCIP_OKAY;
    206}
    207
    208/** expression handler copy callback */
    209static
    211{ /*lint --e{715}*/
    213
    214 return SCIP_OKAY;
    215}
    216
    217/** expression handler free callback */
    218static
    220{ /*lint --e{715}*/
    221 assert(exprhdlrdata != NULL);
    222 assert(*exprhdlrdata != NULL);
    223
    224 SCIPfreeBlockMemory(scip, exprhdlrdata);
    225
    226 return SCIP_OKAY;
    227}
    228
    229/** expression data copy callback */
    230static
    232{ /*lint --e{715}*/
    233 assert(targetexprdata != NULL);
    234 assert(sourceexpr != NULL);
    235 assert(SCIPexprGetData(sourceexpr) == NULL);
    236
    237 *targetexprdata = NULL;
    238
    239 return SCIP_OKAY;
    240}
    241
    242/** expression data free callback */
    243static
    245{ /*lint --e{715}*/
    246 assert(expr != NULL);
    247
    248 SCIPexprSetData(expr, NULL);
    249
    250 return SCIP_OKAY;
    251}
    252
    253/** expression parse callback */
    254static
    256{ /*lint --e{715}*/
    257 SCIP_EXPR* childexpr;
    258
    259 assert(expr != NULL);
    260
    261 /* parse child expression from remaining string */
    262 SCIP_CALL( SCIPparseExpr(scip, &childexpr, string, endstring, ownercreate, ownercreatedata) );
    263 assert(childexpr != NULL);
    264
    265 /* create logarithmic expression */
    266 SCIP_CALL( SCIPcreateExprLog(scip, expr, childexpr, ownercreate, ownercreatedata) );
    267 assert(*expr != NULL);
    268
    269 /* release child expression since it has been captured by the logarithmic expression */
    270 SCIP_CALL( SCIPreleaseExpr(scip, &childexpr) );
    271
    272 *success = TRUE;
    273
    274 return SCIP_OKAY;
    275}
    276
    277/** expression point evaluation callback */
    278static
    280{ /*lint --e{715}*/
    281 assert(expr != NULL);
    282 assert(SCIPexprGetData(expr) == NULL);
    283 assert(SCIPexprGetNChildren(expr) == 1);
    284 assert(SCIPexprGetEvalValue(SCIPexprGetChildren(expr)[0]) != SCIP_INVALID); /*lint !e777*/
    285
    286 /**! [SnippetExprEvalLog] */
    287 if( SCIPexprGetEvalValue(SCIPexprGetChildren(expr)[0]) <= 0.0 )
    288 {
    289 SCIPdebugMsg(scip, "invalid evaluation of logarithmic expression\n");
    290 *val = SCIP_INVALID;
    291 }
    292 else
    293 {
    294 *val = log(SCIPexprGetEvalValue(SCIPexprGetChildren(expr)[0]));
    295 }
    296 /**! [SnippetExprEvalLog] */
    297
    298 return SCIP_OKAY;
    299}
    300
    301/** expression derivative evaluation callback */
    302static
    304{ /*lint --e{715}*/
    305 SCIP_EXPR* child;
    306
    307 assert(expr != NULL);
    308 assert(childidx == 0);
    309 assert(SCIPexprGetEvalValue(expr) != SCIP_INVALID); /*lint !e777*/
    310
    311 child = SCIPexprGetChildren(expr)[0];
    312 assert(child != NULL);
    313 assert(strcmp(SCIPexprhdlrGetName(SCIPexprGetHdlr(child)), "val") != 0);
    314 assert(SCIPexprGetEvalValue(child) > 0.0);
    315
    316 *val = 1.0 / SCIPexprGetEvalValue(child);
    317
    318 return SCIP_OKAY;
    319}
    320
    321/** expression interval evaluation callback */
    322static
    324{ /*lint --e{715}*/
    325 SCIP_EXPRHDLRDATA* exprhdlrdata;
    326 SCIP_INTERVAL childinterval;
    327
    328 assert(expr != NULL);
    329 assert(SCIPexprGetData(expr) == NULL);
    330 assert(SCIPexprGetNChildren(expr) == 1);
    331
    332 exprhdlrdata = SCIPexprhdlrGetData(SCIPexprGetHdlr(expr));
    333 assert(exprhdlrdata != NULL);
    334
    335 childinterval = SCIPexprGetActivity(SCIPexprGetChildren(expr)[0]);
    336
    337 /* pretend childinterval to be >= epsilon, see also reversepropLog */
    338 if( childinterval.inf < exprhdlrdata->minzerodistance && exprhdlrdata->minzerodistance > 0.0 )
    339 {
    340 if( !exprhdlrdata->warnedonpole && SCIPgetVerbLevel(scip) > SCIP_VERBLEVEL_NONE )
    341 {
    342 SCIPinfoMessage(scip, NULL, "Changing lower bound for child of log() from %g to %g.\n"
    343 "Check your model formulation or use option expr/" EXPRHDLR_NAME "/minzerodistance to avoid this warning.\n",
    344 childinterval.inf, exprhdlrdata->minzerodistance);
    345 SCIPinfoMessage(scip, NULL, "Expression: ");
    346 SCIP_CALL( SCIPprintExpr(scip, expr, NULL) );
    347 SCIPinfoMessage(scip, NULL, "\n");
    348 exprhdlrdata->warnedonpole = TRUE;
    349 }
    350 childinterval.inf = exprhdlrdata->minzerodistance;
    351 }
    352
    353 if( SCIPintervalIsEmpty(SCIP_INTERVAL_INFINITY, childinterval) )
    354 {
    355 SCIPintervalSetEmpty(interval);
    356 return SCIP_OKAY;
    357 }
    358
    359 SCIPintervalLog(SCIP_INTERVAL_INFINITY, interval, childinterval);
    360
    361 return SCIP_OKAY;
    362}
    363
    364/** expression estimation callback */
    365static
    367{ /*lint --e{715}*/
    368 SCIP_Real lb;
    369 SCIP_Real ub;
    370
    371 assert(scip != NULL);
    372 assert(expr != NULL);
    373 assert(SCIPexprGetNChildren(expr) == 1);
    374 assert(coefs != NULL);
    375 assert(constant != NULL);
    376 assert(islocal != NULL);
    377 assert(branchcand != NULL);
    378 assert(*branchcand == TRUE);
    379 assert(success != NULL);
    380 assert(refpoint != NULL);
    381
    383
    384 lb = localbounds[0].inf;
    385 ub = localbounds[0].sup;
    386
    387 *coefs = 0.0;
    388 *constant = 0.0;
    389 *success = TRUE;
    390
    391 if( overestimate )
    392 {
    393 if( !SCIPisPositive(scip, refpoint[0]) )
    394 {
    395 /* if refpoint is 0 (then lb=0 probably) or below, then slope is infinite, then try to move away from 0 */
    396 if( SCIPisZero(scip, ub) )
    397 {
    398 *success = FALSE;
    399 return SCIP_OKAY;
    400 }
    401
    402 if( localbounds[0].sup < 0.2 )
    403 refpoint[0] = 0.5 * lb + 0.5 * ub;
    404 else
    405 refpoint[0] = 0.1;
    406 }
    407
    408 addLogLinearization(scip, refpoint[0], SCIPexprIsIntegral(SCIPexprGetChildren(expr)[0]), coefs, constant, success);
    409 *islocal = FALSE; /* linearization is globally valid */
    410 *branchcand = FALSE;
    411 }
    412 else
    413 {
    414 addLogSecant(scip, lb, ub, coefs, constant, success);
    415 *islocal = TRUE; /* secants are only valid locally */
    416 }
    417
    418 return SCIP_OKAY;
    419}
    420
    421/** initial estimates callback that provides initial linear estimators for a logarithm expression */
    422static
    424{
    425 SCIP_Real refpointsover[3] = {SCIP_INVALID, SCIP_INVALID, SCIP_INVALID};
    426 SCIP_Bool overest[4] = {TRUE, TRUE, TRUE, FALSE};
    427 SCIP_EXPR* child;
    428 SCIP_Real lb;
    429 SCIP_Real ub;
    430 SCIP_Bool success;
    431 int i;
    432
    433 assert(scip != NULL);
    434 assert(expr != NULL);
    435 assert(SCIPexprGetNChildren(expr) == 1);
    436
    438
    439 /* get expression data */
    440 child = SCIPexprGetChildren(expr)[0];
    441 assert(child != NULL);
    442
    443 lb = SCIPintervalGetInf(bounds[0]);
    444 ub = SCIPintervalGetSup(bounds[0]);
    445
    446 if( SCIPisEQ(scip, lb, ub) )
    447 return SCIP_OKAY;
    448
    449 if( overestimate )
    450 {
    451 /* adjust lb */
    452 lb = MAX(lb, MIN(0.5 * lb + 0.5 * ub, 0.1));
    453
    454 refpointsover[0] = lb;
    455 refpointsover[1] = SCIPisInfinity(scip, ub) ? lb + 2.0 : (lb + ub) / 2;
    456 refpointsover[2] = SCIPisInfinity(scip, ub) ? lb + 20.0 : ub;
    457 }
    458
    459 *nreturned = 0;
    460
    461 for( i = 0; i < 4; ++i )
    462 {
    463 if( (overest[i] && !overestimate) || (!overest[i] && (overestimate || SCIPisInfinity(scip, ub))) )
    464 continue;
    465
    466 assert(!overest[i] || (SCIPisLE(scip, refpointsover[i], ub) && SCIPisGE(scip, refpointsover[i], lb))); /*lint !e661*/
    467
    468 success = TRUE;
    469 coefs[*nreturned][0] = 0.0;
    470 constant[*nreturned] = 0.0;
    471
    472 if( overest[i] )
    473 {
    474 assert(i < 3);
    475 /* coverity[overrun] */
    476 addLogLinearization(scip, refpointsover[i], SCIPexprIsIntegral(child), coefs[*nreturned], &constant[*nreturned], &success); /*lint !e661*/
    477 if( success )
    478 {
    479 SCIPdebugMsg(scip, "init overestimate log(x) at x=%g -> %g*x+%g\n", refpointsover[i], coefs[*nreturned][0], constant[*nreturned]);
    480 }
    481 }
    482 else
    483 {
    484 addLogSecant(scip, lb, ub, coefs[*nreturned], &constant[*nreturned], &success);
    485 if( success )
    486 {
    487 SCIPdebugMsg(scip, "init underestimate log(x) on x=[%g,%g] -> %g*x+%g\n", lb, ub, coefs[*nreturned][0], constant[*nreturned]);
    488 }
    489 }
    490
    491 if( success )
    492 {
    493 ++(*nreturned);
    494 }
    495 }
    496
    497 return SCIP_OKAY;
    498}
    499
    500/** expression reverse propagation callback */
    501static
    503{ /*lint --e{715}*/
    504 SCIP_EXPRHDLRDATA* exprhdlrdata;
    505
    506 assert(scip != NULL);
    507 assert(expr != NULL);
    508 assert(SCIPexprGetNChildren(expr) == 1);
    509
    510 exprhdlrdata = SCIPexprhdlrGetData(SCIPexprGetHdlr(expr));
    511 assert(exprhdlrdata != NULL);
    512
    513 /* f = log(c0) -> c0 = exp(f) */
    514 SCIPintervalExp(SCIP_INTERVAL_INFINITY, &childrenbounds[0], bounds);
    515
    516 /* force child lower bound to be at least epsilon away from 0
    517 * this can help a lot in enforcement (try ex8_5_3)
    518 * child being equal 0 is already forbidden, so making it strictly greater-equal epsilon enforces
    519 * and hopefully doesn't introduce much problems
    520 * if childrenbounds[0].sup < epsilon, too, then this will result in a cutoff
    521 */
    522 if( childrenbounds[0].inf < exprhdlrdata->minzerodistance )
    523 {
    524 SCIPdebugMsg(scip, "Pushing child lower bound from %g to %g; upper bound remains at %g\n", childrenbounds[0].inf, SCIPepsilon(scip), childrenbounds[0].sup);
    525
    526 if( !exprhdlrdata->warnedonpole && SCIPgetVerbLevel(scip) > SCIP_VERBLEVEL_NONE )
    527 {
    528 SCIPinfoMessage(scip, NULL, "Changing lower bound for child of log() from %g to %g.\n"
    529 "Check your model formulation or use option expr/" EXPRHDLR_NAME "/minzerodistance to avoid this warning.\n",
    530 childrenbounds[0].inf, exprhdlrdata->minzerodistance);
    531 SCIPinfoMessage(scip, NULL, "Expression: ");
    532 SCIP_CALL( SCIPprintExpr(scip, expr, NULL) );
    533 SCIPinfoMessage(scip, NULL, "\n");
    534 exprhdlrdata->warnedonpole = TRUE;
    535 }
    536
    537 childrenbounds[0].inf = exprhdlrdata->minzerodistance;
    538 }
    539
    540 return SCIP_OKAY;
    541}
    542
    543/** expression hash callback */
    544static
    546{ /*lint --e{715}*/
    547 assert(scip != NULL);
    548 assert(expr != NULL);
    549 assert(SCIPexprGetNChildren(expr) == 1);
    550 assert(hashkey != NULL);
    551 assert(childrenhashes != NULL);
    552
    553 *hashkey = EXPRHDLR_HASHKEY;
    554 *hashkey ^= childrenhashes[0];
    555
    556 return SCIP_OKAY;
    557}
    558
    559/** expression curvature detection callback */
    560static
    562{ /*lint --e{715}*/
    563 assert(scip != NULL);
    564 assert(expr != NULL);
    565 assert(childcurv != NULL);
    566 assert(SCIPexprGetNChildren(expr) == 1);
    567
    568 /* expression is concave if child is concave, expression cannot be linear or convex */
    569 if( exprcurvature == SCIP_EXPRCURV_CONCAVE )
    570 {
    571 *childcurv = SCIP_EXPRCURV_CONCAVE;
    572 *success = TRUE;
    573 }
    574 else
    575 *success = FALSE;
    576
    577 return SCIP_OKAY;
    578}
    579
    580/** expression monotonicity detection callback */
    581static
    583{ /*lint --e{715}*/
    584 assert(scip != NULL);
    585 assert(expr != NULL);
    586 assert(result != NULL);
    587 assert(childidx == 0);
    588
    589 *result = SCIP_MONOTONE_INC;
    590
    591 return SCIP_OKAY;
    592}
    593
    594/** creates the handler for logarithmic expression and includes it into SCIP */
    596 SCIP* scip /**< SCIP data structure */
    597 )
    598{
    599 SCIP_EXPRHDLR* exprhdlr;
    600 SCIP_EXPRHDLRDATA* exprhdlrdata;
    601
    602 /**! [SnippetIncludeExprhdlrLog] */
    603 SCIP_CALL( SCIPallocClearBlockMemory(scip, &exprhdlrdata) );
    604
    606 exprhdlrdata) );
    607 assert(exprhdlr != NULL);
    608
    609 SCIPexprhdlrSetCopyFreeHdlr(exprhdlr, copyhdlrLog, freehdlrLog);
    610 SCIPexprhdlrSetCopyFreeData(exprhdlr, copydataLog, freedataLog);
    611 SCIPexprhdlrSetSimplify(exprhdlr, simplifyLog);
    612 SCIPexprhdlrSetParse(exprhdlr, parseLog);
    613 SCIPexprhdlrSetIntEval(exprhdlr, intevalLog);
    614 SCIPexprhdlrSetEstimate(exprhdlr, initestimatesLog, estimateLog);
    615 SCIPexprhdlrSetReverseProp(exprhdlr, reversepropLog);
    616 SCIPexprhdlrSetHash(exprhdlr, hashLog);
    617 SCIPexprhdlrSetDiff(exprhdlr, bwdiffLog, NULL, NULL);
    618 SCIPexprhdlrSetCurvature(exprhdlr, curvatureLog);
    619 SCIPexprhdlrSetMonotonicity(exprhdlr, monotonicityLog);
    620
    621 SCIP_CALL( SCIPaddRealParam(scip, "expr/" EXPRHDLR_NAME "/minzerodistance",
    622 "minimal distance from zero to enforce for child in bound tightening",
    623 &exprhdlrdata->minzerodistance, FALSE, SCIPepsilon(scip), 0.0, 1.0, NULL, NULL) );
    624 /**! [SnippetIncludeExprhdlrLog] */
    625
    626 return SCIP_OKAY;
    627}
    628
    629/** creates a logarithmic expression */
    631 SCIP* scip, /**< SCIP data structure */
    632 SCIP_EXPR** expr, /**< pointer where to store expression */
    633 SCIP_EXPR* child, /**< single child */
    634 SCIP_DECL_EXPR_OWNERCREATE((*ownercreate)), /**< function to call to create ownerdata */
    635 void* ownercreatedata /**< data to pass to ownercreate */
    636 )
    637{
    638 assert(expr != NULL);
    639 assert(child != NULL);
    640
    641 SCIP_CALL( SCIPcreateExpr(scip, expr, SCIPfindExprhdlr(scip, EXPRHDLR_NAME), NULL, 1, &child, ownercreate,
    642 ownercreatedata) );
    643
    644 return SCIP_OKAY;
    645}
    646
    647/** indicates whether expression is of log-type */ /*lint -e{715}*/
    649 SCIP* scip, /**< SCIP data structure */
    650 SCIP_EXPR* expr /**< expression */
    651 )
    652{ /*lint --e{715}*/
    653 assert(expr != NULL);
    654
    655 return strcmp(SCIPexprhdlrGetName(SCIPexprGetHdlr(expr)), EXPRHDLR_NAME) == 0;
    656}
    #define NULL
    Definition: def.h:257
    #define SCIP_INVALID
    Definition: def.h:187
    #define SCIP_INTERVAL_INFINITY
    Definition: def.h:189
    #define SCIP_Bool
    Definition: def.h:100
    #define MIN(x, y)
    Definition: def.h:233
    #define SCIP_STRINGEQ(name, reference, retcode)
    Definition: def.h:454
    #define SCIP_Real
    Definition: def.h:165
    #define TRUE
    Definition: def.h:102
    #define FALSE
    Definition: def.h:103
    #define MAX(x, y)
    Definition: def.h:229
    #define REALABS(x)
    Definition: def.h:191
    #define SCIP_CALL(x)
    Definition: def.h:364
    static SCIP_DECL_EXPRHASH(hashLog)
    Definition: expr_log.c:545
    static void addLogLinearization(SCIP *scip, SCIP_Real refpoint, SCIP_Bool isint, SCIP_Real *lincoef, SCIP_Real *linconstant, SCIP_Bool *success)
    Definition: expr_log.c:112
    static SCIP_DECL_EXPRFREEHDLR(freehdlrLog)
    Definition: expr_log.c:219
    static SCIP_DECL_EXPRBWDIFF(bwdiffLog)
    Definition: expr_log.c:303
    #define EXPRHDLR_HASHKEY
    Definition: expr_log.c:42
    static SCIP_DECL_EXPRINITESTIMATES(initestimatesLog)
    Definition: expr_log.c:423
    static SCIP_DECL_EXPRFREEDATA(freedataLog)
    Definition: expr_log.c:244
    static SCIP_DECL_EXPRCOPYDATA(copydataLog)
    Definition: expr_log.c:231
    #define EXPRHDLR_NAME
    Definition: expr_log.c:39
    static SCIP_DECL_EXPRMONOTONICITY(monotonicityLog)
    Definition: expr_log.c:582
    static SCIP_DECL_EXPRPARSE(parseLog)
    Definition: expr_log.c:255
    static SCIP_DECL_EXPRESTIMATE(estimateLog)
    Definition: expr_log.c:366
    static SCIP_DECL_EXPRREVERSEPROP(reversepropLog)
    Definition: expr_log.c:502
    static SCIP_DECL_EXPRCOPYHDLR(copyhdlrLog)
    Definition: expr_log.c:210
    static SCIP_DECL_EXPRSIMPLIFY(simplifyLog)
    Definition: expr_log.c:176
    static SCIP_DECL_EXPREVAL(evalLog)
    Definition: expr_log.c:279
    #define EXPRHDLR_DESC
    Definition: expr_log.c:40
    static void addLogSecant(SCIP *scip, SCIP_Real lb, SCIP_Real ub, SCIP_Real *lincoef, SCIP_Real *linconstant, SCIP_Bool *success)
    Definition: expr_log.c:61
    #define EXPRHDLR_PRECEDENCE
    Definition: expr_log.c:41
    static SCIP_DECL_EXPRCURVATURE(curvatureLog)
    Definition: expr_log.c:561
    static SCIP_DECL_EXPRINTEVAL(intevalLog)
    Definition: expr_log.c:323
    logarithm expression handler
    constant value expression handler
    SCIP_Bool SCIPisExprLog(SCIP *scip, SCIP_EXPR *expr)
    Definition: expr_log.c:648
    SCIP_RETCODE SCIPcreateExprLog(SCIP *scip, SCIP_EXPR **expr, SCIP_EXPR *child, SCIP_DECL_EXPR_OWNERCREATE((*ownercreate)), void *ownercreatedata)
    Definition: expr_log.c:630
    SCIP_RETCODE SCIPcreateExprValue(SCIP *scip, SCIP_EXPR **expr, SCIP_Real value, SCIP_DECL_EXPR_OWNERCREATE((*ownercreate)), void *ownercreatedata)
    Definition: expr_value.c:274
    SCIP_RETCODE SCIPincludeExprhdlrLog(SCIP *scip)
    Definition: expr_log.c:595
    void SCIPinfoMessage(SCIP *scip, FILE *file, const char *formatstr,...)
    Definition: scip_message.c:208
    SCIP_VERBLEVEL SCIPgetVerbLevel(SCIP *scip)
    Definition: scip_message.c:249
    #define SCIPdebugMsg
    Definition: scip_message.h:78
    SCIP_RETCODE SCIPaddRealParam(SCIP *scip, const char *name, const char *desc, SCIP_Real *valueptr, SCIP_Bool isadvanced, SCIP_Real defaultvalue, SCIP_Real minvalue, SCIP_Real maxvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
    Definition: scip_param.c:139
    const char * SCIPexprhdlrGetName(SCIP_EXPRHDLR *exprhdlr)
    Definition: expr.c:545
    void SCIPexprhdlrSetCopyFreeData(SCIP_EXPRHDLR *exprhdlr, SCIP_DECL_EXPRCOPYDATA((*copydata)), SCIP_DECL_EXPRFREEDATA((*freedata)))
    Definition: expr.c:383
    void SCIPexprhdlrSetHash(SCIP_EXPRHDLR *exprhdlr, SCIP_DECL_EXPRHASH((*hash)))
    Definition: expr.c:451
    SCIP_EXPRHDLRDATA * SCIPexprhdlrGetData(SCIP_EXPRHDLR *exprhdlr)
    Definition: expr.c:575
    void SCIPexprhdlrSetCopyFreeHdlr(SCIP_EXPRHDLR *exprhdlr, SCIP_DECL_EXPRCOPYHDLR((*copyhdlr)), SCIP_DECL_EXPRFREEHDLR((*freehdlr)))
    Definition: expr.c:370
    void SCIPexprhdlrSetDiff(SCIP_EXPRHDLR *exprhdlr, SCIP_DECL_EXPRBWDIFF((*bwdiff)), SCIP_DECL_EXPRFWDIFF((*fwdiff)), SCIP_DECL_EXPRBWFWDIFF((*bwfwdiff)))
    Definition: expr.c:473
    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
    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_RETCODE SCIPincludeExprhdlr(SCIP *scip, SCIP_EXPRHDLR **exprhdlr, const char *name, const char *desc, unsigned int precedence, SCIP_DECL_EXPREVAL((*eval)), SCIP_EXPRHDLRDATA *data)
    Definition: scip_expr.c:847
    SCIP_EXPRHDLR * SCIPfindExprhdlr(SCIP *scip, const char *name)
    Definition: scip_expr.c:894
    void SCIPexprhdlrSetSimplify(SCIP_EXPRHDLR *exprhdlr, SCIP_DECL_EXPRSIMPLIFY((*simplify)))
    Definition: expr.c:499
    SCIP_RETCODE SCIPcreateExpr(SCIP *scip, SCIP_EXPR **expr, SCIP_EXPRHDLR *exprhdlr, SCIP_EXPRDATA *exprdata, int nchildren, SCIP_EXPR **children, SCIP_DECL_EXPR_OWNERCREATE((*ownercreate)), void *ownercreatedata)
    Definition: scip_expr.c:1000
    void SCIPexprSetData(SCIP_EXPR *expr, SCIP_EXPRDATA *exprdata)
    Definition: expr.c:3920
    int SCIPexprGetNChildren(SCIP_EXPR *expr)
    Definition: expr.c:3872
    SCIP_Bool SCIPexprIsIntegral(SCIP_EXPR *expr)
    Definition: expr.c:4101
    SCIP_Bool SCIPisExprValue(SCIP *scip, SCIP_EXPR *expr)
    Definition: scip_expr.c:1468
    SCIP_RETCODE SCIPreleaseExpr(SCIP *scip, SCIP_EXPR **expr)
    Definition: scip_expr.c:1443
    SCIP_EXPRDATA * SCIPexprGetData(SCIP_EXPR *expr)
    Definition: expr.c:3905
    SCIP_RETCODE SCIPparseExpr(SCIP *scip, SCIP_EXPR **expr, const char *exprstr, const char **finalpos, SCIP_DECL_EXPR_OWNERCREATE((*ownercreate)), void *ownercreatedata)
    Definition: scip_expr.c:1406
    SCIP_RETCODE SCIPprintExpr(SCIP *scip, SCIP_EXPR *expr, FILE *file)
    Definition: scip_expr.c:1512
    SCIP_Real SCIPgetValueExprValue(SCIP_EXPR *expr)
    Definition: expr_value.c:298
    SCIP_Real SCIPexprGetEvalValue(SCIP_EXPR *expr)
    Definition: expr.c:3946
    SCIP_EXPR ** SCIPexprGetChildren(SCIP_EXPR *expr)
    Definition: expr.c:3882
    SCIP_INTERVAL SCIPexprGetActivity(SCIP_EXPR *expr)
    Definition: expr.c:4028
    void SCIPcaptureExpr(SCIP_EXPR *expr)
    Definition: scip_expr.c:1435
    SCIP_EXPRHDLR * SCIPexprGetHdlr(SCIP_EXPR *expr)
    Definition: expr.c:3895
    SCIP_Real SCIPintervalGetInf(SCIP_INTERVAL interval)
    SCIP_Bool SCIPintervalIsEmpty(SCIP_Real infinity, SCIP_INTERVAL operand)
    void SCIPintervalLog(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL operand)
    SCIP_Real SCIPintervalGetSup(SCIP_INTERVAL interval)
    void SCIPintervalExp(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL operand)
    void SCIPintervalSetEmpty(SCIP_INTERVAL *resultant)
    #define SCIPallocClearBlockMemory(scip, ptr)
    Definition: scip_mem.h:91
    #define SCIPfreeBlockMemory(scip, ptr)
    Definition: scip_mem.h:108
    SCIP_Bool SCIPisGE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
    SCIP_Bool SCIPisIntegral(SCIP *scip, SCIP_Real val)
    SCIP_Bool SCIPisPositive(SCIP *scip, SCIP_Real val)
    SCIP_Bool SCIPisLE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
    SCIP_Real SCIPfloor(SCIP *scip, SCIP_Real val)
    SCIP_Bool SCIPisInfinity(SCIP *scip, SCIP_Real val)
    SCIP_Bool SCIPisEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
    SCIP_Bool SCIPisZero(SCIP *scip, SCIP_Real val)
    SCIP_Real SCIPepsilon(SCIP *scip)
    SCIP_Real inf
    Definition: intervalarith.h:56
    #define SCIP_DECL_EXPR_OWNERCREATE(x)
    Definition: type_expr.h:143
    struct SCIP_ExprhdlrData SCIP_EXPRHDLRDATA
    Definition: type_expr.h:195
    @ SCIP_EXPRCURV_CONCAVE
    Definition: type_expr.h:64
    @ SCIP_MONOTONE_INC
    Definition: type_expr.h:72
    @ SCIP_VERBLEVEL_NONE
    Definition: type_message.h:57
    @ SCIP_OKAY
    Definition: type_retcode.h:42
    @ SCIP_INVALIDCALL
    Definition: type_retcode.h:51
    enum SCIP_Retcode SCIP_RETCODE
    Definition: type_retcode.h:63