Scippy

SCIP

Solving Constraint Integer Programs

Detailed Description

variable expression handler

Author
Stefan Vigerske
Benjamin Mueller
Felipe Serrano

Definition in file expr_var.c.

#include <string.h>
#include "scip/expr_var.h"
#include "scip/expr_sum.h"

Go to the source code of this file.

Macros

#define EXPRHDLR_NAME   "var"
 
#define EXPRHDLR_DESC   "SCIP variable expression"
 
#define EXPRHDLR_PRECEDENCE   0
 
#define EXPRHDLR_HASHKEY   SCIPcalcFibHash(22153.0)
 
#define infty2infty(infty1, infty2, val)   ((val) >= (infty1) ? (infty2) : (val))
 

Functions

static SCIP_DECL_EXPRSIMPLIFY (simplifyVar)
 
static SCIP_DECL_EXPRCOMPARE (compareVar)
 
static SCIP_DECL_EXPRCOPYHDLR (copyhdlrVar)
 
static SCIP_DECL_EXPRCOPYDATA (copydataVar)
 
static SCIP_DECL_EXPRFREEDATA (freedataVar)
 
static SCIP_DECL_EXPRPRINT (printVar)
 
static SCIP_DECL_EXPREVAL (evalVar)
 
static SCIP_DECL_EXPRBWDIFF (bwdiffVar)
 
static SCIP_DECL_EXPRFWDIFF (fwdiffVar)
 
static SCIP_DECL_EXPRBWFWDIFF (bwfwdiffVar)
 
static SCIP_DECL_EXPRINTEVAL (intevalVar)
 
static SCIP_DECL_EXPRHASH (hashVar)
 
static SCIP_DECL_EXPRCURVATURE (curvatureVar)
 
static SCIP_DECL_EXPRMONOTONICITY (monotonicityVar)
 
static SCIP_DECL_EXPRINTEGRALITY (integralityVar)
 
SCIP_RETCODE SCIPincludeExprhdlrVar (SCIP *scip)
 
SCIP_RETCODE SCIPcreateExprVar (SCIP *scip, SCIP_EXPR **expr, SCIP_VAR *var, SCIP_DECL_EXPR_OWNERCREATE((*ownercreate)), void *ownercreatedata)
 
SCIP_VARSCIPgetVarExprVar (SCIP_EXPR *expr)
 

Macro Definition Documentation

◆ EXPRHDLR_NAME

#define EXPRHDLR_NAME   "var"

Definition at line 43 of file expr_var.c.

Referenced by SCIPgetVarExprVar(), and SCIPincludeExprhdlrVar().

◆ EXPRHDLR_DESC

#define EXPRHDLR_DESC   "SCIP variable expression"

Definition at line 44 of file expr_var.c.

Referenced by SCIPincludeExprhdlrVar().

◆ EXPRHDLR_PRECEDENCE

#define EXPRHDLR_PRECEDENCE   0

Definition at line 45 of file expr_var.c.

Referenced by SCIPincludeExprhdlrVar().

◆ EXPRHDLR_HASHKEY

#define EXPRHDLR_HASHKEY   SCIPcalcFibHash(22153.0)

Definition at line 46 of file expr_var.c.

Referenced by SCIP_DECL_EXPRHASH().

◆ infty2infty

#define infty2infty (   infty1,
  infty2,
  val 
)    ((val) >= (infty1) ? (infty2) : (val))

translate from one value of infinity to another

if val is >= infty1, then give infty2, else give val

Definition at line 52 of file expr_var.c.

Referenced by SCIP_DECL_EXPRINTEVAL().

Function Documentation

◆ SCIP_DECL_EXPRSIMPLIFY()

static SCIP_DECL_EXPRSIMPLIFY ( simplifyVar  )
static

simplifies a variable expression

We replace the variable when fixed by its value. If a variable is fixed, (multi)aggregated or more generally, inactive, we replace it with its active counterpart

Implementation note:

  • we follow the general approach of the simplify, where we replace the var expression for its simplified expression only in the current parent. So if we see that there is any performance issue in the simplify we might have to revisit this decision.
  • we build the sum expression by appending variable expressions one at a time. This may be speed-up if we allocate memory for all the variable expressions and build the sum directly.

Definition at line 68 of file expr_var.c.

