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_varbound.h 17 * @ingroup CONSHDLRS 18 * @brief Constraint handler for variable bound constraints \f$lhs \leq x + c y \leq rhs\f$. 19 * @author Tobias Achterberg 20 * @author Timo Berthold 21 * @author Michael Winkler 22 * @author Gerald Gamrath 23 * @author Stefan Heinz 24 * 25 */ 26 27 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/ 28 29 #ifndef __SCIP_CONS_VARBOUND_H__ 30 #define __SCIP_CONS_VARBOUND_H__ 31 32 33 #include "scip/def.h" 34 #include "scip/type_cons.h" 35 #include "scip/type_lp.h" 36 #include "scip/type_retcode.h" 37 #include "scip/type_scip.h" 38 #include "scip/type_var.h" 39 40 #ifdef __cplusplus 41 extern "C" { 42 #endif 43 44 /** creates the handler for variable bound constraints and includes it in SCIP 45 * 46 * @ingroup ConshdlrIncludes 47 * */ 48 SCIP_EXPORT 49 SCIP_RETCODE SCIPincludeConshdlrVarbound( 50 SCIP* scip /**< SCIP data structure */ 51 ); 52 53 /**@addtogroup CONSHDLRS 54 * 55 * @{ 56 * 57 * @name Variable Bound Constraints 58 * 59 * @{ 60 * 61 * This constraint handler handles a special type of linear constraints, namely variable bound constraints. 62 * A variable bound constraint has the form 63 * \f[ 64 * lhs \leq x + c y \leq rhs 65 * \f] 66 * with coefficient \f$c \in Q\f$, \f$lhs\in Q \cup \{-\infty\}\f$, \f$rhs\in Q \cup \{\infty\}\f$, 67 * and decision variables \f$x\f$ (non-binary) and \f$y\f$ (binary or integer). 68 */ 69 70 /** creates and captures a variable bound constraint: lhs <= x + c*y <= rhs 71 * 72 * @note the constraint gets captured, hence at one point you have to release it using the method SCIPreleaseCons() 73 */ 74 SCIP_EXPORT 75 SCIP_RETCODE SCIPcreateConsVarbound( 76 SCIP* scip, /**< SCIP data structure */ 77 SCIP_CONS** cons, /**< pointer to hold the created constraint */ 78 const char* name, /**< name of constraint */ 79 SCIP_VAR* var, /**< variable x that has variable bound */ 80 SCIP_VAR* vbdvar, /**< binary, integer or implicit integer bounding variable y */ 81 SCIP_Real vbdcoef, /**< coefficient c of bounding variable y */ 82 SCIP_Real lhs, /**< left hand side of variable bound inequality */ 83 SCIP_Real rhs, /**< right hand side of variable bound inequality */ 84 SCIP_Bool initial, /**< should the LP relaxation of constraint be in the initial LP? 85 * Usually set to TRUE. Set to FALSE for 'lazy constraints'. */ 86 SCIP_Bool separate, /**< should the constraint be separated during LP processing? 87 * Usually set to TRUE. */ 88 SCIP_Bool enforce, /**< should the constraint be enforced during node processing? 89 * TRUE for model constraints, FALSE for additional, redundant constraints. */ 90 SCIP_Bool check, /**< should the constraint be checked for feasibility? 91 * TRUE for model constraints, FALSE for additional, redundant constraints. */ 92 SCIP_Bool propagate, /**< should the constraint be propagated during node processing? 93 * Usually set to TRUE. */ 94 SCIP_Bool local, /**< is constraint only valid locally? 95 * Usually set to FALSE. Has to be set to TRUE, e.g., for branching constraints. */ 96 SCIP_Bool modifiable, /**< is constraint modifiable (subject to column generation)? 97 * Usually set to FALSE. In column generation applications, set to TRUE if pricing 98 * adds coefficients to this constraint. */ 99 SCIP_Bool dynamic, /**< is constraint subject to aging? 100 * Usually set to FALSE. Set to TRUE for own cuts which 101 * are separated as constraints. */ 102 SCIP_Bool removable, /**< should the relaxation be removed from the LP due to aging or cleanup? 103 * Usually set to FALSE. Set to TRUE for 'lazy constraints' and 'user cuts'. */ 104 SCIP_Bool stickingatnode /**< should the constraint always be kept at the node where it was added, even 105 * if it may be moved to a more global node? 106 * Usually set to FALSE. Set to TRUE to for constraints that represent node data. */ 107 ); 108 109 /** creates and captures a varbound constraint 110 * in its most basic version, i. e., all constraint flags are set to their basic value as explained for the 111 * method SCIPcreateConsVarbound(); all flags can be set via SCIPsetConsFLAGNAME-methods in scip.h 112 * 113 * @see SCIPcreateConsVarbound() for information about the basic constraint flag configuration 114 * 115 * @note the constraint gets captured, hence at one point you have to release it using the method SCIPreleaseCons() 116 */ 117 SCIP_EXPORT 118 SCIP_RETCODE SCIPcreateConsBasicVarbound( 119 SCIP* scip, /**< SCIP data structure */ 120 SCIP_CONS** cons, /**< pointer to hold the created constraint */ 121 const char* name, /**< name of constraint */ 122 SCIP_VAR* var, /**< variable x that has variable bound */ 123 SCIP_VAR* vbdvar, /**< binary, integer or implicit integer bounding variable y */ 124 SCIP_Real vbdcoef, /**< coefficient c of bounding variable y */ 125 SCIP_Real lhs, /**< left hand side of variable bound inequality */ 126 SCIP_Real rhs /**< right hand side of variable bound inequality */ 127 ); 128 129 /** gets left hand side of variable bound constraint lhs <= x + c*y <= rhs */ 130 SCIP_EXPORT 131 SCIP_Real SCIPgetLhsVarbound( 132 SCIP* scip, /**< SCIP data structure */ 133 SCIP_CONS* cons /**< constraint data */ 134 ); 135 136 /** gets right hand side of variable bound constraint lhs <= x + c*y <= rhs */ 137 SCIP_EXPORT 138 SCIP_Real SCIPgetRhsVarbound( 139 SCIP* scip, /**< SCIP data structure */ 140 SCIP_CONS* cons /**< constraint data */ 141 ); 142 143 /** gets bounded variable x of variable bound constraint lhs <= x + c*y <= rhs */ 144 SCIP_EXPORT 145 SCIP_VAR* SCIPgetVarVarbound( 146 SCIP* scip, /**< SCIP data structure */ 147 SCIP_CONS* cons /**< constraint data */ 148 ); 149 150 /** gets bounding variable y of variable bound constraint lhs <= x + c*y <= rhs */ 151 SCIP_EXPORT 152 SCIP_VAR* SCIPgetVbdvarVarbound( 153 SCIP* scip, /**< SCIP data structure */ 154 SCIP_CONS* cons /**< constraint data */ 155 ); 156 157 /** gets bound coefficient c of variable bound constraint lhs <= x + c*y <= rhs */ 158 SCIP_EXPORT 159 SCIP_Real SCIPgetVbdcoefVarbound( 160 SCIP* scip, /**< SCIP data structure */ 161 SCIP_CONS* cons /**< constraint data */ 162 ); 163 164 /** gets the dual solution of the variable bound constraint in the current LP */ 165 SCIP_EXPORT 166 SCIP_Real SCIPgetDualsolVarbound( 167 SCIP* scip, /**< SCIP data structure */ 168 SCIP_CONS* cons /**< constraint data */ 169 ); 170 171 /** gets the dual Farkas value of the variable bound constraint in the current infeasible LP */ 172 SCIP_EXPORT 173 SCIP_Real SCIPgetDualfarkasVarbound( 174 SCIP* scip, /**< SCIP data structure */ 175 SCIP_CONS* cons /**< constraint data */ 176 ); 177 178 /** returns the linear relaxation of the given variable bound constraint; may return NULL if no LP row was yet created; 179 * the user must not modify the row! 180 */ 181 SCIP_EXPORT 182 SCIP_ROW* SCIPgetRowVarbound( 183 SCIP* scip, /**< SCIP data structure */ 184 SCIP_CONS* cons /**< constraint data */ 185 ); 186 187 /** cleans up (multi-)aggregations and fixings from varbound constraints */ 188 SCIP_EXPORT 189 SCIP_RETCODE SCIPcleanupConssVarbound( 190 SCIP* scip, /**< SCIP data structure */ 191 SCIP_Bool onlychecked, /**< should only checked constraints be cleaned up? */ 192 SCIP_Bool* infeasible, /**< pointer to return whether the problem was detected to be infeasible */ 193 int* naddconss, /**< pointer to count number of added (linear) constraints */ 194 int* ndelconss, /**< pointer to count number of deleted (varbound) constraints */ 195 int* nchgbds /**< pointer to count number of bound changes */ 196 ); 197 198 /** @} */ 199 200 /** @} */ 201 202 #ifdef __cplusplus 203 } 204 #endif 205 206 #endif 207