Scippy

SCIP

Solving Constraint Integer Programs

cons_and.c File Reference

Detailed Description

Constraint handler for "and" constraints, $r = x_1 \wedge x_2 \wedge \dots \wedge x_n$.

Author
Tobias Achterberg
Stefan Heinz
Michael Winkler

This constraint handler deals with "and" constraint. These are constraint of the form:

\[ r = x_1 \wedge x_2 \wedge \dots \wedge x_n \]

where $x_i$ is a binary variable for all $i$. Hence, $r$ is also of binary type. The variable $r$ is called resultant and the $x$'s operators.

Definition in file cons_and.c.

#include <assert.h>
#include <string.h>
#include "scip/cons_and.h"
#include "scip/cons_linear.h"
#include "scip/cons_logicor.h"
#include "scip/cons_setppc.h"
#include "scip/cons_nonlinear.h"
#include "scip/cons_pseudoboolean.h"
#include "scip/pub_misc.h"
#include "scip/debug.h"

Go to the source code of this file.

Macros

#define CONSHDLR_NAME   "and"
 
#define CONSHDLR_DESC   "constraint handler for and constraints: r = and(x1, ..., xn)"
 
#define CONSHDLR_SEPAPRIORITY   +850100
 
#define CONSHDLR_ENFOPRIORITY   -850100
 
#define CONSHDLR_CHECKPRIORITY   -850100
 
#define CONSHDLR_SEPAFREQ   1
 
#define CONSHDLR_PROPFREQ   1
 
#define CONSHDLR_EAGERFREQ   100
 
#define CONSHDLR_MAXPREROUNDS   -1
 
#define CONSHDLR_DELAYSEPA   FALSE
 
#define CONSHDLR_DELAYPROP   FALSE
 
#define CONSHDLR_DELAYPRESOL   FALSE
 
#define CONSHDLR_NEEDSCONS   TRUE
 
#define CONSHDLR_PROP_TIMING   SCIP_PROPTIMING_BEFORELP
 
#define EVENTHDLR_NAME   "and"
 
#define EVENTHDLR_DESC   "bound change event handler for and constraints"
 
#define DEFAULT_PRESOLPAIRWISE   TRUE
 
#define DEFAULT_LINEARIZE   FALSE
 
#define DEFAULT_ENFORCECUTS   TRUE
 
#define DEFAULT_AGGRLINEARIZATION   FALSE
 
#define DEFAULT_UPGRRESULTANT   TRUE
 
#define DEFAULT_DUALPRESOLVING   TRUE
 
#define HASHSIZE_ANDCONS   131101
 
#define DEFAULT_PRESOLUSEHASHING   TRUE
 
#define NMINCOMPARISONS   200000
 
#define MINGAINPERNMINCOMPARISONS   1e-06
 
#define EXPRGRAPHREFORM_PRIORITY   100000
 

Typedefs

typedef enum Proprule PROPRULE
 

Enumerations

enum  Proprule {
  PROPRULE_1,
  PROPRULE_2,
  PROPRULE_3,
  PROPRULE_4,
  PROPRULE_INVALID,
  PROPRULE_INVALID = 0,
  PROPRULE_1 = 1,
  PROPRULE_2 = 2,
  PROPRULE_3 = 3,
  PROPRULE_4 = 4,
  PROPRULE_1_CORETIMES = 1,
  PROPRULE_2_EDGEFINDING = 2,
  PROPRULE_3_TTEF = 3,
  PROPRULE_1_RHS = 1,
  PROPRULE_1_LHS = 2,
  PROPRULE_INVALID = 0,
  PROPRULE_1,
  PROPRULE_2,
  PROPRULE_3,
  PROPRULE_4,
  PROPRULE_INVALID,
  PROPRULE_1,
  PROPRULE_2,
  PROPRULE_3,
  PROPRULE_4,
  PROPRULE_0,
  PROPRULE_1,
  PROPRULE_INTLB,
  PROPRULE_INTUB,
  PROPRULE_INVALID
}
 

Functions

static SCIP_RETCODE lockRounding (SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var)
 
static SCIP_RETCODE unlockRounding (SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var)
 
static SCIP_RETCODE conshdlrdataCreate (SCIP *scip, SCIP_CONSHDLRDATA **conshdlrdata, SCIP_EVENTHDLR *eventhdlr)
 
static SCIP_RETCODE conshdlrdataFree (SCIP *scip, SCIP_CONSHDLRDATA **conshdlrdata)
 
static int consdataGetNRows (SCIP_CONSDATA *consdata)
 
static SCIP_RETCODE consdataCatchWatchedEvents (SCIP *scip, SCIP_CONSDATA *consdata, SCIP_EVENTHDLR *eventhdlr, int pos, int *filterpos)
 
static SCIP_RETCODE consdataDropWatchedEvents (SCIP *scip, SCIP_CONSDATA *consdata, SCIP_EVENTHDLR *eventhdlr, int pos, int filterpos)
 
static SCIP_RETCODE consdataCatchEvents (SCIP *scip, SCIP_CONSDATA *consdata, SCIP_EVENTHDLR *eventhdlr)
 
static SCIP_RETCODE consdataDropEvents (SCIP *scip, SCIP_CONSDATA *consdata, SCIP_EVENTHDLR *eventhdlr)
 
static SCIP_RETCODE consdataSwitchWatchedvars (SCIP *scip, SCIP_CONSDATA *consdata, SCIP_EVENTHDLR *eventhdlr, int watchedvar1, int watchedvar2)
 
static SCIP_RETCODE consdataEnsureVarsSize (SCIP *scip, SCIP_CONSDATA *consdata, int num)
 
static SCIP_RETCODE consdataCreate (SCIP *scip, SCIP_CONSDATA **consdata, SCIP_EVENTHDLR *eventhdlr, int nvars, SCIP_VAR **vars, SCIP_VAR *resvar, SCIP_Bool checkwhenupgr, SCIP_Bool notremovablewhenupgr)
 
static SCIP_RETCODE consdataFreeRows (SCIP *scip, SCIP_CONSDATA *consdata)
 
static SCIP_RETCODE consdataFree (SCIP *scip, SCIP_CONSDATA **consdata, SCIP_EVENTHDLR *eventhdlr)
 
static SCIP_RETCODE consdataPrint (SCIP *scip, SCIP_CONSDATA *consdata, FILE *file)
 
static SCIP_RETCODE addCoef (SCIP *scip, SCIP_CONS *cons, SCIP_EVENTHDLR *eventhdlr, SCIP_VAR *var)
 
static SCIP_RETCODE delCoefPos (SCIP *scip, SCIP_CONS *cons, SCIP_EVENTHDLR *eventhdlr, int pos)
 
static void consdataSort (SCIP_CONSDATA *consdata)
 
static SCIP_RETCODE applyFixings (SCIP *scip, SCIP_CONS *cons, SCIP_EVENTHDLR *eventhdlr, int *nchgcoefs)
 
static SCIP_RETCODE createRelaxation (SCIP *scip, SCIP_CONS *cons)
 
static SCIP_RETCODE addRelaxation (SCIP *scip, SCIP_CONS *cons)
 
static SCIP_RETCODE checkCons (SCIP *scip, SCIP_CONS *cons, SCIP_SOL *sol, SCIP_Bool checklprows, SCIP_Bool printreason, SCIP_Bool *violated)
 
static SCIP_RETCODE separateCons (SCIP *scip, SCIP_CONS *cons, SCIP_SOL *sol, SCIP_Bool *separated, SCIP_Bool *cutoff)
 
static SCIP_RETCODE analyzeConflictOne (SCIP *scip, SCIP_CONS *cons, int falsepos)
 
static SCIP_RETCODE analyzeConflictZero (SCIP *scip, SCIP_CONS *cons)
 
static SCIP_RETCODE consdataFixResultantZero (SCIP *scip, SCIP_CONS *cons, SCIP_VAR *resvar, int pos, SCIP_Bool *cutoff, int *nfixedvars)
 
static SCIP_RETCODE consdataFixOperandsOne (SCIP *scip, SCIP_CONS *cons, SCIP_VAR **vars, int nvars, SCIP_Bool *cutoff, int *nfixedvars)
 
