Scippy

SCIP

Solving Constraint Integer Programs

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

◆ EXPRHDLR_DESC

#define EXPRHDLR_DESC   "natural logarithm expression"

Definition at line 42 of file expr_log.c.

Referenced by SCIPincludeExprhdlrLog().

◆ EXPRHDLR_PRECEDENCE

#define EXPRHDLR_PRECEDENCE   80000

Definition at line 43 of file expr_log.c.

Referenced by SCIPincludeExprhdlrLog().

◆ EXPRHDLR_HASHKEY

#define EXPRHDLR_HASHKEY   SCIPcalcFibHash(16273.0)

Definition at line 44 of file expr_log.c.

Referenced by SCIP_DECL_EXPRHASH().

Function Documentation

◆ addLogSecant()

static 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 FALSE, NULL, REALABS, SCIP_Real, SCIPisEQ(), SCIPisInfinity(), and SCIPisLE().

Referenced by SCIP_DECL_EXPRESTIMATE(), and SCIP_DECL_EXPRINITESTIMATES().

◆ addLogLinearization()

static 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 FALSE, NULL, REALABS, SCIP_Real, SCIPfloor(), SCIPisInfinity(), SCIPisIntegral(), and SCIPisLE().

Referenced by SCIP_DECL_EXPRESTIMATE(), and SCIP_DECL_EXPRINITESTIMATES().

◆ SCIP_DECL_EXPRSIMPLIFY()

static 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 NULL, SCIP_CALL, SCIP_OKAY, SCIPcaptureExpr(), SCIPcreateExprValue(), SCIPexprGetChildren(), SCIPexprGetNChildren(), SCIPgetValueExprValue(), and SCIPisExprValue().

◆ SCIP_DECL_EXPRCOPYHDLR()

static 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()

static SCIP_DECL_EXPRFREEHDLR ( freehdlrLog  )
static

expression handler free callback

Definition at line 221 of file expr_log.c.

References NULL, SCIP_OKAY, and SCIPfreeBlockMemory.

◆ SCIP_DECL_EXPRCOPYDATA()

static SCIP_DECL_EXPRCOPYDATA ( copydataLog  )
static

expression data copy callback

Definition at line 233 of file expr_log.c.

References NULL, SCIP_OKAY, and SCIPexprGetData().

◆ SCIP_DECL_EXPRFREEDATA()

static SCIP_DECL_EXPRFREEDATA ( freedataLog  )
static

expression data free callback

Definition at line 246 of file expr_log.c.

References NULL, SCIP_OKAY, and SCIPexprSetData().

◆ SCIP_DECL_EXPRPARSE()

static SCIP_DECL_EXPRPARSE ( parseLog  )
static

expression parse callback

Definition at line 257 of file expr_log.c.

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

◆ SCIP_DECL_EXPREVAL()

static SCIP_DECL_EXPREVAL ( evalLog  )
static

expression point evaluation callback

! [SnippetExprEvalLog]

! [SnippetExprEvalLog]

Definition at line 281 of file expr_log.c.

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

◆ SCIP_DECL_EXPRBWDIFF()

static SCIP_DECL_EXPRBWDIFF ( bwdiffLog  )
static

expression derivative evaluation callback

Definition at line 305 of file expr_log.c.

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

◆ SCIP_DECL_EXPRINTEVAL()

◆ SCIP_DECL_EXPRESTIMATE()

static SCIP_DECL_EXPRESTIMATE ( estimateLog  )
static

◆ SCIP_DECL_EXPRINITESTIMATES()

static SCIP_DECL_EXPRINITESTIMATES ( initestimatesLog  )
static

◆ SCIP_DECL_EXPRREVERSEPROP()

static SCIP_DECL_EXPRREVERSEPROP ( reversepropLog  )
static

◆ SCIP_DECL_EXPRHASH()

static SCIP_DECL_EXPRHASH ( hashLog  )
static

expression hash callback

Definition at line 545 of file expr_log.c.

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

◆ SCIP_DECL_EXPRCURVATURE()

static SCIP_DECL_EXPRCURVATURE ( curvatureLog  )
static

expression curvature detection callback

Definition at line 561 of file expr_log.c.

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

◆ SCIP_DECL_EXPRMONOTONICITY()

static SCIP_DECL_EXPRMONOTONICITY ( monotonicityLog  )
static

expression monotonicity detection callback

Definition at line 582 of file expr_log.c.

References NULL, SCIP_MONOTONE_INC, and SCIP_OKAY.