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