static SCIP_RETCODE consdataLinearize (SCIP *scip, SCIP_CONS *cons, SCIP_Bool *cutoff, int *nfixedvars, int *nupgdconss)
 
static SCIP_RETCODE analyzeZeroResultant (SCIP *scip, SCIP_CONS *cons, int watchedvar1, int watchedvar2, SCIP_Bool *cutoff, int *nfixedvars)
 
static SCIP_RETCODE mergeMultiples (SCIP *scip, SCIP_CONS *cons, SCIP_EVENTHDLR *eventhdlr, unsigned char **entries, int *nentries, int *nfixedvars, int *nchgcoefs, int *ndelconss)
 
static SCIP_RETCODE propagateCons (SCIP *scip, SCIP_CONS *cons, SCIP_EVENTHDLR *eventhdlr, SCIP_Bool *cutoff, int *nfixedvars, int *nupgdconss)
 
static SCIP_RETCODE resolvePropagation (SCIP *scip, SCIP_CONS *cons, SCIP_VAR *infervar, PROPRULE proprule, SCIP_BDCHGIDX *bdchgidx, SCIP_RESULT *result)
 
static SCIP_RETCODE dualPresolve (SCIP *scip, SCIP_CONS **conss, int nconss, SCIP_EVENTHDLR *eventhdlr, unsigned char **entries, int *nentries, SCIP_Bool *cutoff, int *nfixedvars, int *naggrvars, int *nchgcoefs, int *ndelconss, int *nupgdconss, int *naddconss)
 
static SCIP_RETCODE cliquePresolve (SCIP *scip, SCIP_CONS *cons, SCIP_EVENTHDLR *eventhdlr, SCIP_Bool *cutoff, int *nfixedvars, int *naggrvars, int *nchgcoefs, int *ndelconss, int *naddconss)
 
static SCIP_DECL_HASHGETKEY (hashGetKeyAndcons)
 
static SCIP_DECL_HASHKEYEQ (hashKeyEqAndcons)
 
static SCIP_DECL_HASHKEYVAL (hashKeyValAndcons)
 
static SCIP_RETCODE detectRedundantConstraints (SCIP *scip, BMS_BLKMEM *blkmem, SCIP_CONS **conss, int nconss, int *firstchange, SCIP_Bool *cutoff, int *naggrvars, int *ndelconss)
 
static SCIP_RETCODE preprocessConstraintPairs (SCIP *scip, SCIP_CONS **conss, int firstchange, int chkind, SCIP_Bool *cutoff, int *naggrvars, int *nbdchgs, int *ndelconss)
 
static SCIP_DECL_EXPRGRAPHNODEREFORM (exprgraphnodeReformAnd)
 
static SCIP_DECL_CONSHDLRCOPY (conshdlrCopyAnd)
 
static SCIP_DECL_CONSFREE (consFreeAnd)
 
static SCIP_DECL_CONSINITPRE (consInitpreAnd)
 
static SCIP_DECL_CONSEXITSOL (consExitsolAnd)
 
static SCIP_DECL_CONSDELETE (consDeleteAnd)
 
static SCIP_DECL_CONSTRANS (consTransAnd)
 
static SCIP_DECL_CONSINITLP (consInitlpAnd)
 
static SCIP_DECL_CONSSEPALP (consSepalpAnd)
 
static SCIP_DECL_CONSSEPASOL (consSepasolAnd)
 
static SCIP_DECL_CONSENFOLP (consEnfolpAnd)
 
static SCIP_DECL_CONSENFOPS (consEnfopsAnd)
 
static SCIP_DECL_CONSCHECK (consCheckAnd)
 
static SCIP_DECL_CONSPROP (consPropAnd)
 
static SCIP_DECL_CONSPRESOL (consPresolAnd)
 
static SCIP_DECL_CONSRESPROP (consRespropAnd)
 
static SCIP_DECL_CONSLOCK (consLockAnd)
 
static SCIP_DECL_CONSPRINT (consPrintAnd)
 
static SCIP_DECL_CONSCOPY (consCopyAnd)
 
static SCIP_DECL_CONSPARSE (consParseAnd)
 
static SCIP_DECL_CONSGETVARS (consGetVarsAnd)
 
static SCIP_DECL_CONSGETNVARS (consGetNVarsAnd)
 
static SCIP_DECL_EVENTEXEC (eventExecAnd)
 
SCIP_RETCODE SCIPincludeConshdlrAnd (SCIP *scip)
 
SCIP_RETCODE SCIPcreateConsAnd (SCIP *scip, SCIP_CONS **cons, const char *name, SCIP_VAR *resvar, int nvars, SCIP_VAR **vars, SCIP_Bool initial, SCIP_Bool separate, SCIP_Bool enforce, SCIP_Bool check, SCIP_Bool propagate, SCIP_Bool local, SCIP_Bool modifiable, SCIP_Bool dynamic, SCIP_Bool removable, SCIP_Bool stickingatnode)
 
SCIP_RETCODE SCIPcreateConsBasicAnd (SCIP *scip, SCIP_CONS **cons, const char *name, SCIP_VAR *resvar, int nvars, SCIP_VAR **vars)
 
int SCIPgetNVarsAnd (SCIP *scip, SCIP_CONS *cons)
 
SCIP_VAR ** SCIPgetVarsAnd (SCIP *scip, SCIP_CONS *cons)
 
SCIP_VARSCIPgetResultantAnd (SCIP *scip, SCIP_CONS *cons)
 
SCIP_Bool SCIPisAndConsSorted (SCIP *scip, SCIP_CONS *cons)
 
SCIP_RETCODE SCIPsortAndCons (SCIP *scip, SCIP_CONS *cons)
 
SCIP_RETCODE SCIPchgAndConsCheckFlagWhenUpgr (SCIP *scip, SCIP_CONS *cons, SCIP_Bool flag)
 
SCIP_RETCODE SCIPchgAndConsRemovableFlagWhenUpgr (SCIP *scip, SCIP_CONS *cons, SCIP_Bool flag)
 

Macro Definition Documentation

#define CONSHDLR_DESC   "constraint handler for and constraints: r = and(x1, ..., xn)"

Definition at line 50 of file cons_and.c.

Referenced by SCIPincludeConshdlrAnd().

#define CONSHDLR_SEPAPRIORITY   +850100

priority of the constraint handler for separation

Definition at line 51 of file cons_and.c.

Referenced by SCIPincludeConshdlrAnd().

#define CONSHDLR_ENFOPRIORITY   -850100

priority of the constraint handler for constraint enforcing

Definition at line 52 of file cons_and.c.

Referenced by SCIPincludeConshdlrAnd().

#define CONSHDLR_CHECKPRIORITY   -850100

priority of the constraint handler for checking feasibility

Definition at line 53 of file cons_and.c.

Referenced by SCIPincludeConshdlrAnd().

#define CONSHDLR_SEPAFREQ   1

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

Definition at line 54 of file cons_and.c.

Referenced by SCIPincludeConshdlrAnd().

#define CONSHDLR_PROPFREQ   1

frequency for propagating domains; zero means only preprocessing propagation

Definition at line 55 of file cons_and.c.

Referenced by SCIPincludeConshdlrAnd().

#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 56 of file cons_and.c.

Referenced by SCIPincludeConshdlrAnd().

#define CONSHDLR_MAXPREROUNDS   -1

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

Definition at line 58 of file cons_and.c.

Referenced by SCIPincludeConshdlrAnd().

#define CONSHDLR_DELAYSEPA   FALSE

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

Definition at line 59 of file cons_and.c.

Referenced by SCIPincludeConshdlrAnd().

#define CONSHDLR_DELAYPROP   FALSE

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

Definition at line 60 of file cons_and.c.

Referenced by SCIPincludeConshdlrAnd().

#define CONSHDLR_DELAYPRESOL   FALSE

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

Definition at line 61 of file cons_and.c.

Referenced by SCIPincludeConshdlrAnd().

#define CONSHDLR_NEEDSCONS   TRUE

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

Definition at line 62 of file cons_and.c.

Referenced by SCIPincludeConshdlrAnd().

