Scippy

SCIP

Solving Constraint Integer Programs

Detailed Description

constraint handler for linking constraints

Author
Stefan Heinz
Jens Schulz

The constraints handler stores linking constraints between a linking variable (integer or continuous) and an array of binary variables. Such a linking constraint has the form:

linkvar = sum_{i=1}^n {vals[i] * binvars[i]}

with the additional side condition that exactly one binary variable has to be one (set partitioning condition).

This constraint can be created only with the linking variable if it is an integer variable. In this case the binary variables are only created on demand. That is, whenever someone asks for the binary variables. Therefore, such constraints can be used to get a "binary representation" of the domain of the linking variable which will be dynamically created.

Definition in file cons_linking.c.

#include "blockmemshell/memory.h"
#include "scip/cons_linear.h"
#include "scip/cons_linking.h"
#include "scip/cons_setppc.h"
#include "scip/pub_cons.h"
#include "scip/pub_event.h"
#include "scip/pub_lp.h"
#include "scip/pub_message.h"
#include "scip/pub_misc.h"
#include "scip/pub_misc_sort.h"
#include "scip/pub_var.h"
#include "scip/scip_conflict.h"
#include "scip/scip_cons.h"
#include "scip/scip_copy.h"
#include "scip/scip_cut.h"
#include "scip/scip_event.h"
#include "scip/scip_general.h"
#include "scip/scip_lp.h"
#include "scip/scip_mem.h"
#include "scip/scip_message.h"
#include "scip/scip_nlp.h"
#include "scip/scip_numerics.h"
#include "scip/scip_param.h"
#include "scip/scip_prob.h"
#include "scip/scip_probing.h"
#include "scip/scip_sol.h"
#include "scip/scip_tree.h"
#include "scip/scip_var.h"

Go to the source code of this file.

Macros

#define CONSHDLR_NAME   "linking"
 
#define CONSHDLR_DESC   "linking constraint x = sum_{i=1}^{n} c_i*y_i, y1+...+yn = 1, x real, y's binary"
 
#define EVENTHDLR_NAME   "linking"
 
#define EVENTHDLR_DESC   "event handler for linking constraints"
 
#define CONSHDLR_SEPAPRIORITY   750000
 
#define CONSHDLR_ENFOPRIORITY   -2050000
 
#define CONSHDLR_CHECKPRIORITY   -750000
 
#define CONSHDLR_SEPAFREQ   1
 
#define CONSHDLR_PROPFREQ   1
 
#define CONSHDLR_EAGERFREQ   100
 
#define CONSHDLR_MAXPREROUNDS   -1
 
#define CONSHDLR_DELAYSEPA   FALSE
 
#define CONSHDLR_DELAYPROP   FALSE
 
#define CONSHDLR_NEEDSCONS   TRUE
 
#define CONSHDLR_PROP_TIMING   SCIP_PROPTIMING_BEFORELP
 
#define CONSHDLR_PRESOLTIMING   SCIP_PRESOLTIMING_MEDIUM
 
#define HASHSIZE_BINVARSCONS   500
 
#define DEFAULT_LINEARIZE   FALSE
 

Functions

static void * getHashmapKey (SCIP_VAR *var)
 
static void consdataSort (SCIP_CONSDATA *consdata)
 
static SCIP_RETCODE lockRounding (SCIP *scip, SCIP_CONS *cons, SCIP_VAR **binvars, int nbinvars)
 
static SCIP_RETCODE conshdlrdataCreate (SCIP *scip, SCIP_CONSHDLRDATA **conshdlrdata, SCIP_EVENTHDLR *eventhdlr)
 
static void conshdlrdataFree (SCIP *scip, SCIP_CONSHDLRDATA **conshdlrdata)
 
static SCIP_RETCODE consdataPrint (SCIP *scip, SCIP_CONSDATA *consdata, FILE *file)
 
static SCIP_RETCODE catchEvent (SCIP *scip, SCIP_CONSDATA *consdata, SCIP_EVENTHDLR *eventhdlr, int pos)
 
static SCIP_RETCODE dropEvent (SCIP *scip, SCIP_CONSDATA *consdata, SCIP_EVENTHDLR *eventhdlr, int pos)
 
static SCIP_RETCODE catchAllEvents (SCIP *scip, SCIP_CONSDATA *consdata, SCIP_EVENTHDLR *eventhdlr)
 
static SCIP_RETCODE dropAllEvents (SCIP *scip, SCIP_CONSDATA *consdata, SCIP_EVENTHDLR *eventhdlr)
 
static SCIP_RETCODE consdataLinearize (SCIP *scip, SCIP_CONS *cons, SCIP_CONSDATA *consdata)
 
static SCIP_RETCODE consdataCreateBinvars (SCIP *scip, SCIP_CONS *cons, SCIP_CONSDATA *consdata, SCIP_EVENTHDLR *eventhdlr, SCIP_Bool linearize)
 
static SCIP_RETCODE consdataCreate (SCIP *scip, SCIP_EVENTHDLR *eventhdlr, SCIP_CONSDATA **consdata, SCIP_VAR *linkvar, SCIP_VAR **binvars, SCIP_Real *vals, int nbinvars)
 
static SCIP_RETCODE consdataFree (SCIP *scip, SCIP_CONSDATA **consdata)
 
static SCIP_RETCODE analyzeConflict (SCIP *scip, SCIP_CONS *cons, SCIP_VAR *linkvar, SCIP_VAR *binvar, SCIP_Bool lblinkvar, SCIP_Bool ublinkvar)
 
static SCIP_RETCODE consFixLinkvar (SCIP *scip, SCIP_CONS *cons, int pos, SCIP_Bool *cutoff)
 
static SCIP_RETCODE processRealBoundChg (SCIP *scip, SCIP_CONS *cons, SCIP_Bool *cutoff, int *nchgbds, SCIP_Bool *mustcheck)
 
static SCIP_RETCODE delCoefPos (SCIP *scip, SCIP_EVENTHDLR *eventhdlr, SCIP_CONS *cons, int pos)
 
