Scippy

SCIP

Solving Constraint Integer Programs

Detailed Description

constraint handler that checks bounds on fixed variables

Author
Stefan Vigerske

For each original variable that has a counterpart in the transformed problem which is not active (i.e., fixed, negated, aggregated, or multiaggregated), check the original bounds. In enforcement, add a cut that enforces the bounds or tighten LP feasibility tolerance.

Definition in file cons_fixedvar.c.

#include <assert.h>
#include "scip/cons_fixedvar.h"

Go to the source code of this file.

Macros

#define CONSHDLR_NAME   "fixedvar"
 
#define CONSHDLR_DESC   "check bounds of original variables that are not active in transformed problem"
 
#define CONSHDLR_ENFOPRIORITY   -7000000
 
#define CONSHDLR_CHECKPRIORITY   -7000000
 
#define CONSHDLR_EAGERFREQ   -1
 
#define CONSHDLR_NEEDSCONS   FALSE
 
#define DEFAULT_ENABLED   TRUE
 
#define DEFAULT_SUBSCIPS   TRUE
 
#define DEFAULT_PREFERCUT   TRUE
 
#define assertSmallViolation(lb, val, ub)   (assert((val) >= (lb) - 0.5 && (val) <= (ub) + 0.5));
 

Functions

static SCIP_RETCODE addCut (SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_SOL *sol, SCIP_VAR *var, SCIP_Bool *success, SCIP_Bool *cutoff)
 
static SCIP_DECL_CONSHDLRCOPY (conshdlrCopyFixedvar)
 
static SCIP_DECL_CONSFREE (consFreeFixedvar)
 
static SCIP_DECL_CONSINITSOL (consInitsolFixedvar)
 
static SCIP_DECL_CONSEXITSOL (consExitsolFixedvar)
 
static SCIP_DECL_CONSENFOLP (consEnfolpFixedvar)
 
static SCIP_DECL_CONSENFORELAX (consEnforelaxFixedvar)
 
static SCIP_DECL_CONSENFOPS (consEnfopsFixedvar)
 
static SCIP_DECL_CONSCHECK (consCheckFixedvar)
 
static SCIP_DECL_CONSLOCK (consLockFixedvar)
 
SCIP_RETCODE SCIPincludeConshdlrFixedvar (SCIP *scip)
 

Macro Definition Documentation

◆ CONSHDLR_NAME

#define CONSHDLR_NAME   "fixedvar"

Definition at line 44 of file cons_fixedvar.c.

◆ CONSHDLR_DESC

#define CONSHDLR_DESC   "check bounds of original variables that are not active in transformed problem"

Definition at line 45 of file cons_fixedvar.c.

◆ CONSHDLR_ENFOPRIORITY

#define CONSHDLR_ENFOPRIORITY   -7000000

priority of the constraint handler for constraint enforcing

Definition at line 46 of file cons_fixedvar.c.

◆ CONSHDLR_CHECKPRIORITY

#define CONSHDLR_CHECKPRIORITY   -7000000

priority of the constraint handler for checking feasibility

Definition at line 47 of file cons_fixedvar.c.

◆ CONSHDLR_EAGERFREQ

#define CONSHDLR_EAGERFREQ   -1

frequency for using all instead of only the useful constraints in separation, propagation and enforcement, -1 for no eager evaluations, 0 for first only

Definition at line 49 of file cons_fixedvar.c.

◆ CONSHDLR_NEEDSCONS

#define CONSHDLR_NEEDSCONS   FALSE

should the constraint handler be skipped, if no constraints are available?

Definition at line 50 of file cons_fixedvar.c.

◆ DEFAULT_ENABLED

#define DEFAULT_ENABLED   TRUE

enable constraint handler

Definition at line 53 of file cons_fixedvar.c.

◆ DEFAULT_SUBSCIPS

#define DEFAULT_SUBSCIPS   TRUE

also run in subSCIPs

Definition at line 54 of file cons_fixedvar.c.

◆ DEFAULT_PREFERCUT

#define DEFAULT_PREFERCUT   TRUE

whether to prefer separation over tightening LP feastol in enforcement

Definition at line 55 of file cons_fixedvar.c.

◆ assertSmallViolation

#define assertSmallViolation (   lb,
  val,
  ub 
)    (assert((val) >= (lb) - 0.5 && (val) <= (ub) + 0.5));

an assert for checking that the violation is not so large

The idea of this constraint handler is the handling of tiny bound violations that are scaled up above the feasibility tolerance by aggregation factors. Usually, the violation should still be rather "small". For this test, we quantify "small" as 0.5.

Definition at line 84 of file cons_fixedvar.c.

Function Documentation

◆ addCut()

