Scippy

SCIP

Solving Constraint Integer Programs

cons_and.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_and.h
26 * @ingroup CONSHDLRS
27 * @brief Constraint handler for AND constraints, \f$r = x_1 \wedge x_2 \wedge \dots \wedge 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_AND_H__
37#define __SCIP_CONS_AND_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 and 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 AND Constraints
64 *
65 * @{
66 *
67 * This constraint handler deals with AND-constraints. These are constraint of the form:
68 *
69 * \f[
70 * r = x_1 \wedge x_2 \wedge \dots \wedge x_n
71 * \f]
72 *
73 * where \f$x_i\f$ is a binary variable for all \f$i\f$. Hence, \f$r\f$ is also of binary type. The variable \f$r\f$ is
74 * called resultant and the \f$x\f$'s operators.
75 */
76
77/** creates and captures an and constraint
78 *
79 * @note the constraint gets captured, hence at one point you have to release it using the method SCIPreleaseCons()
80 */
81SCIP_EXPORT
83 SCIP* scip, /**< SCIP data structure */
84 SCIP_CONS** cons, /**< pointer to hold the created constraint */
85 const char* name, /**< name of constraint */
86 SCIP_VAR* resvar, /**< resultant variable of the operation */
87 int nvars, /**< number of operator variables in the constraint */
88 SCIP_VAR** vars, /**< array with operator variables of constraint */
89 SCIP_Bool initial, /**< should the LP relaxation of constraint be in the initial LP?
90 * Usually set to TRUE. Set to FALSE for 'lazy constraints'. */
91 SCIP_Bool separate, /**< should the constraint be separated during LP processing?
92 * Usually set to TRUE. */
93 SCIP_Bool enforce, /**< should the constraint be enforced during node processing?
94 * TRUE for model constraints, FALSE for additional, redundant constraints. */
95 SCIP_Bool check, /**< should the constraint be checked for feasibility?
96 * TRUE for model constraints, FALSE for additional, redundant constraints. */
97 SCIP_Bool propagate, /**< should the constraint be propagated during node processing?
98 * Usually set to TRUE. */
99 SCIP_Bool local, /**< is constraint only valid locally?
100 * Usually set to FALSE. Has to be set to TRUE, e.g., for branching constraints. */
101 SCIP_Bool modifiable, /**< is constraint modifiable (subject to column generation)?
102 * Usually set to FALSE. In column generation applications, set to TRUE if pricing
103 * adds coefficients to this constraint. */
104 SCIP_Bool dynamic, /**< is constraint subject to aging?
105 * Usually set to FALSE. Set to TRUE for own cuts which
106 * are separated as constraints. */
107 SCIP_Bool removable, /**< should the relaxation be removed from the LP due to aging or cleanup?
108 * Usually set to FALSE. Set to TRUE for 'lazy constraints' and 'user cuts'. */
109 SCIP_Bool stickingatnode /**< should the constraint always be kept at the node where it was added, even
110 * if it may be moved to a more global node?
111 * Usually set to FALSE. Set to TRUE to for constraints that represent node data. */
112 );
113
114/** creates and captures an and constraint
115 * in its most basic version, i. e., all constraint flags are set to their basic value as explained for the
116 * method SCIPcreateConsAnd(); all flags can be set via SCIPsetConsFLAGNAME-methods in scip.h
117 *
118 * @see SCIPcreateConsAnd() for information about the basic constraint flag configuration
119 *
120 * @note the constraint gets captured, hence at one point you have to release it using the method SCIPreleaseCons()
121 */
122SCIP_EXPORT
124 SCIP* scip, /**< SCIP data structure */
125 SCIP_CONS** cons, /**< pointer to hold the created constraint */
126 const char* name, /**< name of constraint */
127 SCIP_VAR* resvar, /**< resultant variable of the operation */
128 int nvars, /**< number of operator variables in the constraint */
129 SCIP_VAR** vars /**< array with operator variables of constraint */
130 );
131
132/** gets number of variables in and constraint */
133SCIP_EXPORT
135 SCIP* scip, /**< SCIP data structure */
136 SCIP_CONS* cons /**< constraint data */
137 );
138
139/** gets array of variables in and constraint */
140SCIP_EXPORT
142 SCIP* scip, /**< SCIP data structure */
143 SCIP_CONS* cons /**< constraint data */
144 );
145
146/** gets the resultant variable in and constraint */
147SCIP_EXPORT
149 SCIP* scip, /**< SCIP data structure */
150 SCIP_CONS* cons /**< constraint data */
151 );
152
153/** return if the variables of the AND-constraint are sorted with respect to their indices */
154SCIP_EXPORT
156 SCIP* scip, /**< SCIP data structure */
157 SCIP_CONS* cons /**< constraint data */
158 );
159
160/** sort the variables of the AND-constraint with respect to their indices */
161SCIP_EXPORT
163 SCIP* scip, /**< SCIP data structure */
164 SCIP_CONS* cons /**< constraint data */
165 );
166
167/** when 'upgrading' the given AND-constraint, should the check flag for the upgraded constraint be set to TRUE, even if
168 * the check flag of this AND-constraint is set to FALSE?
169 */
170SCIP_EXPORT
172 SCIP* scip, /**< SCIP data structure */
173 SCIP_CONS* cons, /**< constraint data */
174 SCIP_Bool flag /**< should an arising constraint from the given AND-constraint be checked,
175 * even if the check flag of the AND-constraint is set to FALSE
176 */
177 );
178
179/** when 'upgrading' the given AND-constraint, should the removable flag for the upgraded constraint be set to FALSE,
180 * even if the removable flag of this AND-constraint is set to TRUE?
181 */
182SCIP_EXPORT
184 SCIP* scip, /**< SCIP data structure */
185 SCIP_CONS* cons, /**< constraint data */
186 SCIP_Bool flag /**< should an arising constraint from the given AND-constraint be not
187 * removable, even if the removable flag of the AND-constraint is set to
188 * TRUE
189 */
190 );
191
192/** @} */
193
194/** @} */
195
196#ifdef __cplusplus
197}
198#endif
199
200#endif
common defines and data types used in all packages of SCIP
#define SCIP_Bool
Definition: def.h:91
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)
Definition: cons_and.c:5070
SCIP_RETCODE SCIPchgAndConsCheckFlagWhenUpgr(SCIP *scip, SCIP_CONS *cons, SCIP_Bool flag)
Definition: cons_and.c:5324
SCIP_VAR * SCIPgetResultantAnd(SCIP *scip, SCIP_CONS *cons)
Definition: cons_and.c:5248
int SCIPgetNVarsAnd(SCIP *scip, SCIP_CONS *cons)
Definition: cons_and.c:5199
SCIP_RETCODE SCIPchgAndConsRemovableFlagWhenUpgr(SCIP *scip, SCIP_CONS *cons, SCIP_Bool flag)
Definition: cons_and.c:5355
SCIP_RETCODE SCIPsortAndCons(SCIP *scip, SCIP_CONS *cons)
Definition: cons_and.c:5295
SCIP_Bool SCIPisAndConsSorted(SCIP *scip, SCIP_CONS *cons)
Definition: cons_and.c:5271
SCIP_VAR ** SCIPgetVarsAnd(SCIP *scip, SCIP_CONS *cons)
Definition: cons_and.c:5223
SCIP_RETCODE SCIPcreateConsBasicAnd(SCIP *scip, SCIP_CONS **cons, const char *name, SCIP_VAR *resvar, int nvars, SCIP_VAR **vars)
Definition: cons_and.c:5180
SCIP_RETCODE SCIPincludeConshdlrAnd(SCIP *scip)
Definition: cons_and.c:4982
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