Scippy

SCIP

Solving Constraint Integer Programs

cons_indicator.c File Reference

Detailed Description

constraint handler for indicator constraints

Author
Marc Pfetsch

An indicator constraint is given by a binary variable $y$ and an inequality $ax \leq b$. It states that if $y = 1$ then $ax \leq b$ holds.

This constraint is handled by adding a slack variable $s:\; ax - s \leq b$ with $s \geq 0$. The constraint is enforced by fixing $s$ to 0 if $y = 1$.

Note
The constraint only implements an implication not an equivalence, i.e., it does not ensure that $y = 1$ if $ax \leq b$ or equivalently if $s = 0$ holds.

This constraint is equivalent to a linear constraint $ax - s \leq b$ and an SOS1 constraint on $y$ and $s$ (at most one should be nonzero). In the indicator context we can, however, separate more inequalities.

The name indicator apparently comes from ILOG CPLEX.

Separation Methods

We now explain the handling of indicator constraints in more detail. The indicator constraint handler adds an inequality for each indicator constraint. We assume that this system (with added slack variables) is $ Ax - s \leq b $, where $ x $ are the original variables and $ s $ are the slack variables added by the indicator constraint. Variables $ y $ are the binary variables corresponding to the indicator constraints.

Note
In the implementation, we assume that bounds on the original variables $x$ cannot be influenced by the indicator constraint. If it should be possible to relax these constraints as well, then these constraints have to be added as indicator constraints.

We separate inequalities by using the so-called alternative polyhedron.

Separation via the Alternative Polyhedron

We now describe the separation method of the first method in more detail.

Consider the LP-relaxation of the current subproblem:

\[ \begin{array}{ll} min & c^T x + d^T z\\ & A x - s \leq b, \\ & D x + C z \leq f, \\ & l \leq x \leq u, \\ & u \leq z \leq v, \\ & 0 \leq s. \end{array} \]

As above $Ax - s \leq b$ contains all inequalities corresponding to indicator constraints, while the system $Dx + Cy \leq f$ contains all other inequalities (which are ignored in the following). Similarly, variables $z$ not appearing in indicator constraints are ignored. Bounds for the variables $x_j$ can be given, in particular, variables can be fixed. Note that $s \leq 0$ renders the system infeasible.

To generate cuts, we construct the so-called alternative polyhedron:

\[ \begin{array}{ll} P = \{ (w,r,t) : & A^T w - r + t = 0,\\ & b^T w - l^T r + u^T t = -1,\\ & w, r, t \geq 0 \}. \end{array} \]

Here, $r$ and $t$ correspond to the lower and upper bounds on $x$, respectively.

It turns out that the vertices of $P$ correspond to minimal infeasible subsystems of $A x \leq b$, $l \leq x \leq u$. If $I$ is the index set of such a system, it follows that not all $s_i$ for $i \in I$ can be 0, i.e., $y_i$ can be 1. In other words, the following cut is valid:

\[ \sum_{i \in I} y_i \leq |I| - 1. \]

Separation heuristic

We separate the above inequalities by a heuristic described in

Branch-And-Cut for the Maximum Feasible Subsystem Problem,
Marc Pfetsch, SIAM Journal on Optimization 19, No.1, 21-38 (2008)

The first step in the separation heuristic is to apply the transformation $\bar{y} = 1 - y$, which transforms the above inequality into the constraint

\[ \sum_{i \in I} \bar{y}_i \geq 1, \]

that is, it is a set covering constraint on the negated variables.

The basic idea is to use the current solution to the LP relaxation and use it as the objective, when optimizing of the alternative polyhedron. Since any vertex corresponds to such an inequality, we can check whether it is violated. To enlarge the chance that we find a violated inequality, we perform a fixing procedure, in which the variable corresponding to an arbitrary element of the last IIS $I$ is fixed to zero, i.e., cannot be used in the next IISs. This is repeated until the corresponding alternative polyhedron is infeasible, i.e., we have obtained an IIS-cover. For more details see the paper above.

Preprocessing

Since each indicator constraint adds a linear constraint to the formulation, preprocessing of the linear constraints change the above approach as follows.

The system as present in the formulation is the following (ignoring variables that are not contained in indicator constraints and the objective function):

\[ \begin{array}{ll} & A x - s \leq b, \\ & l \leq x \leq u, \\ & s \leq 0. \end{array} \]

Note again that the requirement $s \leq 0$ leads to an infeasible system. Consider now the preprocessing of the linear constraint (aggregation, bound strengthening, etc.) and assume that this changes the above system to the following:

\[ \begin{array}{ll} & \tilde{A} x - \tilde{B} s \leq \tilde{b}, \\ & \tilde{l} \leq x \leq \tilde{u}, \\ & s \leq 0. \\ \end{array} \]

Note that we forbid multi-aggregation of the $s$ variables in order to be able to change their bounds in propagation/branching. The corresponding alternative system is the following:

\[ \begin{array}{ll} & \tilde{A}^T w - r + t = 0,\\ & - \tilde{B}^T w + v = 0,\\ & b^T w - l^T r + u^T t = -1,\\ & w, v, r, t \geq 0 \end{array} \qquad \Leftrightarrow \qquad \begin{array}{ll} & \tilde{A}^T w - r + t = 0,\\ & \tilde{B}^T w \geq 0,\\ & b^T w - l^T r + u^T t = -1,\\ & w, r, t \geq 0, \end{array} \]

where the second form arises by substituting $v \geq 0$. A closer look at this system reveals that it is not larger than the original one:

  • (Multi-)Aggregation of variables $x$ will remove these variables from the formulation, such that the corresponding column of $\tilde{A}$ (row of $\tilde{A}^T$) will be zero.
  • The rows of $\tilde{B}^T$ are not unit vectors, i.e., do not correspond to redundant nonnegativity constraints, only if the corresponding slack variables appear in an aggregation.

Taken together, these two observations yield the conclusion that the new system is roughly as large as the original one.

Note
Because of possible (multi-)aggregation it might happen that the linear constraint corresponding to an indicator constraint becomes redundant and is deleted. From this we cannot conclude that the indicator constraint is redundant as well (i.e. always fulfilled), because the corresponding slack variable is still present and its setting to 0 might influence other (linear) constraints. Thus, we have to rely on the dual presolving of the linear constraints to detect this case: If the linear constraint is really redundant, i.e., is always fulfilled, it is deleted and the slack variable can be fixed to 0. In this case, the indicator constraint can be deleted as well.

Definition in file cons_indicator.c.

#include <assert.h>
#include <string.h>
#include "scip/cons_indicator.h"
#include "scip/cons_linear.h"
#include "scip/cons_logicor.h"
#include "scip/cons_varbound.h"
#include "scip/cons_quadratic.h"
#include "scip/heur_trysol.h"
#include "scip/pub_misc.h"

Go to the source code of this file.

Macros

#define CONSHDLR_NAME   "indicator"
 
#define CONSHDLR_DESC   "indicator constraint handler"
 
#define CONSHDLR_SEPAPRIORITY   10
 
#define CONSHDLR_ENFOPRIORITY   -100
 
#define CONSHDLR_CHECKPRIORITY   -1000000
 
#define CONSHDLR_SEPAFREQ   10
 
#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 EVENTHDLR_BOUND_NAME   "indicatorbound"
 
#define EVENTHDLR_BOUND_DESC   "bound change event handler for indicator constraints"
 
#define EVENTHDLR_RESTART_NAME   "indicatorrestart"
 
#define EVENTHDLR_RESTART_DESC   "force restart if absolute gap is 1"
 
#define CONFLICTHDLR_NAME   "indicatorconflict"
 
#define CONFLICTHDLR_DESC   "replace slack variables and generate logicor constraints"
 
#define CONFLICTHDLR_PRIORITY   200000
 
#define DEFAULT_BRANCHINDICATORS   FALSE
 
#define DEFAULT_GENLOGICOR   FALSE
 
#define DEFAULT_ADDCOUPLING   TRUE
 
#define DEFAULT_MAXCOUPLINGVALUE   1e4
 
#define DEFAULT_ADDCOUPLINGCONS   FALSE
 
#define DEFAULT_SEPACOUPLINGCUTS   FALSE
 
#define DEFAULT_SEPACOUPLINGLOCAL   FALSE
 
#define DEFAULT_SEPACOUPLINGVALUE   1e4
 
#define DEFAULT_SEPAALTERNATIVELP   FALSE
 
#define DEFAULT_TRYSOLFROMCOVER   FALSE
 
#define DEFAULT_USEOTHERCONSS   FALSE
 
#define DEFAULT_UPDATEBOUNDS   FALSE
 
#define DEFAULT_MAXCONDITIONALTLP   0.0
 
#define DEFAULT_MAXSEPACUTS   100
 
#define DEFAULT_MAXSEPACUTSROOT   2000
 
#define DEFAULT_REMOVEINDICATORS   FALSE
 
#define DEFAULT_GENERATEBILINEAR   FALSE
 
#define DEFAULT_SCALESLACKVAR   FALSE
 
#define DEFAULT_NOLINCONSCONT   FALSE
 
#define DEFAULT_TRYSOLUTIONS   TRUE
 
#define DEFAULT_ENFORCECUTS   FALSE
 
#define DEFAULT_DUALREDUCTIONS   TRUE
 
#define DEFAULT_ADDOPPOSITE   FALSE
 
#define DEFAULT_CONFLICTSUPGRADE   FALSE
 
#define DEFAULT_FORCERESTART   FALSE
 
#define DEFAULT_RESTARTFRAC   0.9
 
#define OBJEPSILON   0.001
 
#define SEPAALTTHRESHOLD   10
 
#define SCIP_CALL_PARAM(x)
 

Functions

static SCIP_DECL_EVENTEXEC (eventExecIndicatorBound)
 
static SCIP_DECL_EVENTEXEC (eventExecIndicatorRestart)
 
static SCIP_DECL_CONFLICTFREE (conflictFreeIndicator)
 
static SCIP_DECL_CONFLICTEXEC (conflictExecIndicator)
 
static SCIP_RETCODE checkParam (SCIP *scip, SCIP_PARAM *param, const char *name, SCIP_Bool oldvalue, SCIP_Bool *newvalue)
 
static SCIP_DECL_PARAMCHGD (paramChangedIndicator)
 
static SCIP_Real varGetObjDelta (SCIP_VAR *var)
 
static SCIP_RETCODE consdataEnsureAddLinConsSize (SCIP *scip, SCIP_CONSHDLR *conshdlr, int num)
 
static SCIP_RETCODE initAlternativeLP (SCIP *scip, SCIP_CONSHDLR *conshdlr)
 
static SCIP_RETCODE checkLPBoundsClean (SCIP *scip, SCIP_LPI *lp, int nconss, SCIP_CONS **conss)
 