References NULL, REALABS, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPallocBufferArray, SCIPappendExprSumExpr(), SCIPcaptureExpr(), SCIPcreateExprSum(), SCIPcreateExprVar(), SCIPfreeBufferArray, SCIPgetProbvarLinearSum(), SCIPgetVarExprVar(), SCIPinfoMessage(), SCIPisInfinity(), SCIPprintExpr(), SCIPreallocBufferArray, SCIPreleaseExpr(), SCIPvarGetName(), SCIPvarIsActive(), SCIPvarIsOriginal(), and TRUE.

◆ SCIP_DECL_EXPRCOMPARE()

static SCIP_DECL_EXPRCOMPARE ( compareVar  )
static

the order of two variable is given by their indices

Note
this is affected by permutations in the problem

Definition at line 158 of file expr_var.c.

References SCIPgetVarExprVar(), and SCIPvarGetIndex().

◆ SCIP_DECL_EXPRCOPYHDLR()

static SCIP_DECL_EXPRCOPYHDLR ( copyhdlrVar  )
static

expression handler copy callback

Definition at line 171 of file expr_var.c.

References SCIP_CALL, SCIP_OKAY, and SCIPincludeExprhdlrVar().

◆ SCIP_DECL_EXPRCOPYDATA()

static SCIP_DECL_EXPRCOPYDATA ( copydataVar  )
static

expression data copy callback

Definition at line 180 of file expr_var.c.

References NULL, SCIP_CALL, SCIP_OKAY, SCIPcaptureVar(), and SCIPgetVarExprVar().

◆ SCIP_DECL_EXPRFREEDATA()

static SCIP_DECL_EXPRFREEDATA ( freedataVar  )
static

expression data free callback

Definition at line 202 of file expr_var.c.

References NULL, SCIP_CALL, SCIP_OKAY, SCIPexprGetData(), SCIPexprSetData(), and SCIPreleaseVar().

◆ SCIP_DECL_EXPRPRINT()

static SCIP_DECL_EXPRPRINT ( printVar  )
static

expression print callback

Definition at line 220 of file expr_var.c.

References NULL, SCIP_EXPRITER_ENTEREXPR, SCIP_OKAY, SCIPgetVarExprVar(), SCIPinfoMessage(), and SCIPvarGetName().

◆ SCIP_DECL_EXPREVAL()

static SCIP_DECL_EXPREVAL ( evalVar  )
static

expression point evaluation callback

Definition at line 235 of file expr_var.c.

References NULL, SCIP_OKAY, SCIPgetSolVal(), and SCIPgetVarExprVar().

◆ SCIP_DECL_EXPRBWDIFF()

static SCIP_DECL_EXPRBWDIFF ( bwdiffVar  )
static

expression backward derivative evaluation callback

Definition at line 247 of file expr_var.c.

References SCIP_INVALIDCALL.

◆ SCIP_DECL_EXPRFWDIFF()

static SCIP_DECL_EXPRFWDIFF ( fwdiffVar  )
static

expression forward derivative evaluation callback

Definition at line 255 of file expr_var.c.

References NULL, SCIP_OKAY, SCIPgetSolVal(), and SCIPgetVarExprVar().

◆ SCIP_DECL_EXPRBWFWDIFF()

static SCIP_DECL_EXPRBWFWDIFF ( bwfwdiffVar  )
static

expression derivative evaluation callback

Definition at line 267 of file expr_var.c.

References SCIP_INVALIDCALL.

◆ SCIP_DECL_EXPRINTEVAL()

static SCIP_DECL_EXPRINTEVAL ( intevalVar  )
static

◆ SCIP_DECL_EXPRHASH()

static SCIP_DECL_EXPRHASH ( hashVar  )
static

variable hash callback

Definition at line 304 of file expr_var.c.

References EXPRHDLR_HASHKEY, NULL, SCIP_OKAY, SCIP_Real, SCIPcalcFibHash(), SCIPexprGetNChildren(), SCIPgetVarExprVar(), and SCIPvarGetIndex().

◆ SCIP_DECL_EXPRCURVATURE()

static SCIP_DECL_EXPRCURVATURE ( curvatureVar  )
static

expression curvature detection callback

Definition at line 324 of file expr_var.c.

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

◆ SCIP_DECL_EXPRMONOTONICITY()

static SCIP_DECL_EXPRMONOTONICITY ( monotonicityVar  )
static

expression monotonicity detection callback

Definition at line 339 of file expr_var.c.

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

◆ SCIP_DECL_EXPRINTEGRALITY()

static SCIP_DECL_EXPRINTEGRALITY ( integralityVar  )
static

expression integrality detection callback

Definition at line 353 of file expr_var.c.

References NULL, SCIP_OKAY, SCIPgetVarExprVar(), and SCIPvarIsIntegral().