static SCIP_RETCODE removeFixedBinvars (SCIP *scip, SCIP_EVENTHDLR *eventhdlr, SCIP_CONS *cons)
 
static SCIP_RETCODE tightenedLinkvar (SCIP *scip, SCIP_CONS *cons, SCIP_CONSDATA *consdata, SCIP_Bool *cutoff, int *nchgbds)
 
static SCIP_RETCODE processBinvarFixings (SCIP *scip, SCIP_CONS *cons, SCIP_Bool *cutoff, int *nchgbds, SCIP_Bool *addcut, SCIP_Bool *mustcheck)
 
static SCIP_Bool checkCons (SCIP *scip, SCIP_CONS *cons, SCIP_SOL *sol)
 
static SCIP_RETCODE createRows (SCIP *scip, SCIP_CONS *cons)
 
static SCIP_RETCODE addCuts (SCIP *scip, SCIP_CONS *cons, SCIP_Bool *cutoff)
 
static SCIP_RETCODE addNlrow (SCIP *scip, SCIP_CONS *cons)
 
static SCIP_RETCODE separateCons (SCIP *scip, SCIP_CONS *cons, SCIP_SOL *sol, SCIP_Bool *cutoff, SCIP_Bool *separated, int *nchgbds)
 
static SCIP_RETCODE enforcePseudo (SCIP *scip, SCIP_CONS *cons, SCIP_Bool *cutoff, SCIP_Bool *infeasible, int *nchgbds, SCIP_Bool *solvelp)
 
static SCIP_RETCODE enforceConstraint (SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS **conss, int nconss, int nusefulconss, SCIP_SOL *sol, SCIP_RESULT *result)
 
static SCIP_DECL_CONSHDLRCOPY (conshdlrCopyLinking)
 
static SCIP_DECL_CONSFREE (consFreeLinking)
 
static SCIP_DECL_CONSINITPRE (consInitpreLinking)
 
static SCIP_DECL_CONSINITSOL (consInitsolLinking)
 
static SCIP_DECL_CONSEXITSOL (consExitsolLinking)
 
static SCIP_DECL_CONSDELETE (consDeleteLinking)
 
static SCIP_DECL_CONSTRANS (consTransLinking)
 
static SCIP_DECL_CONSINITLP (consInitlpLinking)
 
static SCIP_DECL_CONSSEPALP (consSepalpLinking)
 
static SCIP_DECL_CONSSEPASOL (consSepasolLinking)
 
static SCIP_DECL_CONSENFOLP (consEnfolpLinking)
 
static SCIP_DECL_CONSENFORELAX (consEnforelaxLinking)
 
static SCIP_DECL_CONSENFOPS (consEnfopsLinking)
 
static SCIP_DECL_CONSCHECK (consCheckLinking)
 
static SCIP_DECL_CONSPROP (consPropLinking)
 
static SCIP_DECL_CONSPRESOL (consPresolLinking)
 
static SCIP_DECL_CONSRESPROP (consRespropLinking)
 
static SCIP_DECL_CONSLOCK (consLockLinking)
 
static SCIP_DECL_CONSACTIVE (consActiveLinking)
 
static SCIP_DECL_CONSDEACTIVE (consDeactiveLinking)
 
static SCIP_DECL_CONSENABLE (consEnableLinking)
 
static SCIP_DECL_CONSPRINT (consPrintLinking)
 
static SCIP_DECL_CONSCOPY (consCopyLinking)
 
static SCIP_DECL_CONSPARSE (consParseLinking)
 
static SCIP_DECL_CONSGETVARS (consGetVarsLinking)
 
static SCIP_DECL_CONSGETNVARS (consGetNVarsLinking)
 
static SCIP_DECL_EVENTEXEC (eventExecBinvar)
 
SCIP_RETCODE SCIPincludeConshdlrLinking (SCIP *scip)
 
SCIP_RETCODE SCIPcreateConsLinking (SCIP *scip, SCIP_CONS **cons, const char *name, SCIP_VAR *linkvar, SCIP_VAR **binvars, SCIP_Real *vals, int nbinvars, SCIP_Bool initial, SCIP_Bool separate, SCIP_Bool enforce, SCIP_Bool check, SCIP_Bool propagate, SCIP_Bool local, SCIP_Bool modifiable, SCIP_Bool dynamic, SCIP_Bool removable, SCIP_Bool stickingatnode)
 
SCIP_RETCODE SCIPcreateConsBasicLinking (SCIP *scip, SCIP_CONS **cons, const char *name, SCIP_VAR *linkvar, SCIP_VAR **binvars, SCIP_Real *vals, int nbinvars)
 
SCIP_Bool SCIPexistsConsLinking (SCIP *scip, SCIP_VAR *linkvar)
 
SCIP_CONSSCIPgetConsLinking (SCIP *scip, SCIP_VAR *linkvar)
 
SCIP_VARSCIPgetLinkvarLinking (SCIP *scip, SCIP_CONS *cons)
 
SCIP_RETCODE SCIPgetBinvarsLinking (SCIP *scip, SCIP_CONS *cons, SCIP_VAR ***binvars, int *nbinvars)
 
int SCIPgetNBinvarsLinking (SCIP *scip, SCIP_CONS *cons)
 
SCIP_RealSCIPgetValsLinking (SCIP *scip, SCIP_CONS *cons)
 
SCIP_RETCODE SCIPgetBinvarsDataLinking (SCIP_CONS *cons, SCIP_VAR ***binvars, SCIP_Real **vals, int *nbinvars)
 

Macro Definition Documentation

◆ CONSHDLR_NAME

◆ CONSHDLR_DESC

#define CONSHDLR_DESC   "linking constraint x = sum_{i=1}^{n} c_i*y_i, y1+...+yn = 1, x real, y's binary"

Definition at line 82 of file cons_linking.c.

Referenced by SCIPincludeConshdlrLinking().

◆ EVENTHDLR_NAME

#define EVENTHDLR_NAME   "linking"

Definition at line 84 of file cons_linking.c.

