Scippy

SCIP

Solving Constraint Integer Programs

cons_superindicator.c File Reference

Detailed Description

constraint handler for indicator constraints over arbitrary constraint types

Author
Ambros Gleixner
Frederic Pythoud

Definition in file cons_superindicator.c.

#include <assert.h>
#include <string.h>
#include "scip/cons_superindicator.h"
#include "scip/dialog_default.h"
#include "scip/cons_indicator.h"
#include "scip/cons_linear.h"

Go to the source code of this file.

Macros

#define CONSHDLR_NAME   "superindicator"
 
#define CONSHDLR_DESC   "constraint handler for indicator constraints over arbitrary constraint types"
 
#define CONSHDLR_SEPAPRIORITY   0
 
#define CONSHDLR_ENFOPRIORITY   -5000000
 
#define CONSHDLR_CHECKPRIORITY   -5000000
 
#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_DELAYPRESOL   FALSE
 
#define CONSHDLR_NEEDSCONS   TRUE
 
#define CONSHDLR_PROP_TIMING   SCIP_PROPTIMING_BEFORELP
 
#define DEFAULT_CHECKSLACKTYPE   TRUE
 
#define DEFAULT_UPGDPRIOINDICATOR   1
 
#define DEFAULT_UPGDPRIOLINEAR   2
 
#define DEFAULT_MAXUPGDCOEFLINEAR   1e4
 

Functions

static SCIP_RETCODE consdataCreateSuperindicator (SCIP *scip, SCIP_CONSDATA **consdata, SCIP_VAR *binvar, SCIP_CONS *slackcons)
 
static SCIP_RETCODE consdataCheckSuperindicator (SCIP *scip, SCIP_CONSDATA *consdata, SCIP_SOL *sol, SCIP_Bool checkintegrality, SCIP_Bool checklprows, SCIP_Bool printreason, SCIP_RESULT *result)
 
static SCIP_RETCODE extractLinearValues (SCIP *scip, SCIP_CONS *cons, SCIP_Real *minactivity, SCIP_Real *maxactivity, SCIP_Real *minabscoef)
 
static SCIP_RETCODE upgradeIndicatorSuperindicator (SCIP *scip, SCIP_CONS *cons, SCIP_Bool *success, SCIP_Bool *deleted)
 
static SCIP_RETCODE upgradeLinearSuperindicator (SCIP *scip, SCIP_CONS *cons, SCIP_Bool *success, SCIP_Bool *deleted)
 
static SCIP_RETCODE upgradeSuperindicator (SCIP *scip, SCIP_CONS *cons, SCIP_Bool *success, SCIP_Bool *deleted)
 
static SCIP_DECL_CONSHDLRCOPY (conshdlrCopySuperindicator)
 
static SCIP_DECL_CONSFREE (consFreeSuperindicator)
 
static SCIP_DECL_CONSINITPRE (consInitpreSuperindicator)
 
static SCIP_DECL_CONSDELETE (consDeleteSuperindicator)
 
static SCIP_DECL_CONSTRANS (consTransSuperindicator)
 
static SCIP_DECL_CONSINITLP (consInitlpSuperindicator)
 
static SCIP_DECL_CONSSEPALP (consSepalpSuperindicator)
 
static SCIP_DECL_CONSSEPASOL (consSepasolSuperindicator)
 
static SCIP_DECL_CONSENFOLP (consEnfolpSuperindicator)
 
static SCIP_DECL_CONSENFOPS (consEnfopsSuperindicator)
 
static SCIP_DECL_CONSCHECK (consCheckSuperindicator)
 
static SCIP_DECL_CONSPROP (consPropSuperindicator)
 
static SCIP_DECL_CONSPRESOL (consPresolSuperindicator)
 
static SCIP_DECL_CONSRESPROP (consRespropSuperindicator)
 
static SCIP_DECL_CONSLOCK (consLockSuperindicator)
 
static SCIP_DECL_CONSPRINT (consPrintSuperindicator)
 
static SCIP_DECL_CONSCOPY (consCopySuperindicator)
 
