constraint handler for linking constraints
The constraints handler stores linking constraints between an integer variable and an array of binary variables. Such a linking constraint has the form:
intvar = 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 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 integer variable which will be dynamically created.
Definition in file cons_linking.c.
#include <assert.h>
#include <string.h>
#include <ctype.h>
#include "scip/cons_linear.h"
#include "scip/cons_linking.h"
#include "scip/cons_setppc.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 integer, 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 SCIP_RETCODE | 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 *intvar, SCIP_VAR **binvars, int *vals, int nbinvars) |
static SCIP_RETCODE | consdataFree (SCIP *scip, SCIP_CONSDATA **consdata) |
static SCIP_RETCODE | analyzeConflict (SCIP *scip, SCIP_CONS *cons, SCIP_VAR *intvar, SCIP_VAR *binvar, SCIP_Bool lbintvar, SCIP_Bool ubintvar) |
static SCIP_RETCODE | consFixInteger (SCIP *scip, SCIP_CONS *cons, int pos, SCIP_Bool *cutoff) |
static SCIP_RETCODE | processIntegerBoundChg (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 | tightenedIntvar (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 | 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_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_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 *intvar, SCIP_VAR **binvars, int *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 *intvar, SCIP_VAR **binvars, int *vals, int nbinvars) |
SCIP_Bool | SCIPexistsConsLinking (SCIP *scip, SCIP_VAR *intvar) |
SCIP_CONS * | SCIPgetConsLinking (SCIP *scip, SCIP_VAR *intvar) |
SCIP_VAR * | SCIPgetIntvarLinking (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) |
int * | SCIPgetValsLinking (SCIP *scip, SCIP_CONS *cons) |
#define CONSHDLR_NAME "linking" |
Definition at line 49 of file cons_linking.c.
Referenced by enforceConstraint(), enforcePseudo(), processBinvarFixings(), processIntegerBoundChg(), SCIP_DECL_CONSCHECK(), SCIP_DECL_CONSCOPY(), SCIP_DECL_CONSDELETE(), SCIP_DECL_CONSENFOPS(), SCIP_DECL_CONSFREE(), SCIP_DECL_CONSHDLRCOPY(), SCIP_DECL_CONSPRESOL(), SCIP_DECL_CONSPROP(), SCIP_DECL_CONSRESPROP(), SCIP_DECL_CONSSEPALP(), SCIP_DECL_CONSSEPASOL(), SCIP_DECL_CONSTRANS(), SCIPcreateConsLinking(), SCIPexistsConsLinking(), SCIPgetBinvarsLinking(), SCIPgetConsLinking(), SCIPgetIntvarLinking(), SCIPgetNBinvarsLinking(), SCIPgetValsLinking(), SCIPincludeConshdlrLinking(), and separateCons().
#define CONSHDLR_DESC "linking constraint x = sum_{i=1}^{n} c_i*y_i, y1+...+yn = 1, x integer, y's binary" |
Definition at line 50 of file cons_linking.c.
Referenced by SCIPincludeConshdlrLinking().
#define EVENTHDLR_NAME "linking" |
Definition at line 52 of file cons_linking.c.
Referenced by SCIP_DECL_EVENTEXEC(), and SCIPincludeConshdlrLinking().
#define EVENTHDLR_DESC "event handler for linking constraints" |
Definition at line 53 of file cons_linking.c.
Referenced by SCIPincludeConshdlrLinking().
#define CONSHDLR_SEPAPRIORITY 750000 |
priority of the constraint handler for separation
Definition at line 55 of file cons_linking.c.
Referenced by SCIPincludeConshdlrLinking().
#define CONSHDLR_ENFOPRIORITY -2050000 |
priority of the constraint handler for constraint enforcing
Definition at line 56 of file cons_linking.c.
Referenced by SCIPincludeConshdlrLinking().
#define CONSHDLR_CHECKPRIORITY -750000 |
priority of the constraint handler for checking feasibility
Definition at line 57 of file cons_linking.c.
Referenced by SCIPincludeConshdlrLinking().
#define CONSHDLR_SEPAFREQ 1 |
frequency for separating cuts; zero means to separate only in the root node
Definition at line 58 of file cons_linking.c.
Referenced by SCIPincludeConshdlrLinking().
#define CONSHDLR_PROPFREQ 1 |
frequency for propagating domains; zero means only preprocessing propagation
Definition at line 59 of file cons_linking.c.
Referenced by SCIPincludeConshdlrLinking().
#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 60 of file cons_linking.c.
Referenced by SCIPincludeConshdlrLinking().
#define CONSHDLR_MAXPREROUNDS -1 |
maximal number of presolving rounds the constraint handler participates in (-1: no limit)
Definition at line 61 of file cons_linking.c.
Referenced by SCIPincludeConshdlrLinking().
#define CONSHDLR_DELAYSEPA FALSE |
should separation method be delayed, if other separators found cuts?
Definition at line 62 of file cons_linking.c.
Referenced by SCIPincludeConshdlrLinking().
#define CONSHDLR_DELAYPROP FALSE |
should propagation method be delayed, if other propagators found reductions?
Definition at line 63 of file cons_linking.c.
Referenced by SCIPincludeConshdlrLinking().
#define CONSHDLR_NEEDSCONS TRUE |
should the constraint handler be skipped, if no constraints are available?
Definition at line 64 of file cons_linking.c.
Referenced by SCIPincludeConshdlrLinking().
#define CONSHDLR_PROP_TIMING SCIP_PROPTIMING_BEFORELP |
propagation timing mask of the constraint handler
Definition at line 66 of file cons_linking.c.
Referenced by SCIPincludeConshdlrLinking().
#define CONSHDLR_PRESOLTIMING SCIP_PRESOLTIMING_MEDIUM |
presolving timing of the constraint handler (fast, medium, or exhaustive)
Definition at line 67 of file cons_linking.c.
Referenced by SCIPincludeConshdlrLinking().
#define HASHSIZE_BINVARSCONS 500 |
minimal size of hash table in linking constraint handler
Definition at line 70 of file cons_linking.c.
Referenced by SCIPcreateConsLinking().
#define DEFAULT_LINEARIZE FALSE |
should the linking constraint be linearize after the binary variable are created
Definition at line 71 of file cons_linking.c.
Referenced by SCIPincludeConshdlrLinking().
|
static |
returns for a given integer variable the corresponding hash map key
var | variable to get the hash map key for |
Definition at line 109 of file cons_linking.c.
References SCIPvarGetIndex().
Referenced by checkCons(), SCIP_DECL_CONSDELETE(), SCIP_DECL_CONSTRANS(), SCIPcreateConsLinking(), SCIPexistsConsLinking(), and SCIPgetConsLinking().
|
static |
consdata | linking constraint data |
Definition at line 119 of file cons_linking.c.
References SCIPsortIntPtr(), and TRUE.
Referenced by processBinvarFixings(), and processIntegerBoundChg().
|
static |
installs rounding locks for the binary variables in the given linking constraint
scip | SCIP data structure |
cons | linking constraint |
binvars | binary variables |
nbinvars | number of binary variables |
Definition at line 135 of file cons_linking.c.
References SCIP_CALL, SCIP_OKAY, SCIPlockVarCons(), and TRUE.
Referenced by consdataCreateBinvars().
|
static |
creates constraint handler data for the linking constraint handler
scip | SCIP data structure |
conshdlrdata | pointer to store the constraint handler data |
eventhdlr | event handler |
Definition at line 154 of file cons_linking.c.
References SCIP_CALL, SCIP_OKAY, and SCIPallocBlockMemory.
Referenced by SCIPincludeConshdlrLinking().
|
static |
frees constraint handler data for linking constraint handler
scip | SCIP data structure |
conshdlrdata | pointer to the constraint handler data |
Definition at line 177 of file cons_linking.c.
References SCIP_OKAY, SCIPfreeBlockMemory, and SCIPhashmapFree().
Referenced by SCIP_DECL_CONSFREE().
|
static |
prints linking constraint to file stream
scip | SCIP data structure |
consdata | linking constraint data |
file | output file (or NULL for standard output) |
Definition at line 197 of file cons_linking.c.
References FALSE, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPallocBufferArray, SCIPfreeBufferArray, SCIPinfoMessage(), SCIPwriteVarName(), and SCIPwriteVarsLinearsum().
Referenced by SCIP_DECL_CONSPRINT().
|
static |
catches events for variable at given position
scip | SCIP data structure |
consdata | linking constraint data |
eventhdlr | event handler to call for the event processing |
pos | array position of variable to catch bound change events for |
Definition at line 251 of file cons_linking.c.
References SCIP_CALL, SCIP_EVENTTYPE_BOUNDCHANGED, SCIP_OKAY, SCIPcatchVarEvent(), SCIPisEQ(), SCIPvarGetLbLocal(), and SCIPvarGetUbLocal().
Referenced by catchAllEvents().
|
static |
drops events for variable at given position
scip | SCIP data structure |
consdata | linking constraint data |
eventhdlr | event handler to call for the event processing |
pos | array position of variable to catch bound change events for |
Definition at line 283 of file cons_linking.c.
References SCIP_CALL, SCIP_EVENTTYPE_BOUNDCHANGED, SCIP_OKAY, SCIPdropVarEvent(), SCIPisEQ(), SCIPvarGetLbLocal(), and SCIPvarGetUbLocal().
Referenced by delCoefPos(), and dropAllEvents().
|
static |
catches bound change events for all variables in transformed linking constraint
scip | SCIP data structure |
consdata | linking constraint data |
eventhdlr | event handler to call for the event processing |
Definition at line 314 of file cons_linking.c.
References catchEvent(), SCIP_CALL, and SCIP_OKAY.
Referenced by consdataCreate(), and consdataCreateBinvars().
|
static |
drops bound change events for all variables in transformed linking constraint
scip | SCIP data structure |
consdata | linking constraint data |
eventhdlr | event handler to call for the event processing |
Definition at line 338 of file cons_linking.c.
References dropEvent(), SCIP_CALL, and SCIP_OKAY.
Referenced by SCIP_DECL_CONSDELETE().
|
static |
linearize the given linking constraint into a set partitioning constraint for the binary variables and a linear constraint for the linking between the integer variable and the binary variables
scip | SCIP data structure |
cons | linking constraint |
consdata | linking constraint data |
Definition at line 363 of file cons_linking.c.
References SCIP_CALL, SCIP_OKAY, SCIP_Real, 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().
|
static |
creates the binary variables
scip | SCIP data structure |
cons | linking constraint |
consdata | linking constraint data |
eventhdlr | event handler for bound change events on binary variables |
linearize | should the linking constraint be linearized |
Definition at line 402 of file cons_linking.c.
References catchAllEvents(), consdataLinearize(), FALSE, lockRounding(), SCIP_CALL, SCIP_MAXSTRLEN, SCIP_OKAY, SCIP_VARTYPE_BINARY, SCIPaddVar(), SCIPallocBlockMemoryArray, SCIPconvertRealToInt(), SCIPcreateVar(), SCIPdebugMsg, SCIPenableCons(), SCIPisTransformed(), SCIPsnprintf(), SCIPvarGetLbGlobal(), SCIPvarGetName(), SCIPvarGetUbGlobal(), and TRUE.
Referenced by SCIPgetBinvarsLinking().
|
static |
creates consdata
scip | SCIP data structure |
eventhdlr | event handler to call for the event processing |
consdata | pointer to constraint data |
intvar | integer variable which is linked |
binvars | binary variables |
vals | coefficients of the binary variables |
nbinvars | number of binary starting variables |
Definition at line 497 of file cons_linking.c.
References catchAllEvents(), FALSE, SCIP_CALL, SCIP_OKAY, SCIP_VARTYPE_CONTINUOUS, SCIPallocBlockMemory, SCIPcaptureVar(), SCIPduplicateBlockMemoryArray, SCIPgetTransformedVar(), SCIPgetTransformedVars(), SCIPisTransformed(), SCIPmarkDoNotMultaggrVar(), and SCIPvarGetType().
Referenced by SCIP_DECL_CONSTRANS(), and SCIPcreateConsLinking().
|
static |
free consdata
scip | SCIP data structure |
consdata | pointer to consdata |
Definition at line 577 of file cons_linking.c.
References SCIP_CALL, SCIP_OKAY, SCIPfreeBlockMemory, SCIPfreeBlockMemoryArray, SCIPreleaseRow(), and SCIPreleaseVar().
Referenced by SCIP_DECL_CONSDELETE().
|
static |
analyzes conflicting assignment on given constraint where reason comes from the integer variable lower or upper bound
scip | SCIP data structure |
cons | linking constraint to be processed |
intvar | integer variable |
binvar | binary variable is the reason |
lbintvar | lower bound of integer variable is the reason |
ubintvar | upper bound of integer variable is the reason |
Definition at line 628 of file cons_linking.c.
References FALSE, SCIP_CALL, SCIP_CONFTYPE_PROPAGATION, SCIP_OKAY, SCIP_STAGE_SOLVING, SCIPaddConflictBinvar(), SCIPaddConflictLb(), SCIPaddConflictUb(), SCIPanalyzeConflictCons(), SCIPgetStage(), SCIPinitConflictAnalysis(), SCIPinProbing(), and SCIPisConflictAnalysisApplicable().
Referenced by consFixInteger(), and processIntegerBoundChg().
|
static |
fix integer variable to the value of the binary variable at pos
scip | SCIP data structure |
cons | linking constraint to be processed |
pos | position of binary variable |
cutoff | pointer to store TRUE, if the node can be cut off |
Definition at line 671 of file cons_linking.c.
References analyzeConflict(), FALSE, SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPconsGetData(), SCIPinferVarLbCons(), SCIPinferVarUbCons(), SCIPvarGetLbLocal(), SCIPvarGetUbLocal(), and TRUE.
Referenced by processBinvarFixings().
|
static |
checks constraint for violation from the local bound of the integer variable, applies fixings to the binary variables if possible
scip | SCIP data structure |
cons | linking constraint to be processed |
cutoff | pointer to store TRUE, if the node can be cut off |
nchgbds | pointer to store the number of changes (foxed) variable bounds |
mustcheck | pointer to store whether this constraint must be checked for feasibility |
Definition at line 728 of file cons_linking.c.
References analyzeConflict(), consdataSort(), CONSHDLR_NAME, FALSE, SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIPaddCons(), SCIPconsGetData(), SCIPconsGetHdlr(), SCIPconsGetName(), SCIPconshdlrGetName(), SCIPconsIsChecked(), SCIPconsIsDynamic(), SCIPconsIsEnforced(), SCIPconsIsInitial(), SCIPconsIsLocal(), SCIPconsIsModifiable(), SCIPconsIsPropagated(), SCIPconsIsRemovable(), SCIPconsIsSeparated(), SCIPconsIsStickingAtNode(), SCIPconvertRealToInt(), SCIPcreateConsSetpart(), SCIPdebugMsg, SCIPdelConsLocal(), SCIPgetDepth(), SCIPinferBinvarCons(), SCIPreleaseCons(), SCIPvarGetLbLocal(), SCIPvarGetName(), SCIPvarGetUbLocal(), and TRUE.
Referenced by enforcePseudo(), SCIP_DECL_CONSPRESOL(), SCIP_DECL_CONSPROP(), and separateCons().
|
static |
deletes coefficient at given position from the binary variable array
scip | SCIP data structure |
eventhdlr | event handler to call for the event processing |
cons | linking constraint |
pos | position of coefficient to delete |
Definition at line 919 of file cons_linking.c.
References dropEvent(), FALSE, SCIP_CALL, SCIP_OKAY, SCIPconsGetData(), SCIPconsGetHdlr(), SCIPconshdlrGetData(), SCIPconsIsTransformed(), SCIPreleaseVar(), SCIPunlockVarCons(), SCIPvarIsTransformed(), and TRUE.
Referenced by removeFixedBinvars().
|
static |
remove the trailing and leeading binary variable which are fixed to zero
scip | SCIP data structure |
eventhdlr | event handler to call for the event processing |
cons | linking constraint |
Definition at line 977 of file cons_linking.c.
References delCoefPos(), SCIP_CALL, SCIP_OKAY, SCIP_STAGE_PRESOLVING, SCIPconsGetData(), SCIPgetDepth(), SCIPgetStage(), SCIPinProbing(), SCIPinRepropagation(), and SCIPvarGetUbLocal().
Referenced by SCIP_DECL_CONSPRESOL().
|
static |
tightened the integer variable due to binary variables which are fixed to zero
scip | SCIP data structure |
cons | linking constraint to be processed |
consdata | linking constraint to be processed |
cutoff | pointer to store TRUE, if the node can be cut off |
nchgbds | pointer to store the number of changed variable bounds |
Definition at line 1024 of file cons_linking.c.
References FALSE, SCIP_Bool, SCIP_CALL, SCIP_CONFTYPE_PROPAGATION, SCIP_OKAY, SCIP_Real, SCIP_STAGE_SOLVING, SCIPaddConflictBinvar(), SCIPaddConflictLb(), SCIPaddConflictUb(), SCIPanalyzeConflictCons(), SCIPdebugMsg, SCIPgetStage(), SCIPinferVarLbCons(), SCIPinferVarUbCons(), SCIPinitConflictAnalysis(), SCIPinProbing(), SCIPisConflictAnalysisApplicable(), SCIPvarGetLbLocal(), SCIPvarGetName(), SCIPvarGetUbLocal(), and TRUE.
Referenced by processBinvarFixings(), and SCIP_DECL_CONSPRESOL().
|
static |
checks constraint for violation only looking at the fixed binary variables, applies further fixings if possible
scip | SCIP data structure |
cons | linking constraint to be processed |
cutoff | pointer to store TRUE, if the node can be cut off |
nchgbds | pointer to store the number of changed variable bounds |
addcut | pointer to store whether this constraint must be added as a cut |
mustcheck | pointer to store whether this constraint must be checked for feasibility |
Definition at line 1160 of file cons_linking.c.
References consdataSort(), consFixInteger(), CONSHDLR_NAME, FALSE, SCIP_Bool, SCIP_CALL, SCIP_CONFTYPE_PROPAGATION, SCIP_OKAY, SCIP_STAGE_SOLVING, SCIPaddConflictBinvar(), SCIPanalyzeConflictCons(), SCIPconsGetData(), SCIPconsGetHdlr(), SCIPconsGetName(), SCIPconshdlrGetName(), SCIPconsIsModifiable(), SCIPdebugMsg, SCIPdelConsLocal(), SCIPgetStage(), SCIPinferBinvarCons(), SCIPinitConflictAnalysis(), SCIPinProbing(), SCIPisConflictAnalysisApplicable(), SCIPisFeasEQ(), SCIPisFeasZero(), SCIPisLT(), SCIPresetConsAge(), SCIPvarGetLbLocal(), SCIPvarGetName(), SCIPvarGetUbLocal(), SCIPvarIsBinary(), tightenedIntvar(), and TRUE.
Referenced by enforcePseudo(), and SCIP_DECL_CONSPROP().
returns whether the given solution is feasible for the given linking constraint
scip | SCIP data structure |
cons | linking constraint to be checked |
sol | primal solution, or NULL for current LP/pseudo solution |
Definition at line 1408 of file cons_linking.c.
References aggregateVariables(), getHashmapKey(), MAX, REALABS, SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIP_VARSTATUS_AGGREGATED, SCIPaggregateVars(), SCIPconsGetData(), SCIPconsGetName(), SCIPconvertRealToInt(), SCIPdebugMsg, SCIPfeastol(), SCIPgetSolVal(), SCIPhashmapGetImage(), SCIPisEQ(), SCIPisFeasEQ(), SCIPisFeasGE(), SCIPisFeasLE(), SCIPisIntegral(), SCIPrelDiff(), SCIPupdateSolLPConsViolation(), SCIPvarGetAggrConstant(), SCIPvarGetAggrScalar(), SCIPvarGetAggrVar(), SCIPvarGetStatus(), SCIPvarIsBinary(), and TRUE.
Referenced by enforcePseudo(), SCIP_DECL_CONSCHECK(), and separateCons().
|
static |
create two rows for the linking constraint
scip | SCIP data structure |
cons | linking constraint |
Definition at line 1581 of file cons_linking.c.
References SCIP_CALL, SCIP_MAXSTRLEN, SCIP_OKAY, SCIP_Real, SCIPaddVarsToRowSameCoef(), SCIPaddVarToRow(), SCIPconsGetData(), SCIPconsGetHdlr(), SCIPconsGetName(), SCIPconsIsLocal(), SCIPconsIsModifiable(), SCIPconsIsRemovable(), SCIPcreateEmptyRowCons(), and SCIPsnprintf().
Referenced by addCuts().
|
static |
adds linking constraint as cut to the LP
scip | SCIP data structure |
cons | linking constraint |
cutoff | whether a cutoff has been detected |
Definition at line 1631 of file cons_linking.c.
References createRows(), FALSE, SCIP_CALL, SCIP_OKAY, SCIPaddRow(), SCIPconsGetData(), SCIPconsGetName(), SCIPdebugMsg, SCIProwIsInLP(), and TRUE.
Referenced by SCIP_DECL_CONSINITLP(), and separateCons().
|
static |
checks constraint for violation, and adds it as a cuts if possible
scip | SCIP data structure |
cons | linking constraint to be separated |
sol | primal CIP solution, NULL for current LP solution |
cutoff | pointer to store TRUE, if the node can be cut off |
separated | pointer to store TRUE, if a cut was found |
nchgbds | pointer to store the number of changed variables bounds |
Definition at line 1678 of file cons_linking.c.
References addCuts(), checkCons(), CONSHDLR_NAME, FALSE, processIntegerBoundChg(), 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().
|
static |
enforces the pseudo solution on the given constraint
scip | SCIP data structure |
cons | linking constraint to be separated |
cutoff | pointer to store TRUE, if the node can be cut off |
infeasible | pointer to store TRUE, if the constraint was infeasible |
nchgbds | pointer to store the number of changed variable bounds |
solvelp | pointer to store TRUE, if the LP has to be solved |
Definition at line 1772 of file cons_linking.c.
References checkCons(), CONSHDLR_NAME, FALSE, processBinvarFixings(), processIntegerBoundChg(), SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIPconsGetHdlr(), SCIPconshdlrGetName(), SCIPhasCurrentNodeLP(), SCIPincConsAge(), SCIPresetConsAge(), and TRUE.
Referenced by SCIP_DECL_CONSENFOPS().
|
static |
helper function to enforce constraints
scip | SCIP data structure |
conshdlr | constraint handler |
conss | constraints to process |
nconss | number of constraints |
nusefulconss | number of useful (non-obsolete) constraints to process |
sol | solution to enforce (NULL for the LP solution) |
result | pointer to store the result of the enforcing call |
Definition at line 1830 of file cons_linking.c.
References CONSHDLR_NAME, FALSE, 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().
|
static |
copy method for constraint handler plugins (called when SCIP copies plugins)
Definition at line 1888 of file cons_linking.c.
References CONSHDLR_NAME, SCIP_CALL, SCIP_OKAY, SCIPconshdlrGetName(), SCIPincludeConshdlrLinking(), and TRUE.
|
static |
destructor of constraint handler to free constraint handler data (called when SCIP is exiting)
Definition at line 1904 of file cons_linking.c.
References CONSHDLR_NAME, conshdlrdataFree(), SCIP_CALL, SCIP_OKAY, SCIPconshdlrGetData(), and SCIPconshdlrGetName().
|
static |
presolving initialization method of constraint handler (called when presolving is about to begin)
Definition at line 1924 of file cons_linking.c.
References consdataLinearize(), SCIP_CALL, SCIP_OKAY, SCIPconsGetData(), SCIPconshdlrGetData(), SCIPconsIsAdded(), SCIPdelCons(), SCIPdisableCons(), and SCIPvarGetLbGlobal().
|
static |
solving process deinitialization method of constraint handler (called before branch and bound process data is freed)
Definition at line 1961 of file cons_linking.c.
References SCIP_CALL, SCIP_OKAY, SCIPconsGetData(), and SCIPreleaseRow().
|
static |
frees specific constraint data
Definition at line 1987 of file cons_linking.c.
References consdataFree(), CONSHDLR_NAME, dropAllEvents(), getHashmapKey(), SCIP_CALL, SCIP_OKAY, SCIPconshdlrGetData(), SCIPconshdlrGetName(), SCIPhashmapExists(), SCIPhashmapRemove(), and SCIPisTransformed().
|
static |
transforms constraint data into data belonging to the transformed problem
Definition at line 2019 of file cons_linking.c.
References consdataCreate(), CONSHDLR_NAME, getHashmapKey(), SCIP_CALL, SCIP_OKAY, SCIP_STAGE_TRANSFORMING, SCIPconsGetData(), SCIPconsGetName(), SCIPconshdlrGetData(), SCIPconshdlrGetName(), SCIPconsIsChecked(), SCIPconsIsDynamic(), SCIPconsIsEnforced(), SCIPconsIsInitial(), SCIPconsIsLocal(), SCIPconsIsModifiable(), SCIPconsIsPropagated(), SCIPconsIsRemovable(), SCIPconsIsSeparated(), SCIPconsIsStickingAtNode(), SCIPcreateCons(), SCIPdebugMsg, SCIPgetStage(), SCIPhashmapInsert(), and SCIPvarGetName().
|
static |
LP initialization method of constraint handler (called before the initial LP relaxation at a node is solved)
Definition at line 2063 of file cons_linking.c.
References addCuts(), FALSE, SCIP_CALL, SCIP_OKAY, SCIPconsGetData(), and SCIPconsIsInitial().
|
static |
separation method of constraint handler for LP solutions
Definition at line 2089 of file cons_linking.c.
References CONSHDLR_NAME, FALSE, SCIP_Bool, SCIP_CALL, SCIP_CUTOFF, SCIP_DIDNOTFIND, SCIP_OKAY, SCIP_REDUCEDDOM, SCIP_SEPARATED, SCIPconshdlrGetName(), SCIPdebugMsg, and separateCons().
|
static |
separation method of constraint handler for arbitrary primal solutions
Definition at line 2129 of file cons_linking.c.
References CONSHDLR_NAME, FALSE, SCIP_Bool, SCIP_CALL, SCIP_CUTOFF, SCIP_DIDNOTFIND, SCIP_OKAY, SCIP_REDUCEDDOM, SCIP_SEPARATED, SCIPconshdlrGetName(), SCIPdebugMsg, and separateCons().
|
static |
constraint enforcing method of constraint handler for LP solutions
Definition at line 2169 of file cons_linking.c.
References enforceConstraint(), SCIP_CALL, and SCIP_OKAY.
|
static |
constraint enforcing method of constraint handler for relaxation solutions
Definition at line 2179 of file cons_linking.c.
References enforceConstraint(), SCIP_CALL, and SCIP_OKAY.
|
static |
constraint enforcing method of constraint handler for pseudo solutions
Definition at line 2189 of file cons_linking.c.
References CONSHDLR_NAME, enforcePseudo(), FALSE, SCIP_Bool, SCIP_CALL, SCIP_CUTOFF, SCIP_DIDNOTRUN, SCIP_FEASIBLE, SCIP_INFEASIBLE, SCIP_OKAY, SCIP_REDUCEDDOM, SCIP_SOLVELP, SCIPconshdlrGetName(), and SCIPdebugMsg.
|
static |
feasibility check method of constraint handler for integral solutions
Definition at line 2238 of file cons_linking.c.
References checkCons(), CONSHDLR_NAME, SCIP_CALL, SCIP_FEASIBLE, SCIP_INFEASIBLE, SCIP_OKAY, SCIP_Real, SCIPconsGetData(), SCIPconshdlrGetName(), SCIPgetSolVal(), SCIPinfoMessage(), SCIPisFeasEQ(), SCIPisFeasIntegral(), SCIPprintCons(), SCIProwIsInLP(), SCIPvarGetName(), and SCIPvarIsBinary().
|
static |
domain propagation method of constraint handler
Definition at line 2322 of file cons_linking.c.
References CONSHDLR_NAME, FALSE, processBinvarFixings(), processIntegerBoundChg(), SCIP_Bool, SCIP_CALL, SCIP_CUTOFF, SCIP_DIDNOTFIND, SCIP_OKAY, SCIP_REDUCEDDOM, SCIPconshdlrGetName(), SCIPdebugMsg, and TRUE.
|
static |
presolving method of constraint handler
Definition at line 2363 of file cons_linking.c.
References aggregateVariables(), CONSHDLR_NAME, FALSE, processIntegerBoundChg(), removeFixedBinvars(), SCIP_Bool, SCIP_CALL, SCIP_CUTOFF, SCIP_DIDNOTFIND, SCIP_OKAY, SCIP_Real, SCIP_SUCCESS, SCIPaddClique(), SCIPaggregateVars(), SCIPconsGetData(), SCIPconsGetName(), SCIPconshdlrGetData(), SCIPconshdlrGetName(), SCIPconsIsActive(), SCIPconsIsEnabled(), SCIPconsIsModifiable(), SCIPdebugMsg, SCIPdelCons(), SCIPfixVar(), SCIPisStopped(), SCIPvarGetLbGlobal(), SCIPvarGetName(), SCIPvarGetUbGlobal(), tightenedIntvar(), and TRUE.
|
static |
propagation conflict resolving method of constraint handler
Definition at line 2693 of file cons_linking.c.
References CONSHDLR_NAME, FALSE, SCIP_BOUNDTYPE_LOWER, SCIP_BOUNDTYPE_UPPER, SCIP_CALL, SCIP_DIDNOTFIND, SCIP_OKAY, SCIP_SUCCESS, SCIPaddConflictBinvar(), SCIPaddConflictLb(), SCIPaddConflictUb(), SCIPconsGetData(), SCIPconvertRealToInt(), SCIPdebugMsg, SCIPgetVarLbAtIndex(), SCIPgetVarUbAtIndex(), SCIPisFeasEQ(), SCIPvarGetUbLocal(), SCIPvarIsBinary(), and TRUE.
|
static |
variable rounding lock method of constraint handler
Definition at line 2869 of file cons_linking.c.
References SCIP_CALL, SCIP_OKAY, SCIPaddVarLocks(), and SCIPconsGetData().
|
static |
constraint enabling notification method of constraint handler
Definition at line 2891 of file cons_linking.c.
References consdataLinearize(), SCIP_CALL, SCIP_OKAY, SCIPconsGetData(), SCIPconshdlrGetData(), SCIPdelCons(), SCIPdisableCons(), and SCIPvarGetLbGlobal().
|
static |
constraint display method of constraint handler
Definition at line 2919 of file cons_linking.c.
References consdataPrint(), SCIP_CALL, SCIP_OKAY, and SCIPconsGetData().
|
static |
constraint copying method of constraint handler
Definition at line 2933 of file cons_linking.c.
References CONSHDLR_NAME, SCIP_CALL, SCIP_INVALIDDATA, SCIP_OKAY, SCIPABORT, SCIPconsGetData(), SCIPconsGetHdlr(), SCIPconsGetName(), SCIPconshdlrGetName(), SCIPcreateConsLinking(), SCIPduplicateBufferArray, SCIPerrorMessage, SCIPfreeBufferArrayNull, SCIPgetVarCopy(), and TRUE.
|
static |
constraint parsing method of constraint handler
Definition at line 3010 of file cons_linking.c.
References FALSE, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIP_VERBLEVEL_MINIMAL, SCIPallocBufferArray, SCIPconvertRealToInt(), SCIPcreateConsLinking(), SCIPfreeBufferArray, SCIPisIntegral(), SCIPparseVarName(), SCIPparseVarsLinearsum(), SCIPreallocBufferArray, SCIPverbMessage(), and TRUE.
|
static |
constraint method of constraint handler which returns the variables (if possible)
Definition at line 3110 of file cons_linking.c.
References BMScopyMemoryArray, FALSE, SCIP_OKAY, SCIPconsGetData(), and TRUE.
|
static |
constraint method of constraint handler which returns the number of variables (if possible)
Definition at line 3133 of file cons_linking.c.
References SCIP_OKAY, SCIPconsGetData(), and TRUE.
|
static |
execution method of event handler
Definition at line 3152 of file cons_linking.c.
References EVENTHDLR_NAME, SCIP_EVENTTYPE_LBRELAXED, SCIP_EVENTTYPE_LBTIGHTENED, SCIP_EVENTTYPE_UBRELAXED, SCIP_EVENTTYPE_UBTIGHTENED, SCIP_INVALIDDATA, SCIP_OKAY, SCIPerrorMessage, SCIPeventGetType(), and SCIPeventhdlrGetName().