Referenced by SCIP_DECL_EVENTEXEC(), and SCIPincludeConshdlrLinking().

◆ EVENTHDLR_DESC

#define EVENTHDLR_DESC   "event handler for linking constraints"

Definition at line 85 of file cons_linking.c.

Referenced by SCIPincludeConshdlrLinking().

◆ CONSHDLR_SEPAPRIORITY

#define CONSHDLR_SEPAPRIORITY   750000

priority of the constraint handler for separation

Definition at line 87 of file cons_linking.c.

Referenced by SCIPincludeConshdlrLinking().

◆ CONSHDLR_ENFOPRIORITY

#define CONSHDLR_ENFOPRIORITY   -2050000

priority of the constraint handler for constraint enforcing

Definition at line 88 of file cons_linking.c.

Referenced by SCIPincludeConshdlrLinking().

◆ CONSHDLR_CHECKPRIORITY

#define CONSHDLR_CHECKPRIORITY   -750000

priority of the constraint handler for checking feasibility

Definition at line 89 of file cons_linking.c.

Referenced by SCIPincludeConshdlrLinking().

◆ CONSHDLR_SEPAFREQ

#define CONSHDLR_SEPAFREQ   1

frequency for separating cuts; zero means to separate only in the root node

Definition at line 90 of file cons_linking.c.

Referenced by SCIPincludeConshdlrLinking().

◆ CONSHDLR_PROPFREQ

#define CONSHDLR_PROPFREQ   1

frequency for propagating domains; zero means only preprocessing propagation

Definition at line 91 of file cons_linking.c.

Referenced by SCIPincludeConshdlrLinking().

◆ CONSHDLR_EAGERFREQ

#define CONSHDLR_EAGERFREQ   100

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 92 of file cons_linking.c.

Referenced by SCIPincludeConshdlrLinking().

◆ CONSHDLR_MAXPREROUNDS

#define CONSHDLR_MAXPREROUNDS   -1

maximal number of presolving rounds the constraint handler participates in (-1: no limit)

Definition at line 93 of file cons_linking.c.

Referenced by SCIPincludeConshdlrLinking().

◆ CONSHDLR_DELAYSEPA

#define CONSHDLR_DELAYSEPA   FALSE

should separation method be delayed, if other separators found cuts?

Definition at line 94 of file cons_linking.c.

Referenced by SCIPincludeConshdlrLinking().

◆ CONSHDLR_DELAYPROP

#define CONSHDLR_DELAYPROP   FALSE

should propagation method be delayed, if other propagators found reductions?

Definition at line 95 of file cons_linking.c.

Referenced by SCIPincludeConshdlrLinking().

◆ CONSHDLR_NEEDSCONS

#define CONSHDLR_NEEDSCONS   TRUE

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

Definition at line 96 of file cons_linking.c.

Referenced by SCIPincludeConshdlrLinking().

◆ CONSHDLR_PROP_TIMING

#define CONSHDLR_PROP_TIMING   SCIP_PROPTIMING_BEFORELP

propagation timing mask of the constraint handler

Definition at line 98 of file cons_linking.c.

Referenced by SCIPincludeConshdlrLinking().

◆ CONSHDLR_PRESOLTIMING

#define CONSHDLR_PRESOLTIMING   SCIP_PRESOLTIMING_MEDIUM

presolving timing of the constraint handler (fast, medium, or exhaustive)

Definition at line 99 of file cons_linking.c.

Referenced by SCIPincludeConshdlrLinking().

◆ HASHSIZE_BINVARSCONS

#define HASHSIZE_BINVARSCONS   500

minimal size of hash table in linking constraint handler

Definition at line 102 of file cons_linking.c.

Referenced by SCIPcreateConsLinking().

◆ DEFAULT_LINEARIZE

#define DEFAULT_LINEARIZE   FALSE

should the linking constraint be linearize after the binary variable are created

Definition at line 103 of file cons_linking.c.

Referenced by SCIPincludeConshdlrLinking().

Function Documentation

◆ getHashmapKey()

static void* getHashmapKey ( SCIP_VAR var)
static

returns for a given linking variable the corresponding hash map key

Parameters
varvariable to get the hash map key for

Definition at line 143 of file cons_linking.c.

References SCIPvarGetIndex().

Referenced by checkCons(), SCIP_DECL_CONSDELETE(), SCIP_DECL_CONSTRANS(), SCIPcreateConsLinking(), SCIPexistsConsLinking(), and SCIPgetConsLinking().

◆ consdataSort()

static void consdataSort ( SCIP_CONSDATA consdata)
static
Parameters
consdatalinking constraint data

Definition at line 153 of file cons_linking.c.

References SCIPsortRealPtr(), and TRUE.

Referenced by processBinvarFixings(), processRealBoundChg(), SCIPgetBinvarsDataLinking(), and SCIPgetValsLinking().

◆ lockRounding()

static SCIP_RETCODE lockRounding ( SCIP scip,
SCIP_CONS cons,
SCIP_VAR **  binvars,
int  nbinvars 
)
static

installs rounding locks for the binary variables in the given linking constraint

Parameters
scipSCIP data structure
conslinking constraint
binvarsbinary variables
nbinvarsnumber of binary variables

Definition at line 169 of file cons_linking.c.

References b, SCIP_CALL, SCIP_OKAY, SCIPlockVarCons(), and TRUE.

Referenced by consdataCreateBinvars().

◆ conshdlrdataCreate()

static SCIP_RETCODE conshdlrdataCreate ( SCIP scip,
SCIP_CONSHDLRDATA **  conshdlrdata,
SCIP_EVENTHDLR eventhdlr 
)
static

creates constraint handler data for the linking constraint handler

Parameters
scipSCIP data structure
conshdlrdatapointer to store the constraint handler data
eventhdlrevent handler

Definition at line 188 of file cons_linking.c.

References NULL, SCIP_CALL, SCIP_OKAY, and SCIPallocBlockMemory.

Referenced by SCIPincludeConshdlrLinking().

◆ conshdlrdataFree()