#define CONSHDLR_PROP_TIMING   SCIP_PROPTIMING_BEFORELP

Definition at line 64 of file cons_and.c.

Referenced by SCIPincludeConshdlrAnd().

#define EVENTHDLR_NAME   "and"

Definition at line 66 of file cons_and.c.

Referenced by SCIPincludeConshdlrAnd().

#define EVENTHDLR_DESC   "bound change event handler for and constraints"

Definition at line 67 of file cons_and.c.

Referenced by SCIPincludeConshdlrAnd().

#define DEFAULT_PRESOLPAIRWISE   TRUE

should pairwise constraint comparison be performed in presolving?

Definition at line 69 of file cons_and.c.

Referenced by SCIPincludeConshdlrAnd().

#define DEFAULT_LINEARIZE   FALSE

should constraint get linearize and removed?

Definition at line 70 of file cons_and.c.

Referenced by SCIPincludeConshdlrAnd().

#define DEFAULT_ENFORCECUTS   TRUE

should cuts be separated during LP enforcing?

Definition at line 71 of file cons_and.c.

Referenced by SCIPincludeConshdlrAnd().

#define DEFAULT_AGGRLINEARIZATION   FALSE

should an aggregated linearization be used?

Definition at line 72 of file cons_and.c.

Referenced by SCIPincludeConshdlrAnd().

#define DEFAULT_UPGRRESULTANT   TRUE

should all binary resultant variables be upgraded to implicit binary variables

Definition at line 73 of file cons_and.c.

Referenced by SCIPincludeConshdlrAnd().

#define DEFAULT_DUALPRESOLVING   TRUE

should dual presolving be performed?

Definition at line 74 of file cons_and.c.

Referenced by SCIPincludeConshdlrAnd().

#define HASHSIZE_ANDCONS   131101

minimal size of hash table in and constraint tables

Definition at line 76 of file cons_and.c.

Referenced by detectRedundantConstraints().

#define DEFAULT_PRESOLUSEHASHING   TRUE

should hash table be used for detecting redundant constraints in advance

Definition at line 77 of file cons_and.c.

Referenced by SCIPincludeConshdlrAnd().

#define NMINCOMPARISONS   200000

number for minimal pairwise presolving comparisons

Definition at line 78 of file cons_and.c.

Referenced by SCIP_DECL_CONSPRESOL().

#define MINGAINPERNMINCOMPARISONS   1e-06

minimal gain per minimal pairwise presolving comparisons to repeat pairwise comparison round

Definition at line 79 of file cons_and.c.

Referenced by SCIP_DECL_CONSPRESOL().

#define EXPRGRAPHREFORM_PRIORITY   100000

priority of expression graph node reformulation method

Definition at line 80 of file cons_and.c.

Referenced by SCIPincludeConshdlrAnd().

Typedef Documentation

typedef enum Proprule PROPRULE

Definition at line 143 of file cons_and.c.

Enumeration Type Documentation

enum Proprule
Enumerator:
PROPRULE_1 

left hand side and bounds on z -> lower bound on x

PROPRULE_2 

left hand side and upper bound on x -> bound on z

PROPRULE_3 

right hand side and bounds on z -> upper bound on x

PROPRULE_4 

right hand side and lower bound on x -> bound on z

PROPRULE_INVALID 

propagation was applied without a specific propagation rule

PROPRULE_INVALID 

propagation was applied without a specific propagation rule

PROPRULE_1 

v_i = FALSE => r = FALSE

PROPRULE_2 

r = TRUE => v_i = TRUE for all i

PROPRULE_3 

v_i = TRUE for all i => r = TRUE

PROPRULE_4 

r = FALSE, v_i = TRUE for all i except j => v_j = FALSE

PROPRULE_1_CORETIMES 

core-time propagator

PROPRULE_2_EDGEFINDING 

edge-finder

PROPRULE_3_TTEF 

time-table edeg-finding

PROPRULE_1_RHS 

activity residuals of all other variables tighten bounds of single variable due to the right hand side of the inequality

PROPRULE_1_LHS 

activity residuals of all other variables tighten bounds of single variable due to the left hand side of the inequality

PROPRULE_INVALID 

propagation was applied without a specific propagation rule

PROPRULE_1 

v_i = TRUE => r = TRUE

PROPRULE_2 

r = FALSE => v_i = FALSE for all i

PROPRULE_3 

v_i = FALSE for all i => r = FALSE

PROPRULE_4 

r = TRUE, v_i = FALSE for all i except j => v_j = TRUE

PROPRULE_INVALID 

propagation was applied without a specific propagation rule

PROPRULE_1 

left hand side and bounds on y -> lower bound on x

PROPRULE_2 

left hand side and upper bound on x -> bound on y

PROPRULE_3 

right hand side and bounds on y -> upper bound on x

PROPRULE_4 

right hand side and lower bound on x -> bound on y

PROPRULE_0 

all variables are fixed => fix integral variable

PROPRULE_1 

all except one variable fixed => fix remaining variable

PROPRULE_INTLB 

lower bound propagation of integral variable

PROPRULE_INTUB 

upper bound propagation of integral variable

PROPRULE_INVALID 

propagation was applied without a specific propagation rule

Definition at line 135 of file cons_and.c.

Function Documentation

static SCIP_RETCODE lockRounding ( SCIP scip,
SCIP_CONS cons,
SCIP_VAR var 
)
static

installs rounding locks for the given variable in the given and constraint

Parameters
scipSCIP data structure
consand constraint
varvariable of constraint entry

Definition at line 152 of file cons_and.c.

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

Referenced by addCoef().

static SCIP_RETCODE unlockRounding ( SCIP scip,
SCIP_CONS cons,
SCIP_VAR var 
)
static

removes rounding locks for the given variable in the given and constraint

Parameters
scipSCIP data structure
consand constraint
varvariable of constraint entry

Definition at line 166 of file cons_and.c.

References SCIP_CALL, SCIP_OKAY, SCIPunlockVarCons(), and TRUE.

Referenced by delCoefPos().

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

creates constraint handler data

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

Definition at line 180 of file cons_and.c.

References NULL, SCIP_CALL, SCIP_OKAY, and SCIPallocMemory.

Referenced by SCIPincludeConshdlrAnd().

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

frees constraint handler data

Parameters
scipSCIP data structure
conshdlrdatapointer to the constraint handler data

Definition at line 200 of file cons_and.c.

References NULL, SCIP_OKAY, and SCIPfreeMemory.

Referenced by SCIP_DECL_CONSFREE().

static int consdataGetNRows ( SCIP_CONSDATA consdata)
static

gets number of LP rows needed for the LP relaxation of the constraint

Parameters
consdataconstraint data

Definition at line 215 of file cons_and.c.

References NULL.

Referenced by createRelaxation().

static SCIP_RETCODE consdataCatchWatchedEvents ( SCIP scip,
SCIP_CONSDATA consdata,
SCIP_EVENTHDLR eventhdlr,
int  pos,
int *  filterpos 
)
static

catches events for the watched variable at given position

Parameters
scipSCIP data structure
consdataand constraint data
eventhdlrevent handler to call for the event processing
posarray position of variable to catch bound change events for
filterpospointer to store position of event filter entry

Definition at line 226 of file cons_and.c.

References NULL, SCIP_CALL, SCIP_EVENTTYPE_LBTIGHTENED, SCIP_EVENTTYPE_UBRELAXED, SCIP_OKAY, and SCIPcatchVarEvent().

Referenced by consdataSwitchWatchedvars().

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

drops events for the watched variable at given position

Parameters
scipSCIP data structure
consdataand constraint data
eventhdlrevent handler to call for the event processing
posarray position of watched variable to drop bound change events for
filterposposition of event filter entry

Definition at line 250 of file cons_and.c.

References NULL, SCIP_CALL, SCIP_EVENTTYPE_LBTIGHTENED, SCIP_EVENTTYPE_UBRELAXED, SCIP_OKAY, and SCIPdropVarEvent().

Referenced by consdataSwitchWatchedvars().

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

catches needed events on all variables of constraint, except the special ones for watched variables

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

Definition at line 273 of file cons_and.c.