static SCIP_DECL_CONSPARSE (consParseSuperindicator)
 
static SCIP_DECL_CONSGETVARS (consGetVarsSuperindicator)
 
static SCIP_DECL_CONSGETNVARS (consGetNVarsSuperindicator)
 
SCIP_RETCODE SCIPincludeConshdlrSuperindicator (SCIP *scip)
 
SCIP_RETCODE SCIPcreateConsSuperindicator (SCIP *scip, SCIP_CONS **cons, const char *name, SCIP_VAR *binvar, SCIP_CONS *slackcons, SCIP_Bool initial, SCIP_Bool separate, SCIP_Bool enforce, SCIP_Bool check, SCIP_Bool propagate, SCIP_Bool local, SCIP_Bool dynamic, SCIP_Bool removable, SCIP_Bool stickingatnode)
 
SCIP_RETCODE SCIPcreateConsBasicSuperindicator (SCIP *scip, SCIP_CONS **cons, const char *name, SCIP_VAR *binvar, SCIP_CONS *slackcons)
 
SCIP_VARSCIPgetBinaryVarSuperindicator (SCIP_CONS *cons)
 
SCIP_CONSSCIPgetSlackConsSuperindicator (SCIP_CONS *cons)
 
SCIP_RETCODE SCIPtransformMinUC (SCIP *scip, SCIP_Bool *success)
 
 SCIP_DECL_DIALOGEXEC (SCIPdialogExecChangeMinUC)
 

Macro Definition Documentation

#define CONSHDLR_DESC   "constraint handler for indicator constraints over arbitrary constraint types"

Definition at line 45 of file cons_superindicator.c.

Referenced by SCIPincludeConshdlrSuperindicator().

#define CONSHDLR_SEPAPRIORITY   0

priority of the constraint handler for separation

Definition at line 46 of file cons_superindicator.c.

Referenced by SCIPincludeConshdlrSuperindicator().

#define CONSHDLR_ENFOPRIORITY   -5000000

priority of the constraint handler for constraint enforcing

Definition at line 47 of file cons_superindicator.c.

Referenced by SCIPincludeConshdlrSuperindicator().

#define CONSHDLR_CHECKPRIORITY   -5000000

priority of the constraint handler for checking feasibility

Definition at line 48 of file cons_superindicator.c.

Referenced by SCIPincludeConshdlrSuperindicator().

#define CONSHDLR_SEPAFREQ   -1

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

Definition at line 49 of file cons_superindicator.c.

Referenced by SCIPincludeConshdlrSuperindicator().

#define CONSHDLR_PROPFREQ   1

frequency for propagating domains; zero means only preprocessing propagation

Definition at line 50 of file cons_superindicator.c.

Referenced by SCIPincludeConshdlrSuperindicator().

#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 51 of file cons_superindicator.c.

Referenced by SCIPincludeConshdlrSuperindicator().

#define CONSHDLR_MAXPREROUNDS   -1

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

Definition at line 53 of file cons_superindicator.c.

Referenced by SCIPincludeConshdlrSuperindicator().

#define CONSHDLR_DELAYSEPA   FALSE

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

Definition at line 55 of file cons_superindicator.c.

Referenced by SCIPincludeConshdlrSuperindicator().

#define CONSHDLR_DELAYPROP   FALSE

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

Definition at line 56 of file cons_superindicator.c.

Referenced by SCIPincludeConshdlrSuperindicator().

#define CONSHDLR_DELAYPRESOL   FALSE

should presolving method be delayed, if other presolvers found reductions?

Definition at line 57 of file cons_superindicator.c.

Referenced by SCIPincludeConshdlrSuperindicator().

#define CONSHDLR_NEEDSCONS   TRUE

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

Definition at line 58 of file cons_superindicator.c.

Referenced by SCIPincludeConshdlrSuperindicator().

#define CONSHDLR_PROP_TIMING   SCIP_PROPTIMING_BEFORELP

propagation timing mask of the constraint handler

Definition at line 60 of file cons_superindicator.c.