static SCIP_RETCODE setAltLPObj (SCIP *scip, SCIP_LPI *lp, SCIP_SOL *sol, int nconss, SCIP_CONS **conss)
 
static SCIP_RETCODE setAltLPObjZero (SCIP *scip, SCIP_LPI *lp, int nconss, SCIP_CONS **conss)
 
static SCIP_RETCODE fixAltLPVariables (SCIP *scip, SCIP_LPI *lp, int nconss, SCIP_CONS **conss, SCIP_Bool *S)
 
static SCIP_RETCODE fixAltLPVariable (SCIP_LPI *lp, int ind)
 
static SCIP_RETCODE unfixAltLPVariable (SCIP_LPI *lp, int ind)
 
static SCIP_RETCODE unfixAltLPVariables (SCIP *scip, SCIP_LPI *lp, int nconss, SCIP_CONS **conss, SCIP_Bool *S)
 
static SCIP_RETCODE updateFirstRow (SCIP *scip, SCIP_CONSHDLRDATA *conshdlrdata)
 
static SCIP_RETCODE updateFirstRowGlobal (SCIP *scip, SCIP_CONSHDLRDATA *conshdlrdata)
 
static SCIP_RETCODE checkIISlocal (SCIP *scip, SCIP_CONSHDLRDATA *conshdlrdata, SCIP_Real *vector, SCIP_Bool *isLocal)
 
static SCIP_RETCODE scaleFirstRow (SCIP *scip, SCIP_CONSHDLRDATA *conshdlrdata)
 
static SCIP_RETCODE addAltLPConstraint (SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS *lincons, SCIP_VAR *slackvar, SCIP_Real objcoef, int *colindex)
 
static SCIP_RETCODE addAltLPRow (SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_ROW *row, SCIP_Real objcoef, int *colindex)
 
static SCIP_RETCODE deleteAltLPConstraint (SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS *cons)
 
static SCIP_RETCODE checkAltLPInfeasible (SCIP *scip, SCIP_LPI *lp, SCIP_Real maxcondition, SCIP_Bool primal, SCIP_Bool *infeasible, SCIP_Bool *error)
 
static SCIP_RETCODE extendToCover (SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONSHDLRDATA *conshdlrdata, SCIP_LPI *lp, SCIP_SOL *sol, SCIP_Bool removable, SCIP_Bool genlogicor, int nconss, SCIP_CONS **conss, SCIP_Bool *S, int *size, SCIP_Real *value, SCIP_Bool *error, int *nGen)
 
static SCIP_RETCODE consdataCreate (SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONSHDLRDATA *conshdlrdata, const char *consname, SCIP_CONSDATA **consdata, SCIP_EVENTHDLR *eventhdlrbound, SCIP_EVENTHDLR *eventhdlrrestart, SCIP_VAR *binvar, SCIP_VAR *slackvar, SCIP_CONS *lincons, SCIP_Bool linconsactive)
 
static SCIP_RETCODE createVarUbs (SCIP *scip, SCIP_CONSHDLRDATA *conshdlrdata, SCIP_CONS **conss, int nconss, int *ngen)
 
static SCIP_RETCODE presolRoundIndicator (SCIP *scip, SCIP_CONSHDLRDATA *conshdlrdata, SCIP_CONS *cons, SCIP_CONSDATA *consdata, SCIP_Bool dualreductions, SCIP_Bool *cutoff, SCIP_Bool *success, int *ndelconss, int *nfixedvars)
 
static SCIP_RETCODE propIndicator (SCIP *scip, SCIP_CONS *cons, SCIP_CONSDATA *consdata, SCIP_Bool dualreductions, SCIP_Bool addopposite, SCIP_Bool *cutoff, int *nGen)
 
static SCIP_RETCODE enforceCuts (SCIP *scip, SCIP_CONSHDLR *conshdlr, int nconss, SCIP_CONS **conss, SCIP_SOL *sol, SCIP_Bool genlogicor, int *nGen)
 
static SCIP_RETCODE enforceIndicators (SCIP *scip, SCIP_CONSHDLR *conshdlr, int nconss, SCIP_CONS **conss, SCIP_Bool genlogicor, SCIP_RESULT *result)
 
static SCIP_RETCODE separateIISRounding (SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_SOL *sol, int nconss, SCIP_CONS **conss, int maxsepacuts, int *nGen)
 
static SCIP_RETCODE separateIndicators (SCIP *scip, SCIP_CONSHDLR *conshdlr, int nconss, int nusefulconss, SCIP_CONS **conss, SCIP_SOL *sol, SCIP_RESULT *result)
 
static void initConshdlrData (SCIP_CONSHDLRDATA *conshdlrdata)
 
static SCIP_DECL_CONSHDLRCOPY (conshdlrCopyIndicator)
 
static SCIP_DECL_CONSINIT (consInitIndicator)
 
static SCIP_DECL_CONSEXIT (consExitIndicator)
 
static SCIP_DECL_CONSFREE (consFreeIndicator)
 
static SCIP_DECL_CONSINITSOL (consInitsolIndicator)
 
static SCIP_DECL_CONSEXITSOL (consExitsolIndicator)
 
static SCIP_DECL_CONSDELETE (consDeleteIndicator)
 
static SCIP_DECL_CONSTRANS (consTransIndicator)
 
static SCIP_DECL_CONSINITPRE (consInitpreIndicator)
 
static SCIP_DECL_CONSPRESOL (consPresolIndicator)
 
static SCIP_DECL_CONSINITLP (consInitlpIndicator)
 
static SCIP_DECL_CONSSEPALP (consSepalpIndicator)
 
static SCIP_DECL_CONSSEPASOL (consSepasolIndicator)
 
static SCIP_DECL_CONSENFOLP (consEnfolpIndicator)
 
static SCIP_DECL_CONSENFOPS (consEnfopsIndicator)
 
static SCIP_DECL_CONSCHECK (consCheckIndicator)
 
static SCIP_DECL_CONSPROP (consPropIndicator)
 
static SCIP_DECL_CONSRESPROP (consRespropIndicator)
 
static SCIP_DECL_CONSLOCK (consLockIndicator)
 
static SCIP_DECL_CONSPRINT (consPrintIndicator)
 
static SCIP_DECL_CONSCOPY (consCopyIndicator)
 
static SCIP_DECL_CONSPARSE (consParseIndicator)
 
static SCIP_DECL_CONSENABLE (consEnableIndicator)
 
static SCIP_DECL_CONSDISABLE (consDisableIndicator)
 
static SCIP_DECL_CONSGETVARS (consGetVarsIndicator)
 
static SCIP_DECL_CONSGETNVARS (consGetNVarsIndicator)
 
SCIP_RETCODE SCIPincludeConshdlrIndicator (SCIP *scip)
 