References NULL, SCIP_CALL, SCIP_EVENTTYPE_BOUNDCHANGED, SCIP_EVENTTYPE_LBRELAXED, SCIP_EVENTTYPE_UBTIGHTENED, SCIP_OKAY, and SCIPcatchVarEvent().

Referenced by consdataCreate().

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

drops events on all variables of constraint, except the special ones for watched variables

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

Definition at line 299 of file cons_and.c.

References NULL, SCIP_CALL, SCIP_EVENTTYPE_BOUNDCHANGED, SCIP_EVENTTYPE_LBRELAXED, SCIP_EVENTTYPE_UBTIGHTENED, SCIP_OKAY, and SCIPdropVarEvent().

Referenced by consdataFree().

static SCIP_RETCODE consdataSwitchWatchedvars ( SCIP scip,
SCIP_CONSDATA consdata,
SCIP_EVENTHDLR eventhdlr,
int  watchedvar1,
int  watchedvar2 
)
static

stores the given variable numbers as watched variables, and updates the event processing

Parameters
scipSCIP data structure
consdataand constraint data
eventhdlrevent handler to call for the event processing
watchedvar1new first watched variable
watchedvar2new second watched variable

Definition at line 325 of file cons_and.c.

References consdataCatchWatchedEvents(), consdataDropWatchedEvents(), NULL, SCIP_CALL, and SCIP_OKAY.

Referenced by consdataFree(), delCoefPos(), and propagateCons().

static SCIP_RETCODE consdataEnsureVarsSize ( SCIP scip,
SCIP_CONSDATA consdata,
int  num 
)
static

ensures, that the vars array can store at least num entries

Parameters
scipSCIP data structure
consdatalinear constraint data
numminimum number of entries to store

Definition at line 385 of file cons_and.c.

References NULL, SCIP_CALL, SCIP_OKAY, SCIPcalcMemGrowSize(), and SCIPreallocBlockMemoryArray.

Referenced by addCoef().

static SCIP_RETCODE consdataCreate ( SCIP scip,
SCIP_CONSDATA **  consdata,
SCIP_EVENTHDLR eventhdlr,
int  nvars,
SCIP_VAR **  vars,
SCIP_VAR resvar,
SCIP_Bool  checkwhenupgr,
SCIP_Bool  notremovablewhenupgr 
)
static

creates constraint data for and constraint

Parameters
scipSCIP data structure
consdatapointer to store the constraint data
eventhdlrevent handler to call for the event processing
nvarsnumber of variables in the and operation
varsvariables in and operation
resvarresultant variable
checkwhenupgrshould an upgraded constraint be checked despite the fact that this and-constraint will not be checked
notremovablewhenupgrshould an upgraded constraint be despite the fact that this and-constraint will not be checked

Definition at line 409 of file cons_and.c.

References consdataCatchEvents(), FALSE, NULL, SCIP_CALL, SCIP_OKAY, SCIPallocBlockMemory, SCIPcaptureVar(), SCIPduplicateBlockMemoryArray, SCIPgetTransformedVar(), SCIPgetTransformedVars(), SCIPisTransformed(), SCIPvarIsBinary(), and TRUE.

Referenced by SCIP_DECL_CONSTRANS(), and SCIPcreateConsAnd().

static SCIP_RETCODE consdataFreeRows ( SCIP scip,
SCIP_CONSDATA consdata 
)
static

releases LP rows of constraint data and frees rows array

Parameters
scipSCIP data structure
consdataconstraint data

Definition at line 479 of file cons_and.c.

References NULL, SCIP_CALL, SCIP_OKAY, SCIPfreeBlockMemoryArray, and SCIPreleaseRow().

Referenced by consdataFree(), and SCIP_DECL_CONSEXITSOL().

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

frees constraint data for and constraint

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

Definition at line 510 of file cons_and.c.

References consdataDropEvents(), consdataFreeRows(), consdataSwitchWatchedvars(), NULL, SCIP_CALL, SCIP_OKAY, SCIPfreeBlockMemory, SCIPfreeBlockMemoryArray, SCIPisTransformed(), and SCIPreleaseVar().

Referenced by SCIP_DECL_CONSDELETE().

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

prints and constraint to file stream

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

Definition at line 555 of file cons_and.c.

References NULL, SCIP_CALL, SCIP_OKAY, SCIPinfoMessage(), SCIPwriteVarName(), SCIPwriteVarsList(), and TRUE.

Referenced by applyFixings(), and SCIP_DECL_CONSPRINT().

static SCIP_RETCODE addCoef ( SCIP scip,
SCIP_CONS cons,
SCIP_EVENTHDLR eventhdlr,
SCIP_VAR var 
)
static

adds coefficient to and constraint

Parameters
scipSCIP data structure
conslinear constraint
eventhdlrevent handler to call for the event processing
varvariable to add to the constraint

Definition at line 580 of file cons_and.c.

References consdataEnsureVarsSize(), FALSE, lockRounding(), NULL, SCIP_Bool, SCIP_CALL, SCIP_EVENTTYPE_LBRELAXED, SCIP_EVENTTYPE_UBTIGHTENED, SCIP_INVALIDCALL, SCIP_OKAY, SCIPcaptureVar(), SCIPcatchVarEvent(), SCIPconsGetData(), SCIPconsIsTransformed(), SCIPerrorMessage, SCIPgetTransformedVar(), SCIPvarIsTransformed(), and TRUE.

Referenced by applyFixings().

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

deletes coefficient at given position from and constraint data

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

Definition at line 640 of file cons_and.c.

References consdataSwitchWatchedvars(), FALSE, NULL, SCIP_CALL, SCIP_EVENTTYPE_LBRELAXED, SCIP_EVENTTYPE_UBTIGHTENED, SCIP_OKAY, SCIPconsGetData(), SCIPconsIsTransformed(), SCIPdropVarEvent(), SCIPreleaseVar(), SCIPvarIsTransformed(), TRUE, and unlockRounding().

Referenced by applyFixings(), cliquePresolve(), dualPresolve(), and mergeMultiples().

static void consdataSort ( SCIP_CONSDATA consdata)
static

sorts and constraint's variables by non-decreasing variable index

Parameters
consdataconstraint data

Definition at line 703 of file cons_and.c.

References NULL, SCIP_Bool, SCIPsortedvecFindPtr(), SCIPsortPtr(), SCIPvarCompare(), and TRUE.

Referenced by detectRedundantConstraints(), preprocessConstraintPairs(), SCIP_DECL_HASHKEYEQ(), and SCIPsortAndCons().

static SCIP_RETCODE applyFixings ( SCIP scip,
SCIP_CONS cons,
SCIP_EVENTHDLR eventhdlr,
int *  nchgcoefs 
)
static

deletes all one-fixed variables

Parameters
scipSCIP data structure
consand constraint
eventhdlrevent handler to call for the event processing
nchgcoefspointer to add up the number of changed coefficients

Definition at line 784 of file cons_and.c.

References addCoef(), consdataPrint(), delCoefPos(), NULL, SCIP_Bool, SCIP_CALL, SCIP_EVENTTYPE_BOUNDCHANGED, SCIP_OKAY, SCIPcaptureVar(), SCIPcatchVarEvent(), SCIPconsGetData(), SCIPconsIsTransformed(), SCIPdebug, SCIPdebugMessage, SCIPdebugPrintf, SCIPdropVarEvent(), SCIPgetBinvarRepresentative(), SCIPisFeasEQ(), SCIPreleaseVar(), SCIPvarGetLbGlobal(), SCIPvarGetUbGlobal(), SCIPvarIsActive(), SCIPvarIsBinary(), and TRUE.

Referenced by dualPresolve(), and SCIP_DECL_CONSPRESOL().

static SCIP_RETCODE createRelaxation ( SCIP scip,
SCIP_CONS cons 
)
static
static SCIP_RETCODE addRelaxation ( SCIP scip,
SCIP_CONS cons 
)
static
static SCIP_RETCODE checkCons ( SCIP scip,
SCIP_CONS cons,
SCIP_SOL sol,
SCIP_Bool  checklprows,
SCIP_Bool  printreason,
SCIP_Bool violated 
)
static