Referenced by SCIPincludeConshdlrSuperindicator().

#define DEFAULT_CHECKSLACKTYPE   TRUE

should type of slack constraint be checked when creating superindicator constraint?

Definition at line 62 of file cons_superindicator.c.

Referenced by SCIPincludeConshdlrSuperindicator().

#define DEFAULT_UPGDPRIOINDICATOR   1

priority for upgrading to an indicator constraint (-1: never)

Definition at line 63 of file cons_superindicator.c.

Referenced by SCIPincludeConshdlrSuperindicator().

#define DEFAULT_UPGDPRIOLINEAR   2

priority for upgrading to a linear constraint (-1: never)

Definition at line 64 of file cons_superindicator.c.

Referenced by SCIPincludeConshdlrSuperindicator().

#define DEFAULT_MAXUPGDCOEFLINEAR   1e4

maximum big-M coefficient of binary variable in upgrade to a linear constraint (relative to smallest coefficient)

Definition at line 65 of file cons_superindicator.c.

Referenced by SCIPincludeConshdlrSuperindicator().

Function Documentation

static SCIP_RETCODE consdataCreateSuperindicator ( SCIP scip,
SCIP_CONSDATA **  consdata,
SCIP_VAR binvar,
SCIP_CONS slackcons 
)
static

creates superindicator constraint data

Parameters
scipSCIP data structure
consdatapointer to constraint data
binvarbinary variable
slackconsslack constraint

Definition at line 97 of file cons_superindicator.c.

References NULL, SCIP_CALL, SCIP_OKAY, SCIPallocBlockMemory, SCIPcaptureCons(), SCIPdebugMessage, SCIPgetTransformedVar(), SCIPisTransformed(), and SCIPtransformCons().

Referenced by SCIP_DECL_CONSTRANS(), and SCIPcreateConsSuperindicator().

static SCIP_RETCODE consdataCheckSuperindicator ( SCIP scip,
SCIP_CONSDATA consdata,
SCIP_SOL sol,
SCIP_Bool  checkintegrality,
SCIP_Bool  checklprows,
SCIP_Bool  printreason,
SCIP_RESULT result 
)
static

checks the feasibility of a superindicator constraint

Parameters
scipSCIP data structure
consdatapointer to superindicator constraint data
solpointer to the solution to be checked
checkintegralityhas integrality to be checked?
checklprowshave current LP rows to be checked?
printreasonshould the reason for the violation be printed?
resultpointer to store the result of the test

Definition at line 136 of file cons_superindicator.c.

References NULL, SCIP_CALL, SCIP_DIDNOTRUN, SCIP_FEASIBLE, SCIP_INFEASIBLE, SCIP_OKAY, SCIP_Real, SCIPcheckCons(), SCIPconsGetName(), SCIPdebugMessage, SCIPgetSolVal(), SCIPinfoMessage(), SCIPisFeasEQ(), SCIPisIntegral(), SCIPvarGetName(), and TRUE.

Referenced by SCIP_DECL_CONSCHECK(), SCIP_DECL_CONSENFOLP(), and SCIP_DECL_CONSENFOPS().

static SCIP_RETCODE extractLinearValues ( SCIP scip,
SCIP_CONS cons,
SCIP_Real minactivity,
SCIP_Real maxactivity,
SCIP_Real minabscoef 
)
static

computes the minactivity, maxactivity, and minimal absolute value of nonzero coefficients of a linear constraint with respect to its global bounds

Parameters
scipSCIP data structure
conspointer to linear constraint
minactivitypointer to return the minimal activity
maxactivitypointer to return the maximal activity
minabscoefpointer to return the minimal absolute value of the coefficients

Definition at line 207 of file cons_superindicator.c.

References FALSE, NULL, SCIP_Bool, SCIP_OKAY, SCIP_Real, SCIPconsGetHdlr(), SCIPconshdlrGetName(), SCIPgetNVarsLinear(), SCIPgetValsLinear(), SCIPgetVarsLinear(), SCIPinfinity(), SCIPisInfinity(), SCIPvarGetLbGlobal(), and SCIPvarGetUbGlobal().

