Scippy

SCIP

Solving Constraint Integer Programs

cons_xor.h
Go to the documentation of this file.
1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2 /* */
3 /* This file is part of the program and library */
4 /* SCIP --- Solving Constraint Integer Programs */
5 /* */
6 /* Copyright (C) 2002-2017 Konrad-Zuse-Zentrum */
7 /* fuer Informationstechnik Berlin */
8 /* */
9 /* SCIP is distributed under the terms of the ZIB Academic License. */
10 /* */
11 /* You should have received a copy of the ZIB Academic License */
12 /* along with SCIP; see the file COPYING. If not email to scip@zib.de. */
13 /* */
14 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
15 
16 /**@file cons_xor.h
17  * @ingroup CONSHDLRS
18  * @brief Constraint handler for XOR constraints, \f$rhs = x_1 \oplus x_2 \oplus \dots \oplus x_n\f$
19  * @author Tobias Achterberg
20  * @author Stefan Heinz
21  * @author Michael Winkler
22  *
23  */
24 
25 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
26 
27 #ifndef __SCIP_CONS_XOR_H__
28 #define __SCIP_CONS_XOR_H__
29 
30 
31 #include "scip/scip.h"
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
37 /** creates the handler for xor constraints and includes it in SCIP
38  *
39  * @ingroup ConshdlrIncludes
40  * */
41 extern
43  SCIP* scip /**< SCIP data structure */
44  );
45 
46 /**@addtogroup CONSHDLRS
47  *
48  * @{
49  *
50  * @name XOR Constraints
51  *
52  * @{
53  *
54  * This constraint handler deals with "xor" constraint. These are constraint of the form:
55  *
56  * \f[
57  * rhs = x_1 \oplus x_2 \oplus \dots \oplus x_n
58  * \f]
59  *
60  * where \f$x_i\f$ is a binary variable for all \f$i\f$ and \f$rhs\f$ is bool. The variables \f$x\f$'s are called
61  * operators. This constraint is satisfied if \f$rhs\f$ is TRUE and an odd number of the operators are TRUE or if the
62  * \f$rhs\f$ is FALSE and a even number of operators are TRUE. Hence, if the sum of \f$rhs\f$ and operators is even.
63  */
64 
65 /** creates and captures an xor constraint
66  *
67  * @note the constraint gets captured, hence at one point you have to release it using the method SCIPreleaseCons()
68  */
69 extern
71  SCIP* scip, /**< SCIP data structure */
72  SCIP_CONS** cons, /**< pointer to hold the created constraint */
73  const char* name, /**< name of constraint */
74  SCIP_Bool rhs, /**< right hand side of the constraint */
75  int nvars, /**< number of operator variables in the constraint */
76  SCIP_VAR** vars, /**< array with operator variables of constraint */
77  SCIP_Bool initial, /**< should the LP relaxation of constraint be in the initial LP?
78  * Usually set to TRUE. Set to FALSE for 'lazy constraints'. */
79  SCIP_Bool separate, /**< should the constraint be separated during LP processing?
80  * Usually set to TRUE. */
81  SCIP_Bool enforce, /**< should the constraint be enforced during node processing?
82  * TRUE for model constraints, FALSE for additional, redundant constraints. */
83  SCIP_Bool check, /**< should the constraint be checked for feasibility?
84  * TRUE for model constraints, FALSE for additional, redundant constraints. */
85  SCIP_Bool propagate, /**< should the constraint be propagated during node processing?
86  * Usually set to TRUE. */
87  SCIP_Bool local, /**< is constraint only valid locally?
88  * Usually set to FALSE. Has to be set to TRUE, e.g., for branching constraints. */
89  SCIP_Bool modifiable, /**< is constraint modifiable (subject to column generation)?
90  * Usually set to FALSE. In column generation applications, set to TRUE if pricing
91  * adds coefficients to this constraint. */
92  SCIP_Bool dynamic, /**< is constraint subject to aging?
93  * Usually set to FALSE. Set to TRUE for own cuts which
94  * are separated as constraints. */
95  SCIP_Bool removable, /**< should the relaxation be removed from the LP due to aging or cleanup?
96  * Usually set to FALSE. Set to TRUE for 'lazy constraints' and 'user cuts'. */
97  SCIP_Bool stickingatnode /**< should the constraint always be kept at the node where it was added, even
98  * if it may be moved to a more global node?
99  * Usually set to FALSE. Set to TRUE to for constraints that represent node data. */
100  );
101 
102 /** creates and captures an xor constraint
103  * in its most basic version, i. e., all constraint flags are set to their basic value as explained for the
104  * method SCIPcreateConsXor(); all flags can be set via SCIPsetConsFLAGNAME-methods in scip.h
105  *
106  * @see SCIPcreateConsXor() for information about the basic constraint flag configuration
107  *
108  * @note the constraint gets captured, hence at one point you have to release it using the method SCIPreleaseCons()
109  */
110 extern
112  SCIP* scip, /**< SCIP data structure */
113  SCIP_CONS** cons, /**< pointer to hold the created constraint */
114  const char* name, /**< name of constraint */
115  SCIP_Bool rhs, /**< right hand side of the constraint */
116  int nvars, /**< number of operator variables in the constraint */
117  SCIP_VAR** vars /**< array with operator variables of constraint */
118  );
119 
120 /** gets number of variables in xor constraint */
121 extern
122 int SCIPgetNVarsXor(
123  SCIP* scip, /**< SCIP data structure */
124  SCIP_CONS* cons /**< constraint data */
125  );
126 
127 /** gets array of variables in xor constraint */
128 extern
130  SCIP* scip, /**< SCIP data structure */
131  SCIP_CONS* cons /**< constraint data */
132  );
133 
134 /** gets integer variable in xor constraint */
135 extern
137  SCIP* scip, /**< SCIP data structure */
138  SCIP_CONS* cons /**< constraint data */
139  );
140 
141 /** gets the right hand side of the xor constraint */
142 extern
144  SCIP* scip, /**< SCIP data structure */
145  SCIP_CONS* cons /**< constraint data */
146  );
147 
148 /* @} */
149 
150 /* @} */
151 
152 #ifdef __cplusplus
153 }
154 #endif
155 
156 #endif
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:53
SCIP_RETCODE SCIPincludeConshdlrXor(SCIP *scip)
Definition: cons_xor.c:5543
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)
Definition: cons_xor.c:5630
SCIP_RETCODE SCIPcreateConsBasicXor(SCIP *scip, SCIP_CONS **cons, const char *name, SCIP_Bool rhs, int nvars, SCIP_VAR **vars)
Definition: cons_xor.c:5688
#define SCIP_Bool
Definition: def.h:61
SCIP_Bool SCIPgetRhsXor(SCIP *scip, SCIP_CONS *cons)
Definition: cons_xor.c:5767
SCIP_VAR ** SCIPgetVarsXor(SCIP *scip, SCIP_CONS *cons)
Definition: cons_xor.c:5725
int SCIPgetNVarsXor(SCIP *scip, SCIP_CONS *cons)
Definition: cons_xor.c:5704
SCIP_VAR * SCIPgetIntVarXor(SCIP *scip, SCIP_CONS *cons)
Definition: cons_xor.c:5746
SCIP callable library.