static void conshdlrdataFree ( SCIP scip,
SCIP_CONSHDLRDATA **  conshdlrdata 
)
static

frees constraint handler data for linking constraint handler

Parameters
scipSCIP data structure
conshdlrdatapointer to the constraint handler data

Definition at line 211 of file cons_linking.c.

References NULL, SCIPfreeBlockMemory, and SCIPhashmapFree().

Referenced by SCIP_DECL_CONSFREE().

◆ consdataPrint()

static SCIP_RETCODE consdataPrint ( SCIP scip,
SCIP_CONSDATA consdata,
FILE *  file 
)
static

prints linking constraint to file stream

Parameters
scipSCIP data structure
consdatalinking constraint data
fileoutput file (or NULL for standard output)

Definition at line 229 of file cons_linking.c.

References FALSE, NULL, SCIP_CALL, SCIP_OKAY, SCIPinfoMessage(), SCIPwriteVarName(), and SCIPwriteVarsLinearsum().

Referenced by SCIP_DECL_CONSPRINT().

◆ catchEvent()

static SCIP_RETCODE catchEvent ( SCIP scip,
SCIP_CONSDATA consdata,
SCIP_EVENTHDLR eventhdlr,
int  pos 
)
static

catches events for variable at given position

Parameters
scipSCIP data structure
consdatalinking constraint data
eventhdlrevent handler to call for the event processing
posarray position of variable to catch bound change events for

Definition at line 270 of file cons_linking.c.

References NULL, SCIP_CALL, SCIP_EVENTTYPE_BOUNDCHANGED, SCIP_OKAY, SCIPcatchVarEvent(), SCIPisEQ(), SCIPvarGetLbLocal(), and SCIPvarGetUbLocal().

Referenced by catchAllEvents().

◆ dropEvent()

static SCIP_RETCODE dropEvent ( SCIP scip,
SCIP_CONSDATA consdata,
SCIP_EVENTHDLR eventhdlr,
int  pos 
)
static

drops events for variable at given position

Parameters
scipSCIP data structure
consdatalinking constraint data
eventhdlrevent handler to call for the event processing
posarray position of variable to catch bound change events for

Definition at line 302 of file cons_linking.c.

References NULL, SCIP_CALL, SCIP_EVENTTYPE_BOUNDCHANGED, SCIP_OKAY, SCIPdropVarEvent(), SCIPisEQ(), SCIPvarGetLbLocal(), and SCIPvarGetUbLocal().

Referenced by delCoefPos(), and dropAllEvents().

◆ catchAllEvents()

static SCIP_RETCODE catchAllEvents ( SCIP scip,
SCIP_CONSDATA consdata,
SCIP_EVENTHDLR eventhdlr 
)
static

catches bound change events for all variables in transformed linking constraint

Parameters
scipSCIP data structure
consdatalinking constraint data
eventhdlrevent handler to call for the event processing

Definition at line 333 of file cons_linking.c.

References catchEvent(), NULL, SCIP_CALL, and SCIP_OKAY.

Referenced by consdataCreate(), and consdataCreateBinvars().

◆ dropAllEvents()

static SCIP_RETCODE dropAllEvents ( SCIP scip,
SCIP_CONSDATA consdata,
SCIP_EVENTHDLR eventhdlr 
)
static

drops bound change events for all variables in transformed linking constraint

Parameters
scipSCIP data structure
consdatalinking constraint data
eventhdlrevent handler to call for the event processing

Definition at line 359 of file cons_linking.c.

References dropEvent(), NULL, SCIP_CALL, and SCIP_OKAY.

Referenced by SCIP_DECL_CONSDELETE().

◆ consdataLinearize()

static SCIP_RETCODE consdataLinearize ( SCIP scip,
SCIP_CONS cons,
SCIP_CONSDATA consdata 
)
static

linearize the given linking constraint into a set partitioning constraint for the binary variables and a linear constraint for the linking between the linking variable and the binary variables

Parameters
scipSCIP data structure
conslinking constraint
consdatalinking constraint data

Definition at line 386 of file cons_linking.c.

References b, NULL, SCIP_CALL, SCIP_OKAY, SCIPaddCoefLinear(), SCIPaddCons(), SCIPconsGetName(), SCIPconsIsChecked(), SCIPconsIsDynamic(), SCIPconsIsEnforced(), SCIPconsIsInitial(), SCIPconsIsLocal(), SCIPconsIsModifiable(), SCIPconsIsPropagated(), SCIPconsIsRemovable(), SCIPconsIsSeparated(), SCIPconsIsStickingAtNode(), SCIPcreateConsLinear(), SCIPcreateConsSetpart(), SCIPdebugMsg, and SCIPreleaseCons().

Referenced by consdataCreateBinvars(), SCIP_DECL_CONSENABLE(), and SCIP_DECL_CONSINITPRE().

◆ consdataCreateBinvars()

static SCIP_RETCODE consdataCreateBinvars ( SCIP scip,
SCIP_CONS cons,
SCIP_CONSDATA consdata,
SCIP_EVENTHDLR eventhdlr,
SCIP_Bool  linearize 
)
static

creates the binary variables

Parameters
scipSCIP data structure
conslinking constraint
consdatalinking constraint data
eventhdlrevent handler for bound change events on binary variables
linearizeshould the linking constraint be linearized

Definition at line 425 of file cons_linking.c.

References b, catchAllEvents(), consdataLinearize(), FALSE, lockRounding(), NULL, SCIP_CALL, SCIP_MAXSTRLEN, SCIP_OKAY, SCIP_VARTYPE_BINARY, SCIPaddVar(), SCIPallocBlockMemoryArray, SCIPconvertRealToInt(), SCIPcreateVar(), SCIPdebugMsg, SCIPenableCons(), SCIPisTransformed(), SCIPsnprintf(), SCIPvarGetLbGlobal(), SCIPvarGetName(), SCIPvarGetUbGlobal(), and TRUE.

Referenced by SCIPcreateConsLinking(), and SCIPgetBinvarsLinking().

◆ consdataCreate()