checks and constraint for feasibility of given solution: returns TRUE iff constraint is feasible

Parameters
scipSCIP data structure
consconstraint to check
solsolution to check, NULL for current solution
checklprowsshould LP rows be checked?
printreasonshould the reason for the violation be printed?
violatedpointer to store whether the constraint is violated

Definition at line 989 of file cons_and.c.

References FALSE, NULL, SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIP_REAL_FORMAT, SCIP_VARTYPE_IMPLINT, SCIPconsGetData(), SCIPgetSolVal(), SCIPincConsAge(), SCIPinfoMessage(), SCIPisFeasIntegral(), SCIPprintCons(), SCIPresetConsAge(), SCIProwIsInLP(), SCIPvarGetName(), SCIPvarGetType(), and TRUE.

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

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

separates given primal solution

Parameters
scipSCIP data structure
consconstraint to check
solprimal CIP solution, NULL for current LP solution
separatedpointer to store whether a cut was found
cutoffwhether a cutoff has been detected

Definition at line 1102 of file cons_and.c.

References createRelaxation(), FALSE, NULL, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPaddCut(), SCIPconsGetData(), SCIPgetRowSolFeasibility(), SCIPisFeasNegative(), SCIProwIsInLP(), and TRUE.

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

static SCIP_RETCODE analyzeConflictOne ( SCIP scip,
SCIP_CONS cons,
int  falsepos 
)
static

analyzes conflicting TRUE assignment to resultant of given constraint, and adds conflict constraint to problem

Parameters
scipSCIP data structure
consand constraint that detected the conflict
falseposposition of operand that is fixed to FALSE

Definition at line 1151 of file cons_and.c.

References NULL, SCIP_CALL, SCIP_OKAY, SCIP_STAGE_SOLVING, SCIPaddConflictBinvar(), SCIPanalyzeConflictCons(), SCIPconsGetData(), SCIPgetStage(), SCIPinitConflictAnalysis(), SCIPinProbing(), SCIPisConflictAnalysisApplicable(), SCIPvarGetLbLocal(), and SCIPvarGetUbLocal().

Referenced by consdataFixOperandsOne(), and consdataFixResultantZero().

static SCIP_RETCODE analyzeConflictZero ( SCIP scip,
SCIP_CONS cons 
)
static

analyzes conflicting FALSE assignment to resultant of given constraint, and adds conflict constraint to problem

Parameters
scipSCIP data structure
consor constraint that detected the conflict

Definition at line 1182 of file cons_and.c.

References NULL, SCIP_CALL, SCIP_OKAY, SCIP_STAGE_SOLVING, SCIPaddConflictBinvar(), SCIPanalyzeConflictCons(), SCIPconsGetData(), SCIPconsIsModifiable(), SCIPgetStage(), SCIPinitConflictAnalysis(), SCIPinProbing(), SCIPisConflictAnalysisApplicable(), SCIPvarGetLbLocal(), and SCIPvarGetUbLocal().

Referenced by analyzeZeroResultant(), and propagateCons().

static SCIP_RETCODE consdataFixResultantZero ( SCIP scip,
SCIP_CONS cons,
SCIP_VAR resvar,
int  pos,
SCIP_Bool cutoff,
int *  nfixedvars 
)
static

tries to fix the given resultant to zero

Parameters
scipSCIP data structure
consand constraint to be processed
resvarresultant variable to fix to zero
posposition of operand that is fixed to FALSE
cutoffpointer to store TRUE, if the node can be cut off
nfixedvarspointer to add up the number of found domain reductions

Definition at line 1217 of file cons_and.c.

References analyzeConflictOne(), FALSE, PROPRULE_1, SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIPconsGetName(), SCIPdebugMessage, SCIPdelConsLocal(), SCIPinferBinvarCons(), SCIPresetConsAge(), SCIPvarGetName(), and TRUE.

Referenced by propagateCons().

static SCIP_RETCODE consdataFixOperandsOne ( SCIP scip,
SCIP_CONS cons,
SCIP_VAR **  vars,
int  nvars,
SCIP_Bool cutoff,
int *  nfixedvars 
)
static

fix all operands to one

Parameters
scipSCIP data structure
consand constraint to be processed
varsarray of operands
nvarsnumber of operands
cutoffpointer to store TRUE, if the node can be cut off
nfixedvarspointer to add up the number of found domain reductions

Definition at line 1256 of file cons_and.c.

References analyzeConflictOne(), PROPRULE_2, SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIPconsGetName(), SCIPdebugMessage, SCIPdelConsLocal(), SCIPinferBinvarCons(), SCIPresetConsAge(), SCIPvarGetName(), and TRUE.

Referenced by propagateCons().

static SCIP_RETCODE consdataLinearize ( SCIP scip,
SCIP_CONS cons,
SCIP_Bool cutoff,
int *  nfixedvars,
int *  nupgdconss 
)
static

linearize AND constraint due to a globally to zero fixed resultant; that is, creates, adds, and releases a logicor constraint and remove the AND constraint globally.

Since the resultant is fixed to zero the AND constraint collapses to linear constraint of the form:

  • $\sum_{i=0}^{n-1} v_i \leq n-1$

This can be transformed into a logicor constraint of the form

  • $\sum_{i=0}^{n-1} ~v_i \geq 1$
Parameters
scipSCIP data structure
consAND constraint to linearize
cutoffpointer to store TRUE, if the node can be cut off
nfixedvarspointer to add up the number of found domain reductions
nupgdconsspointer to add up the number of upgraded constraints

Definition at line 1310 of file cons_and.c.

References FALSE, NULL, SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIPaddCons(), SCIPallocBufferArray, SCIPconsGetData(), SCIPconsGetName(), SCIPconsIsChecked(), SCIPconsIsDynamic(), SCIPconsIsEnforced(), SCIPconsIsInitial(), SCIPconsIsLocal(), SCIPconsIsModifiable(), SCIPconsIsPropagated(), SCIPconsIsRemovable(), SCIPconsIsSeparated(), SCIPconsIsStickingAtNode(), SCIPcreateConsLogicor(), SCIPcreateConsSetpack(), SCIPdebugPrintCons, SCIPdelCons(), SCIPfixVar(), SCIPfreeBufferArray, SCIPgetBinvarRepresentatives(), SCIPgetNegatedVar(), SCIPreleaseCons(), SCIPvarGetLbGlobal(), SCIPvarGetUbGlobal(), and TRUE.

Referenced by propagateCons().

static SCIP_RETCODE analyzeZeroResultant ( SCIP scip,
SCIP_CONS cons,
int  watchedvar1,
int  watchedvar2,
SCIP_Bool cutoff,
int *  nfixedvars 
)
static

the resultant is fixed to zero; in case all except one operator are fixed to TRUE the last operator has to fixed to FALSE

Note
consdata->watchedvars might not be the same to the watchedvar parameters, because the update was not yet done
Parameters
scipSCIP data structure
consand constraint to be processed
watchedvar1maybe last unfixed variable position
watchedvar2second watched position
cutoffpointer to store TRUE, if the node can be cut off
nfixedvarspointer to add up the number of found domain reductions

Definition at line 1421 of file cons_and.c.

References analyzeConflictZero(), FALSE, NULL, PROPRULE_4, SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIPconsGetData(), SCIPconsGetName(), SCIPdebugMessage, SCIPdelConsLocal(), SCIPinferBinvarCons(), SCIPresetConsAge(), SCIPvarGetLbLocal(), SCIPvarGetName(), SCIPvarGetUbLocal(), and TRUE.

Referenced by propagateCons().

static SCIP_RETCODE mergeMultiples ( SCIP scip,
SCIP_CONS cons,
SCIP_EVENTHDLR eventhdlr,
unsigned char **  entries,
int *  nentries,
int *  nfixedvars,
int *  nchgcoefs,
int *  ndelconss 
)
static

replaces multiple occurrences of variables

Parameters
scipSCIP data structure
consand-constraint
eventhdlrevent handler to call for the event processing
entriesarray to store whether two positions in constraints represent the same variable
nentriespointer for array size, if array will be to small it's corrected
nfixedvarspointer to store number of fixed variables
nchgcoefspointer to store number of changed coefficients
ndelconsspointer to store number of deleted constraints

