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-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_and.h
17  * @ingroup CONSHDLRS
18  * @brief Constraint handler for AND constraints, \f$r = x_1 \wedge x_2 \wedge \dots \wedge 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_AND_H__
28 #define __SCIP_CONS_AND_H__
29 
30 
31 #include "scip/scip.h"
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
37 /** creates the handler for and 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 AND Constraints
51  *
52  * @{
53  *
54  * This constraint handler deals with AND-constraints. These are constraint of the form:
55  *
56  * \f[
57  * r = x_1 \wedge x_2 \wedge \dots \wedge x_n
58  * \f]
59  *
60  * 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
61  * called resultant and the \f$x\f$'s operators.
62  */
63 
64 /** creates and captures an and constraint
65  *
66  * @note the constraint gets captured, hence at one point you have to release it using the method SCIPreleaseCons()
67  */
68 extern
70  SCIP* scip, /**< SCIP data structure */
71  SCIP_CONS** cons, /**< pointer to hold the created constraint */
72  const char* name, /**< name of constraint */
73  SCIP_VAR* resvar, /**< resultant variable of the operation */
74  int nvars, /**< number of operator variables in the constraint */
75  SCIP_VAR** vars, /**< array with operator variables of constraint */
76  SCIP_Bool initial, /**< should the LP relaxation of constraint be in the initial LP?
77  * Usually set to TRUE. Set to FALSE for 'lazy constraints'. */
78  SCIP_Bool separate, /**< should the constraint be separated during LP processing?
79  * Usually set to TRUE. */
80  SCIP_Bool enforce, /**< should the constraint be enforced during node processing?
81  * TRUE for model constraints, FALSE for additional, redundant constraints. */
82  SCIP_Bool check, /**< should the constraint be checked for feasibility?
83  * TRUE for model constraints, FALSE for additional, redundant constraints. */
84  SCIP_Bool propagate, /**< should the constraint be propagated during node processing?
85  * Usually set to TRUE. */
86  SCIP_Bool local, /**< is constraint only valid locally?
87  * Usually set to FALSE. Has to be set to TRUE, e.g., for branching constraints. */
88  SCIP_Bool modifiable, /**< is constraint modifiable (subject to column generation)?
89  * Usually set to FALSE. In column generation applications, set to TRUE if pricing
90  * adds coefficients to this constraint. */
91  SCIP_Bool dynamic, /**< is constraint subject to aging?
92  * Usually set to FALSE. Set to TRUE for own cuts which
93  * are separated as constraints. */
94  SCIP_Bool removable, /**< should the relaxation be removed from the LP due to aging or cleanup?
95  * Usually set to FALSE. Set to TRUE for 'lazy constraints' and 'user cuts'. */
96  SCIP_Bool stickingatnode /**< should the constraint always be kept at the node where it was added, even
97  * if it may be moved to a more global node?
98  * Usually set to FALSE. Set to TRUE to for constraints that represent node data. */
99  );
100 
101 /** creates and captures an and constraint
102  * in its most basic version, i. e., all constraint flags are set to their basic value as explained for the
103  * method SCIPcreateConsAnd(); all flags can be set via SCIPsetConsFLAGNAME-methods in scip.h
104  *
105  * @see SCIPcreateConsAnd() for information about the basic constraint flag configuration
106  *
107  * @note the constraint gets captured, hence at one point you have to release it using the method SCIPreleaseCons()
108  */
109 extern
111  SCIP* scip, /**< SCIP data structure */
112  SCIP_CONS** cons, /**< pointer to hold the created constraint */
113  const char* name, /**< name of constraint */
114  SCIP_VAR* resvar, /**< resultant variable of the operation */
115  int nvars, /**< number of operator variables in the constraint */
116  SCIP_VAR** vars /**< array with operator variables of constraint */
117  );
118 
119 /** gets number of variables in and constraint */
120 extern
121 int SCIPgetNVarsAnd(
122  SCIP* scip, /**< SCIP data structure */
123  SCIP_CONS* cons /**< constraint data */
124  );
125 
126 /** gets array of variables in and constraint */
127 extern
129  SCIP* scip, /**< SCIP data structure */
130  SCIP_CONS* cons /**< constraint data */
131  );
132 
133 /** gets the resultant variable in and constraint */
134 extern
136  SCIP* scip, /**< SCIP data structure */
137  SCIP_CONS* cons /**< constraint data */
138  );
139 
140 /** return if the variables of the AND-constraint are sorted with respect to their indices */
141 extern
143  SCIP* scip, /**< SCIP data structure */
144  SCIP_CONS* cons /**< constraint data */
145  );
146 
147 /** sort the variables of the AND-constraint with respect to their indices */
148 extern
150  SCIP* scip, /**< SCIP data structure */
151  SCIP_CONS* cons /**< constraint data */
152  );
153 
154 /** when 'upgrading' the given AND-constraint, should the check flag for the upgraded constraint be set to TRUE, even if
155  * the check flag of this AND-constraint is set to FALSE?
156  */
157 extern
159  SCIP* scip, /**< SCIP data structure */
160  SCIP_CONS* cons, /**< constraint data */
161  SCIP_Bool flag /**< should an arising constraint from the given AND-constraint be checked,
162  * even if the check flag of the AND-constraint is set to FALSE
163  */
164  );
165 
166 /** when 'upgrading' the given AND-constraint, should the removable flag for the upgraded constraint be set to FALSE,
167  * even if the removable flag of this AND-constraint is set to TRUE?
168  */
169 extern
171  SCIP* scip, /**< SCIP data structure */
172  SCIP_CONS* cons, /**< constraint data */
173  SCIP_Bool flag /**< should an arising constraint from the given AND-constraint be not
174  * removable, even if the removable flag of the AND-constraint is set to
175  * TRUE
176  */
177  );
178 
179 /* @} */
180 
181 /* @} */
182 
183 #ifdef __cplusplus
184 }
185 #endif
186 
187 #endif
SCIP_RETCODE SCIPsortAndCons(SCIP *scip, SCIP_CONS *cons)
Definition: cons_and.c:5193
SCIP_RETCODE SCIPincludeConshdlrAnd(SCIP *scip)
Definition: cons_and.c:4879
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:53
SCIP_Bool SCIPisAndConsSorted(SCIP *scip, SCIP_CONS *cons)
Definition: cons_and.c:5169
SCIP_VAR ** SCIPgetVarsAnd(SCIP *scip, SCIP_CONS *cons)
Definition: cons_and.c:5121
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:4968
SCIP_VAR * SCIPgetResultantAnd(SCIP *scip, SCIP_CONS *cons)
Definition: cons_and.c:5146
SCIP_RETCODE SCIPcreateConsBasicAnd(SCIP *scip, SCIP_CONS **cons, const char *name, SCIP_VAR *resvar, int nvars, SCIP_VAR **vars)
Definition: cons_and.c:5078
SCIP_RETCODE SCIPchgAndConsRemovableFlagWhenUpgr(SCIP *scip, SCIP_CONS *cons, SCIP_Bool flag)
Definition: cons_and.c:5253
SCIP_RETCODE SCIPchgAndConsCheckFlagWhenUpgr(SCIP *scip, SCIP_CONS *cons, SCIP_Bool flag)
Definition: cons_and.c:5222
#define SCIP_Bool
Definition: def.h:61
int SCIPgetNVarsAnd(SCIP *scip, SCIP_CONS *cons)
Definition: cons_and.c:5097
SCIP callable library.