static SCIP_RETCODE consdataCreate ( SCIP scip,
SCIP_EVENTHDLR eventhdlr,
SCIP_CONSDATA **  consdata,
SCIP_VAR linkvar,
SCIP_VAR **  binvars,
SCIP_Real vals,
int  nbinvars 
)
static

creates consdata

Parameters
scipSCIP data structure
eventhdlrevent handler to call for the event processing
consdatapointer to constraint data
linkvarlinking variable which is linked
binvarsbinary variables
valscoefficients of the binary variables
nbinvarsnumber of binary starting variables

Definition at line 528 of file cons_linking.c.

References catchAllEvents(), FALSE, NULL, SCIP_CALL, SCIP_OKAY, SCIP_VARTYPE_CONTINUOUS, SCIPallocBlockMemory, SCIPcaptureVar(), SCIPduplicateBlockMemoryArray, SCIPgetTransformedVar(), SCIPgetTransformedVars(), SCIPisTransformed(), and SCIPvarGetType().

Referenced by SCIP_DECL_CONSTRANS(), and SCIPcreateConsLinking().

◆ consdataFree()

static SCIP_RETCODE consdataFree ( SCIP scip,
SCIP_CONSDATA **  consdata 
)
static

free consdata

Parameters
scipSCIP data structure
consdatapointer to consdata

Definition at line 613 of file cons_linking.c.

References NULL, SCIP_CALL, SCIP_OKAY, SCIPfreeBlockMemory, SCIPfreeBlockMemoryArray, SCIPreleaseNlRow(), SCIPreleaseRow(), and SCIPreleaseVar().

Referenced by SCIP_DECL_CONSDELETE().

◆ analyzeConflict()

static SCIP_RETCODE analyzeConflict ( SCIP scip,
SCIP_CONS cons,
SCIP_VAR linkvar,
SCIP_VAR binvar,
SCIP_Bool  lblinkvar,
SCIP_Bool  ublinkvar 
)
static

analyzes conflicting assignment on given constraint where reason comes from the linking variable lower or upper bound

Parameters
scipSCIP data structure
conslinking constraint to be processed
linkvarlinking variable
binvarbinary variable is the reason
lblinkvarlower bound of linking variable is the reason
ublinkvarupper bound of linking variable is the reason

Definition at line 673 of file cons_linking.c.

References FALSE, NULL, SCIP_CALL, SCIP_CONFTYPE_PROPAGATION, SCIP_OKAY, SCIP_STAGE_SOLVING, SCIPaddConflictBinvar(), SCIPaddConflictLb(), SCIPaddConflictUb(), SCIPanalyzeConflictCons(), SCIPgetStage(), SCIPinitConflictAnalysis(), SCIPinProbing(), and SCIPisConflictAnalysisApplicable().

Referenced by consFixLinkvar(), and processRealBoundChg().

◆ consFixLinkvar()

static SCIP_RETCODE consFixLinkvar ( SCIP scip,
SCIP_CONS cons,
int  pos,
SCIP_Bool cutoff 
)
static

fix linking variable to the value of the binary variable at pos

Parameters
scipSCIP data structure
conslinking constraint to be processed
posposition of binary variable
cutoffpointer to store TRUE, if the node can be cut off

Definition at line 721 of file cons_linking.c.

References analyzeConflict(), FALSE, NULL, SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPconsGetData(), SCIPinferVarLbCons(), SCIPinferVarUbCons(), SCIPisFeasEQ(), SCIPisFeasLE(), SCIPvarGetLbLocal(), SCIPvarGetUbLocal(), and TRUE.

Referenced by processBinvarFixings().

◆ processRealBoundChg()

static SCIP_RETCODE processRealBoundChg ( SCIP scip,
SCIP_CONS cons,
SCIP_Bool cutoff,
int *  nchgbds,
SCIP_Bool mustcheck 
)
static

checks constraint for violation from the local bound of the linking variable, applies fixings to the binary variables if possible

Parameters
scipSCIP data structure
conslinking constraint to be processed
cutoffpointer to store TRUE, if the node can be cut off
nchgbdspointer to store the number of changes (foxed) variable bounds
mustcheckpointer to store whether this constraint must be checked for feasibility

Definition at line 778 of file cons_linking.c.

References analyzeConflict(), b, consdataSort(), CONSHDLR_NAME, FALSE, NULL, SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIP_VARSTATUS_AGGREGATED, SCIP_VARSTATUS_MULTAGGR, SCIPaddCons(), SCIPconsGetData(), SCIPconsGetHdlr(), SCIPconsGetName(), SCIPconshdlrGetName(), SCIPconsIsChecked(), SCIPconsIsDynamic(), SCIPconsIsEnforced(), SCIPconsIsInitial(), SCIPconsIsLocal(), SCIPconsIsModifiable(), SCIPconsIsPropagated(), SCIPconsIsRemovable(), SCIPconsIsSeparated(), SCIPconsIsStickingAtNode(), SCIPcreateConsSetpart(), SCIPdebugMsg, SCIPdelConsLocal(), SCIPgetDepth(), SCIPinferBinvarCons(), SCIPisEQ(), SCIPisGT(), SCIPisLT(), SCIPreleaseCons(), SCIPvarGetAggrVar(), SCIPvarGetLbLocal(), SCIPvarGetName(), SCIPvarGetStatus(), SCIPvarGetUbLocal(), and TRUE.

Referenced by enforcePseudo(), SCIP_DECL_CONSPRESOL(), SCIP_DECL_CONSPROP(), and separateCons().

◆ delCoefPos()

static SCIP_RETCODE delCoefPos ( SCIP scip,
SCIP_EVENTHDLR eventhdlr,
SCIP_CONS cons,
int  pos 
)
static

deletes coefficient at given position from the binary variable array

Parameters
scipSCIP data structure
eventhdlrevent handler to call for the event processing
conslinking constraint
posposition of coefficient to delete

Definition at line 978 of file cons_linking.c.