Definition at line 1482 of file cons_and.c.

References delCoefPos(), NULL, SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIP_VARTYPE_BINARY, SCIP_VARTYPE_IMPLINT, SCIP_VARTYPE_INTEGER, SCIPconsGetData(), SCIPconsGetName(), SCIPdebugMessage, SCIPdelCons(), SCIPfixVar(), SCIPgetNBinVars(), SCIPgetNImplVars(), SCIPgetNIntVars(), SCIPvarGetName(), SCIPvarGetNegatedVar(), SCIPvarGetProbindex(), SCIPvarGetType(), SCIPvarIsActive(), SCIPvarIsBinary(), SCIPvarIsNegated(), and TRUE.

Referenced by dualPresolve(), and SCIP_DECL_CONSPRESOL().

static SCIP_RETCODE propagateCons ( SCIP scip,
SCIP_CONS cons,
SCIP_EVENTHDLR eventhdlr,
SCIP_Bool cutoff,
int *  nfixedvars,
int *  nupgdconss 
)
static

propagates constraint with the following rules: (1) v_i = FALSE => r = FALSE (2) r = TRUE => v_i = TRUE for all i (3) v_i = TRUE for all i => r = TRUE (4) r = FALSE, v_i = TRUE for all i except j => v_j = FALSE

additional if the resultant is fixed to zero during presolving or in the root node (globally), then the "and" constraint is collapsed to a linear (logicor) constraint of the form -> sum_{i=0}^{n-1} ~v_i >= 1

Parameters
scipSCIP data structure
consand constraint to be processed
eventhdlrevent handler to call for the event processing
cutoffpointer to store TRUE, if the node can be cut off
nfixedvarspointer to add up the number of found domain reductions
nupgdconsspointer to add up the number of upgraded constraints

Definition at line 1639 of file cons_and.c.

References analyzeConflictZero(), analyzeZeroResultant(), consdataFixOperandsOne(), consdataFixResultantZero(), consdataLinearize(), consdataSwitchWatchedvars(), NULL, PROPRULE_3, SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIPconsGetData(), SCIPconsGetName(), SCIPconsIsModifiable(), SCIPcutoffNode(), SCIPdebugMessage, SCIPdelConsLocal(), SCIPgetDepth(), SCIPgetRootNode(), SCIPincConsAge(), SCIPinferBinvarCons(), SCIPinProbing(), SCIPinRepropagation(), SCIPisFeasEQ(), SCIPresetConsAge(), SCIPvarGetLbLocal(), SCIPvarGetName(), SCIPvarGetUbGlobal(), SCIPvarGetUbLocal(), and TRUE.

Referenced by dualPresolve(), SCIP_DECL_CONSPRESOL(), and SCIP_DECL_CONSPROP().

static SCIP_RETCODE resolvePropagation ( SCIP scip,
SCIP_CONS cons,
SCIP_VAR infervar,
PROPRULE  proprule,
SCIP_BDCHGIDX bdchgidx,
SCIP_RESULT result 
)
static

resolves a conflict on the given variable by supplying the variables needed for applying the corresponding propagation rule (see propagateCons()): (1) v_i = FALSE => r = FALSE (2) r = TRUE => v_i = TRUE for all i (3) v_i = TRUE for all i => r = TRUE (4) r = FALSE, v_i = TRUE for all i except j => v_j = FALSE

Parameters
scipSCIP data structure
consconstraint that inferred the bound change
infervarvariable that was deduced
proprulepropagation rule that deduced the value
bdchgidxbound change index (time stamp of bound change), or NULL for current time
resultpointer to store the result of the propagation conflict resolving call

Definition at line 1840 of file cons_and.c.

References FALSE, NULL, PROPRULE_1, PROPRULE_2, PROPRULE_3, PROPRULE_4, PROPRULE_INVALID, SCIP_CALL, SCIP_INVALIDDATA, SCIP_OKAY, SCIP_SUCCESS, SCIPaddConflictBinvar(), SCIPconsGetData(), SCIPconsGetName(), SCIPerrorMessage, SCIPvarGetLbAtIndex(), SCIPvarGetUbAtIndex(), and TRUE.

Referenced by SCIP_DECL_CONSRESPROP().

static SCIP_RETCODE dualPresolve ( SCIP scip,
SCIP_CONS **  conss,
int  nconss,
SCIP_EVENTHDLR eventhdlr,
unsigned char **  entries,
int *  nentries,
SCIP_Bool cutoff,
int *  nfixedvars,
int *  naggrvars,
int *  nchgcoefs,
int *  ndelconss,
int *  nupgdconss,
int *  naddconss 
)
static

perform dual presolving on and-constraints

Parameters
scipSCIP data structure
conssand-constraints to perform dual presolving on
nconssnumber of and-constraints
eventhdlrevent handler to call for the event processing
entriesarray to store whether two positions in constraints represent the same variable
nentriespointer for array size, if array will be to small it's corrected
cutoffpointer to store TRUE, if the node can be cut off
nfixedvarspointer to add up the number of found domain reductions
naggrvarspointer to add up the number of aggregated variables
nchgcoefspointer to add up the number of changed coefficients
ndelconsspointer to add up the number of deleted constraints
nupgdconsspointer to add up the number of upgraded constraints
naddconsspointer to add up the number of added constraints

Definition at line 1926 of file cons_and.c.

References applyFixings(), delCoefPos(), FALSE, mergeMultiples(), NULL, propagateCons(), REALABS, SCIP_Bool, SCIP_CALL, SCIP_MAXSTRLEN, SCIP_OKAY, SCIP_Real, SCIPaddCons(), SCIPaggregateVars(), SCIPallocMemoryArray, SCIPconsGetData(), SCIPconsGetName(), SCIPconsIsActive(), SCIPconsIsChecked(), SCIPconsIsDynamic(), SCIPconsIsEnforced(), SCIPconsIsInitial(), SCIPconsIsLocal(), SCIPconsIsModifiable(), SCIPconsIsPropagated(), SCIPconsIsRemovable(), SCIPconsIsSeparated(), SCIPconsIsStickingAtNode(), SCIPcreateConsLinear(), SCIPdebugMessage, SCIPdelCons(), SCIPfixVar(), SCIPfreeMemoryArray, SCIPgetNBinVars(), SCIPgetNImplVars(), SCIPinfinity(), SCIPisEQ(), SCIPisGE(), SCIPisGT(), SCIPisInfinity(), SCIPisLE(), SCIPisLT(), SCIPisNegative(), SCIPisPositive(), SCIPreleaseCons(), SCIPsnprintf(), SCIPvarGetAggregatedObj(), SCIPvarGetLbGlobal(), SCIPvarGetName(), SCIPvarGetNLocksDown(), SCIPvarGetNLocksUp(), SCIPvarGetUbGlobal(), and TRUE.

Referenced by SCIP_DECL_CONSPRESOL().

static SCIP_RETCODE cliquePresolve ( SCIP scip,
SCIP_CONS cons,
SCIP_EVENTHDLR eventhdlr,
SCIP_Bool cutoff,
int *  nfixedvars,
int *  naggrvars,
int *  nchgcoefs,
int *  ndelconss,
int *  naddconss 
)
static
  1. check if at least two operands or one operand and the resultant are in one clique, if so, we can fix the resultant to zero and in the former case we can also delete this constraint but we need to extract the clique information as constraint

    x == AND(y, z) and clique(y,z) => x = 0, delete constraint and create y + z <= 1 x == AND(y, z) and clique(x,y) => x = 0

    special handled cases are:

    • if the resultant is a negation of an operand, in that case we fix the resultant to 0
    • if the resultant is equal to an operand, we will linearize this constraint by adding all necessary set-packing constraints like resultant + ~operand <= 1 and delete the old constraint

    x == AND(~x, y) => x = 0 x == AND(x, y) => add x + ~y <= 1 and delete the constraint

  1. check if one operand is in a clique with the negation of all other operands, this means we can aggregate this operand to the resultant

    r == AND(x,y,z) and clique(x,~y) and clique(x,~z) => r == x

  1. check if the resultant and the negations of all operands are in a clique

    r == AND(x,y) and clique(r, ~x,~y) => upgrade the constraint to a set-partitioning constraint r + ~x + ~y = 1

