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