1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2 /*                                                                           */
3 /*                  This file is part of the program and library             */
4 /*         SCIP --- Solving Constraint Integer Programs                      */
5 /*                                                                           */
6 /*    Copyright (C) 2002-2021 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 scipopt.org.         */
13 /*                                                                           */
14 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
15 
16 /**@file   cons_bounddisjunction.h
17  * @ingroup CONSHDLRS
18  * @brief  constraint handler for bound disjunction constraints \f$(x_1 \{\leq,\geq\} b_1) \vee \ldots \vee (x_n \{\leq,\geq\} b_n)\f$
19  * @author Tobias Achterberg
20  */
21 
22 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
23 
24 #ifndef __SCIP_CONS_BOUNDDISJUNCTION_H__
25 #define __SCIP_CONS_BOUNDDISJUNCTION_H__
26 
27 
28 #include "scip/def.h"
29 #include "scip/type_cons.h"
30 #include "scip/type_lp.h"
31 #include "scip/type_retcode.h"
32 #include "scip/type_scip.h"
33 #include "scip/type_var.h"
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
39 /** creates the handler for bound disjunction constraints and includes it in SCIP
40  *
41  * @ingroup ConshdlrIncludes
42  * */
43 SCIP_EXPORT
44 SCIP_RETCODE SCIPincludeConshdlrBounddisjunction(
45    SCIP*                 scip                /**< SCIP data structure */
46    );
47 
48 /**@addtogroup CONSHDLRS
49  *
50  * @{
51  *
52  * @name Bound Disjunction Constraints
53  *
54  * @{
55  *
56  * This constraint handler handles bound disjunction constraints of the form
57  * \f[
58  *   (x_1 \{\leq,\geq\} b_1) \vee \ldots \vee (x_n \{\leq,\geq\} b_n)
59  * \f]
60  * with bounds \f$b_i \in Q\f$, decision variables \f$x_i\f$, which can be of any type,
61  * and bound types \f$\leq\f$ or \f$\geq\f$.
62  */
63 
64 /** creates and captures a bound disjunction constraint
65  *
66  *  @note the constraint gets captured, hence at one point you have to release it using the method SCIPreleaseCons()
67  */
68 SCIP_EXPORT
69 SCIP_RETCODE SCIPcreateConsBounddisjunction(
70    SCIP*                 scip,               /**< SCIP data structure */
71    SCIP_CONS**           cons,               /**< pointer to hold the created constraint */
72    const char*           name,               /**< name of constraint */
73    int                   nvars,              /**< number of variables in the constraint */
74    SCIP_VAR**            vars,               /**< variables of the literals in the constraint */
75    SCIP_BOUNDTYPE*       boundtypes,         /**< types of bounds of the literals (lower or upper bounds) */
76    SCIP_Real*            bounds,             /**< bounds of the literals */
77    SCIP_Bool             initial,            /**< should the LP relaxation of constraint be in the initial LP?
78                                               *   Usually set to TRUE. Set to FALSE for 'lazy constraints'. */
79    SCIP_Bool             separate,           /**< should the constraint be separated during LP processing?
80                                               *   Usually set to TRUE. */
81    SCIP_Bool             enforce,            /**< should the constraint be enforced during node processing?
82                                               *   TRUE for model constraints, FALSE for additional, redundant constraints. */
83    SCIP_Bool             check,              /**< should the constraint be checked for feasibility?
84                                               *   TRUE for model constraints, FALSE for additional, redundant constraints. */
85    SCIP_Bool             propagate,          /**< should the constraint be propagated during node processing?
86                                               *   Usually set to TRUE. */
87    SCIP_Bool             local,              /**< is constraint only valid locally?
88                                               *   Usually set to FALSE. Has to be set to TRUE, e.g., for branching constraints. */
89    SCIP_Bool             modifiable,         /**< is constraint modifiable (subject to column generation)?
90                                               *   Usually set to FALSE. In column generation applications, set to TRUE if pricing
91                                               *   adds coefficients to this constraint. */
92    SCIP_Bool             dynamic,            /**< is constraint subject to aging?
93                                               *   Usually set to FALSE. Set to TRUE for own cuts which
94                                               *   are separated as constraints. */
95    SCIP_Bool             removable,          /**< should the relaxation be removed from the LP due to aging or cleanup?
96                                               *   Usually set to FALSE. Set to TRUE for 'lazy constraints' and 'user cuts'. */
97    SCIP_Bool             stickingatnode      /**< should the constraint always be kept at the node where it was added, even
98                                               *   if it may be moved to a more global node?
99                                               *   Usually set to FALSE. Set to TRUE to for constraints that represent node data. */
100    );
101 
102 /** creates and captures an and constraint
103  *  in its most basic version, i. e., all constraint flags are set to their basic value as explained for the
104  *  method SCIPcreateConsBounddisjunction(); all flags can be set via SCIPsetConsFLAGNAME-methods in scip.h
105  *
106  *  @see SCIPcreateConsBounddisjunction() for information about the basic constraint flag configuration
107  *
108  *  @note the constraint gets captured, hence at one point you have to release it using the method SCIPreleaseCons()
109  */
110 SCIP_EXPORT
111 SCIP_RETCODE SCIPcreateConsBasicBounddisjunction(
112    SCIP*                 scip,               /**< SCIP data structure */
113    SCIP_CONS**           cons,               /**< pointer to hold the created constraint */
114    const char*           name,               /**< name of constraint */
115    int                   nvars,              /**< number of variables in the constraint */
116    SCIP_VAR**            vars,               /**< variables of the literals in the constraint */
117    SCIP_BOUNDTYPE*       boundtypes,         /**< types of bounds of the literals (lower or upper bounds) */
118    SCIP_Real*            bounds              /**< bounds of the literals */
119    );
120 
121 /** creates and captures a bound disjunction constraint with possibly redundant literals
122  *
123  *  @note the constraint gets captured, hence at one point you have to release it using the method SCIPreleaseCons()
124  */
125 SCIP_EXPORT
126 SCIP_RETCODE SCIPcreateConsBounddisjunctionRedundant(
127    SCIP*                 scip,               /**< SCIP data structure */
128    SCIP_CONS**           cons,               /**< pointer to hold the created constraint */
129    const char*           name,               /**< name of constraint */
130    int                   nvars,              /**< number of variables in the constraint */
131    SCIP_VAR**            vars,               /**< variables of the literals in the constraint */
132    SCIP_BOUNDTYPE*       boundtypes,         /**< types of bounds of the literals (lower or upper bounds) */
133    SCIP_Real*            bounds,             /**< bounds of the literals */
134    SCIP_Bool             initial,            /**< should the LP relaxation of constraint be in the initial LP?
135                                               *   Usually set to TRUE. Set to FALSE for 'lazy constraints'. */
136    SCIP_Bool             separate,           /**< should the constraint be separated during LP processing?
137                                               *   Usually set to TRUE. */
138    SCIP_Bool             enforce,            /**< should the constraint be enforced during node processing?
139                                               *   TRUE for model constraints, FALSE for additional, redundant constraints. */
140    SCIP_Bool             check,              /**< should the constraint be checked for feasibility?
141                                               *   TRUE for model constraints, FALSE for additional, redundant constraints. */
142    SCIP_Bool             propagate,          /**< should the constraint be propagated during node processing?
143                                               *   Usually set to TRUE. */
144    SCIP_Bool             local,              /**< is constraint only valid locally?
145                                               *   Usually set to FALSE. Has to be set to TRUE, e.g., for branching constraints. */
146    SCIP_Bool             modifiable,         /**< is constraint modifiable (subject to column generation)?
147                                               *   Usually set to FALSE. In column generation applications, set to TRUE if pricing
148                                               *   adds coefficients to this constraint. */
149    SCIP_Bool             dynamic,            /**< is constraint subject to aging?
150                                               *   Usually set to FALSE. Set to TRUE for own cuts which
151                                               *   are separated as constraints. */
152    SCIP_Bool             removable,          /**< should the relaxation be removed from the LP due to aging or cleanup?
153                                               *   Usually set to FALSE. Set to TRUE for 'lazy constraints' and 'user cuts'. */
154    SCIP_Bool             stickingatnode      /**< should the constraint always be kept at the node where it was added, even
155                                               *   if it may be moved to a more global node?
156                                               *   Usually set to FALSE. Set to TRUE to for constraints that represent node data. */
157    );
158 
159 /** creates and captures an and constraint with possibly redundant literals
160  *  in its most basic version, i. e., all constraint flags are set to their basic value as explained for the
161  *  method SCIPcreateConsBounddisjunction(); all flags can be set via SCIPsetConsFLAGNAME-methods in scip.h
162  *
163  *  @see SCIPcreateConsBounddisjunction() for information about the basic constraint flag configuration
164  *
165  *  @note the constraint gets captured, hence at one point you have to release it using the method SCIPreleaseCons()
166  */
167 SCIP_EXPORT
168 SCIP_RETCODE SCIPcreateConsBasicBounddisjunctionRedundant(
169    SCIP*                 scip,               /**< SCIP data structure */
170    SCIP_CONS**           cons,               /**< pointer to hold the created constraint */
171    const char*           name,               /**< name of constraint */
172    int                   nvars,              /**< number of variables in the constraint */
173    SCIP_VAR**            vars,               /**< variables of the literals in the constraint */
174    SCIP_BOUNDTYPE*       boundtypes,         /**< types of bounds of the literals (lower or upper bounds) */
175    SCIP_Real*            bounds              /**< bounds of the literals */
176    );
177 
178 /** gets number of variables in bound disjunction constraint */
179 SCIP_EXPORT
180 int SCIPgetNVarsBounddisjunction(
181    SCIP*                 scip,               /**< SCIP data structure */
182    SCIP_CONS*            cons                /**< constraint data */
183    );
184 
185 /** gets array of variables in bound disjunction constraint */
186 SCIP_EXPORT
187 SCIP_VAR** SCIPgetVarsBounddisjunction(
188    SCIP*                 scip,               /**< SCIP data structure */
189    SCIP_CONS*            cons                /**< constraint data */
190    );
191 
192 /** gets array of bound types in bound disjunction constraint */
193 SCIP_EXPORT
194 SCIP_BOUNDTYPE* SCIPgetBoundtypesBounddisjunction(
195    SCIP*                 scip,               /**< SCIP data structure */
196    SCIP_CONS*            cons                /**< constraint data */
197    );
198 
199 /** gets array of bounds in bound disjunction constraint */
200 SCIP_EXPORT
201 SCIP_Real* SCIPgetBoundsBounddisjunction(
202    SCIP*                 scip,               /**< SCIP data structure */
203    SCIP_CONS*            cons                /**< constraint data */
204    );
205 
206 /** @} */
207 
208 /** @} */
209 
210 #ifdef __cplusplus
211 }
212 #endif
213 
214 #endif
215