Scippy

SCIP

Solving Constraint Integer Programs

cons_xor.h File Reference

Detailed Description

Constraint handler for "xor" constraints, $rhs = x_1 \oplus x_2 \oplus \dots \oplus x_n$.

Author
Tobias Achterberg
Stefan Heinz
Michael Winkler

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

\[ rhs = x_1 \oplus x_2 \oplus \dots \oplus x_n \]

where $x_i$ is a binary variable for all $i$ and $rhs$ is bool. The variables $x$'s are called operators. This constraint is satisfied if $rhs$ is TRUE and an odd number of the operators are TRUE or if the $rhs$ is FALSE and a even number of operators are TRUE. Hence, if the sum of $rhs$ and operators is even.

Definition in file cons_xor.h.

#include "scip/scip.h"

Go to the source code of this file.

Functions

SCIP_RETCODE SCIPincludeConshdlrXor (SCIP *scip)
 
SCIP_RETCODE SCIPcreateConsXor (SCIP *scip, SCIP_CONS **cons, const char *name, SCIP_Bool rhs, 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 SCIPcreateConsBasicXor (SCIP *scip, SCIP_CONS **cons, const char *name, SCIP_Bool rhs, int nvars, SCIP_VAR **vars)
 
int SCIPgetNVarsXor (SCIP *scip, SCIP_CONS *cons)
 
SCIP_VAR ** SCIPgetVarsXor (SCIP *scip, SCIP_CONS *cons)
 
SCIP_Bool SCIPgetRhsXor (SCIP *scip, SCIP_CONS *cons)
 

Function Documentation

SCIP_RETCODE SCIPcreateConsXor ( SCIP scip,
SCIP_CONS **  cons,
const char *  name,
SCIP_Bool  rhs,
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 xor constraint

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

creates and captures a xor constraint x_0 xor ... xor x_{k-1} = rhs

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
rhsright hand side of the constraint
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 5424 of file cons_xor.c.

References consdataCreate(), CONSHDLR_NAME, NULL, SCIP_CALL, SCIP_OKAY, SCIP_PLUGINNOTFOUND, SCIPcreateCons(), SCIPcreateConsBasicXor(), SCIPerrorMessage, and SCIPfindConshdlr().

Referenced by CREATE_CONSTRAINT(), SCIP_DECL_CONSPARSE(), SCIPcreateConsBasicXor(), SCIPincludeConshdlrXor(), and tryUpgradingXor().

SCIP_RETCODE SCIPcreateConsBasicXor ( SCIP scip,
SCIP_CONS **  cons,
const char *  name,
SCIP_Bool  rhs,
int  nvars,
SCIP_VAR **  vars 
)

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

See also
SCIPcreateConsXor() 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 a xor constraint x_0 xor ... xor x_{k-1} = rhs with all constraint flags set to their default values

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
rhsright hand side of the constraint
nvarsnumber of operator variables in the constraint
varsarray with operator variables of constraint

Definition at line 5482 of file cons_xor.c.

References FALSE, SCIP_CALL, SCIP_OKAY, SCIPcreateConsXor(), SCIPgetNVarsXor(), and TRUE.

Referenced by createMIP(), and SCIPcreateConsXor().

int SCIPgetNVarsXor ( SCIP scip,
SCIP_CONS cons 
)

gets number of variables in xor constraint

Parameters
scipSCIP data structure
consconstraint data

Definition at line 5498 of file cons_xor.c.

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

Referenced by SCIPcreateConsBasicXor().

SCIP_VAR** SCIPgetVarsXor ( SCIP scip,
SCIP_CONS cons 
)

gets array of variables in xor constraint

Parameters
scipSCIP data structure
consconstraint data

Definition at line 5519 of file cons_xor.c.

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

Referenced by SCIPgetNVarsXor().

SCIP_Bool SCIPgetRhsXor ( SCIP scip,
SCIP_CONS cons 
)

gets the right hand side of the xor constraint

Parameters
scipSCIP data structure
consconstraint data

Definition at line 5540 of file cons_xor.c.

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

Referenced by SCIP_DECL_CONSCOPY(), and SCIPgetVarsXor().