References dropEvent(), FALSE, NULL, SCIP_CALL, SCIP_OKAY, SCIPconsGetData(), SCIPconsGetHdlr(), SCIPconshdlrGetData(), SCIPconsIsTransformed(), SCIPreleaseVar(), SCIPunlockVarCons(), SCIPvarIsTransformed(), and TRUE.

Referenced by removeFixedBinvars().

◆ removeFixedBinvars()

static SCIP_RETCODE removeFixedBinvars ( SCIP scip,
SCIP_EVENTHDLR eventhdlr,
SCIP_CONS cons 
)
static

remove the trailing and leading binary variables that are fixed to zero

Parameters
scipSCIP data structure
eventhdlrevent handler to call for the event processing
conslinking constraint

Definition at line 1036 of file cons_linking.c.

References b, delCoefPos(), NULL, SCIP_CALL, SCIP_OKAY, SCIP_STAGE_PRESOLVING, SCIPconsGetData(), SCIPgetDepth(), SCIPgetStage(), SCIPinProbing(), SCIPinRepropagation(), and SCIPvarGetUbLocal().

Referenced by SCIP_DECL_CONSPRESOL().

◆ tightenedLinkvar()

static SCIP_RETCODE tightenedLinkvar ( SCIP scip,
SCIP_CONS cons,
SCIP_CONSDATA consdata,
SCIP_Bool cutoff,
int *  nchgbds 
)
static

tightened the linking variable due to binary variables which are fixed to zero

Parameters
scipSCIP data structure
conslinking constraint to be processed
consdatalinking constraint to be processed
cutoffpointer to store TRUE, if the node can be cut off
nchgbdspointer to store the number of changed variable bounds

Definition at line 1083 of file cons_linking.c.

References b, FALSE, NULL, SCIP_Bool, SCIP_CALL, SCIP_CONFTYPE_PROPAGATION, SCIP_OKAY, SCIP_Real, SCIP_STAGE_SOLVING, SCIP_VARSTATUS_MULTAGGR, SCIPaddConflictBinvar(), SCIPaddConflictLb(), SCIPaddConflictUb(), SCIPanalyzeConflictCons(), SCIPdebugMsg, SCIPgetStage(), SCIPinferVarLbCons(), SCIPinferVarUbCons(), SCIPinitConflictAnalysis(), SCIPinProbing(), SCIPisConflictAnalysisApplicable(), SCIPvarGetLbLocal(), SCIPvarGetName(), SCIPvarGetProbvar(), SCIPvarGetStatus(), SCIPvarGetUbLocal(), and TRUE.

Referenced by processBinvarFixings(), and SCIP_DECL_CONSPRESOL().

◆ processBinvarFixings()

static SCIP_RETCODE processBinvarFixings ( SCIP scip,
SCIP_CONS cons,
SCIP_Bool cutoff,
int *  nchgbds,
SCIP_Bool addcut,
SCIP_Bool mustcheck 
)
static

checks constraint for violation only looking at the fixed binary variables, applies further fixings if possible

Parameters
scipSCIP data structure
conslinking constraint to be processed
cutoffpointer to store TRUE, if the node can be cut off
nchgbdspointer to store the number of changed variable bounds
addcutpointer to store whether this constraint must be added as a cut
mustcheckpointer to store whether this constraint must be checked for feasibility

Definition at line 1220 of file cons_linking.c.

References consdataSort(), consFixLinkvar(), CONSHDLR_NAME, FALSE, NULL, SCIP_Bool, SCIP_CALL, SCIP_CONFTYPE_PROPAGATION, SCIP_OKAY, SCIP_STAGE_SOLVING, SCIP_VARSTATUS_AGGREGATED, SCIP_VARSTATUS_MULTAGGR, SCIPaddConflictBinvar(), SCIPanalyzeConflictCons(), SCIPconsGetData(), SCIPconsGetHdlr(), SCIPconsGetName(), SCIPconshdlrGetName(), SCIPconsIsModifiable(), SCIPdebugMsg, SCIPdelConsLocal(), SCIPgetStage(), SCIPinferBinvarCons(), SCIPinitConflictAnalysis(), SCIPinProbing(), SCIPisConflictAnalysisApplicable(), SCIPisFeasEQ(), SCIPisFeasZero(), SCIPisLT(), SCIPresetConsAge(), SCIPvarGetAggrVar(), SCIPvarGetLbLocal(), SCIPvarGetName(), SCIPvarGetProbvar(), SCIPvarGetStatus(), SCIPvarGetUbLocal(), SCIPvarIsBinary(), tightenedLinkvar(), and TRUE.

Referenced by enforcePseudo(), and SCIP_DECL_CONSPROP().

◆ checkCons()

static SCIP_Bool checkCons ( SCIP scip,
SCIP_CONS cons,
SCIP_SOL sol 
)
static

◆ createRows()

static SCIP_RETCODE createRows ( SCIP scip,
SCIP_CONS cons 
)
static

create two rows for the linking constraint

  • row1: {sum_{b=1}^n-1 vals[b] * binvars[b]} - linkvar = 0
  • row2: {sum_{b=0}^n-1 binvars[b]} = 1.0
Parameters
scipSCIP data structure
conslinking constraint

Definition at line 1656 of file cons_linking.c.

References b, NULL, SCIP_CALL, SCIP_MAXSTRLEN, SCIP_OKAY, SCIPaddVarsToRowSameCoef(), SCIPaddVarToRow(), SCIPconsGetData(), SCIPconsGetName(), SCIPconsIsLocal(), SCIPconsIsModifiable(), SCIPconsIsRemovable(), SCIPcreateEmptyRowCons(), and SCIPsnprintf().

Referenced by addCuts().

◆ addCuts()

static SCIP_RETCODE addCuts ( SCIP scip,
SCIP_CONS cons,
SCIP_Bool cutoff 
)
static

adds linking constraint as cut to the LP

Parameters
scipSCIP data structure
conslinking constraint
cutoffwhether a cutoff has been detected

Definition at line 1706 of file cons_linking.c.

References createRows(), FALSE, NULL, SCIP_CALL, SCIP_OKAY, SCIPaddRow(), SCIPconsGetData(), SCIPconsGetName(), SCIPdebugMsg, SCIProwIsInLP(), and TRUE.

