constraint handler for indicator constraints over arbitrary constraint types
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_NEEDSCONS TRUE |
#define | CONSHDLR_PROP_TIMING SCIP_PROPTIMING_BEFORELP |
#define | CONSHDLR_PRESOLTIMING SCIP_PRESOLTIMING_MEDIUM |
#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_RETCODE | enforceConstraint (SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS **conss, int nconss, int nusefulconss, SCIP_SOL *sol, SCIP_Bool solinfeasible, SCIP_RESULT *result) |
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_CONSENFORELAX (consEnforelaxSuperindicator) |
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_VAR * | SCIPgetBinaryVarSuperindicator (SCIP_CONS *cons) |
SCIP_CONS * | SCIPgetSlackConsSuperindicator (SCIP_CONS *cons) |
SCIP_RETCODE | SCIPtransformMinUC (SCIP *scip, SCIP_Bool *success) |
SCIP_DECL_DIALOGEXEC (SCIPdialogExecChangeMinUC) | |
#define CONSHDLR_NAME "superindicator" |
Definition at line 44 of file cons_superindicator.c.
Referenced by SCIPcreateConsSuperindicator(), SCIPgetBinaryVarSuperindicator(), SCIPgetSlackConsSuperindicator(), and SCIPincludeConshdlrSuperindicator().
#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 54 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 57 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 58 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 59 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 61 of file cons_superindicator.c.
Referenced by SCIPincludeConshdlrSuperindicator().
#define CONSHDLR_PRESOLTIMING SCIP_PRESOLTIMING_MEDIUM |
presolving timing of the constraint handler (fast, medium, or exhaustive)
Definition at line 62 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 64 of file cons_superindicator.c.
Referenced by SCIPincludeConshdlrSuperindicator().
#define DEFAULT_UPGDPRIOINDICATOR 1 |
priority for upgrading to an indicator constraint (-1: never)
Definition at line 65 of file cons_superindicator.c.
Referenced by SCIPincludeConshdlrSuperindicator().
#define DEFAULT_UPGDPRIOLINEAR 2 |
priority for upgrading to a linear constraint (-1: never)
Definition at line 66 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 67 of file cons_superindicator.c.
Referenced by SCIPincludeConshdlrSuperindicator().
|
static |
creates superindicator constraint data
scip | SCIP data structure |
consdata | pointer to constraint data |
binvar | binary variable |
slackcons | slack constraint |
Definition at line 100 of file cons_superindicator.c.
References consdataCheckSuperindicator(), SCIP_CALL, SCIP_OKAY, SCIPallocBlockMemory, SCIPcaptureCons(), SCIPdebugMsg, SCIPgetTransformedVar(), SCIPisTransformed(), and SCIPtransformCons().
Referenced by SCIPcreateConsSuperindicator().
|
static |
checks the feasibility of a superindicator constraint
scip | SCIP data structure |
consdata | pointer to superindicator constraint data |
sol | pointer to the solution to be checked |
checkintegrality | Has integrality to be checked? |
checklprows | Do constraints represented by rows in the current LP have to be checked? |
printreason | Should the reason for the violation be printed? |
result | pointer to store the result of the test |
Definition at line 139 of file cons_superindicator.c.
References extractLinearValues(), SCIP_CALL, SCIP_DIDNOTRUN, SCIP_FEASIBLE, SCIP_INFEASIBLE, SCIP_OKAY, SCIP_Real, SCIPcheckCons(), SCIPconsGetName(), SCIPdebugMsg, SCIPgetSolVal(), SCIPinfoMessage(), SCIPisFeasEQ(), SCIPisIntegral(), SCIPvarGetName(), and TRUE.
Referenced by consdataCreateSuperindicator(), and enforceConstraint().
|
static |
computes the minactivity, maxactivity, and minimal absolute value of nonzero coefficients of a linear constraint with respect to its global bounds
scip | SCIP data structure |
cons | pointer to linear constraint |
minactivity | pointer to return the minimal activity |
maxactivity | pointer to return the maximal activity |
minabscoef | pointer to return the minimal absolute value of the coefficients |
Definition at line 210 of file cons_superindicator.c.
References FALSE, SCIP_Bool, SCIP_OKAY, SCIP_Real, SCIPconsGetHdlr(), SCIPconshdlrGetName(), SCIPgetNVarsLinear(), SCIPgetValsLinear(), SCIPgetVarsLinear(), SCIPinfinity(), SCIPisInfinity(), SCIPvarGetLbGlobal(), SCIPvarGetUbGlobal(), and upgradeIndicatorSuperindicator().
Referenced by consdataCheckSuperindicator(), and upgradeLinearSuperindicator().
|
static |
tries to upgrade superindicator constraint to an indicator constraint
scip | SCIP data structure |
cons | superindicator constraint to be upgraded |
success | pointer to store if the upgrading was successful |
deleted | pointer to store if the constraint was deleted |
Definition at line 289 of file cons_superindicator.c.
References FALSE, SCIP_CALL, SCIP_MAXSTRLEN, SCIP_OKAY, SCIP_Real, SCIPaddCons(), SCIPallocBufferArray, SCIPconsGetData(), SCIPconsGetHdlr(), SCIPconsGetName(), SCIPconshdlrGetName(), SCIPconsIsChecked(), SCIPconsIsDynamic(), SCIPconsIsEnforced(), SCIPconsIsInitial(), SCIPconsIsLocal(), SCIPconsIsPropagated(), SCIPconsIsRemovable(), SCIPconsIsSeparated(), SCIPconsIsStickingAtNode(), SCIPcreateConsIndicator(), SCIPdebug, SCIPdebugMsg, SCIPdelCons(), SCIPfindConshdlr(), SCIPfreeBufferArray, SCIPgetLhsLinear(), SCIPgetNVarsLinear(), SCIPgetRhsLinear(), SCIPgetValsLinear(), SCIPgetVarsLinear(), SCIPisInfinity(), SCIPreleaseCons(), SCIPsnprintf(), TRUE, and upgradeLinearSuperindicator().
Referenced by extractLinearValues(), and upgradeSuperindicator().
|
static |
upgrades a superindicator constraint to a linear constraint if possible
scip | SCIP data structure |
cons | superindicator constraint to be upgraded |
success | pointer to store if the upgrading was successful |
deleted | pointer to store if the constraint was deleted |
Definition at line 405 of file cons_superindicator.c.
References extractLinearValues(), FALSE, SCIP_CALL, SCIP_MAXSTRLEN, SCIP_OKAY, SCIP_Real, SCIPaddCons(), SCIPallocBufferArray, SCIPconsGetData(), SCIPconsGetHdlr(), SCIPconsGetName(), SCIPconshdlrGetData(), SCIPconshdlrGetName(), SCIPconsIsChecked(), SCIPconsIsDynamic(), SCIPconsIsEnforced(), SCIPconsIsInitial(), SCIPconsIsLocal(), SCIPconsIsModifiable(), SCIPconsIsPropagated(), SCIPconsIsRemovable(), SCIPconsIsSeparated(), SCIPconsIsStickingAtNode(), SCIPcreateConsLinear(), SCIPdebug, SCIPdebugMsg, SCIPdelCons(), SCIPfindConshdlr(), SCIPfreeBufferArray, SCIPgetLhsLinear(), SCIPgetNVarsLinear(), SCIPgetRhsLinear(), SCIPgetValsLinear(), SCIPgetVarsLinear(), SCIPinfinity(), SCIPisGE(), SCIPisInfinity(), SCIPisLE(), SCIPisNegative(), SCIPisPositive(), SCIPreleaseCons(), SCIPsnprintf(), TRUE, and upgradeSuperindicator().
Referenced by upgradeIndicatorSuperindicator(), and upgradeSuperindicator().
|
static |
tries to upgrade a superindicator constraint in order of the upgrade priority parameters
scip | SCIP data structure |
cons | superindicator constraint to be updated |
success | pointer to store if the constraint was upgraded |
deleted | pointer to store if the constraint was deleted |
Definition at line 608 of file cons_superindicator.c.
References enforceConstraint(), FALSE, SCIP_CALL, SCIP_OKAY, SCIPconsGetHdlr(), SCIPconshdlrGetData(), upgradeIndicatorSuperindicator(), and upgradeLinearSuperindicator().
Referenced by upgradeLinearSuperindicator().
|
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) |
solinfeasible | was the solution already declared infeasible by a constraint handler? |
result | pointer to store the result of the enforcing call |
Definition at line 655 of file cons_superindicator.c.
References consdataCheckSuperindicator(), FALSE, SCIP_Bool, SCIP_BRANCHED, SCIP_CALL, SCIP_CONSADDED, SCIP_CUTOFF, SCIP_DECL_CONSHDLRCOPY(), SCIP_FEASIBLE, SCIP_INFEASIBLE, SCIP_INVALIDRESULT, SCIP_OKAY, SCIP_REDUCEDDOM, SCIP_SEPARATED, SCIPconsGetData(), SCIPconsGetName(), SCIPdebugMsg, SCIPdebugPrintf, SCIPenfolpCons(), SCIPenforelaxCons(), SCIPerrorMessage, SCIPisFeasEQ(), SCIPprintSol(), SCIPvarGetLbLocal(), SCIPvarGetName(), and TRUE.
Referenced by SCIP_DECL_CONSENFOLP(), and upgradeSuperindicator().
|
static |
copy method for constraint handler plugins (called when SCIP copies plugins)
Definition at line 789 of file cons_superindicator.c.
Referenced by enforceConstraint().
|
static |
destructor of constraint handler to free constraint handler data (called when SCIP is exiting)
Definition at line 805 of file cons_superindicator.c.
|
static |
presolving initialization method of constraint handler (called when presolving is about to begin)
Definition at line 828 of file cons_superindicator.c.
|
static |
frees specific constraint data
Definition at line 849 of file cons_superindicator.c.
|
static |
transforms constraint data into data belonging to the transformed problem
Definition at line 872 of file cons_superindicator.c.
|
static |
LP initialization method of constraint handler
Definition at line 899 of file cons_superindicator.c.
|
static |
separation method of constraint handler for LP solutions
Definition at line 936 of file cons_superindicator.c.
|
static |
separation method of constraint handler for arbitrary primal solutions
Definition at line 1045 of file cons_superindicator.c.
|
static |
constraint enforcing method of constraint handler for LP solutions
Definition at line 1155 of file cons_superindicator.c.
References enforceConstraint(), and SCIP_CALL.
|
static |
constraint enforcing method of constraint handler for relaxation solutions
Definition at line 1164 of file cons_superindicator.c.
References SCIP_Bool.
|
static |
constraint enforcing method of constraint handler for pseudo solutions
Definition at line 1173 of file cons_superindicator.c.
|
static |
feasibility check method of constraint handler for integral solutions
Definition at line 1307 of file cons_superindicator.c.
|
static |
domain propagation method of constraint handler
Definition at line 1335 of file cons_superindicator.c.
|
static |
presolving method of constraint handler
Definition at line 1428 of file cons_superindicator.c.
|
static |
propagation conflict resolving method of constraint handler
Definition at line 1517 of file cons_superindicator.c.
|
static |
variable rounding lock method of constraint handler
Definition at line 1550 of file cons_superindicator.c.
|
static |
constraint display method of constraint handler
Definition at line 1573 of file cons_superindicator.c.
|
static |
constraint copying method of constraint handler
Definition at line 1615 of file cons_superindicator.c.
|
static |
constraint parsing method of constraint handler
Definition at line 1734 of file cons_superindicator.c.
|
static |
constraint method of constraint handler which returns the variables (if possible)
Definition at line 1825 of file cons_superindicator.c.
|
static |
constraint method of constraint handler which returns the number of variables (if possible)
Definition at line 1849 of file cons_superindicator.c.