Note
We removed also fixed variables and propagate them, and if only one operand is remaining due to removal, we will aggregate the resultant with this operand
Parameters
scipSCIP data structure
consconstraint to process
eventhdlrevent handler to call for the event processing
cutoffpointer to store TRUE, if the node can be cut off
nfixedvarspointer to add up the number of found domain reductions
naggrvarspointer to add up the number of aggregated variables
nchgcoefspointer to add up the number of changed coefficients
ndelconsspointer to add up the number of deleted constraints
naddconsspointer to add up the number of added constraints

Definition at line 2561 of file cons_and.c.

References BMSclearMemoryArray, delCoefPos(), FALSE, NULL, SCIP_Bool, SCIP_CALL, SCIP_MAXSTRLEN, SCIP_OKAY, SCIP_VARSTATUS_FIXED, SCIPaddCons(), SCIPaggregateVars(), SCIPallocBufferArray, SCIPconsGetData(), SCIPconsGetName(), SCIPconsIsActive(), SCIPconsIsChecked(), SCIPconsIsDynamic(), SCIPconsIsEnforced(), SCIPconsIsInitial(), SCIPconsIsLocal(), SCIPconsIsModifiable(), SCIPconsIsPropagated(), SCIPconsIsRemovable(), SCIPconsIsSeparated(), SCIPconsIsStickingAtNode(), SCIPcreateConsSetpack(), SCIPcreateConsSetpart(), SCIPdebugMessage, SCIPdebugPrintCons, SCIPdelCons(), SCIPfixVar(), SCIPfreeBufferArray, SCIPgetNegatedVar(), SCIPreleaseCons(), SCIPsnprintf(), SCIPvarGetLbGlobal(), SCIPvarGetName(), SCIPvarGetNegatedVar(), SCIPvarGetProbvarBinary(), SCIPvarGetStatus(), SCIPvarGetUbGlobal(), SCIPvarsHaveCommonClique(), and TRUE.

Referenced by SCIP_DECL_CONSPRESOL().

static SCIP_DECL_HASHGETKEY ( hashGetKeyAndcons  )
static

gets the key of the given element

Definition at line 3210 of file cons_and.c.

static SCIP_DECL_HASHKEYEQ ( hashKeyEqAndcons  )
static

returns TRUE iff both keys are equal; two constraints are equal if they have the same variables

Definition at line 3218 of file cons_and.c.

References consdataSort(), FALSE, NULL, SCIP_Bool, SCIPconsGetData(), SCIPvarCompare(), and TRUE.

static SCIP_DECL_HASHKEYVAL ( hashKeyValAndcons  )
static

returns the hash value of the key

Definition at line 3264 of file cons_and.c.

References NULL, SCIPconsGetData(), and SCIPvarGetIndex().

static SCIP_RETCODE detectRedundantConstraints ( SCIP scip,
BMS_BLKMEM blkmem,
SCIP_CONS **  conss,
int  nconss,
int *  firstchange,
SCIP_Bool cutoff,
int *  naggrvars,
int *  ndelconss 
)
static

compares each constraint with all other constraints for possible redundancy and removes or changes constraint accordingly; in contrast to removeRedundantConstraints(), it uses a hash table

Parameters
scipSCIP data structure
blkmemblock memory
conssconstraint set
nconssnumber of constraints in constraint set
firstchangepointer to store first changed constraint
cutoffpointer to store TRUE, if a cutoff was found
naggrvarspointer to count number of aggregated variables
ndelconsspointer to count number of deleted constraints

Definition at line 3291 of file cons_and.c.

References consdataSort(), FALSE, HASHSIZE_ANDCONS, MAX, NULL, SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIPaggregateVars(), SCIPcalcHashtableSize(), SCIPconsGetData(), SCIPconsGetPos(), SCIPconsIsActive(), SCIPconsIsModifiable(), SCIPdelCons(), SCIPdoNotAggr(), SCIPhashtableCreate(), SCIPhashtableFree(), SCIPhashtableInsert(), SCIPhashtableRetrieve(), SCIPupdateConsFlags(), SCIPvarCompare(), and TRUE.

Referenced by SCIP_DECL_CONSPRESOL().

static SCIP_RETCODE preprocessConstraintPairs ( SCIP scip,
SCIP_CONS **  conss,
int  firstchange,
int  chkind,
SCIP_Bool cutoff,
int *  naggrvars,
int *  nbdchgs,
int *  ndelconss 
)
static

compares constraint with all prior constraints for possible redundancy or aggregation, and removes or changes constraint accordingly

Parameters
scipSCIP data structure
conssconstraint set
firstchangefirst constraint that changed since last pair preprocessing round
chkindindex of constraint to check against all prior indices upto startind
cutoffpointer to store TRUE, if a cutoff was found
naggrvarspointer to count number of aggregated variables
nbdchgspointer to count the number of performed bound changes, or NULL
ndelconsspointer to count number of deleted constraints

Definition at line 3412 of file cons_and.c.

References consdataSort(), FALSE, NULL, SCIP_Bool, SCIP_BOUNDTYPE_LOWER, SCIP_CALL, SCIP_INVALIDDATA, SCIP_OKAY, SCIPABORT, SCIPaddVarImplication(), SCIPaggregateVars(), SCIPconsGetData(), SCIPconsGetName(), SCIPconsIsActive(), SCIPconsIsModifiable(), SCIPdebugMessage, SCIPdelCons(), SCIPdoNotAggr(), SCIPerrorMessage, SCIPisStopped(), SCIPupdateConsFlags(), SCIPvarCompare(), SCIPvarGetName(), and TRUE.

Referenced by SCIP_DECL_CONSPRESOL().

static SCIP_DECL_CONSHDLRCOPY ( conshdlrCopyAnd  )
static

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

Definition at line 3741 of file cons_and.c.

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

static SCIP_DECL_CONSFREE ( consFreeAnd  )
static

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

Definition at line 3757 of file cons_and.c.

References conshdlrdataFree(), NULL, SCIP_CALL, SCIP_OKAY, SCIPconshdlrGetData(), and SCIPconshdlrSetData().

static SCIP_DECL_CONSEXITSOL ( consExitsolAnd  )
static

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

Definition at line 4057 of file cons_and.c.

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

static SCIP_DECL_CONSDELETE ( consDeleteAnd  )
static

frees specific constraint data

Definition at line 4077 of file cons_and.c.

References consdataFree(), NULL, SCIP_CALL, SCIP_OKAY, and SCIPconshdlrGetData().

static SCIP_DECL_CONSINITLP ( consInitlpAnd  )
static

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

Definition at line 4122 of file cons_and.c.

References addRelaxation(), SCIP_CALL, SCIP_OKAY, and SCIPconsIsInitial().

static SCIP_DECL_CONSSEPALP ( consSepalpAnd  )
static

separation method of constraint handler for LP solutions

Definition at line 4138 of file cons_and.c.

References NULL, SCIP_Bool, SCIP_CALL, SCIP_CUTOFF, SCIP_DIDNOTFIND, SCIP_OKAY, SCIP_SEPARATED, and separateCons().

static SCIP_DECL_CONSSEPASOL ( consSepasolAnd  )
static

separation method of constraint handler for arbitrary primal solutions

Definition at line 4165 of file cons_and.c.

References SCIP_Bool, SCIP_CALL, SCIP_CUTOFF, SCIP_DIDNOTFIND, SCIP_OKAY, SCIP_SEPARATED, and separateCons().

static SCIP_DECL_CONSENFOLP ( consEnfolpAnd  )
static

constraint enforcing method of constraint handler for LP solutions

Definition at line 4192 of file cons_and.c.

References checkCons(), FALSE, NULL, SCIP_Bool, SCIP_CALL, SCIP_CUTOFF, SCIP_FEASIBLE, SCIP_INFEASIBLE, SCIP_OKAY, SCIP_SEPARATED, SCIPconshdlrGetData(), and separateCons().