Referenced by SCIP_DECL_CONSINITLP(), and separateCons().

◆ addNlrow()

static SCIP_RETCODE addNlrow ( SCIP scip,
SCIP_CONS cons 
)
static

◆ separateCons()

static SCIP_RETCODE separateCons ( SCIP scip,
SCIP_CONS cons,
SCIP_SOL sol,
SCIP_Bool cutoff,
SCIP_Bool separated,
int *  nchgbds 
)
static

checks constraint for violation, and adds it as a cuts if possible

Parameters
scipSCIP data structure
conslinking constraint to be separated
solprimal CIP solution, NULL for current LP solution
cutoffpointer to store TRUE, if the node can be cut off
separatedpointer to store TRUE, if a cut was found
nchgbdspointer to store the number of changed variables bounds

Definition at line 1810 of file cons_linking.c.

References addCuts(), checkCons(), CONSHDLR_NAME, FALSE, NULL, processRealBoundChg(), SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPconsGetData(), SCIPconsGetHdlr(), SCIPconsGetName(), SCIPconshdlrGetName(), SCIPdebugMsg, SCIPgetRowLPFeasibility(), SCIPincConsAge(), SCIPisFeasNegative(), SCIPresetConsAge(), SCIProwIsInLP(), and TRUE.

Referenced by enforceConstraint(), SCIP_DECL_CONSSEPALP(), and SCIP_DECL_CONSSEPASOL().

◆ enforcePseudo()

static SCIP_RETCODE enforcePseudo ( SCIP scip,
SCIP_CONS cons,
SCIP_Bool cutoff,
SCIP_Bool infeasible,
int *  nchgbds,
SCIP_Bool solvelp 
)
static

enforces the pseudo solution on the given constraint

Parameters
scipSCIP data structure
conslinking constraint to be separated
cutoffpointer to store TRUE, if the node can be cut off
infeasiblepointer to store TRUE, if the constraint was infeasible
nchgbdspointer to store the number of changed variable bounds
solvelppointer to store TRUE, if the LP has to be solved

Definition at line 1903 of file cons_linking.c.

References checkCons(), CONSHDLR_NAME, FALSE, NULL, processBinvarFixings(), processRealBoundChg(), SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIPconsGetHdlr(), SCIPconshdlrGetName(), SCIPhasCurrentNodeLP(), SCIPincConsAge(), SCIPresetConsAge(), and TRUE.

Referenced by SCIP_DECL_CONSENFOPS().

◆ enforceConstraint()

static SCIP_RETCODE enforceConstraint ( SCIP scip,
SCIP_CONSHDLR conshdlr,
SCIP_CONS **  conss,
int  nconss,
int  nusefulconss,
SCIP_SOL sol,
SCIP_RESULT result 
)
static

helper function to enforce constraints

Parameters
scipSCIP data structure
conshdlrconstraint handler
conssconstraints to process
nconssnumber of constraints
nusefulconssnumber of useful (non-obsolete) constraints to process
solsolution to enforce (NULL for the LP solution)
resultpointer to store the result of the enforcing call

Definition at line 1961 of file cons_linking.c.

References CONSHDLR_NAME, FALSE, NULL, SCIP_Bool, SCIP_CALL, SCIP_CUTOFF, SCIP_FEASIBLE, SCIP_OKAY, SCIP_REDUCEDDOM, SCIP_SEPARATED, SCIPconshdlrGetName(), SCIPdebugMsg, and separateCons().

Referenced by SCIP_DECL_CONSENFOLP(), and SCIP_DECL_CONSENFORELAX().

◆ SCIP_DECL_CONSHDLRCOPY()

static SCIP_DECL_CONSHDLRCOPY ( conshdlrCopyLinking  )
static

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

Definition at line 2018 of file cons_linking.c.

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

◆ SCIP_DECL_CONSFREE()

static SCIP_DECL_CONSFREE ( consFreeLinking  )
static

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

Definition at line 2034 of file cons_linking.c.

References CONSHDLR_NAME, conshdlrdataFree(), NULL, SCIP_OKAY, SCIPconshdlrGetData(), and SCIPconshdlrGetName().

◆ SCIP_DECL_CONSINITPRE()

static SCIP_DECL_CONSINITPRE ( consInitpreLinking  )
static

presolving initialization method of constraint handler (called when presolving is about to begin)

Definition at line 2054 of file cons_linking.c.

References consdataLinearize(), NULL, SCIP_CALL, SCIP_OKAY, SCIPconsGetData(), SCIPconshdlrGetData(), SCIPconsIsAdded(), SCIPdelCons(), SCIPdisableCons(), and SCIPvarGetLbGlobal().

◆ SCIP_DECL_CONSINITSOL()

static SCIP_DECL_CONSINITSOL ( consInitsolLinking  )
static

solving process initialization method of constraint handler

Definition at line 2090 of file cons_linking.c.

References addNlrow(), SCIP_CALL, SCIP_OKAY, and SCIPisNLPConstructed().

◆ SCIP_DECL_CONSEXITSOL()

static SCIP_DECL_CONSEXITSOL ( consExitsolLinking  )
static

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

Definition at line 2107 of file cons_linking.c.

References NULL, SCIP_CALL, SCIP_OKAY, SCIPconsGetData(), SCIPreleaseNlRow(), and SCIPreleaseRow().

◆ SCIP_DECL_CONSDELETE()

static SCIP_DECL_CONSDELETE ( consDeleteLinking  )
static

◆ SCIP_DECL_CONSTRANS()

◆ SCIP_DECL_CONSINITLP()

static SCIP_DECL_CONSINITLP ( consInitlpLinking  )
static

LP initialization method of constraint handler (called before the initial LP relaxation at a node is solved)

Definition at line 2217 of file cons_linking.c.

References addCuts(), FALSE, NULL, SCIP_CALL, SCIP_OKAY, SCIPconsGetData(), and SCIPconsIsInitial().

◆ SCIP_DECL_CONSSEPALP()