static SCIP_RETCODE addCut ( SCIP scip,
SCIP_CONSHDLR conshdlr,
SCIP_SOL sol,
SCIP_VAR var,
SCIP_Bool success,
SCIP_Bool cutoff 
)
static

add cut to enforce global bounds on variable aggregation

Given an original fixed variable x, add cut lb <= x <= ub. SCIP will replace x by the corresponding aggregation of x in the transformed problem. Though we only need to enforce original bounds on x, we use here the global bounds on x for lb/ub, as these should be as tight as or tighter than the original bounds.

Parameters
scipSCIP data structure
conshdlrfixedvar conshdlr
solsolution that is enforced
varfixed original variable which bound is violated
successbuffer to store whether cut was added
cutoffbuffer to store whether a cutoff was detected

Definition at line 94 of file cons_fixedvar.c.

References FALSE, NULL, SCIP_CALL, SCIP_MAXSTRLEN, SCIP_OKAY, SCIPaddRow(), SCIPaddVarToRow(), SCIPcreateEmptyRowConshdlr(), SCIPdebugMsg, SCIPgetRowSolFeasibility(), SCIPgetSolVal(), SCIPisFeasNegative(), SCIPprintRow(), SCIPreleaseRow(), SCIPsnprintf(), SCIPvarGetLbGlobal(), SCIPvarGetLbOriginal(), SCIPvarGetName(), SCIPvarGetUbGlobal(), SCIPvarGetUbOriginal(), and TRUE.

Referenced by SCIP_DECL_CONSENFOLP(), and SCIP_DECL_CONSENFORELAX().

◆ SCIP_DECL_CONSHDLRCOPY()

static SCIP_DECL_CONSHDLRCOPY ( conshdlrCopyFixedvar  )
static

copy method for constraint handler plugins (called when SCIP copies plugins)

Definition at line 145 of file cons_fixedvar.c.

References CONSHDLR_NAME, NULL, SCIP_CALL, SCIP_OKAY, SCIPconshdlrGetData(), SCIPconshdlrGetName(), SCIPincludeConshdlrFixedvar(), and TRUE.

◆ SCIP_DECL_CONSFREE()

static SCIP_DECL_CONSFREE ( consFreeFixedvar  )
static

destructor of constraint handler to free constraint handler data (called when SCIP is exiting)

Definition at line 163 of file cons_fixedvar.c.

References NULL, SCIP_OKAY, SCIPconshdlrGetData(), SCIPconshdlrSetData(), and SCIPfreeBlockMemory.

◆ SCIP_DECL_CONSINITSOL()

static SCIP_DECL_CONSINITSOL ( consInitsolFixedvar  )
static

solving process initialization method of constraint handler (called when branch and bound process is about to begin)

Definition at line 180 of file cons_fixedvar.c.

References NULL, SCIP_CALL, SCIP_OKAY, SCIPallocBlockMemoryArray, SCIPconshdlrGetData(), SCIPgetNFixedVars(), SCIPgetNOrigVars(), SCIPgetOrigVars(), SCIPgetTransformedVar(), SCIPisInfinity(), SCIPvarGetLbOriginal(), SCIPvarGetUbOriginal(), and SCIPvarIsActive().

◆ SCIP_DECL_CONSEXITSOL()

static SCIP_DECL_CONSEXITSOL ( consExitsolFixedvar  )
static

solving process deinitialization method of constraint handler (called before branch and bound process data is freed)

Definition at line 238 of file cons_fixedvar.c.

References NULL, SCIP_OKAY, SCIPconshdlrGetData(), and SCIPfreeBlockMemoryArrayNull.

◆ SCIP_DECL_CONSENFOLP()

◆ SCIP_DECL_CONSENFORELAX()

static SCIP_DECL_CONSENFORELAX ( consEnforelaxFixedvar  )
static

◆ SCIP_DECL_CONSENFOPS()

static SCIP_DECL_CONSENFOPS ( consEnfopsFixedvar  )
static

constraint enforcing method of constraint handler for pseudo solutions

Definition at line 406 of file cons_fixedvar.c.

References assertSmallViolation, NULL, SCIP_FEASIBLE, SCIP_OKAY, SCIP_Real, SCIP_SOLVELP, SCIPconshdlrGetData(), SCIPgetSolVal(), SCIPisFeasGT(), SCIPisFeasLT(), SCIPisInfinity(), SCIPvarGetLbOriginal(), and SCIPvarGetUbOriginal().

◆ SCIP_DECL_CONSCHECK()

◆ SCIP_DECL_CONSLOCK()

static SCIP_DECL_CONSLOCK ( consLockFixedvar  )
static

variable rounding lock method of constraint handler

Definition at line 556 of file cons_fixedvar.c.

References SCIP_OKAY.