static SCIP_DECL_CONSENFOPS ( consEnfopsAnd  )
static

constraint enforcing method of constraint handler for pseudo solutions

Definition at line 4254 of file cons_and.c.

References checkCons(), FALSE, NULL, SCIP_Bool, SCIP_CALL, SCIP_FEASIBLE, SCIP_INFEASIBLE, SCIP_OKAY, and TRUE.

static SCIP_DECL_CONSCHECK ( consCheckAnd  )
static

feasibility check method of constraint handler for integral solutions

Definition at line 4277 of file cons_and.c.

References checkCons(), SCIP_Bool, SCIP_CALL, SCIP_FEASIBLE, SCIP_INFEASIBLE, and SCIP_OKAY.

static SCIP_DECL_CONSPROP ( consPropAnd  )
static

domain propagation method of constraint handler

Definition at line 4300 of file cons_and.c.

References FALSE, NULL, propagateCons(), SCIP_Bool, SCIP_CALL, SCIP_CUTOFF, SCIP_DIDNOTFIND, SCIP_OKAY, SCIP_REDUCEDDOM, and SCIPconshdlrGetData().

static SCIP_DECL_CONSRESPROP ( consRespropAnd  )
static

propagation conflict resolving method of constraint handler

Definition at line 4556 of file cons_and.c.

References resolvePropagation(), SCIP_CALL, and SCIP_OKAY.

static SCIP_DECL_CONSLOCK ( consLockAnd  )
static

variable rounding lock method of constraint handler

Definition at line 4566 of file cons_and.c.

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

static SCIP_DECL_CONSPRINT ( consPrintAnd  )
static

constraint display method of constraint handler

Definition at line 4589 of file cons_and.c.

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

static SCIP_DECL_CONSCOPY ( consCopyAnd  )
static
static SCIP_DECL_CONSPARSE ( consParseAnd  )
static
static SCIP_DECL_CONSGETVARS ( consGetVarsAnd  )
static

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

Definition at line 4769 of file cons_and.c.

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

static SCIP_DECL_CONSGETNVARS ( consGetNVarsAnd  )
static

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

Definition at line 4790 of file cons_and.c.

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

static SCIP_DECL_EVENTEXEC ( eventExecAnd  )
static

Definition at line 4811 of file cons_and.c.

References FALSE, NULL, SCIP_EVENTTYPE_UBTIGHTENED, SCIP_OKAY, and SCIPeventGetType().

SCIP_RETCODE SCIPcreateConsAnd ( SCIP scip,
SCIP_CONS **  cons,
const char *  name,
SCIP_VAR resvar,
int  nvars,
SCIP_VAR **  vars,
SCIP_Bool  initial,
SCIP_Bool  separate,
SCIP_Bool  enforce,
SCIP_Bool  check,
SCIP_Bool  propagate,
SCIP_Bool  local,
SCIP_Bool  modifiable,
SCIP_Bool  dynamic,
SCIP_Bool  removable,
SCIP_Bool  stickingatnode 
)

creates and captures a and constraint

Note
the constraint gets captured, hence at one point you have to release it using the method SCIPreleaseCons()
Parameters
scipSCIP data structure
conspointer to hold the created constraint
namename of constraint
resvarresultant variable of the operation
nvarsnumber of operator variables in the constraint
varsarray with operator variables of constraint
initialshould the LP relaxation of constraint be in the initial LP? Usually set to TRUE. Set to FALSE for 'lazy constraints'.
separateshould the constraint be separated during LP processing? Usually set to TRUE.
enforceshould the constraint be enforced during node processing? TRUE for model constraints, FALSE for additional, redundant constraints.
checkshould the constraint be checked for feasibility? TRUE for model constraints, FALSE for additional, redundant constraints.
propagateshould the constraint be propagated during node processing? Usually set to TRUE.
localis constraint only valid locally? Usually set to FALSE. Has to be set to TRUE, e.g., for branching constraints.
modifiableis constraint modifiable (subject to column generation)? Usually set to FALSE. In column generation applications, set to TRUE if pricing adds coefficients to this constraint.
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 4925 of file cons_and.c.

References ARTIFICIALVARNAMEPREFIX, consdataCreate(), CONSHDLR_NAME, FALSE, NULL, SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIP_PLUGINNOTFOUND, SCIP_VARTYPE_BINARY, SCIP_VARTYPE_IMPLINT, SCIPchgVarType(), SCIPconshdlrGetData(), SCIPcreateCons(), SCIPerrorMessage, SCIPfindConshdlr(), SCIPvarGetName(), and SCIPvarGetType().

Referenced by CREATE_CONSTRAINT(), createAndAddAndCons(), extractGates(), findAggregation(), presolveTryAddAND(), presolveTryAddLinearReform(), SCIP_DECL_CONSCOPY(), SCIP_DECL_CONSPARSE(), SCIP_DECL_EXPRGRAPHNODEREFORM(), SCIPcreateConsBasicAnd(), setObjective(), and upgradeCons().

SCIP_RETCODE SCIPcreateConsBasicAnd ( SCIP scip,
SCIP_CONS **  cons,
const char *  name,
SCIP_VAR resvar,
int  nvars,
SCIP_VAR **  vars 
)

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

See Also
SCIPcreateConsAnd() 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
resvarresultant variable of the operation
nvarsnumber of operator variables in the constraint
varsarray with operator variables of constraint

Definition at line 5007 of file cons_and.c.

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

SCIP_Bool SCIPisAndConsSorted ( SCIP scip,
SCIP_CONS cons 
)

return if the variables of the and-constraint are sorted due to their indices

Parameters
scipSCIP data structure
consconstraint data

Definition at line 5098 of file cons_and.c.

References CONSHDLR_NAME, FALSE, NULL, SCIPABORT, SCIPconsGetData(), SCIPconsGetHdlr(), SCIPconshdlrGetName(), and SCIPerrorMessage.

Referenced by computeConsAndDataChanges().

SCIP_RETCODE SCIPsortAndCons ( SCIP scip,
SCIP_CONS cons 
)

sort the variables of the and-constraint due to their indices

Parameters
scipSCIP data structure
consconstraint data

Definition at line 5122 of file cons_and.c.

References consdataSort(), CONSHDLR_NAME, NULL, SCIP_INVALIDDATA, SCIP_OKAY, SCIPABORT, SCIPconsGetData(), SCIPconsGetHdlr(), SCIPconshdlrGetName(), and SCIPerrorMessage.

Referenced by computeConsAndDataChanges().

SCIP_RETCODE SCIPchgAndConsCheckFlagWhenUpgr ( SCIP scip,
SCIP_CONS cons,
SCIP_Bool  flag 
)

when 'upgrading' the given and-constraint, should the check flag for the upgraded constraint be set to TRUE, even if the check flag of this and-constraint is set to FALSE?

Parameters
scipSCIP data structure
consconstraint data
flagshould an arising constraint from the given and-constraint be checked, even if the check flag of the and-constraint is set to FALSE

Definition at line 5151 of file cons_and.c.

References CONSHDLR_NAME, NULL, SCIP_INVALIDDATA, SCIP_OKAY, SCIPABORT, SCIPconsGetData(), SCIPconsGetHdlr(), SCIPconshdlrGetName(), and SCIPerrorMessage.

Referenced by createAndAddAndCons().

SCIP_RETCODE SCIPchgAndConsRemovableFlagWhenUpgr ( SCIP scip,
SCIP_CONS cons,
SCIP_Bool  flag 
)

when 'upgrading' the given and-constraint, should the removable flag for the upgraded constraint be set to FALSE, even if the removable flag of this and-constraint is set to TRUE?

Parameters
scipSCIP data structure
consconstraint data
flagshould an arising constraint from the given and-constraint be not removable, even if the removable flag of the and-constraint is set to TRUE

Definition at line 5182 of file cons_and.c.

References CONSHDLR_NAME, NULL, SCIP_INVALIDDATA, SCIP_OKAY, SCIPABORT, SCIPconsGetData(), SCIPconsGetHdlr(), SCIPconshdlrGetName(), and SCIPerrorMessage.

Referenced by createAndAddAndCons().