SCIP Doxygen Documentation
Loading...
Searching...
No Matches

Detailed Description

logarithm expression handler

Author
Stefan Vigerske
Benjamin Mueller
Ksenia Bestuzheva

Definition in file expr_log.c.

#include <string.h>
#include "scip/expr_value.h"
#include "scip/expr_log.h"

Go to the source code of this file.

Macros

#define EXPRHDLR_NAME   "log"
#define EXPRHDLR_DESC   "natural logarithm expression"
#define EXPRHDLR_PRECEDENCE   80000
#define EXPRHDLR_HASHKEY   SCIPcalcFibHash(16273.0)

Functions

static void addLogSecant (SCIP *scip, SCIP_Real lb, SCIP_Real ub, SCIP_Real *lincoef, SCIP_Real *linconstant, SCIP_Bool *success)
static void addLogLinearization (SCIP *scip, SCIP_Real refpoint, SCIP_Bool isint, SCIP_Real *lincoef, SCIP_Real *linconstant, SCIP_Bool *success)
static SCIP_DECL_EXPRSIMPLIFY (simplifyLog)
static SCIP_DECL_EXPRCOPYHDLR (copyhdlrLog)
static SCIP_DECL_EXPRFREEHDLR (freehdlrLog)
static SCIP_DECL_EXPRCOPYDATA (copydataLog)
static SCIP_DECL_EXPRFREEDATA (freedataLog)
static SCIP_DECL_EXPRPARSE (parseLog)
static SCIP_DECL_EXPREVAL (evalLog)
static SCIP_DECL_EXPRBWDIFF (bwdiffLog)
static SCIP_DECL_EXPRINTEVAL (intevalLog)
static SCIP_DECL_EXPRESTIMATE (estimateLog)
static SCIP_DECL_EXPRINITESTIMATES (initestimatesLog)
static SCIP_DECL_EXPRREVERSEPROP (reversepropLog)
static SCIP_DECL_EXPRHASH (hashLog)
static SCIP_DECL_EXPRCURVATURE (curvatureLog)
static SCIP_DECL_EXPRMONOTONICITY (monotonicityLog)
SCIP_RETCODE SCIPincludeExprhdlrLog (SCIP *scip)
SCIP_RETCODE SCIPcreateExprLog (SCIP *scip, SCIP_EXPR **expr, SCIP_EXPR *child, SCIP_DECL_EXPR_OWNERCREATE((*ownercreate)), void *ownercreatedata)
SCIP_Bool SCIPisExprLog (SCIP *scip, SCIP_EXPR *expr)

Macro Definition Documentation

◆ EXPRHDLR_NAME

#define EXPRHDLR_NAME   "log"

Definition at line 41 of file expr_log.c.

◆ EXPRHDLR_DESC

#define EXPRHDLR_DESC   "natural logarithm expression"

Definition at line 42 of file expr_log.c.

◆ EXPRHDLR_PRECEDENCE

#define EXPRHDLR_PRECEDENCE   80000

Definition at line 43 of file expr_log.c.

◆ EXPRHDLR_HASHKEY

#define EXPRHDLR_HASHKEY   SCIPcalcFibHash(16273.0)

Definition at line 44 of file expr_log.c.

Function Documentation

◆ addLogSecant()

void addLogSecant ( SCIP * scip,
SCIP_Real lb,
SCIP_Real ub,
SCIP_Real * lincoef,
SCIP_Real * linconstant,
SCIP_Bool * success )
static

computes coefficients of secant of a logarithmic term

Parameters
scipSCIP data structure
lblower bound on variable
ubupper bound on variable
lincoefbuffer to add coefficient of secant
linconstantbuffer to add constant of secant
successbuffer to set to FALSE if secant has failed due to large numbers or unboundedness

Definition at line 63 of file expr_log.c.

References assert(), FALSE, NULL, REALABS, SCIP_Bool, SCIP_Real, SCIPisEQ(), SCIPisInfinity(), and SCIPisLE().

Referenced by SCIP_DECL_EXPRESTIMATE(), and SCIP_DECL_EXPRINITESTIMATES().

◆ addLogLinearization()

void addLogLinearization ( SCIP * scip,
SCIP_Real refpoint,
SCIP_Bool isint,
SCIP_Real * lincoef,
SCIP_Real * linconstant,
SCIP_Bool * success )
static

computes coefficients of linearization of a logarithmic term in a reference point

Parameters
scipSCIP data structure
refpointpoint for which to compute value of linearization
isintwhether corresponding variable is a discrete variable, and thus linearization could be moved
lincoefbuffer to add coefficient of secant
linconstantbuffer to add constant of secant
successbuffer to set to FALSE if secant has failed due to large numbers or unboundedness

Definition at line 114 of file expr_log.c.

