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-2024 Zuse Institute Berlin (ZIB) */
7/* */
8/* Licensed under the Apache License, Version 2.0 (the "License"); */
9/* you may not use this file except in compliance with the License. */
10/* You may obtain a copy of the License at */
11/* */
12/* http://www.apache.org/licenses/LICENSE-2.0 */
13/* */
14/* Unless required by applicable law or agreed to in writing, software */
15/* distributed under the License is distributed on an "AS IS" BASIS, */
16/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
17/* See the License for the specific language governing permissions and */
18/* limitations under the License. */
19/* */
20/* You should have received a copy of the Apache-2.0 license */
21/* along with SCIP; see the file LICENSE. If not visit scipopt.org. */
22/* */
23/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
24
25/**@file cons_xor.h
26 * @ingroup CONSHDLRS
27 * @brief Constraint handler for XOR constraints, \f$rhs = x_1 \oplus x_2 \oplus \dots \oplus x_n\f$
28 * @author Tobias Achterberg
29 * @author Stefan Heinz
30 * @author Michael Winkler
31 *
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/def.h"
41#include "scip/type_cons.h"
42#include "scip/type_retcode.h"
43#include "scip/type_scip.h"
44#include "scip/type_var.h"
45
46#ifdef __cplusplus
47extern "C" {
48#endif
49
50/** creates the handler for xor constraints and includes it in SCIP
51 *
52 * @ingroup ConshdlrIncludes
53 * */
54SCIP_EXPORT
56 SCIP* scip /**< SCIP data structure */
57 );
58
59/**@addtogroup CONSHDLRS
60 *
61 * @{
62 *
63 * @name XOR Constraints
64 *
65 * @{
66 *
67 * This constraint handler deals with "xor" constraint. These are constraint of the form:
68 *
69 * \f[
70 * rhs = x_1 \oplus x_2 \oplus \dots \oplus x_n
71 * \f]
72 *
73 * 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
74 * operators. This constraint is satisfied if \f$rhs\f$ is TRUE and an odd number of the operators are TRUE or if the
75 * \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.
76 */
77
78/** creates and captures an xor constraint
79 *
80 * @note the constraint gets captured, hence at one point you have to release it using the method SCIPreleaseCons()
81 */
82SCIP_EXPORT
84 SCIP* scip, /**< SCIP data structure */
85 SCIP_CONS** cons, /**< pointer to hold the created constraint */
86 const char* name, /**< name of constraint */
87 SCIP_Bool rhs, /**< right hand side of the constraint */
88 int nvars, /**< number of operator variables in the constraint */
89 SCIP_VAR** vars, /**< array with operator variables of constraint */
90 SCIP_Bool initial, /**< should the LP relaxation of constraint be in the initial LP?
91 * Usually set to TRUE. Set to FALSE for 'lazy constraints'. */
92 SCIP_Bool separate, /**< should the constraint be separated during LP processing?
93 * Usually set to TRUE. */
94 SCIP_Bool enforce, /**< should the constraint be enforced during node processing?
95 * TRUE for model constraints, FALSE for additional, redundant constraints. */
96 SCIP_Bool check, /**< should the constraint be checked for feasibility?
97 * TRUE for model constraints, FALSE for additional, redundant constraints. */
98 SCIP_Bool propagate, /**< should the constraint be propagated during node processing?
99 * Usually set to TRUE. */
100 SCIP_Bool local, /**< is constraint only valid locally?
101 * Usually set to FALSE. Has to be set to TRUE, e.g., for branching constraints. */
102 SCIP_Bool modifiable, /**< is constraint modifiable (subject to column generation)?
103 * Usually set to FALSE. In column generation applications, set to TRUE if pricing
104 * adds coefficients to this constraint. */
105 SCIP_Bool dynamic, /**< is constraint subject to aging?
106 * Usually set to FALSE. Set to TRUE for own cuts which
107 * are separated as constraints. */
108 SCIP_Bool removable, /**< should the relaxation be removed from the LP due to aging or cleanup?
109 * Usually set to FALSE. Set to TRUE for 'lazy constraints' and 'user cuts'. */
110 SCIP_Bool stickingatnode /**< should the constraint always be kept at the node where it was added, even
111 * if it may be moved to a more global node?
112 * Usually set to FALSE. Set to TRUE to for constraints that represent node data. */
113 );
114
115/** creates and captures an xor constraint
116 * in its most basic version, i. e., all constraint flags are set to their basic value as explained for the
117 * method SCIPcreateConsXor(); all flags can be set via SCIPsetConsFLAGNAME-methods in scip.h
118 *
119 * @see SCIPcreateConsXor() for information about the basic constraint flag configuration
120 *
121 * @note the constraint gets captured, hence at one point you have to release it using the method SCIPreleaseCons()
122 */
123SCIP_EXPORT
125 SCIP* scip, /**< SCIP data structure */
126 SCIP_CONS** cons, /**< pointer to hold the created constraint */
127 const char* name, /**< name of constraint */
128 SCIP_Bool rhs, /**< right hand side of the constraint */
129 int nvars, /**< number of operator variables in the constraint */
130 SCIP_VAR** vars /**< array with operator variables of constraint */
131 );
132
133/** gets number of variables in xor constraint */
134SCIP_EXPORT
136 SCIP* scip, /**< SCIP data structure */
137 SCIP_CONS* cons /**< constraint data */
138 );
139
140/** gets array of variables in xor constraint */
141SCIP_EXPORT
143 SCIP* scip, /**< SCIP data structure */
144 SCIP_CONS* cons /**< constraint data */
145 );
146
147/** gets integer variable in xor constraint */
148SCIP_EXPORT
150 SCIP* scip, /**< SCIP data structure */
151 SCIP_CONS* cons /**< constraint data */
152 );
153
154/** gets the right hand side of the xor constraint */
155SCIP_EXPORT
157 SCIP* scip, /**< SCIP data structure */
158 SCIP_CONS* cons /**< constraint data */
159 );
160
161/** @} */
162
163/** @} */
164
165#ifdef __cplusplus
166}
167#endif
168
169#endif
common defines and data types used in all packages of SCIP
#define SCIP_Bool
Definition: def.h:91
int SCIPgetNVarsXor(SCIP *scip, SCIP_CONS *cons)
Definition: cons_xor.c:6019
SCIP_RETCODE SCIPcreateConsBasicXor(SCIP *scip, SCIP_CONS **cons, const char *name, SCIP_Bool rhs, int nvars, SCIP_VAR **vars)
Definition: cons_xor.c:6003
SCIP_VAR * SCIPgetIntVarXor(SCIP *scip, SCIP_CONS *cons)
Definition: cons_xor.c:6065
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:5945
SCIP_Bool SCIPgetRhsXor(SCIP *scip, SCIP_CONS *cons)
Definition: cons_xor.c:6088
SCIP_VAR ** SCIPgetVarsXor(SCIP *scip, SCIP_CONS *cons)
Definition: cons_xor.c:6042
SCIP_RETCODE SCIPincludeConshdlrXor(SCIP *scip)
Definition: cons_xor.c:5856
type definitions for constraints and constraint handlers
type definitions for return codes for SCIP methods
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:63
type definitions for SCIP's main datastructure
type definitions for problem variables