Scippy

SCIP

Solving Constraint Integer Programs

Detailed Description

handler for -x*log(x) expressions

Author
Benjamin Mueller
Fabian Wegscheider
Ksenia Bestuzheva

Definition in file expr_entropy.c.

#include "scip/expr_entropy.h"
#include "scip/expr_value.h"
#include "scip/expr.h"
#include <string.h>

Go to the source code of this file.

Macros

#define EXPRHDLR_NAME   "entropy"
 
#define EXPRHDLR_DESC   "entropy expression (-x*log(x))"
 
#define EXPRHDLR_PRECEDENCE   81000
 
#define EXPRHDLR_HASHKEY   SCIPcalcFibHash(7477.0)
 

Functions

static SCIP_Real reversePropBinarySearch (SCIP *scip, SCIP_Real xmin, SCIP_Real xmax, SCIP_Bool increasing, SCIP_Real targetval)
 
static SCIP_RETCODE reverseProp (SCIP *scip, SCIP_INTERVAL exprinterval, SCIP_INTERVAL childinterval, SCIP_INTERVAL *interval)
 
static SCIP_DECL_EXPRCOPYHDLR (copyhdlrEntropy)
 
static SCIP_DECL_EXPRSIMPLIFY (simplifyEntropy)
 
static SCIP_DECL_EXPRCOPYDATA (copydataEntropy)
 
static SCIP_DECL_EXPRFREEDATA (freedataEntropy)
 
static SCIP_DECL_EXPRPARSE (parseEntropy)
 
static SCIP_DECL_EXPREVAL (evalEntropy)
 
static SCIP_DECL_EXPRBWDIFF (bwdiffEntropy)
 
static SCIP_DECL_EXPRINTEVAL (intevalEntropy)
 
static SCIP_DECL_EXPRESTIMATE (estimateEntropy)
 
static SCIP_DECL_EXPRINITESTIMATES (initestimatesEntropy)
 
static SCIP_DECL_EXPRREVERSEPROP (reversepropEntropy)
 
static SCIP_DECL_EXPRHASH (hashEntropy)
 
static SCIP_DECL_EXPRCURVATURE (curvatureEntropy)
 
static SCIP_DECL_EXPRMONOTONICITY (monotonicityEntropy)
 
static SCIP_DECL_EXPRINTEGRALITY (integralityEntropy)
 
SCIP_RETCODE SCIPincludeExprhdlrEntropy (SCIP *scip)
 
SCIP_RETCODE SCIPcreateExprEntropy (SCIP *scip, SCIP_EXPR **expr, SCIP_EXPR *child, SCIP_DECL_EXPR_OWNERCREATE((*ownercreate)), void *ownercreatedata)
 
SCIP_Bool SCIPisExprEntropy (SCIP *scip, SCIP_EXPR *expr)
 

Macro Definition Documentation

◆ EXPRHDLR_NAME

#define EXPRHDLR_NAME   "entropy"

◆ EXPRHDLR_DESC

#define EXPRHDLR_DESC   "entropy expression (-x*log(x))"

Definition at line 45 of file expr_entropy.c.

Referenced by SCIPincludeExprhdlrEntropy().

◆ EXPRHDLR_PRECEDENCE

#define EXPRHDLR_PRECEDENCE   81000

Definition at line 46 of file expr_entropy.c.

Referenced by SCIPincludeExprhdlrEntropy().

◆ EXPRHDLR_HASHKEY

#define EXPRHDLR_HASHKEY   SCIPcalcFibHash(7477.0)

Definition at line 47 of file expr_entropy.c.

Referenced by SCIP_DECL_EXPRHASH().

Function Documentation

◆ reversePropBinarySearch()

static SCIP_Real reversePropBinarySearch ( SCIP scip,
SCIP_Real  xmin,
SCIP_Real  xmax,
SCIP_Bool  increasing,
SCIP_Real  targetval 
)
static

helper function for reverseProp() which returns an x* in [xmin,xmax] s.t. the distance -x*log(x) and a given target value is minimized; the function assumes that -x*log(x) is monotone on [xmin,xmax];

Parameters
scipSCIP data structure
xminsmallest possible x
xmaxlargest possible x
increasing-x*log(x) is increasing or decreasing on [xmin,xmax]
targetvaltarget value

Definition at line 61 of file expr_entropy.c.

References SCIP_INVALID, SCIP_Real, SCIPisEQ(), SCIPisGE(), SCIPisLE(), SCIPisLT(), and x.

Referenced by reverseProp().

◆ reverseProp()

static SCIP_RETCODE reverseProp ( SCIP scip,
SCIP_INTERVAL  exprinterval,
SCIP_INTERVAL  childinterval,
SCIP_INTERVAL interval 
)
static