static SCIP_DECL_CONSSEPALP ( consSepalpLinking  )
static

separation method of constraint handler for LP solutions

Definition at line 2243 of file cons_linking.c.

References CONSHDLR_NAME, FALSE, NULL, SCIP_Bool, SCIP_CALL, SCIP_CUTOFF, SCIP_DIDNOTFIND, SCIP_OKAY, SCIP_REDUCEDDOM, SCIP_SEPARATED, SCIPconshdlrGetName(), SCIPdebugMsg, and separateCons().

◆ SCIP_DECL_CONSSEPASOL()

static SCIP_DECL_CONSSEPASOL ( consSepasolLinking  )
static

separation method of constraint handler for arbitrary primal solutions

Definition at line 2283 of file cons_linking.c.

References CONSHDLR_NAME, FALSE, NULL, SCIP_Bool, SCIP_CALL, SCIP_CUTOFF, SCIP_DIDNOTFIND, SCIP_OKAY, SCIP_REDUCEDDOM, SCIP_SEPARATED, SCIPconshdlrGetName(), SCIPdebugMsg, and separateCons().

◆ SCIP_DECL_CONSENFOLP()

static SCIP_DECL_CONSENFOLP ( consEnfolpLinking  )
static

constraint enforcing method of constraint handler for LP solutions

Definition at line 2323 of file cons_linking.c.

References enforceConstraint(), NULL, SCIP_CALL, and SCIP_OKAY.

◆ SCIP_DECL_CONSENFORELAX()

static SCIP_DECL_CONSENFORELAX ( consEnforelaxLinking  )
static

constraint enforcing method of constraint handler for relaxation solutions

Definition at line 2333 of file cons_linking.c.

References enforceConstraint(), SCIP_CALL, and SCIP_OKAY.

◆ SCIP_DECL_CONSENFOPS()

static SCIP_DECL_CONSENFOPS ( consEnfopsLinking  )
static

constraint enforcing method of constraint handler for pseudo solutions

Definition at line 2343 of file cons_linking.c.

References CONSHDLR_NAME, enforcePseudo(), FALSE, NULL, SCIP_Bool, SCIP_CALL, SCIP_CUTOFF, SCIP_DIDNOTRUN, SCIP_FEASIBLE, SCIP_INFEASIBLE, SCIP_OKAY, SCIP_REDUCEDDOM, SCIP_SOLVELP, SCIPconshdlrGetName(), and SCIPdebugMsg.

◆ SCIP_DECL_CONSCHECK()

static SCIP_DECL_CONSCHECK ( consCheckLinking  )
static

◆ SCIP_DECL_CONSPROP()

static SCIP_DECL_CONSPROP ( consPropLinking  )
static

◆ SCIP_DECL_CONSPRESOL()

◆ SCIP_DECL_CONSRESPROP()

◆ SCIP_DECL_CONSLOCK()

static SCIP_DECL_CONSLOCK ( consLockLinking  )
static

variable rounding lock method of constraint handler

Definition at line 3054 of file cons_linking.c.

References b, NULL, SCIP_CALL, SCIP_LOCKTYPE_MODEL, SCIP_OKAY, SCIPaddVarLocksType(), and SCIPconsGetData().

◆ SCIP_DECL_CONSACTIVE()

static SCIP_DECL_CONSACTIVE ( consActiveLinking  )
static

constraint activation notification method of constraint handler

Definition at line 3078 of file cons_linking.c.

References addNlrow(), CONSHDLR_NAME, NULL, SCIP_CALL, SCIP_OKAY, SCIP_STAGE_SOLVING, SCIPconshdlrGetName(), SCIPconsIsTransformed(), SCIPgetStage(), and SCIPisNLPConstructed().

◆ SCIP_DECL_CONSDEACTIVE()

static SCIP_DECL_CONSDEACTIVE ( consDeactiveLinking  )
static

constraint deactivation notification method of constraint handler

Definition at line 3095 of file cons_linking.c.

References CONSHDLR_NAME, NULL, SCIP_CALL, SCIP_OKAY, SCIP_STAGE_SOLVING, SCIPconsGetData(), SCIPconshdlrGetName(), SCIPconsIsTransformed(), SCIPdelNlRow(), and SCIPgetStage().

◆ SCIP_DECL_CONSENABLE()

static SCIP_DECL_CONSENABLE ( consEnableLinking  )
static

constraint enabling notification method of constraint handler

Definition at line 3121 of file cons_linking.c.

References consdataLinearize(), NULL, SCIP_CALL, SCIP_OKAY, SCIPconsGetData(), SCIPconshdlrGetData(), SCIPdelCons(), SCIPdisableCons(), and SCIPvarGetLbGlobal().

◆ SCIP_DECL_CONSPRINT()

static SCIP_DECL_CONSPRINT ( consPrintLinking  )
static

constraint display method of constraint handler

Definition at line 3149 of file cons_linking.c.

References consdataPrint(), NULL, SCIP_CALL, SCIP_OKAY, and SCIPconsGetData().

◆ SCIP_DECL_CONSCOPY()

static SCIP_DECL_CONSCOPY ( consCopyLinking  )
static

◆ SCIP_DECL_CONSPARSE()

static SCIP_DECL_CONSPARSE ( consParseLinking  )
static

◆ SCIP_DECL_CONSGETVARS()

static SCIP_DECL_CONSGETVARS ( consGetVarsLinking  )
static

constraint method of constraint handler which returns the variables (if possible)

Definition at line 3337 of file cons_linking.c.

References BMScopyMemoryArray, FALSE, NULL, SCIP_OKAY, SCIPconsGetData(), and TRUE.

◆ SCIP_DECL_CONSGETNVARS()

static SCIP_DECL_CONSGETNVARS ( consGetNVarsLinking  )
static

constraint method of constraint handler which returns the number of variables (if possible)

Definition at line 3360 of file cons_linking.c.

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

◆ SCIP_DECL_EVENTEXEC()

static SCIP_DECL_EVENTEXEC ( eventExecBinvar  )
static