Referenced by upgradeLinearSuperindicator().

static SCIP_RETCODE upgradeIndicatorSuperindicator ( SCIP scip,
SCIP_CONS cons,
SCIP_Bool success,
SCIP_Bool deleted 
)
static
static SCIP_RETCODE upgradeSuperindicator ( SCIP scip,
SCIP_CONS cons,
SCIP_Bool success,
SCIP_Bool deleted 
)
static

tries to upgrade a superindicator constraint in order of the upgrade priority parameters

Parameters
scipSCIP data structure
conssuperindicator constraint to be updated
successpointer to store if the constraint was upgraded
deletedpointer to store if the constraint was deleted

Definition at line 605 of file cons_superindicator.c.

References FALSE, NULL, SCIP_CALL, SCIP_OKAY, SCIPconsGetHdlr(), SCIPconshdlrGetData(), upgradeIndicatorSuperindicator(), and upgradeLinearSuperindicator().

Referenced by SCIP_DECL_CONSPRESOL().

static SCIP_DECL_CONSHDLRCOPY ( conshdlrCopySuperindicator  )
static

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

Definition at line 657 of file cons_superindicator.c.

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

static SCIP_DECL_CONSFREE ( consFreeSuperindicator  )
static

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

Definition at line 673 of file cons_superindicator.c.

References CONSHDLR_NAME, NULL, SCIP_OKAY, SCIPconshdlrGetData(), SCIPconshdlrGetName(), SCIPconshdlrSetData(), SCIPdebugMessage, and SCIPfreeMemory.

static SCIP_DECL_CONSINITPRE ( consInitpreSuperindicator  )
static

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

Definition at line 696 of file cons_superindicator.c.

References NULL, SCIP_CALL, SCIP_OKAY, SCIPconsGetData(), SCIPdebugMessage, SCIPsetConsLocal(), and TRUE.

static SCIP_DECL_CONSDELETE ( consDeleteSuperindicator  )
static
static SCIP_DECL_CONSINITLP ( consInitlpSuperindicator  )
static
static SCIP_DECL_CONSCHECK ( consCheckSuperindicator  )
static

feasibility check method of constraint handler for integral solutions

Definition at line 1264 of file cons_superindicator.c.

References consdataCheckSuperindicator(), NULL, SCIP_CALL, SCIP_FEASIBLE, SCIP_INFEASIBLE, SCIP_OKAY, SCIPconsGetData(), SCIPdebugMessage, SCIPheurGetName(), and SCIPsolGetHeur().

static SCIP_DECL_CONSRESPROP ( consRespropSuperindicator  )
static
static SCIP_DECL_CONSLOCK ( consLockSuperindicator  )
static

variable rounding lock method of constraint handler

Definition at line 1531 of file cons_superindicator.c.

References NULL, SCIP_CALL, SCIP_OKAY, SCIPaddConsLocks(), SCIPaddVarLocks(), SCIPconsGetData(), SCIPconsGetName(), and SCIPdebugMessage.

static SCIP_DECL_CONSPRINT ( consPrintSuperindicator  )
static
static SCIP_DECL_CONSPARSE ( consParseSuperindicator  )
static
static SCIP_DECL_CONSGETVARS ( consGetVarsSuperindicator  )
static

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

Definition at line 1806 of file cons_superindicator.c.

References FALSE, NULL, SCIP_CALL, SCIP_OKAY, SCIPconsGetData(), and SCIPgetConsVars().

static SCIP_DECL_CONSGETNVARS ( consGetNVarsSuperindicator  )
static

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

Definition at line 1830 of file cons_superindicator.c.

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

SCIP_RETCODE SCIPcreateConsSuperindicator ( SCIP scip,
SCIP_CONS **  cons,
const char *  name,
SCIP_VAR binvar,
SCIP_CONS slackcons,
SCIP_Bool  initial,
SCIP_Bool  separate,
SCIP_Bool  enforce,
SCIP_Bool  check,
SCIP_Bool  propagate,
SCIP_Bool  local,
SCIP_Bool  dynamic,
SCIP_Bool  removable,
SCIP_Bool  stickingatnode 
)