References assert(), FALSE, NULL, REALABS, SCIP_Bool, SCIP_Real, SCIPfloor(), SCIPisInfinity(), SCIPisIntegral(), and SCIPisLE().

Referenced by SCIP_DECL_EXPRESTIMATE(), and SCIP_DECL_EXPRINITESTIMATES().

◆ SCIP_DECL_EXPRSIMPLIFY()

SCIP_DECL_EXPRSIMPLIFY ( simplifyLog )
static

simplifies a log expression

Evaluates the logarithm function when its child is a value expression.

TODO: split products ? TODO: log(exp(*)) = *

Definition at line 178 of file expr_log.c.

References assert(), NULL, SCIP_CALL, SCIP_OKAY, SCIPcaptureExpr(), SCIPcreateExprValue(), SCIPexprGetChildren(), SCIPexprGetNChildren(), SCIPgetValueExprValue(), SCIPisExprValue(), and SCIPisPositive().

◆ SCIP_DECL_EXPRCOPYHDLR()

SCIP_DECL_EXPRCOPYHDLR ( copyhdlrLog )
static

expression handler copy callback

Definition at line 212 of file expr_log.c.

References SCIP_CALL, SCIP_OKAY, and SCIPincludeExprhdlrLog().

◆ SCIP_DECL_EXPRFREEHDLR()

SCIP_DECL_EXPRFREEHDLR ( freehdlrLog )
static

expression handler free callback

Definition at line 221 of file expr_log.c.

References assert(), NULL, SCIP_OKAY, and SCIPfreeBlockMemory.

◆ SCIP_DECL_EXPRCOPYDATA()

SCIP_DECL_EXPRCOPYDATA ( copydataLog )
static

expression data copy callback

Definition at line 233 of file expr_log.c.

References assert(), NULL, SCIP_OKAY, and SCIPexprGetData().

◆ SCIP_DECL_EXPRFREEDATA()

SCIP_DECL_EXPRFREEDATA ( freedataLog )
static

expression data free callback

Definition at line 246 of file expr_log.c.

References assert(), NULL, SCIP_OKAY, and SCIPexprSetData().

◆ SCIP_DECL_EXPRPARSE()

SCIP_DECL_EXPRPARSE ( parseLog )
static

expression parse callback

Definition at line 257 of file expr_log.c.

References assert(), NULL, SCIP_CALL, SCIP_OKAY, SCIPcreateExprLog(), SCIPparseExpr(), SCIPreleaseExpr(), and TRUE.

◆ SCIP_DECL_EXPREVAL()

SCIP_DECL_EXPREVAL ( evalLog )
static

expression point evaluation callback

! [SnippetExprEvalLog]

! [SnippetExprEvalLog]

Definition at line 281 of file expr_log.c.

References assert(), NULL, SCIP_INVALID, SCIP_OKAY, SCIPdebugMsg, SCIPexprGetChildren(), SCIPexprGetData(), SCIPexprGetEvalValue(), and SCIPexprGetNChildren().

◆ SCIP_DECL_EXPRBWDIFF()

SCIP_DECL_EXPRBWDIFF ( bwdiffLog )
static

expression derivative evaluation callback

Definition at line 305 of file expr_log.c.

References assert(), NULL, SCIP_INVALID, SCIP_OKAY, SCIPexprGetChildren(), SCIPexprGetEvalValue(), SCIPexprGetHdlr(), and SCIPexprhdlrGetName().

◆ SCIP_DECL_EXPRINTEVAL()

◆ SCIP_DECL_EXPRESTIMATE()

SCIP_DECL_EXPRESTIMATE ( estimateLog )
static

◆ SCIP_DECL_EXPRINITESTIMATES()

SCIP_DECL_EXPRINITESTIMATES ( initestimatesLog )
static

◆ SCIP_DECL_EXPRREVERSEPROP()

SCIP_DECL_EXPRREVERSEPROP ( reversepropLog )
static

◆ SCIP_DECL_EXPRHASH()

SCIP_DECL_EXPRHASH ( hashLog )
static

expression hash callback

Definition at line 545 of file expr_log.c.

References assert(), EXPRHDLR_HASHKEY, NULL, SCIP_OKAY, and SCIPexprGetNChildren().

◆ SCIP_DECL_EXPRCURVATURE()

SCIP_DECL_EXPRCURVATURE ( curvatureLog )
static

expression curvature detection callback

Definition at line 561 of file expr_log.c.

References assert(), FALSE, NULL, SCIP_EXPRCURV_CONCAVE, SCIP_OKAY, SCIPexprGetNChildren(), and TRUE.

◆ SCIP_DECL_EXPRMONOTONICITY()

SCIP_DECL_EXPRMONOTONICITY ( monotonicityLog )
static

expression monotonicity detection callback

Definition at line 582 of file expr_log.c.

References assert(), NULL, result, SCIP_MONOTONE_INC, and SCIP_OKAY.