SCIP_RETCODE SCIPcreateConsIndicator (SCIP *scip, SCIP_CONS **cons, const char *name, SCIP_VAR *binvar, int nvars, SCIP_VAR **vars, SCIP_Real *vals, SCIP_Real rhs, 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 SCIPcreateConsBasicIndicator (SCIP *scip, SCIP_CONS **cons, const char *name, SCIP_VAR *binvar, int nvars, SCIP_VAR **vars, SCIP_Real *vals, SCIP_Real rhs)
 
SCIP_RETCODE SCIPcreateConsIndicatorLinCons (SCIP *scip, SCIP_CONS **cons, const char *name, SCIP_VAR *binvar, SCIP_CONS *lincons, SCIP_VAR *slackvar, 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 SCIPcreateConsBasicIndicatorLinCons (SCIP *scip, SCIP_CONS **cons, const char *name, SCIP_VAR *binvar, SCIP_CONS *lincons, SCIP_VAR *slackvar)
 
SCIP_RETCODE SCIPaddVarIndicator (SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var, SCIP_Real val)
 
SCIP_CONSSCIPgetLinearConsIndicator (SCIP_CONS *cons)
 
SCIP_RETCODE SCIPsetLinearConsIndicator (SCIP *scip, SCIP_CONS *cons, SCIP_CONS *lincons)
 
SCIP_VARSCIPgetBinaryVarIndicator (SCIP_CONS *cons)
 
SCIP_RETCODE SCIPsetBinaryVarIndicator (SCIP *scip, SCIP_CONS *cons, SCIP_VAR *binvar)
 
SCIP_VARSCIPgetSlackVarIndicator (SCIP_CONS *cons)
 
SCIP_Bool SCIPisViolatedIndicator (SCIP *scip, SCIP_CONS *cons, SCIP_SOL *sol)
 
SCIP_RETCODE SCIPmakeIndicatorFeasible (SCIP *scip, SCIP_CONS *cons, SCIP_SOL *sol, SCIP_Bool *changed)
 
SCIP_RETCODE SCIPmakeIndicatorsFeasible (SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_SOL *sol, SCIP_Bool *changed)
 
SCIP_RETCODE SCIPaddLinearConsIndicator (SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_CONS *lincons)
 
SCIP_RETCODE SCIPaddRowIndicator (SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_ROW *row)
 

Macro Definition Documentation

#define CONSHDLR_DESC   "indicator constraint handler"

Definition at line 211 of file cons_indicator.c.

Referenced by SCIPincludeConshdlrIndicator().

#define CONSHDLR_SEPAPRIORITY   10

priority of the constraint handler for separation

Definition at line 212 of file cons_indicator.c.

Referenced by SCIPincludeConshdlrIndicator().

#define CONSHDLR_ENFOPRIORITY   -100

priority of the constraint handler for constraint enforcing

Definition at line 213 of file cons_indicator.c.

Referenced by SCIPincludeConshdlrIndicator().

#define CONSHDLR_CHECKPRIORITY   -1000000

priority of the constraint handler for checking feasibility

Definition at line 214 of file cons_indicator.c.

Referenced by SCIPincludeConshdlrIndicator().

#define CONSHDLR_SEPAFREQ   10

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

Definition at line 215 of file cons_indicator.c.

Referenced by SCIPincludeConshdlrIndicator().

#define CONSHDLR_PROPFREQ   1

frequency for propagating domains; zero means only preprocessing propagation

Definition at line 216 of file cons_indicator.c.

Referenced by SCIPincludeConshdlrIndicator().

#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 217 of file cons_indicator.c.

Referenced by SCIPincludeConshdlrIndicator().

#define CONSHDLR_MAXPREROUNDS   -1

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

Definition at line 219 of file cons_indicator.c.

Referenced by SCIPincludeConshdlrIndicator().

#define CONSHDLR_DELAYSEPA   FALSE

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

Definition at line 220 of file cons_indicator.c.

Referenced by SCIPincludeConshdlrIndicator().

#define CONSHDLR_DELAYPROP   FALSE

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

Definition at line 221 of file cons_indicator.c.

Referenced by SCIPincludeConshdlrIndicator().

#define CONSHDLR_DELAYPRESOL   FALSE

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

Definition at line 222 of file cons_indicator.c.

Referenced by SCIPincludeConshdlrIndicator().

#define CONSHDLR_NEEDSCONS   TRUE

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

Definition at line 223 of file cons_indicator.c.

Referenced by SCIPincludeConshdlrIndicator().

#define CONSHDLR_PROP_TIMING   SCIP_PROPTIMING_BEFORELP

Definition at line 225 of file cons_indicator.c.

Referenced by SCIPincludeConshdlrIndicator().

#define EVENTHDLR_BOUND_NAME   "indicatorbound"

Definition at line 229 of file cons_indicator.c.

Referenced by SCIP_DECL_EVENTEXEC(), and SCIPincludeConshdlrIndicator().

#define EVENTHDLR_BOUND_DESC   "bound change event handler for indicator constraints"

Definition at line 230 of file cons_indicator.c.

Referenced by SCIPincludeConshdlrIndicator().

#define EVENTHDLR_RESTART_NAME   "indicatorrestart"

Definition at line 232 of file cons_indicator.c.

Referenced by SCIP_DECL_EVENTEXEC(), and SCIPincludeConshdlrIndicator().

#define EVENTHDLR_RESTART_DESC   "force restart if absolute gap is 1"

Definition at line 233 of file cons_indicator.c.

Referenced by SCIPincludeConshdlrIndicator().

#define CONFLICTHDLR_NAME   "indicatorconflict"
#define CONFLICTHDLR_DESC   "replace slack variables and generate logicor constraints"

Definition at line 237 of file cons_indicator.c.

Referenced by SCIPincludeConshdlrIndicator().

#define CONFLICTHDLR_PRIORITY   200000

Definition at line 238 of file cons_indicator.c.

Referenced by SCIPincludeConshdlrIndicator().

#define DEFAULT_BRANCHINDICATORS   FALSE

Branch on indicator constraints in enforcing?

Definition at line 241 of file cons_indicator.c.

Referenced by SCIPincludeConshdlrIndicator().

#define DEFAULT_GENLOGICOR   FALSE

Generate logicor constraints instead of cuts?

Definition at line 242 of file cons_indicator.c.

Referenced by SCIPincludeConshdlrIndicator().

#define DEFAULT_ADDCOUPLING   TRUE

Add coupling constraints if big-M is small enough?

Definition at line 243 of file cons_indicator.c.

Referenced by SCIPincludeConshdlrIndicator().

#define DEFAULT_MAXCOUPLINGVALUE   1e4

maximum coefficient for binary variable in coupling constraint

Definition at line 244 of file cons_indicator.c.

Referenced by SCIPincludeConshdlrIndicator().

#define DEFAULT_ADDCOUPLINGCONS   FALSE

Add initial coupling inequalities as linear constraints, if 'addcoupling' is true?

Definition at line 245 of file cons_indicator.c.

Referenced by SCIPincludeConshdlrIndicator().

#define DEFAULT_SEPACOUPLINGCUTS   FALSE

Should the coupling inequalities be separated dynamically?

Definition at line 246 of file cons_indicator.c.

Referenced by SCIPincludeConshdlrIndicator().

#define DEFAULT_SEPACOUPLINGLOCAL   FALSE

Allow to use local bounds in order to separated coupling inequalities?

Definition at line 247 of file cons_indicator.c.

Referenced by SCIPincludeConshdlrIndicator().

#define DEFAULT_SEPACOUPLINGVALUE   1e4

maximum coefficient for binary variable in separated coupling constraint

Definition at line 248 of file cons_indicator.c.

Referenced by SCIPincludeConshdlrIndicator().

#define DEFAULT_SEPAALTERNATIVELP   FALSE

Separate using the alternative LP?

Definition at line 249 of file cons_indicator.c.

Referenced by SCIPincludeConshdlrIndicator().

#define DEFAULT_TRYSOLFROMCOVER   FALSE

Try to construct a feasible solution from a cover?

Definition at line 250 of file cons_indicator.c.

Referenced by SCIPincludeConshdlrIndicator().

#define DEFAULT_USEOTHERCONSS   FALSE

Collect other constraints to alternative LP?

Definition at line 251 of file cons_indicator.c.

Referenced by SCIPincludeConshdlrIndicator().

#define DEFAULT_UPDATEBOUNDS   FALSE

Update bounds of original variables for separation?

Definition at line 252 of file cons_indicator.c.

Referenced by SCIPincludeConshdlrIndicator().

#define DEFAULT_MAXCONDITIONALTLP   0.0

max. estimated condition of the solution basis matrix of the alt. LP to be trustworthy (0.0 to disable check)

Definition at line 253 of file cons_indicator.c.

Referenced by SCIPincludeConshdlrIndicator().

#define DEFAULT_MAXSEPACUTS   100

maximal number of cuts separated per separation round

Definition at line 254 of file cons_indicator.c.

Referenced by SCIPincludeConshdlrIndicator().

#define DEFAULT_MAXSEPACUTSROOT   2000

maximal number of cuts separated per separation round in the root node

Definition at line 255 of file cons_indicator.c.

Referenced by SCIPincludeConshdlrIndicator().

#define DEFAULT_REMOVEINDICATORS   FALSE

Remove indicator constraint if corresponding variable bound constraint has been added?

Definition at line 256 of file cons_indicator.c.

Referenced by SCIPincludeConshdlrIndicator().

#define DEFAULT_GENERATEBILINEAR   FALSE

Do not generate indicator constraint, but a bilinear constraint instead?

Definition at line 257 of file cons_indicator.c.

Referenced by SCIPincludeConshdlrIndicator().

#define DEFAULT_SCALESLACKVAR   FALSE

Scale slack variable coefficient at construction time?

Definition at line 258 of file cons_indicator.c.

Referenced by SCIPincludeConshdlrIndicator().

#define DEFAULT_NOLINCONSCONT   FALSE

decompose problem - do not generate linear constraint if all variables are continuous

Definition at line 259 of file cons_indicator.c.

Referenced by SCIPincludeConshdlrIndicator().

#define DEFAULT_TRYSOLUTIONS   TRUE

Try to make solutions feasible by setting indicator variables?

Definition at line 260 of file cons_indicator.c.

Referenced by SCIPincludeConshdlrIndicator().

#define DEFAULT_ENFORCECUTS   FALSE

In enforcing try to generate cuts (only if sepaalternativelp is true)?

Definition at line 261 of file cons_indicator.c.

Referenced by SCIPincludeConshdlrIndicator().

#define DEFAULT_DUALREDUCTIONS   TRUE

Should dual reduction steps be performed?

Definition at line 262 of file cons_indicator.c.

Referenced by SCIPincludeConshdlrIndicator().

#define DEFAULT_ADDOPPOSITE   FALSE

Add opposite inequality in nodes in which the binary variable has been fixed to 0?

Definition at line 263 of file cons_indicator.c.

Referenced by SCIPincludeConshdlrIndicator().

#define DEFAULT_CONFLICTSUPGRADE   FALSE

Try to upgrade bounddisjunction conflicts by replacing slack variables?

Definition at line 264 of file cons_indicator.c.

Referenced by SCIPincludeConshdlrIndicator().

#define DEFAULT_FORCERESTART   FALSE

force restart if we have a max FS instance and gap is 1?

Definition at line 265 of file cons_indicator.c.

Referenced by SCIPincludeConshdlrIndicator().

#define DEFAULT_RESTARTFRAC   0.9

fraction of binary variables that need to be fixed before restart occurs (in forcerestart)

Definition at line 266 of file cons_indicator.c.

Referenced by SCIPincludeConshdlrIndicator().

#define OBJEPSILON   0.001

value to add to objective in alt. LP if the binary variable is 1 to get small IISs

Definition at line 270 of file cons_indicator.c.

Referenced by setAltLPObj(), and setAltLPObjZero().

#define SEPAALTTHRESHOLD   10

only separate IIS cuts if the number of separated coupling cuts is less than this value

Definition at line 271 of file cons_indicator.c.

Referenced by separateIndicators().

#define SCIP_CALL_PARAM (   x)
Value:
/*lint -e527 */ do \
{ \
SCIP_RETCODE _restat_; \
if ( (_restat_ = (x)) != SCIP_OKAY && (_restat_ != SCIP_PARAMETERUNKNOWN) ) \
{ \
SCIPerrorMessage("[%s:%d] Error <%d> in function call\n", __FILE__, __LINE__, _restat_); \
SCIPABORT(); \
return _restat_; \
} \
} \
while ( FALSE )

Definition at line 360 of file cons_indicator.c.

Referenced by checkAltLPInfeasible(), extendToCover(), initAlternativeLP(), and SCIP_DECL_CONSCHECK().

Function Documentation

static SCIP_DECL_CONFLICTFREE ( conflictFreeIndicator  )
static

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

Definition at line 555 of file cons_indicator.c.

References CONFLICTHDLR_NAME, NULL, SCIP_OKAY, SCIPconflicthdlrGetData(), SCIPconflicthdlrGetName(), and SCIPfreeMemory.

static SCIP_RETCODE checkParam ( SCIP scip,
SCIP_PARAM param,
const char *  name,
SCIP_Bool  oldvalue,
SCIP_Bool newvalue 
)
static

check parameter

Parameters
scipSCIP data structure
paramparameter
nameparameter name to check
oldvalueold value of parameter
newvaluenew value after call

Definition at line 743 of file cons_indicator.c.

References NULL, paramname, SCIP_CALL, SCIP_OKAY, SCIP_STAGE_PROBLEM, SCIPchgBoolParam(), SCIPgetStage(), SCIPparamGetName(), and SCIPwarningMessage().

Referenced by SCIP_DECL_PARAMCHGD().

static SCIP_DECL_PARAMCHGD ( paramChangedIndicator  )
static

called after a parameter has been changed

Definition at line 782 of file cons_indicator.c.

References checkParam(), NULL, SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIPconshdlrGetData(), and SCIPfindConshdlr().

static SCIP_Real varGetObjDelta ( SCIP_VAR var)
static

return objective contribution of variable

Special treatment of negated variables: return negative of objective of original variable. SCIPvarGetObj() would return 0 in these cases.

Parameters
varvariable

Definition at line 1079 of file cons_indicator.c.

References NULL, SCIP_VARSTATUS_AGGREGATED, SCIPvarGetAggrScalar(), SCIPvarGetAggrVar(), SCIPvarGetNegatedVar(), SCIPvarGetObj(), SCIPvarGetStatus(), SCIPvarIsBinary(), and SCIPvarIsNegated().

Referenced by enforceCuts(), extendToCover(), presolRoundIndicator(), propIndicator(), SCIPmakeIndicatorFeasible(), and separateIISRounding().

static SCIP_RETCODE consdataEnsureAddLinConsSize ( SCIP scip,
SCIP_CONSHDLR conshdlr,
int  num 
)
static

ensures that the addlincons array can store at least num entries

Parameters
scipSCIP data structure
conshdlrconstraint handler
numminimum number of entries to store

Definition at line 1100 of file cons_indicator.c.

References CONSHDLR_NAME, NULL, SCIP_CALL, SCIP_OKAY, SCIPcalcMemGrowSize(), SCIPconshdlrGetData(), SCIPconshdlrGetName(), and SCIPreallocBlockMemoryArray.

Referenced by SCIPaddLinearConsIndicator().

static SCIP_RETCODE initAlternativeLP ( SCIP scip,
SCIP_CONSHDLR conshdlr 
)
static

initialize alternative LP

The alternative system is organized as follows:

  • The first row corresponds to the right hand side of the original system.
  • The next nconss constraints correspond to the slack variables.
  • The rows after that correspond to the original variables.
Parameters
scipSCIP pointer
conshdlrconstraint handler

Definition at line 1140 of file cons_indicator.c.

References CONSHDLR_NAME, FALSE, NULL, SCIP_CALL, SCIP_CALL_PARAM, SCIP_LPPAR_FASTMIP, SCIP_LPPAR_FROMSCRATCH, SCIP_LPPAR_PRESOLVING, SCIP_LPPAR_SCALING, SCIP_OBJSEN_MINIMIZE, SCIP_OKAY, SCIP_Real, SCIPblkmem(), SCIPcalcHashtableSize(), SCIPconshdlrGetData(), SCIPconshdlrGetName(), SCIPconshdlrSetData(), SCIPdebugMessage, SCIPgetMessagehdlr(), SCIPgetNVars(), SCIPhashmapCreate(), SCIPlpiAddRows(), SCIPlpiCreate(), SCIPlpiSetIntpar(), and TRUE.

Referenced by addAltLPConstraint(), and addAltLPRow().

static SCIP_RETCODE checkLPBoundsClean ( SCIP scip,
SCIP_LPI lp,
int  nconss,
SCIP_CONS **  conss 
)
static

Check whether the bounds int given (alternative) LP are set correctly (for debugging)

Parameters
scipSCIP pointer
lpLP for which bounds should be checked
nconssnumber of constraints
conssconstraints

Definition at line 1195 of file cons_indicator.c.

References FALSE, NULL, SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPABORT, SCIPallocBufferArray, SCIPconsGetData(), SCIPfreeBufferArray, SCIPisFeasZero(), SCIPlpiGetBounds(), SCIPlpiGetNCols(), SCIPlpiIsInfinity(), and TRUE.

Referenced by enforceCuts(), SCIP_DECL_CONSCHECK(), and separateIISRounding().

static SCIP_RETCODE setAltLPObj ( SCIP scip,
SCIP_LPI lp,
SCIP_SOL sol,
int  nconss,
SCIP_CONS **  conss 
)
static

Set the alternative system objective function

We assume that the objective function coefficients of the variables other than the binary indicators are always 0 and hence do not have to be changed.

We already use the tranformation $y' = 1 - y$.

Parameters
scipSCIP pointer
lpalternative LP
solsolution to be dealt with
nconssnumber of constraints
conssindicator constraints

Definition at line 1273 of file cons_indicator.c.

References NULL, OBJEPSILON, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPallocBufferArray, SCIPconsGetData(), SCIPfreeBufferArray, SCIPgetSolVal(), SCIPisFeasEQ(), and SCIPlpiChgObj().

Referenced by separateIISRounding().

static SCIP_RETCODE setAltLPObjZero ( SCIP scip,
SCIP_LPI lp,
int  nconss,
SCIP_CONS **  conss 
)
static

Set the alternative system objective function to some small value

Parameters
scipSCIP pointer
lpalternative LP
nconssnumber of constraints
conssindicator constraints

Definition at line 1326 of file cons_indicator.c.

References NULL, OBJEPSILON, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPallocBufferArray, SCIPconsGetData(), SCIPfreeBufferArray, and SCIPlpiChgObj().

Referenced by enforceCuts(), and SCIP_DECL_CONSCHECK().

static SCIP_RETCODE fixAltLPVariables ( SCIP scip,
SCIP_LPI lp,
int  nconss,
SCIP_CONS **  conss,
SCIP_Bool S 
)
static

Fix variable given by S to 0

Parameters
scipSCIP pointer
lpalternative LP
nconssnumber of constraints
conssindicator constraints
Sbitset of variables

Definition at line 1374 of file cons_indicator.c.

References NULL, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPallocBufferArray, SCIPconsGetData(), SCIPfreeBufferArray, and SCIPlpiChgBounds().

Referenced by enforceCuts(), SCIP_DECL_CONSCHECK(), and separateIISRounding().

static SCIP_RETCODE fixAltLPVariable ( SCIP_LPI lp,
int  ind 
)
static

Fix variable ind to 0

Parameters
lpalternative LP
indvariable that should be fixed to 0

Definition at line 1433 of file cons_indicator.c.

References SCIP_CALL, SCIP_OKAY, SCIP_Real, and SCIPlpiChgBounds().

Referenced by deleteAltLPConstraint(), extendToCover(), and SCIP_DECL_CONSDISABLE().

static SCIP_RETCODE unfixAltLPVariable ( SCIP_LPI lp,
int  ind 
)
static

unfix variable ind to 0

Parameters
lpalternative LP
indvariable that should be fixed to 0

Definition at line 1453 of file cons_indicator.c.

References SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPlpiChgBounds(), and SCIPlpiInfinity().

Referenced by SCIP_DECL_CONSENABLE().

static SCIP_RETCODE unfixAltLPVariables ( SCIP scip,
SCIP_LPI lp,
int  nconss,
SCIP_CONS **  conss,
SCIP_Bool S 
)
static

unfix variable given by S to 0

Parameters
scipSCIP pointer
lpalternative LP
nconssnumber of constraints
conssindicator constraints
Sbitset of variables

Definition at line 1469 of file cons_indicator.c.

References NULL, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPallocBufferArray, SCIPconsGetData(), SCIPfreeBufferArray, SCIPlpiChgBounds(), and SCIPlpiInfinity().

Referenced by enforceCuts(), SCIP_DECL_CONSCHECK(), and separateIISRounding().

static SCIP_RETCODE updateFirstRow ( SCIP scip,
SCIP_CONSHDLRDATA conshdlrdata 
)
static

update bounds in first row to the current ones

Parameters
scipSCIP pointer
conshdlrdataconstraint handler

Definition at line 1528 of file cons_indicator.c.

References FALSE, NULL, SCIP_CALL, SCIP_OKAY, SCIPdebugMessage, SCIPgetNVars(), SCIPgetVars(), SCIPhashmapExists(), SCIPhashmapGetImage(), SCIPisEQ(), SCIPlpiChgCoef(), SCIPvarGetLbGlobal(), SCIPvarGetLbLocal(), SCIPvarGetUbGlobal(), and SCIPvarGetUbLocal().

Referenced by separateIISRounding().

static SCIP_RETCODE updateFirstRowGlobal ( SCIP scip,
SCIP_CONSHDLRDATA conshdlrdata 
)
static

update bounds in first row to the global bounds

Parameters
scipSCIP pointer
conshdlrdataconstraint handler

Definition at line 1592 of file cons_indicator.c.

References NULL, SCIP_CALL, SCIP_OKAY, SCIPdebugMessage, SCIPgetNVars(), SCIPgetVars(), SCIPhashmapExists(), SCIPhashmapGetImage(), SCIPlpiChgCoef(), SCIPvarGetLbGlobal(), and SCIPvarGetUbGlobal().

Referenced by enforceCuts(), and SCIP_DECL_CONSCHECK().

static SCIP_RETCODE checkIISlocal ( SCIP scip,
SCIP_CONSHDLRDATA conshdlrdata,
SCIP_Real vector,
SCIP_Bool isLocal 
)
static

Check whether IIS defined by vector corresponds to a local cut

Parameters
scipSCIP pointer
conshdlrdataconstraint handler
vectorsolution to alternative LP defining IIS
isLocalwhether the IIS uses local bounds different from the global ones

Definition at line 1653 of file cons_indicator.c.

References FALSE, NULL, SCIP_CALL, SCIP_OKAY, SCIPgetNVars(), SCIPgetVars(), SCIPhashmapExists(), SCIPhashmapGetImage(), SCIPisEQ(), SCIPisFeasZero(), SCIPlpiGetNCols(), SCIPvarGetLbGlobal(), SCIPvarGetLbLocal(), SCIPvarGetUbGlobal(), and SCIPvarGetUbLocal().

Referenced by extendToCover().

static SCIP_RETCODE scaleFirstRow ( SCIP scip,
SCIP_CONSHDLRDATA conshdlrdata 
)
static

compute scaling for first row

If the coefficients in the first row are large, a right hand side of -1 might not be adequate. Here, we replace the right hand side by the sum of the coefficients divided by the number of nonzeros.

Parameters
scipSCIP pointer
conshdlrdataconstraint handler

Definition at line 1742 of file cons_indicator.c.

References NULL, REALABS, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPallocBufferArray, SCIPfreeBufferArray, SCIPlpiChgSides(), SCIPlpiGetNCols(), SCIPlpiGetRows(), and TRUE.

Referenced by enforceCuts(), SCIP_DECL_CONSCHECK(), and separateIISRounding().

static SCIP_RETCODE addAltLPConstraint ( SCIP scip,
SCIP_CONSHDLR conshdlr,
SCIP_CONS lincons,
SCIP_VAR slackvar,
SCIP_Real  objcoef,
int *  colindex 
)
static
static SCIP_RETCODE addAltLPRow ( SCIP scip,
SCIP_CONSHDLR conshdlr,
SCIP_ROW row,
SCIP_Real  objcoef,
int *  colindex 
)
static
static SCIP_RETCODE deleteAltLPConstraint ( SCIP scip,
SCIP_CONSHDLR conshdlr,
SCIP_CONS cons 
)
static

delete column corresponding to constraint in alternative LP

We currently just fix the corresponding variable to 0.

Parameters
scipSCIP pointer
conshdlrconstraint handler
consindicator constraint

Definition at line 2426 of file cons_indicator.c.

References CONSHDLR_NAME, FALSE, fixAltLPVariable(), NULL, SCIP_CALL, SCIP_OKAY, SCIPconsGetData(), SCIPconshdlrGetData(), SCIPconshdlrGetName(), and SCIPdebugMessage.

Referenced by SCIP_DECL_CONSDELETE().

static SCIP_RETCODE checkAltLPInfeasible ( SCIP scip,
SCIP_LPI lp,
SCIP_Real  maxcondition,
SCIP_Bool  primal,
SCIP_Bool infeasible,
SCIP_Bool error 
)
static

Check whether the given LP is infeasible

If primal is false we assume that the problem is dual feasible, e.g., the problem was only changed by fixing bounds!

This is the workhorse for all methods that have to solve the alternative LP. We try in several ways to recover from possible stability problems.

Precondition
It is assumed that all parameters for the alternative LP are set.
Parameters
scipSCIP pointer
lpLP
maxconditionmaximal allowed condition of LP solution basis matrix
primalwhether we are using the primal or dual simplex
infeasibleoutput: whether the LP is infeasible
erroroutput: whether an error occured

Definition at line 2475 of file cons_indicator.c.

References FALSE, NULL, SCIP_CALL, SCIP_CALL_PARAM, SCIP_INVALID, SCIP_LPERROR, SCIP_LPPAR_FROMSCRATCH, SCIP_LPPAR_PRESOLVING, SCIP_LPPAR_SCALING, SCIP_LPSOLQUALITY_ESTIMCONDITION, SCIP_OKAY, SCIP_Real, SCIPdebugMessage, SCIPlpiExistsPrimalRay(), SCIPlpiGetInternalStatus(), SCIPlpiGetRealSolQuality(), SCIPlpiIsOptimal(), SCIPlpiIsPrimalInfeasible(), SCIPlpiIsPrimalUnbounded(), SCIPlpiIsStable(), SCIPlpiSetIntpar(), SCIPlpiSolveDual(), SCIPlpiSolvePrimal(), SCIPwarningMessage(), and TRUE.

Referenced by extendToCover(), and SCIP_DECL_CONSCHECK().

static SCIP_RETCODE extendToCover ( SCIP scip,
SCIP_CONSHDLR conshdlr,
SCIP_CONSHDLRDATA conshdlrdata,
SCIP_LPI lp,
SCIP_SOL sol,
SCIP_Bool  removable,
SCIP_Bool  genlogicor,
int  nconss,
SCIP_CONS **  conss,
SCIP_Bool S,
int *  size,
SCIP_Real value,
SCIP_Bool error,
int *  nGen 
)
static

Tries to extend a given set of variables to a cover.

At each step we include a variable which covers a new IIS. Ties are broken according to the number of IISs a variable is contained in. The corresponding IIS inequalities are added to the LP if this not already happened.

Precondition
It is assumed that all parameters for the alternative LP are set and that the variables corresponding to S are fixed. Furthermore xVal_ should contain the current LP solution.
Parameters
scipSCIP pointer
conshdlrconstraint handler
conshdlrdataconstraint handler
lpLP
solsolution to be separated
removablewhether cuts should be removable
genlogicorshould logicor constraints be generated?
nconssnumber of constraints
conssindicator constraints
Sbitset of variables
sizesize of S
valueobjective value of S
erroroutput: whether an error occured
nGennumber of generated cuts

Definition at line 2628 of file cons_indicator.c.

References checkAltLPInfeasible(), checkIISlocal(), FALSE, fixAltLPVariable(), NULL, SCIP_Bool, SCIP_CALL, SCIP_CALL_PARAM, SCIP_LPPAR_FROMSCRATCH, SCIP_LPSOLSTAT_OPTIMAL, SCIP_OKAY, SCIP_Real, SCIPaddCons(), SCIPaddCut(), SCIPaddPoolCut(), SCIPaddVarToRow(), SCIPallocBufferArray, SCIPcacheRowExtensions(), SCIPchgVarLbProbing(), SCIPchgVarUbProbing(), SCIPconsGetData(), SCIPconsIsActive(), SCIPcreateConsLogicor(), SCIPcreateEmptyRowCons(), SCIPcreateSol(), SCIPdebug, SCIPdebugMessage, SCIPendProbing(), SCIPfindHeur(), SCIPflushRowExtensions(), SCIPfreeBufferArray, SCIPfreeSol(), SCIPgetLPSolstat(), SCIPgetNBinVars(), SCIPgetNegatedVar(), SCIPgetNIntVars(), SCIPgetRowSolFeasibility(), SCIPgetSolVal(), SCIPinfinity(), SCIPinfoMessage(), SCIPisEfficacious(), SCIPisFeasNegative(), SCIPisFeasPositive(), SCIPisFeasZero(), SCIPlinkLPSol(), SCIPlpiGetNCols(), SCIPlpiGetSol(), SCIPlpiSetIntpar(), SCIPprintCons(), SCIPprintRow(), SCIPprintSol(), SCIPreleaseCons(), SCIPreleaseRow(), SCIPsolveProbingLP(), SCIPstartProbing(), SCIPtrySol(), SCIPvarGetLbLocal(), SCIPvarGetUbLocal(), TRUE, and varGetObjDelta().

Referenced by enforceCuts(), and separateIISRounding().

static SCIP_RETCODE consdataCreate ( SCIP scip,
SCIP_CONSHDLR conshdlr,
SCIP_CONSHDLRDATA conshdlrdata,
const char *  consname,
SCIP_CONSDATA **  consdata,
SCIP_EVENTHDLR eventhdlrbound,
SCIP_EVENTHDLR eventhdlrrestart,
SCIP_VAR binvar,
SCIP_VAR slackvar,
SCIP_CONS lincons,
SCIP_Bool  linconsactive 
)
static

creates and initializes consdata

Parameters
scipSCIP data structure
conshdlrconstraint handler
conshdlrdataconstraint handler data
consnamename of constraint (or NULL)
consdatapointer to linear constraint data
eventhdlrboundevent handler for bound change events
eventhdlrrestartevent handler for handling restarts
binvarbinary variable (or NULL)
slackvarslack variable
linconslinear constraint (or NULL)
linconsactivewhether the linear constraint is active

Definition at line 2960 of file cons_indicator.c.

References addAltLPConstraint(), FALSE, NULL, SCIP_CALL, SCIP_ERROR, SCIP_EVENTTYPE_BOUNDCHANGED, SCIP_EVENTTYPE_GBDCHANGED, SCIP_OKAY, SCIP_STAGE_INITSOLVE, SCIP_VARTYPE_BINARY, SCIPallocBlockMemory, SCIPcaptureCons(), SCIPcaptureVar(), SCIPcatchVarEvent(), SCIPdebugMessage, SCIPerrorMessage, SCIPgetStage(), SCIPgetTransformedVar(), SCIPinfoMessage(), SCIPisFeasPositive(), SCIPisTransformed(), SCIPprintCons(), SCIPvarGetLbLocal(), SCIPvarGetName(), and SCIPvarGetType().

Referenced by SCIP_DECL_CONSTRANS(), SCIPcreateConsIndicator(), and SCIPcreateConsIndicatorLinCons().

static SCIP_RETCODE createVarUbs ( SCIP scip,
SCIP_CONSHDLRDATA conshdlrdata,
SCIP_CONS **  conss,
int  nconss,
int *  ngen 
)
static

create variable upper bounds for constraints

Parameters
scipSCIP pointer
conshdlrdataconstraint handler data
conssconstraints
nconssnumber of constraints
ngennumber of successful operations

Definition at line 3077 of file cons_indicator.c.

References FALSE, NULL, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPaddCons(), SCIPconsAddUpgradeLocks(), SCIPconsGetData(), SCIPconsGetName(), SCIPconsGetNUpgradeLocks(), SCIPconsIsActive(), SCIPconsIsModifiable(), SCIPcreateConsVarbound(), SCIPdebugMessage, SCIPdelCons(), SCIPinfinity(), SCIPisNegative(), SCIPreleaseCons(), SCIPsnprintf(), SCIPvarGetUbGlobal(), and TRUE.

Referenced by SCIP_DECL_CONSPRESOL().

static SCIP_RETCODE presolRoundIndicator ( SCIP scip,
SCIP_CONSHDLRDATA conshdlrdata,
SCIP_CONS cons,
SCIP_CONSDATA consdata,
SCIP_Bool  dualreductions,
SCIP_Bool cutoff,
SCIP_Bool success,
int *  ndelconss,
int *  nfixedvars 
)
static
static SCIP_RETCODE propIndicator ( SCIP scip,
SCIP_CONS cons,
SCIP_CONSDATA consdata,
SCIP_Bool  dualreductions,
SCIP_Bool  addopposite,
SCIP_Bool cutoff,
int *  nGen 
)
static

propagate indicator constraint

Parameters
scipSCIP pointer
consconstraint
consdataconstraint data
dualreductionsshould dual reductions be performed?
addoppositeadd opposite inequalities if binary var = 0?
cutoffwhether a cutoff happened
nGennumber of domain changes

Definition at line 3460 of file cons_indicator.c.

References FALSE, NULL, REALABS, SCIP_Bool, SCIP_CALL, SCIP_MAXSTRLEN, SCIP_OKAY, SCIP_Real, SCIP_STAGE_SOLVING, SCIP_VARSTATUS_MULTAGGR, SCIPaddConflictBinvar(), SCIPaddConflictLb(), SCIPaddCons(), SCIPallocBufferArray, SCIPanalyzeConflictCons(), SCIPconsAddUpgradeLocks(), SCIPconsGetName(), SCIPconsGetNUpgradeLocks(), SCIPconsIsActive(), SCIPconsIsModifiable(), SCIPcreateConsLinear(), SCIPdebugMessage, SCIPdebugPrintCons, SCIPdelConsLocal(), SCIPfreeBufferArray, SCIPgetDepth(), SCIPgetNVarsLinear(), SCIPgetRhsLinear(), SCIPgetStage(), SCIPgetValsLinear(), SCIPgetVarsLinear(), SCIPincConsAge(), SCIPinferVarLbCons(), SCIPinferVarUbCons(), SCIPinfinity(), SCIPinitConflictAnalysis(), SCIPinProbing(), SCIPinRepropagation(), SCIPisConflictAnalysisApplicable(), SCIPisEQ(), SCIPisFeasGE(), SCIPisFeasPositive(), SCIPisFeasZero(), SCIPisInfinity(), SCIPisIntegral(), SCIPisPositive(), SCIPisZero(), SCIPreleaseCons(), SCIPresetConsAge(), SCIPsnprintf(), SCIPvarGetLbLocal(), SCIPvarGetName(), SCIPvarGetNLocksDown(), SCIPvarGetNLocksUp(), SCIPvarGetStatus(), SCIPvarGetUbLocal(), SCIPvarIsIntegral(), TRUE, and varGetObjDelta().

Referenced by enforceIndicators(), and SCIP_DECL_CONSPROP().

static SCIP_RETCODE enforceCuts ( SCIP scip,
SCIP_CONSHDLR conshdlr,
int  nconss,
SCIP_CONS **  conss,
SCIP_SOL sol,
SCIP_Bool  genlogicor,
int *  nGen 
)
static

enforcement method that produces cuts if possible

This is a variant of the enforcement method that generates cuts/constraints via the alternative LP, if possible.

Parameters
scipSCIP pointer
conshdlrconstraint handler
nconssnumber of constraints
conssindicator constraints
solsolution to be enforced
genlogicorwhether logicor constraint should be generated
nGennumber of cuts generated

Definition at line 3752 of file cons_indicator.c.

References checkLPBoundsClean(), extendToCover(), FALSE, fixAltLPVariables(), NULL, scaleFirstRow(), SCIP_Bool, SCIP_CALL, SCIP_LPERROR, SCIP_OKAY, SCIP_Real, SCIPallocBufferArray, SCIPconsGetData(), SCIPconshdlrGetData(), SCIPdebugMessage, SCIPfreeBufferArray, SCIPgetSolVal(), SCIPisFeasIntegral(), SCIPisFeasZero(), setAltLPObjZero(), TRUE, unfixAltLPVariables(), updateFirstRowGlobal(), and varGetObjDelta().

Referenced by enforceIndicators().

static SCIP_RETCODE enforceIndicators ( SCIP scip,
SCIP_CONSHDLR conshdlr,
int  nconss,
SCIP_CONS **  conss,
SCIP_Bool  genlogicor,
SCIP_RESULT result 
)
static

enforcement method

We check whether the current solution is feasible, i.e., if binvar = 1 implies that slackvar = 0. If not, we branch as follows:

In one branch we fix binvar = 1 and slackvar = 0. In the other branch we fix binvar = 0 and leave slackvar unchanged.

Parameters
scipSCIP pointer
conshdlrconstraint handler
nconssnumber of constraints
conssindicator constraints
genlogicorwhether logicor constraint should be generated
resultresult

Definition at line 3858 of file cons_indicator.c.

References branchCons(), enforceCuts(), FALSE, NULL, propIndicator(), SCIP_Bool, SCIP_BRANCHED, SCIP_CALL, SCIP_CONSADDED, SCIP_CUTOFF, SCIP_FEASIBLE, SCIP_INFEASIBLE, SCIP_OKAY, SCIP_Real, SCIP_REDUCEDDOM, SCIP_SEPARATED, SCIP_VARSTATUS_MULTAGGR, SCIPcalcChildEstimate(), SCIPchgVarLbNode(), SCIPchgVarUbNode(), SCIPconsGetData(), SCIPconsGetName(), SCIPconshdlrGetData(), SCIPconshdlrGetName(), SCIPcreateChild(), SCIPdebugMessage, SCIPgetSolVal(), SCIPinfoMessage(), SCIPisFeasNegative(), SCIPisFeasZero(), SCIPprintCons(), SCIPresetConsAge(), SCIPvarGetLbLocal(), SCIPvarGetStatus(), SCIPvarGetUbLocal(), SCIPwriteTransProblem(), and TRUE.

Referenced by SCIP_DECL_CONSENFOLP(), and SCIP_DECL_CONSENFOPS().

static SCIP_RETCODE separateIISRounding ( SCIP scip,
SCIP_CONSHDLR conshdlr,
SCIP_SOL sol,
int  nconss,
SCIP_CONS **  conss,
int  maxsepacuts,
int *  nGen 
)
static

separate IIS-cuts via rounding

Parameters
scipSCIP pointer
conshdlrconstraint handler
solsolution to be separated
nconssnumber of constraints
conssindicator constraints
maxsepacutsmaximal number of cuts to be generated
nGennumber of domain changes

Definition at line 4035 of file cons_indicator.c.

References checkLPBoundsClean(), extendToCover(), FALSE, fixAltLPVariables(), NULL, scaleFirstRow(), SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPallocBufferArray, SCIPconsGetData(), SCIPconshdlrGetData(), SCIPdebugMessage, SCIPfreeBufferArray, SCIPgetVarSol(), SCIPisFeasLT(), setAltLPObj(), TRUE, unfixAltLPVariables(), updateFirstRow(), and varGetObjDelta().

Referenced by separateIndicators().

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

separation method

We first check whether coupling inequalities can be separated (if required). If not enough of these could be generated, we check whether IIS inequalities can be separated.

Parameters
scipSCIP pointer
conshdlrconstraint handler
nconssnumber of constraints
nusefulconssnumber of usefull constraints
conssindicator constraints
solsolution to be separated
resultresult

Definition at line 4177 of file cons_indicator.c.

References FALSE, NULL, SCIP_Bool, SCIP_CALL, SCIP_CONSADDED, SCIP_DIDNOTFIND, SCIP_DIDNOTRUN, SCIP_OKAY, SCIP_Real, SCIP_SEPARATED, SCIPaddCut(), SCIPaddVarToRow(), SCIPcacheRowExtensions(), SCIPconsGetData(), SCIPconsGetHdlr(), SCIPconsGetName(), SCIPconshdlrGetData(), SCIPcreateEmptyRowCons(), SCIPdebugMessage, SCIPflushRowExtensions(), SCIPgetDepth(), SCIPgetSolVal(), SCIPinfinity(), SCIPisEfficacious(), SCIPisFeasNegative(), SCIPprintRow(), SCIPreleaseRow(), SCIPresetConsAge(), SCIPsnprintf(), SCIPvarGetUbGlobal(), SCIPvarGetUbLocal(), SEPAALTTHRESHOLD, separateIISRounding(), and TRUE.

Referenced by SCIP_DECL_CONSSEPALP(), and SCIP_DECL_CONSSEPASOL().

static void initConshdlrData ( SCIP_CONSHDLRDATA conshdlrdata)
static

initializes the constraint handler data

Parameters
conshdlrdataconstraint handler data

Definition at line 4315 of file cons_indicator.c.

References FALSE, NULL, and TRUE.

Referenced by SCIP_DECL_CONSINIT(), and SCIPincludeConshdlrIndicator().

static SCIP_DECL_CONSHDLRCOPY ( conshdlrCopyIndicator  )
static

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

Definition at line 4349 of file cons_indicator.c.

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

static SCIP_DECL_CONSINIT ( consInitIndicator  )
static

initialization method of constraint handler (called after problem was transformed)

Definition at line 4367 of file cons_indicator.c.

References CONSHDLR_NAME, initConshdlrData(), NULL, SCIP_OKAY, SCIPconshdlrGetData(), SCIPconshdlrGetName(), and SCIPfindHeur().

static SCIP_DECL_CONSEXIT ( consExitIndicator  )
static

deinitialization method of constraint handler (called before transformed problem is freed)

Definition at line 4392 of file cons_indicator.c.

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

static SCIP_DECL_CONSFREE ( consFreeIndicator  )
static

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

Definition at line 4413 of file cons_indicator.c.

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

static SCIP_DECL_CONSEXITSOL ( consExitsolIndicator  )
static

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

Definition at line 4726 of file cons_indicator.c.

References CONSHDLR_NAME, NULL, SCIP_CALL, SCIP_OKAY, SCIPconsGetData(), SCIPconshdlrGetData(), SCIPconshdlrGetName(), SCIPgetMessagehdlr(), SCIPhashmapFree(), SCIPhashmapPrintStatistics(), SCIPinfoMessage(), and SCIPlpiFree().

static SCIP_DECL_CONSINITPRE ( consInitpreIndicator  )
static
static SCIP_DECL_CONSPRESOL ( consPresolIndicator  )
static

presolving method of constraint handler

For an indicator constraint with binary variable $y$ and slack variable $s$ the coupling inequality $s \le M (1-y)$ (equivalently: $s + M y \le M$) is inserted, where $M$ is an upper bound on the value of $s$. If $M$ is too large the inequality is not inserted. Depending on the parameter addcouplingcons we add a variable upper bound or a row (in consInitlpIndicator()).

Warning
We can never delete linear constraints, because we need them to get the right values for the slack variables!

Definition at line 4983 of file cons_indicator.c.

References CONSHDLR_NAME, createVarUbs(), FALSE, NULL, presolRoundIndicator(), SCIP_Bool, SCIP_BOUNDTYPE_UPPER, SCIP_CALL, SCIP_CUTOFF, SCIP_DIDNOTFIND, SCIP_DIDNOTRUN, SCIP_OKAY, SCIP_Real, SCIP_SUCCESS, SCIP_VARTYPE_IMPLINT, SCIPaddVarImplication(), SCIPchgVarType(), SCIPconsGetData(), SCIPconsGetHdlr(), SCIPconshdlrGetData(), SCIPconshdlrGetName(), SCIPconsIsModifiable(), SCIPconsIsTransformed(), SCIPdebugMessage, SCIPgetNVarsLinear(), SCIPgetValsLinear(), SCIPgetVarsLinear(), SCIPisIntegral(), SCIPvarGetType(), SCIPvarIsIntegral(), and TRUE.

static SCIP_DECL_CONSINITLP ( consInitlpIndicator  )
static

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

For an indicator constraint with binary variable $y$ and slack variable $s$ the coupling inequality $s \le M (1-y)$ (equivalently: $s + M y \le M$) is inserted, where $M$ is an upper bound on the value of $s$. If $M$ is too large the inequality is not inserted.

Definition at line 5148 of file cons_indicator.c.

References CONSHDLR_NAME, FALSE, NULL, SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPaddCons(), SCIPaddCut(), SCIPaddPoolCut(), SCIPaddVarToRow(), SCIPcacheRowExtensions(), SCIPconsGetData(), SCIPconsGetName(), SCIPconshdlrGetData(), SCIPconshdlrGetName(), SCIPcreateConsVarbound(), SCIPcreateEmptyRowCons(), SCIPdebugMessage, SCIPflushRowExtensions(), SCIPinfinity(), SCIPisNegative(), SCIPprintRow(), SCIPreleaseCons(), SCIPreleaseRow(), SCIPsnprintf(), SCIPvarGetUbGlobal(), and TRUE.

static SCIP_DECL_CONSSEPALP ( consSepalpIndicator  )
static

separation method of constraint handler for LP solutions

Definition at line 5246 of file cons_indicator.c.

References CONSHDLR_NAME, NULL, SCIP_CALL, SCIP_OKAY, SCIPconshdlrGetName(), and separateIndicators().

static SCIP_DECL_CONSSEPASOL ( consSepasolIndicator  )
static

separation method of constraint handler for arbitrary primal solutions

Definition at line 5263 of file cons_indicator.c.

References CONSHDLR_NAME, NULL, SCIP_CALL, SCIP_OKAY, SCIPconshdlrGetName(), and separateIndicators().

static SCIP_DECL_CONSENFOLP ( consEnfolpIndicator  )
static

constraint enforcing method of constraint handler for LP solutions

Definition at line 5280 of file cons_indicator.c.

References CONSHDLR_NAME, enforceIndicators(), NULL, SCIP_CALL, SCIP_FEASIBLE, SCIP_OKAY, SCIPconshdlrGetData(), and SCIPconshdlrGetName().

static SCIP_DECL_CONSENFOPS ( consEnfopsIndicator  )
static

constraint enforcing method of constraint handler for pseudo solutions

Definition at line 5308 of file cons_indicator.c.

References CONSHDLR_NAME, enforceIndicators(), NULL, SCIP_CALL, SCIP_DIDNOTRUN, SCIP_FEASIBLE, SCIP_OKAY, SCIPconshdlrGetName(), and TRUE.

static SCIP_DECL_CONSPROP ( consPropIndicator  )
static
static SCIP_DECL_CONSRESPROP ( consRespropIndicator  )
static

propagation conflict resolving method of constraint handler

We check which bound changes were the reason for infeasibility. We use that inferinfo is 0 if the binary variable has bounds that fix it to be nonzero (these bounds are the reason). Likewise inferinfo is 1 if the slack variable has bounds that fix it to be nonzero.

Definition at line 5591 of file cons_indicator.c.

References CONSHDLR_NAME, FALSE, NULL, SCIP_CALL, SCIP_DIDNOTFIND, SCIP_OKAY, SCIP_SUCCESS, SCIPaddConflictLb(), SCIPaddConflictUb(), SCIPconsGetData(), SCIPconsGetName(), SCIPconshdlrGetData(), SCIPconshdlrGetName(), SCIPdebugMessage, SCIPisFeasZero(), SCIPisPositive(), SCIPvarGetLbAtIndex(), and SCIPvarGetUbAtIndex().

static SCIP_DECL_CONSLOCK ( consLockIndicator  )
static

variable rounding lock method of constraint handler

The up-rounding of the binary and slack variable may violate the constraint. If the linear constraint is not active, we lock all variables in the depending constraint - otherwise they will be fixed by dual presolving methods.

Definition at line 5647 of file cons_indicator.c.

References CONSHDLR_NAME, NULL, REALABS, SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPaddVarLocks(), SCIPconsGetData(), SCIPconsGetName(), SCIPconshdlrGetName(), SCIPdebugMessage, SCIPgetLhsLinear(), SCIPgetNVarsLinear(), SCIPgetRhsLinear(), SCIPgetValsLinear(), SCIPgetVarsLinear(), SCIPisInfinity(), SCIPisPositive(), and SCIPisZero().

static SCIP_DECL_CONSPRINT ( consPrintIndicator  )
static
static SCIP_DECL_CONSPARSE ( consParseIndicator  )
static
static SCIP_DECL_CONSENABLE ( consEnableIndicator  )
static

constraint enabling notification method of constraint handler

Definition at line 5967 of file cons_indicator.c.

References CONSHDLR_NAME, NULL, SCIP_CALL, SCIP_OKAY, SCIPconsGetData(), SCIPconsGetName(), SCIPconshdlrGetData(), SCIPconshdlrGetName(), SCIPdebugMessage, and unfixAltLPVariable().

static SCIP_DECL_CONSDISABLE ( consDisableIndicator  )
static

constraint disabling notification method of constraint handler

Definition at line 6001 of file cons_indicator.c.

References CONSHDLR_NAME, fixAltLPVariable(), NULL, SCIP_CALL, SCIP_OKAY, SCIPconsGetData(), SCIPconsGetName(), SCIPconshdlrGetData(), SCIPconshdlrGetName(), and SCIPdebugMessage.

static SCIP_DECL_CONSGETVARS ( consGetVarsIndicator  )
static

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

Definition at line 6035 of file cons_indicator.c.

References NULL, SCIP_CALL, SCIP_INVALIDDATA, SCIP_OKAY, SCIPconsGetData(), SCIPconsIsDeleted(), SCIPgetConsVars(), and TRUE.

static SCIP_DECL_CONSGETNVARS ( consGetNVarsIndicator  )
static

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

Definition at line 6081 of file cons_indicator.c.

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

SCIP_RETCODE SCIPincludeConshdlrIndicator ( SCIP scip)

creates the handler for indicator constraints and includes it in SCIP

Parameters
scipSCIP data structure

Definition at line 6125 of file cons_indicator.c.

References CONFLICTHDLR_DESC, CONFLICTHDLR_NAME, CONFLICTHDLR_PRIORITY, CONSHDLR_CHECKPRIORITY, CONSHDLR_DELAYPRESOL, CONSHDLR_DELAYPROP, CONSHDLR_DELAYSEPA, CONSHDLR_DESC, CONSHDLR_EAGERFREQ, CONSHDLR_ENFOPRIORITY, CONSHDLR_MAXPREROUNDS, CONSHDLR_NAME, CONSHDLR_NEEDSCONS, CONSHDLR_PROP_TIMING, CONSHDLR_PROPFREQ, CONSHDLR_SEPAFREQ, CONSHDLR_SEPAPRIORITY, DEFAULT_ADDCOUPLING, DEFAULT_ADDCOUPLINGCONS, DEFAULT_ADDOPPOSITE, DEFAULT_BRANCHINDICATORS, DEFAULT_CONFLICTSUPGRADE, DEFAULT_DUALREDUCTIONS, DEFAULT_ENFORCECUTS, DEFAULT_FORCERESTART, DEFAULT_GENERATEBILINEAR, DEFAULT_GENLOGICOR, DEFAULT_MAXCONDITIONALTLP, DEFAULT_MAXCOUPLINGVALUE, DEFAULT_MAXSEPACUTS, DEFAULT_MAXSEPACUTSROOT, DEFAULT_NOLINCONSCONT, DEFAULT_REMOVEINDICATORS, DEFAULT_RESTARTFRAC, DEFAULT_SCALESLACKVAR, DEFAULT_SEPAALTERNATIVELP, DEFAULT_SEPACOUPLINGCUTS, DEFAULT_SEPACOUPLINGLOCAL, DEFAULT_SEPACOUPLINGVALUE, DEFAULT_TRYSOLFROMCOVER, DEFAULT_TRYSOLUTIONS, DEFAULT_UPDATEBOUNDS, DEFAULT_USEOTHERCONSS, EVENTHDLR_BOUND_DESC, EVENTHDLR_BOUND_NAME, EVENTHDLR_RESTART_DESC, EVENTHDLR_RESTART_NAME, FALSE, initConshdlrData(), NULL, SCIP_CALL, SCIP_OKAY, SCIP_PLUGINNOTFOUND, SCIP_REAL_MAX, SCIPaddBoolParam(), SCIPaddIntParam(), SCIPaddRealParam(), SCIPallocMemory, SCIPerrorMessage, SCIPincludeConflicthdlrBasic(), SCIPincludeConshdlrBasic(), SCIPincludeEventhdlrBasic(), SCIPsetConflicthdlrFree(), SCIPsetConshdlrCopy(), SCIPsetConshdlrDelete(), SCIPsetConshdlrDisable(), SCIPsetConshdlrEnable(), SCIPsetConshdlrExit(), SCIPsetConshdlrExitsol(), SCIPsetConshdlrFree(), SCIPsetConshdlrGetNVars(), SCIPsetConshdlrGetVars(), SCIPsetConshdlrInit(), SCIPsetConshdlrInitlp(), SCIPsetConshdlrInitpre(), SCIPsetConshdlrInitsol(), SCIPsetConshdlrParse(), SCIPsetConshdlrPresol(), SCIPsetConshdlrPrint(), SCIPsetConshdlrProp(), SCIPsetConshdlrResprop(), SCIPsetConshdlrSepa(), SCIPsetConshdlrTrans(), and TRUE.

Referenced by SCIP_DECL_CONSHDLRCOPY(), and SCIPincludeDefaultPlugins().

SCIP_RETCODE SCIPcreateConsIndicator ( SCIP scip,
SCIP_CONS **  cons,
const char *  name,
SCIP_VAR binvar,
int  nvars,
SCIP_VAR **  vars,
SCIP_Real vals,
SCIP_Real  rhs,
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 an indicator constraint

Note
binvar is checked to be binary only later. This enables a change of the type in procedures reading an instance.
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 (indicator or quadratic)
namename of constraint
binvarbinary indicator variable (or NULL)
nvarsnumber of variables in the inequality
varsarray with variables of inequality (or NULL)
valsvalues of variables in inequality (or NULL)
rhsrhs of the inequality
initialshould the LP relaxation of constraint be in the initial LP? Usually set to TRUE.
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 6366 of file cons_indicator.c.

References consdataCreate(), CONSHDLR_NAME, FALSE, NULL, REALABS, SCIP_Bool, SCIP_CALL, SCIP_INVALIDDATA, SCIP_MAXSTRLEN, SCIP_OKAY, SCIP_PLUGINNOTFOUND, SCIP_Real, SCIP_VARTYPE_CONTINUOUS, SCIP_VARTYPE_IMPLINT, SCIPaddCoefLinear(), SCIPaddCons(), SCIPaddVar(), SCIPceil(), SCIPconsAddUpgradeLocks(), SCIPconsGetNUpgradeLocks(), SCIPconshdlrGetData(), SCIPcreateCons(), SCIPcreateConsLinear(), SCIPcreateConsQuadratic(), SCIPcreateVar(), SCIPerrorMessage, SCIPfindConshdlr(), SCIPinfinity(), SCIPisIntegral(), SCIPisZero(), SCIPmarkDoNotMultaggrVar(), SCIPreleaseCons(), SCIPreleaseVar(), SCIPsnprintf(), SCIPvarGetType(), SCIPvarIsIntegral(), and TRUE.

Referenced by createIndicatorConstraint(), readIndicators(), SCIP_DECL_CONSINITPRE(), SCIPcreateConsBasicIndicator(), and upgradeIndicatorSuperindicator().

SCIP_RETCODE SCIPcreateConsBasicIndicator ( SCIP scip,
SCIP_CONS **  cons,
const char *  name,
SCIP_VAR binvar,
int  nvars,
SCIP_VAR **  vars,
SCIP_Real vals,
SCIP_Real  rhs 
)

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

See Also
SCIPcreateConsIndicator() 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 (indicator or quadratic)
namename of constraint
binvarbinary indicator variable (or NULL)
nvarsnumber of variables in the inequality
varsarray with variables of inequality (or NULL)
valsvalues of variables in inequality (or NULL)
rhsrhs of the inequality

Definition at line 6562 of file cons_indicator.c.

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

SCIP_RETCODE SCIPcreateConsIndicatorLinCons ( SCIP scip,
SCIP_CONS **  cons,
const char *  name,
SCIP_VAR binvar,
SCIP_CONS lincons,
SCIP_VAR slackvar,
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 an indicator constraint with given linear constraint and slack variable

Note
binvar is checked to be binary only later. This enables a change of the type in procedures reading an instance.
we assume that slackvar actually appears in lincons and we also assume that it takes the role of a slack variable!
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
binvarbinary indicator variable (or NULL)
linconslinear constraint
slackvarslack variable
initialshould the LP relaxation of constraint be in the initial LP? Usually set to TRUE.
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 6591 of file cons_indicator.c.

References consdataCreate(), CONSHDLR_NAME, FALSE, NULL, SCIP_Bool, SCIP_CALL, SCIP_INVALIDDATA, SCIP_OKAY, SCIP_PLUGINNOTFOUND, SCIP_Real, SCIP_VARTYPE_CONTINUOUS, SCIP_VARTYPE_IMPLINT, SCIPconsAddUpgradeLocks(), SCIPconsGetHdlr(), SCIPconsGetNUpgradeLocks(), SCIPconshdlrGetData(), SCIPconshdlrGetName(), SCIPcreateCons(), SCIPcreateConsQuadratic(), SCIPerrorMessage, SCIPfindConshdlr(), SCIPgetNVarsLinear(), SCIPgetVarsLinear(), SCIPmarkDoNotMultaggrVar(), SCIPvarGetType(), and TRUE.

Referenced by createSubSCIP(), readIndicators(), SCIP_DECL_CONSCOPY(), SCIP_DECL_CONSPARSE(), and SCIPcreateConsBasicIndicatorLinCons().

SCIP_RETCODE SCIPcreateConsBasicIndicatorLinCons ( SCIP scip,
SCIP_CONS **  cons,
const char *  name,
SCIP_VAR binvar,
SCIP_CONS lincons,
SCIP_VAR slackvar 
)

creates and captures an indicator constraint with given linear constraint and slack variable in its most basic version, i. e., all constraint flags are set to their basic value as explained for the method SCIPcreateConsIndicator(); all flags can be set via SCIPsetConsFLAGNAME-methods in scip.h

Note
binvar is checked to be binary only later. This enables a change of the type in procedures reading an instance.
we assume that slackvar actually appears in lincons and we also assume that it takes the role of a slack variable!
the constraint gets captured, hence at one point you have to release it using the method SCIPreleaseCons()
See Also
SCIPcreateConsIndicatorLinCons() 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
binvarbinary indicator variable (or NULL)
linconslinear constraint
slackvarslack variable

Definition at line 6735 of file cons_indicator.c.

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

SCIP_RETCODE SCIPaddVarIndicator ( SCIP scip,
SCIP_CONS cons,
SCIP_VAR var,
SCIP_Real  val 
)

adds variable to the inequality of the indicator constraint

Parameters
scipSCIP data structure
consindicator constraint
varvariable to add to the inequality
valvalue of variable

Definition at line 6754 of file cons_indicator.c.

References CONSHDLR_NAME, NULL, SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIP_VARTYPE_CONTINUOUS, SCIPaddCoefLinear(), SCIPchgVarType(), SCIPconsGetData(), SCIPconsGetHdlr(), SCIPconshdlrGetName(), SCIPisIntegral(), SCIPvarGetType(), and SCIPvarIsIntegral().

SCIP_CONS* SCIPgetLinearConsIndicator ( SCIP_CONS cons)

gets the linear constraint corresponding to the indicator constraint (may be NULL)

Parameters
consindicator constraint

Definition at line 6785 of file cons_indicator.c.

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

Referenced by computeRanks(), createSubSCIP(), SCIP_DECL_READERWRITE(), SCIPwriteLp(), and writeOpbConstraints().

SCIP_RETCODE SCIPsetLinearConsIndicator ( SCIP scip,
SCIP_CONS cons,
SCIP_CONS lincons 
)

sets the linear constraint corresponding to the indicator constraint (may be NULL)

Parameters
scipSCIP data structure
consindicator constraint
linconslinear constraint

Definition at line 6802 of file cons_indicator.c.

References CONSHDLR_NAME, FALSE, NULL, SCIP_Bool, SCIP_CALL, SCIP_INVALIDCALL, SCIP_OKAY, SCIP_STAGE_PROBLEM, SCIP_VARTYPE_CONTINUOUS, SCIP_VARTYPE_IMPLINT, SCIPcaptureCons(), SCIPconsGetData(), SCIPconsGetHdlr(), SCIPconshdlrGetData(), SCIPconshdlrGetName(), SCIPdelCons(), SCIPerrorMessage, SCIPgetNVarsLinear(), SCIPgetStage(), SCIPgetVarsLinear(), SCIPreleaseCons(), SCIPvarGetType(), and TRUE.

SCIP_VAR* SCIPgetBinaryVarIndicator ( SCIP_CONS cons)

gets binary variable corresponding to indicator constraint

Parameters
consindicator constraint

Definition at line 6873 of file cons_indicator.c.

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

Referenced by computeRanks(), createCoveringProblem(), createSubSCIP(), getIndCandVars(), SCIP_DECL_CONFLICTEXEC(), SCIP_DECL_READERWRITE(), SCIPwriteGms(), SCIPwriteLp(), and writeOpbConstraints().

SCIP_RETCODE SCIPsetBinaryVarIndicator ( SCIP scip,
SCIP_CONS cons,
SCIP_VAR binvar 
)
SCIP_VAR* SCIPgetSlackVarIndicator ( SCIP_CONS cons)

gets slack variable corresponding to indicator constraint

Parameters
consindicator constraint

Definition at line 6964 of file cons_indicator.c.

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

Referenced by createSubSCIP(), SCIP_DECL_CONFLICTEXEC(), SCIP_DECL_READERWRITE(), SCIPwriteGms(), SCIPwriteLp(), and writeOpbConstraints().

SCIP_Bool SCIPisViolatedIndicator ( SCIP scip,
SCIP_CONS cons,
SCIP_SOL sol 
)

checks whether indicator constraint is violated w.r.t. sol

Parameters
scipSCIP data structure
consindicator constraint
solsolution, or NULL to use current node's solution

Definition at line 6981 of file cons_indicator.c.

References FALSE, NULL, SCIPconsGetData(), SCIPconsIsDeleted(), SCIPgetSolVal(), SCIPisFeasPositive(), and TRUE.

Referenced by getIndCandVars().

SCIP_RETCODE SCIPmakeIndicatorFeasible ( SCIP scip,
SCIP_CONS cons,
SCIP_SOL sol,
SCIP_Bool changed 
)

Based on values of other variables, computes slack and binary variable to turn constraint feasible

It will also clean up the solution, i.e., shift slack variable, as follows:

If the inequality is $a^T x + \gamma\, s \leq \beta$, the value of the slack variable $s$ to achieve equality is

\[ s^* = \frac{\beta - a^T x^*}{\gamma}, \]

where $x^*$ is the given solution. In case of $a^T x + \gamma\, s \geq \alpha$, we arrive at

\[ s^* = \frac{\alpha - a^T x^*}{\gamma}. \]

The typical values of $\gamma$ in the first case is -1 and +1 in the second case.

Now, let $\sigma$ be the sign of $\gamma$ in the first case and $-\gamma$ in the second case. Thus, if $\sigma > 0$ and $s^* < 0$, the inequality cannot be satisfied by a nonnegative value for the slack variable; in this case, we have to leave the values as they are. If $\sigma < 0$ and $s^* > 0$, the solution violates the indicator constraint (we can set the slack variable to value $s^*$). If $\sigma < 0$ and $s^* \leq 0$ or $\sigma > 0$ and $s^* \geq 0$, the constraint is satisfied, and we can set the slack variable to 0.

Parameters
scipSCIP data structure
consindicator constraint
solsolution
changedpointer to store whether the solution has been changed

Definition at line 7036 of file cons_indicator.c.

References CONSHDLR_NAME, FALSE, NULL, REALABS, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIP_STAGE_INITPRESOLVE, SCIP_VARSTATUS_FIXED, SCIP_VARSTATUS_NEGATED, SCIPconsGetData(), SCIPconsGetHdlr(), SCIPconshdlrGetName(), SCIPconsIsActive(), SCIPgetLhsLinear(), SCIPgetNVarsLinear(), SCIPgetRhsLinear(), SCIPgetSolVal(), SCIPgetStage(), SCIPgetValsLinear(), SCIPgetVarsLinear(), SCIPisFeasEQ(), SCIPisFeasGE(), SCIPisFeasNegative(), SCIPisFeasPositive(), SCIPisFeasZero(), SCIPisInfinity(), SCIPisZero(), SCIPsetSolVal(), SCIPvarGetLbLocal(), SCIPvarGetNegationVar(), SCIPvarGetNLocksDown(), SCIPvarGetNLocksUp(), SCIPvarGetStatus(), TRUE, and varGetObjDelta().

Referenced by SCIP_DECL_CONSCHECK(), and SCIPmakeIndicatorsFeasible().

SCIP_RETCODE SCIPmakeIndicatorsFeasible ( SCIP scip,
SCIP_CONSHDLR conshdlr,
SCIP_SOL sol,
SCIP_Bool changed 
)

Based on values of other variables, computes slack and binary variable to turn all constraints feasible

Parameters
scipSCIP data structure
conshdlrindicator constraint handler
solsolution
changedpointer to store whether the solution has been changed

Definition at line 7205 of file cons_indicator.c.

References CONSHDLR_NAME, FALSE, NULL, SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIP_STAGE_INITPRESOLVE, SCIPconsGetData(), SCIPconshdlrGetConss(), SCIPconshdlrGetName(), SCIPconshdlrGetNConss(), SCIPgetStage(), and SCIPmakeIndicatorFeasible().

Referenced by SCIP_DECL_HEUREXEC().

SCIP_RETCODE SCIPaddLinearConsIndicator ( SCIP scip,
SCIP_CONSHDLR conshdlr,
SCIP_CONS lincons 
)

adds additional linear constraint that is not connected with an indicator constraint, but can be used for separation

Parameters
scipSCIP data structure
conshdlrindicator constraint handler
linconslinear constraint

Definition at line 7252 of file cons_indicator.c.

References consdataEnsureAddLinConsSize(), CONSHDLR_NAME, NULL, SCIP_CALL, SCIP_OKAY, SCIPconshdlrGetData(), SCIPconshdlrGetName(), and SCIPconsIsLocal().

SCIP_RETCODE SCIPaddRowIndicator ( SCIP scip,
SCIP_CONSHDLR conshdlr,
SCIP_ROW row 
)

adds additional row that is not connected by an indicator constraint, but can be used for separation

Note
The row is directly added to the alternative polyhedron and is not stored.
Parameters
scipSCIP data structure
conshdlrindicator constraint handler
rowrow to add

Definition at line 7284 of file cons_indicator.c.

References addAltLPRow(), CONSHDLR_NAME, NULL, SCIP_CALL, SCIP_OKAY, SCIPconshdlrGetData(), SCIPconshdlrGetName(), SCIPdebugMessage, SCIProwGetName(), and SCIProwIsLocal().

Referenced by SCIP_DECL_CONSINITLP(), and separatePoint().