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-2014 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  * This constraint handler deals with "xor" constraint. These are constraint of the form:
24  *
25  * \f[
26  * rhs = x_1 \oplus x_2 \oplus \dots \oplus x_n
27  * \f]
28  *
29  * 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
30  * operators. This constraint is satisfied if \f$rhs\f$ is TRUE and an odd number of the operators are TRUE or if the
31  * \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.
32  */
33 
34 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
35 
36 #ifndef __SCIP_CONS_XOR_H__
37 #define __SCIP_CONS_XOR_H__
38 
39 
40 #include "scip/scip.h"
41 
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45 
46 /** creates the handler for xor constraints and includes it in SCIP */
47 extern
49  SCIP* scip /**< SCIP data structure */
50  );
51 
52 /** creates and captures an xor constraint
53  *
54  * @note the constraint gets captured, hence at one point you have to release it using the method SCIPreleaseCons()
55 */
56 extern
58  SCIP* scip, /**< SCIP data structure */
59  SCIP_CONS** cons, /**< pointer to hold the created constraint */
60  const char* name, /**< name of constraint */
61  SCIP_Bool rhs, /**< right hand side of the constraint */
62  int nvars, /**< number of operator variables in the constraint */
63  SCIP_VAR** vars, /**< array with operator variables of constraint */
64  SCIP_Bool initial, /**< should the LP relaxation of constraint be in the initial LP?
65  * Usually set to TRUE. Set to FALSE for 'lazy constraints'. */
66  SCIP_Bool separate, /**< should the constraint be separated during LP processing?
67  * Usually set to TRUE. */
68  SCIP_Bool enforce, /**< should the constraint be enforced during node processing?
69  * TRUE for model constraints, FALSE for additional, redundant constraints. */
70  SCIP_Bool check, /**< should the constraint be checked for feasibility?
71  * TRUE for model constraints, FALSE for additional, redundant constraints. */
72  SCIP_Bool propagate, /**< should the constraint be propagated during node processing?
73  * Usually set to TRUE. */
74  SCIP_Bool local, /**< is constraint only valid locally?
75  * Usually set to FALSE. Has to be set to TRUE, e.g., for branching constraints. */
76  SCIP_Bool modifiable, /**< is constraint modifiable (subject to column generation)?
77  * Usually set to FALSE. In column generation applications, set to TRUE if pricing
78  * adds coefficients to this constraint. */
79  SCIP_Bool dynamic, /**< is constraint subject to aging?
80  * Usually set to FALSE. Set to TRUE for own cuts which
81  * are separated as constraints. */
82  SCIP_Bool removable, /**< should the relaxation be removed from the LP due to aging or cleanup?
83  * Usually set to FALSE. Set to TRUE for 'lazy constraints' and 'user cuts'. */
84  SCIP_Bool stickingatnode /**< should the constraint always be kept at the node where it was added, even
85  * if it may be moved to a more global node?
86  * Usually set to FALSE. Set to TRUE to for constraints that represent node data. */
87  );
88 
89 /** creates and captures an xor constraint
90  * in its most basic version, i. e., all constraint flags are set to their basic value as explained for the
91  * method SCIPcreateConsXor(); all flags can be set via SCIPsetConsFLAGNAME-methods in scip.h
92  *
93  * @see SCIPcreateConsXor() for information about the basic constraint flag configuration
94  *
95  * @note the constraint gets captured, hence at one point you have to release it using the method SCIPreleaseCons()
96  */
97 extern
99  SCIP* scip, /**< SCIP data structure */
100  SCIP_CONS** cons, /**< pointer to hold the created constraint */
101  const char* name, /**< name of constraint */
102  SCIP_Bool rhs, /**< right hand side of the constraint */
103  int nvars, /**< number of operator variables in the constraint */
104  SCIP_VAR** vars /**< array with operator variables of constraint */
105  );
106 
107 /** gets number of variables in xor constraint */
108 extern
109 int SCIPgetNVarsXor(
110  SCIP* scip, /**< SCIP data structure */
111  SCIP_CONS* cons /**< constraint data */
112  );
113 
114 /** gets array of variables in xor constraint */
115 extern
117  SCIP* scip, /**< SCIP data structure */
118  SCIP_CONS* cons /**< constraint data */
119  );
120 
121 /** gets the right hand side of the xor constraint */
122 extern
124  SCIP* scip, /**< SCIP data structure */
125  SCIP_CONS* cons /**< constraint data */
126  );
127 
128 #ifdef __cplusplus
129 }
130 #endif
131 
132 #endif
133