helper function for reverse propagation; needed for proper unittest

Parameters
scipSCIP data structure
exprintervalbounds on the expression
childintervalbounds on the interval of the child
intervalresulting interval

Definition at line 112 of file expr_entropy.c.

References FALSE, MAX, MIN, NULL, reversePropBinarySearch(), SCIP_INTERVAL_INFINITY, SCIP_INVALID, SCIP_OKAY, SCIP_Real, SCIPepsilon(), SCIPintervalEntropy(), SCIPintervalGetInf(), SCIPintervalGetSup(), SCIPintervalIntersect(), SCIPintervalIsEmpty(), SCIPintervalIsSubsetEQ(), SCIPintervalSet(), SCIPintervalSetBounds(), SCIPintervalSetEmpty(), SCIPisGT(), and TRUE.

Referenced by SCIP_DECL_EXPRREVERSEPROP().

◆ SCIP_DECL_EXPRCOPYHDLR()

static SCIP_DECL_EXPRCOPYHDLR ( copyhdlrEntropy  )
static

expression handler copy callback

Definition at line 233 of file expr_entropy.c.

References SCIP_CALL, SCIP_OKAY, and SCIPincludeExprhdlrEntropy().

◆ SCIP_DECL_EXPRSIMPLIFY()

static SCIP_DECL_EXPRSIMPLIFY ( simplifyEntropy  )
static

◆ SCIP_DECL_EXPRCOPYDATA()

static SCIP_DECL_EXPRCOPYDATA ( copydataEntropy  )
static

expression data copy callback

Definition at line 287 of file expr_entropy.c.

References NULL, SCIP_OKAY, and SCIPexprGetData().

◆ SCIP_DECL_EXPRFREEDATA()

static SCIP_DECL_EXPRFREEDATA ( freedataEntropy  )
static

expression data free callback

Definition at line 299 of file expr_entropy.c.

References NULL, SCIP_OKAY, and SCIPexprSetData().

◆ SCIP_DECL_EXPRPARSE()

static SCIP_DECL_EXPRPARSE ( parseEntropy  )
static

expression parse callback

Definition at line 309 of file expr_entropy.c.

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

◆ SCIP_DECL_EXPREVAL()

static SCIP_DECL_EXPREVAL ( evalEntropy  )
static

expression (point-) evaluation callback

Definition at line 334 of file expr_entropy.c.

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

◆ SCIP_DECL_EXPRBWDIFF()

static SCIP_DECL_EXPRBWDIFF ( bwdiffEntropy  )
static

expression derivative evaluation callback

Definition at line 365 of file expr_entropy.c.

References NULL, SCIP_INVALID, SCIP_OKAY, SCIP_Real, SCIPexprGetChildren(), SCIPexprGetEvalValue(), SCIPexprGetNChildren(), and SCIPisExprValue().

◆ SCIP_DECL_EXPRINTEVAL()

static SCIP_DECL_EXPRINTEVAL ( intevalEntropy  )
static

◆ SCIP_DECL_EXPRESTIMATE()

static SCIP_DECL_EXPRESTIMATE ( estimateEntropy  )
static

◆ SCIP_DECL_EXPRINITESTIMATES()

static SCIP_DECL_EXPRINITESTIMATES ( initestimatesEntropy  )
static

◆ SCIP_DECL_EXPRREVERSEPROP()

static SCIP_DECL_EXPRREVERSEPROP ( reversepropEntropy  )
static

expression reverse propagation callback

Definition at line 551 of file expr_entropy.c.

References SCIP_Interval::inf, NULL, reverseProp(), SCIP_CALL, SCIP_INTERVAL_INFINITY, SCIP_OKAY, SCIPexprGetNChildren(), and SCIPintervalIsEmpty().

◆ SCIP_DECL_EXPRHASH()

static SCIP_DECL_EXPRHASH ( hashEntropy  )
static

entropy hash callback

Definition at line 572 of file expr_entropy.c.

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

◆ SCIP_DECL_EXPRCURVATURE()

static SCIP_DECL_EXPRCURVATURE ( curvatureEntropy  )
static

expression curvature detection callback

Definition at line 587 of file expr_entropy.c.

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

◆ SCIP_DECL_EXPRMONOTONICITY()

static SCIP_DECL_EXPRMONOTONICITY ( monotonicityEntropy  )
static

◆ SCIP_DECL_EXPRINTEGRALITY()

static SCIP_DECL_EXPRINTEGRALITY ( integralityEntropy  )
static

expression integrality detection callback

Definition at line 638 of file expr_entropy.c.

References FALSE, NULL, and SCIP_OKAY.