creates and captures a superindicator constraint

Note
the constraint gets captured, hence at one point you have to release it using the method SCIPreleaseCons()
Parameters
scipSCIP data structure
conspointer to hold the created constraint
namename of constraint
binvarpointer to the indicator constraint
slackconsconstraint corresponding to the handled constraint
initialshould the LP relaxation of constraint be in the initial LP? Usually set to TRUE. Set to FALSE for 'lazy constraints'.
separateshould the constraint be separated during LP processing? Usually set to TRUE.
enforceshould the constraint be enforced during node processing? TRUE for model constraints, FALSE for additional, redundant constraints.
checkshould the constraint be checked for feasibility? TRUE for model constraints, FALSE for additional, redundant constraints.
propagateshould the constraint be propagated during node processing? Usually set to TRUE.
localis constraint only valid locally? Usually set to FALSE. Has to be set to TRUE, e.g., for branching constraints.
dynamicis constraint subject to aging? Usually set to FALSE. Set to TRUE for own cuts which are separated as constraints.
removableshould the relaxation be removed from the LP due to aging or cleanup? Usually set to FALSE. Set to TRUE for 'lazy constraints' and 'user cuts'.
stickingatnodeshould the constraint always be kept at the node where it was added, even if it may be moved to a more global node? Usually set to FALSE. Set to TRUE to for constraints that represent node data.

Definition at line 1955 of file cons_superindicator.c.

References consdataCreateSuperindicator(), CONSHDLR_NAME, FALSE, NULL, SCIP_Bool, SCIP_CALL, SCIP_INVALIDCALL, SCIP_OKAY, SCIP_PLUGINNOTFOUND, SCIPconsGetHdlr(), SCIPconsGetName(), SCIPconshdlrGetData(), SCIPconshdlrGetName(), SCIPcreateCons(), SCIPerrorMessage, SCIPfindConshdlr(), and SCIPwarningMessage().

Referenced by SCIP_DECL_CONSCOPY(), SCIP_DECL_CONSPARSE(), SCIPcreateConsBasicSuperindicator(), and SCIPtransformMinUC().

SCIP_RETCODE SCIPcreateConsBasicSuperindicator ( SCIP scip,
SCIP_CONS **  cons,
const char *  name,
SCIP_VAR binvar,
SCIP_CONS slackcons 
)

creates and captures a superindicator constraint in its most basic version, i. e., all constraint flags are set to their basic value as explained for the method SCIPcreateConsSuperindicator(); all flags can be set via SCIPsetConsFLAGNAME-methods in scip.h

See Also
SCIPcreateConsSuperindicator() for information about the basic constraint flag configuration
Note
the constraint gets captured, hence at one point you have to release it using the method SCIPreleaseCons()
Parameters
scipSCIP data structure
conspointer to hold the created constraint
namename of constraint
binvarpointer to the indicator constraint
slackconsconstraint corresponding to the handled constraint

Definition at line 2066 of file cons_superindicator.c.

References FALSE, NULL, SCIP_CALL, SCIP_OKAY, SCIPcreateConsSuperindicator(), and TRUE.

SCIP_VAR* SCIPgetBinaryVarSuperindicator ( SCIP_CONS cons)

gets binary variable corresponding to the general indicator constraint

Parameters
conssuperindicator constraint

Definition at line 2088 of file cons_superindicator.c.

References CONSHDLR_NAME, NULL, SCIPconsGetData(), SCIPconsGetHdlr(), and SCIPconshdlrGetName().

SCIP_CONS* SCIPgetSlackConsSuperindicator ( SCIP_CONS cons)

gets the slack constraint corresponding to the general indicator constraint

Parameters
conssuperindicator constraint

Definition at line 2100 of file cons_superindicator.c.

References CONSHDLR_NAME, NULL, SCIPconsGetData(), SCIPconsGetHdlr(), and SCIPconshdlrGetName().