Scippy

SCIP

Solving Constraint Integer Programs

cons_and.h 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.h.

#include "scip/scip.h"

Go to the source code of this file.

Functions

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)
 

Function Documentation

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 an and constraint

Note
the constraint gets captured, hence at one point you have to release it using the method SCIPreleaseCons()

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 4922 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(), SCIPcreateConsBasicAnd(), SCIPerrorMessage, SCIPfindConshdlr(), SCIPisTransformed(), SCIPvarGetName(), SCIPvarGetProbvar(), and SCIPvarGetType().

Referenced by CREATE_CONSTRAINT(), createAndAddAndCons(), extractGates(), findAggregation(), presolveTryAddAND(), presolveTryAddLinearReform(), SCIP_DECL_CONSCOPY(), SCIP_DECL_CONSPARSE(), SCIP_DECL_EXPRGRAPHNODEREFORM(), SCIPcreateConsBasicAnd(), SCIPincludeConshdlrAnd(), 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()

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

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

Referenced by SCIPcreateConsAnd().

SCIP_Bool SCIPisAndConsSorted ( SCIP scip,
SCIP_CONS cons 
)

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

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

Parameters
scipSCIP data structure
consconstraint data

Definition at line 5123 of file cons_and.c.

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

Referenced by computeConsAndDataChanges(), and SCIPgetResultantAnd().

SCIP_RETCODE SCIPsortAndCons ( SCIP scip,
SCIP_CONS cons 
)

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

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

Parameters
scipSCIP data structure
consconstraint data

Definition at line 5147 of file cons_and.c.

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

Referenced by computeConsAndDataChanges(), and SCIPisAndConsSorted().

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?

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

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

Referenced by createAndAddAndCons(), and SCIPsortAndCons().

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?

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

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

Referenced by createAndAddAndCons(), and SCIPchgAndConsCheckFlagWhenUpgr().