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 scip_var.h 26 * @ingroup PUBLICCOREAPI 27 * @brief public methods for SCIP variables 28 * @author Tobias Achterberg 29 * @author Timo Berthold 30 * @author Thorsten Koch 31 * @author Alexander Martin 32 * @author Marc Pfetsch 33 * @author Kati Wolter 34 * @author Gregor Hendel 35 * @author Leona Gottwald 36 */ 37 38 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/ 39 40 #ifndef __SCIP_SCIP_VAR_H__ 41 #define __SCIP_SCIP_VAR_H__ 42 43 44 #include "scip/def.h" 45 #include "scip/type_cons.h" 46 #include "scip/type_history.h" 47 #include "scip/type_implics.h" 48 #include "scip/type_lp.h" 49 #include "scip/type_misc.h" 50 #include "scip/type_prop.h" 51 #include "scip/type_relax.h" 52 #include "scip/type_result.h" 53 #include "scip/type_retcode.h" 54 #include "scip/type_scip.h" 55 #include "scip/type_sol.h" 56 #include "scip/type_tree.h" 57 #include "scip/type_var.h" 58 59 /* In debug mode, we include the SCIP's structure in scip.c, such that no one can access 60 * this structure except the interface methods in scip.c. 61 * In optimized mode, the structure is included in scip.h, because some of the methods 62 * are implemented as defines for performance reasons (e.g. the numerical comparisons). 63 * Additionally, the internal "set.h" is included, such that the defines in set.h are 64 * available in optimized mode. 65 */ 66 #ifdef NDEBUG 67 #include "scip/pub_var.h" 68 #endif 69 70 #ifdef __cplusplus 71 extern "C" { 72 #endif 73 74 /**@addtogroup PublicVariableMethods 75 * 76 *@{ 77 */ 78 79 /** creates and captures problem variable; if variable is of integral type, fractional bounds are automatically rounded; 80 * an integer variable with bounds zero and one is automatically converted into a binary variable; 81 * 82 * @warning When doing column generation and the original problem is a maximization problem, notice that SCIP will 83 * transform the problem into a minimization problem by multiplying the objective function by -1. Thus, the 84 * original objective function value of variables created during the solving process has to be multiplied by 85 * -1, too. 86 * 87 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 88 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 89 * 90 * @pre This method can be called if @p scip is in one of the following stages: 91 * - \ref SCIP_STAGE_PROBLEM 92 * - \ref SCIP_STAGE_TRANSFORMING 93 * - \ref SCIP_STAGE_INITPRESOLVE 94 * - \ref SCIP_STAGE_PRESOLVING 95 * - \ref SCIP_STAGE_EXITPRESOLVE 96 * - \ref SCIP_STAGE_PRESOLVED 97 * - \ref SCIP_STAGE_SOLVING 98 * 99 * @note the variable gets captured, hence at one point you have to release it using the method SCIPreleaseVar() 100 */ 101 SCIP_EXPORT 102 SCIP_RETCODE SCIPcreateVar( 103 SCIP* scip, /**< SCIP data structure */ 104 SCIP_VAR** var, /**< pointer to variable object */ 105 const char* name, /**< name of variable, or NULL for automatic name creation */ 106 SCIP_Real lb, /**< lower bound of variable */ 107 SCIP_Real ub, /**< upper bound of variable */ 108 SCIP_Real obj, /**< objective function value */ 109 SCIP_VARTYPE vartype, /**< type of variable */ 110 SCIP_Bool initial, /**< should var's column be present in the initial root LP? */ 111 SCIP_Bool removable, /**< is var's column removable from the LP (due to aging or cleanup)? */ 112 SCIP_DECL_VARDELORIG ((*vardelorig)), /**< frees user data of original variable, or NULL */ 113 SCIP_DECL_VARTRANS ((*vartrans)), /**< creates transformed user data by transforming original user data, or NULL */ 114 SCIP_DECL_VARDELTRANS ((*vardeltrans)), /**< frees user data of transformed variable, or NULL */ 115 SCIP_DECL_VARCOPY ((*varcopy)), /**< copies variable data if wanted to subscip, or NULL */ 116 SCIP_VARDATA* vardata /**< user data for this specific variable, or NULL */ 117 ); 118 119 /** creates and captures problem variable with optional callbacks and variable data set to NULL, which can be set 120 * afterwards using SCIPvarSetDelorigData(), SCIPvarSetTransData(), 121 * SCIPvarSetDeltransData(), SCIPvarSetCopy(), and SCIPvarSetData(); sets variable flags initial=TRUE 122 * and removable = FALSE, which can be adjusted by using SCIPvarSetInitial() and SCIPvarSetRemovable(), resp.; 123 * if variable is of integral type, fractional bounds are automatically rounded; 124 * an integer variable with bounds zero and one is automatically converted into a binary variable; 125 * 126 * @warning When doing column generation and the original problem is a maximization problem, notice that SCIP will 127 * transform the problem into a minimization problem by multiplying the objective function by -1. Thus, the 128 * original objective function value of variables created during the solving process has to be multiplied by 129 * -1, too. 130 * 131 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 132 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 133 * 134 * @pre This method can be called if @p scip is in one of the following stages: 135 * - \ref SCIP_STAGE_PROBLEM 136 * - \ref SCIP_STAGE_TRANSFORMING 137 * - \ref SCIP_STAGE_INITPRESOLVE 138 * - \ref SCIP_STAGE_PRESOLVING 139 * - \ref SCIP_STAGE_EXITPRESOLVE 140 * - \ref SCIP_STAGE_PRESOLVED 141 * - \ref SCIP_STAGE_SOLVING 142 * 143 * @note the variable gets captured, hence at one point you have to release it using the method SCIPreleaseVar() 144 */ 145 SCIP_EXPORT 146 SCIP_RETCODE SCIPcreateVarBasic( 147 SCIP* scip, /**< SCIP data structure */ 148 SCIP_VAR** var, /**< pointer to variable object */ 149 const char* name, /**< name of variable, or NULL for automatic name creation */ 150 SCIP_Real lb, /**< lower bound of variable */ 151 SCIP_Real ub, /**< upper bound of variable */ 152 SCIP_Real obj, /**< objective function value */ 153 SCIP_VARTYPE vartype /**< type of variable */ 154 ); 155 156 /** outputs the variable name to the file stream 157 * 158 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 159 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 160 * 161 * @pre This method can be called if @p scip is in one of the following stages: 162 * - \ref SCIP_STAGE_PROBLEM 163 * - \ref SCIP_STAGE_TRANSFORMING 164 * - \ref SCIP_STAGE_TRANSFORMED 165 * - \ref SCIP_STAGE_INITPRESOLVE 166 * - \ref SCIP_STAGE_PRESOLVING 167 * - \ref SCIP_STAGE_EXITPRESOLVE 168 * - \ref SCIP_STAGE_PRESOLVED 169 * - \ref SCIP_STAGE_INITSOLVE 170 * - \ref SCIP_STAGE_SOLVING 171 * - \ref SCIP_STAGE_SOLVED 172 * - \ref SCIP_STAGE_EXITSOLVE 173 * - \ref SCIP_STAGE_FREETRANS 174 */ 175 SCIP_EXPORT 176 SCIP_RETCODE SCIPwriteVarName( 177 SCIP* scip, /**< SCIP data structure */ 178 FILE* file, /**< output file, or NULL for stdout */ 179 SCIP_VAR* var, /**< variable to output */ 180 SCIP_Bool type /**< should the variable type be also posted */ 181 ); 182 183 /** print the given list of variables to output stream separated by the given delimiter character; 184 * 185 * i. e. the variables x1, x2, ..., xn with given delimiter ',' are written as: \<x1\>, \<x2\>, ..., \<xn\>; 186 * 187 * the method SCIPparseVarsList() can parse such a string 188 * 189 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 190 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 191 * 192 * @pre This method can be called if @p scip is in one of the following stages: 193 * - \ref SCIP_STAGE_PROBLEM 194 * - \ref SCIP_STAGE_TRANSFORMING 195 * - \ref SCIP_STAGE_TRANSFORMED 196 * - \ref SCIP_STAGE_INITPRESOLVE 197 * - \ref SCIP_STAGE_PRESOLVING 198 * - \ref SCIP_STAGE_EXITPRESOLVE 199 * - \ref SCIP_STAGE_PRESOLVED 200 * - \ref SCIP_STAGE_INITSOLVE 201 * - \ref SCIP_STAGE_SOLVING 202 * - \ref SCIP_STAGE_SOLVED 203 * - \ref SCIP_STAGE_EXITSOLVE 204 * - \ref SCIP_STAGE_FREETRANS 205 * 206 * @note The printing process is done via the message handler system. 207 */ 208 SCIP_EXPORT 209 SCIP_RETCODE SCIPwriteVarsList( 210 SCIP* scip, /**< SCIP data structure */ 211 FILE* file, /**< output file, or NULL for stdout */ 212 SCIP_VAR** vars, /**< variable array to output */ 213 int nvars, /**< number of variables */ 214 SCIP_Bool type, /**< should the variable type be also posted */ 215 char delimiter /**< character which is used for delimitation */ 216 ); 217 218 /** print the given variables and coefficients as linear sum in the following form 219 * c1 \<x1\> + c2 \<x2\> ... + cn \<xn\> 220 * 221 * This string can be parsed by the method SCIPparseVarsLinearsum(). 222 * 223 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 224 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 225 * 226 * @pre This method can be called if @p scip is in one of the following stages: 227 * - \ref SCIP_STAGE_PROBLEM 228 * - \ref SCIP_STAGE_TRANSFORMING 229 * - \ref SCIP_STAGE_TRANSFORMED 230 * - \ref SCIP_STAGE_INITPRESOLVE 231 * - \ref SCIP_STAGE_PRESOLVING 232 * - \ref SCIP_STAGE_EXITPRESOLVE 233 * - \ref SCIP_STAGE_PRESOLVED 234 * - \ref SCIP_STAGE_INITSOLVE 235 * - \ref SCIP_STAGE_SOLVING 236 * - \ref SCIP_STAGE_SOLVED 237 * - \ref SCIP_STAGE_EXITSOLVE 238 * - \ref SCIP_STAGE_FREETRANS 239 * 240 * @note The printing process is done via the message handler system. 241 */ 242 SCIP_EXPORT 243 SCIP_RETCODE SCIPwriteVarsLinearsum( 244 SCIP* scip, /**< SCIP data structure */ 245 FILE* file, /**< output file, or NULL for stdout */ 246 SCIP_VAR** vars, /**< variable array to output */ 247 SCIP_Real* vals, /**< array of coefficients or NULL if all coefficients are 1.0 */ 248 int nvars, /**< number of variables */ 249 SCIP_Bool type /**< should the variable type be also posted */ 250 ); 251 252 /** print the given terms as signomial in the following form 253 * c1 \<x11\>^e11 \<x12\>^e12 ... \<x1n\>^e1n + c2 \<x21\>^e21 \<x22\>^e22 ... + ... + cn \<xn1\>^en1 ... 254 * 255 * This string can be parsed by the method SCIPparseVarsPolynomial(). 256 * 257 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 258 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 259 * 260 * @pre This method can be called if @p scip is in one of the following stages: 261 * - \ref SCIP_STAGE_PROBLEM 262 * - \ref SCIP_STAGE_TRANSFORMING 263 * - \ref SCIP_STAGE_TRANSFORMED 264 * - \ref SCIP_STAGE_INITPRESOLVE 265 * - \ref SCIP_STAGE_PRESOLVING 266 * - \ref SCIP_STAGE_EXITPRESOLVE 267 * - \ref SCIP_STAGE_PRESOLVED 268 * - \ref SCIP_STAGE_INITSOLVE 269 * - \ref SCIP_STAGE_SOLVING 270 * - \ref SCIP_STAGE_SOLVED 271 * - \ref SCIP_STAGE_EXITSOLVE 272 * - \ref SCIP_STAGE_FREETRANS 273 * 274 * @note The printing process is done via the message handler system. 275 */ 276 SCIP_EXPORT 277 SCIP_RETCODE SCIPwriteVarsPolynomial( 278 SCIP* scip, /**< SCIP data structure */ 279 FILE* file, /**< output file, or NULL for stdout */ 280 SCIP_VAR*** monomialvars, /**< arrays with variables for each monomial */ 281 SCIP_Real** monomialexps, /**< arrays with variable exponents, or NULL if always 1.0 */ 282 SCIP_Real* monomialcoefs, /**< array with monomial coefficients */ 283 int* monomialnvars, /**< array with number of variables for each monomial */ 284 int nmonomials, /**< number of monomials */ 285 SCIP_Bool type /**< should the variable type be also posted */ 286 ); 287 288 /** parses variable information (in cip format) out of a string; if the parsing process was successful a variable is 289 * created and captured; if variable is of integral type, fractional bounds are automatically rounded; an integer 290 * variable with bounds zero and one is automatically converted into a binary variable 291 * 292 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 293 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 294 * 295 * @pre This method can be called if @p scip is in one of the following stages: 296 * - \ref SCIP_STAGE_PROBLEM 297 * - \ref SCIP_STAGE_TRANSFORMING 298 * - \ref SCIP_STAGE_INITPRESOLVE 299 * - \ref SCIP_STAGE_PRESOLVING 300 * - \ref SCIP_STAGE_EXITPRESOLVE 301 * - \ref SCIP_STAGE_PRESOLVED 302 * - \ref SCIP_STAGE_SOLVING 303 */ 304 SCIP_EXPORT 305 SCIP_RETCODE SCIPparseVar( 306 SCIP* scip, /**< SCIP data structure */ 307 SCIP_VAR** var, /**< pointer to store the problem variable */ 308 const char* str, /**< string to parse */ 309 SCIP_Bool initial, /**< should var's column be present in the initial root LP? */ 310 SCIP_Bool removable, /**< is var's column removable from the LP (due to aging or cleanup)? */ 311 SCIP_DECL_VARCOPY ((*varcopy)), /**< copies variable data if wanted to subscip, or NULL */ 312 SCIP_DECL_VARDELORIG ((*vardelorig)), /**< frees user data of original variable */ 313 SCIP_DECL_VARTRANS ((*vartrans)), /**< creates transformed user data by transforming original user data */ 314 SCIP_DECL_VARDELTRANS ((*vardeltrans)), /**< frees user data of transformed variable */ 315 SCIP_VARDATA* vardata, /**< user data for this specific variable */ 316 char** endptr, /**< pointer to store the final string position if successful */ 317 SCIP_Bool* success /**< pointer store if the paring process was successful */ 318 ); 319 320 /** parses the given string for a variable name and stores the variable in the corresponding pointer if such a variable 321 * exits and returns the position where the parsing stopped 322 * 323 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 324 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 325 * 326 * @pre This method can be called if @p scip is in one of the following stages: 327 * - \ref SCIP_STAGE_PROBLEM 328 * - \ref SCIP_STAGE_TRANSFORMING 329 * - \ref SCIP_STAGE_INITPRESOLVE 330 * - \ref SCIP_STAGE_PRESOLVING 331 * - \ref SCIP_STAGE_EXITPRESOLVE 332 * - \ref SCIP_STAGE_PRESOLVED 333 * - \ref SCIP_STAGE_SOLVING 334 */ 335 SCIP_EXPORT 336 SCIP_RETCODE SCIPparseVarName( 337 SCIP* scip, /**< SCIP data structure */ 338 const char* str, /**< string to parse */ 339 SCIP_VAR** var, /**< pointer to store the problem variable, or NULL if it does not exit */ 340 char** endptr /**< pointer to store the final string position if successful */ 341 ); 342 343 /** parse the given string as variable list (here ',' is the delimiter)) (\<x1\>, \<x2\>, ..., \<xn\>) (see 344 * SCIPwriteVarsList() ); if it was successful, the pointer success is set to TRUE 345 * 346 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 347 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 348 * 349 * @pre This method can be called if @p scip is in one of the following stages: 350 * - \ref SCIP_STAGE_PROBLEM 351 * - \ref SCIP_STAGE_TRANSFORMING 352 * - \ref SCIP_STAGE_INITPRESOLVE 353 * - \ref SCIP_STAGE_PRESOLVING 354 * - \ref SCIP_STAGE_EXITPRESOLVE 355 * - \ref SCIP_STAGE_PRESOLVED 356 * - \ref SCIP_STAGE_SOLVING 357 * 358 * @note The pointer success in only set to FALSE in the case that a variable with a parsed variable name does not exist. 359 * 360 * @note If the number of (parsed) variables is greater than the available slots in the variable array, nothing happens 361 * except that the required size is stored in the corresponding integer; the reason for this approach is that we 362 * cannot reallocate memory, since we do not know how the memory has been allocated (e.g., by a C++ 'new' or SCIP 363 * memory functions). 364 */ 365 SCIP_EXPORT 366 SCIP_RETCODE SCIPparseVarsList( 367 SCIP* scip, /**< SCIP data structure */ 368 const char* str, /**< string to parse */ 369 SCIP_VAR** vars, /**< array to store the parsed variable */ 370 int* nvars, /**< pointer to store number of parsed variables */ 371 int varssize, /**< size of the variable array */ 372 int* requiredsize, /**< pointer to store the required array size for the active variables */ 373 char** endptr, /**< pointer to store the final string position if successful */ 374 char delimiter, /**< character which is used for delimitation */ 375 SCIP_Bool* success /**< pointer to store the whether the parsing was successful or not */ 376 ); 377 378 /** parse the given string as linear sum of variables and coefficients (c1 \<x1\> + c2 \<x2\> + ... + cn \<xn\>) 379 * (see SCIPwriteVarsLinearsum() ); if it was successful, the pointer success is set to TRUE 380 * 381 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 382 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 383 * 384 * @pre This method can be called if @p scip is in one of the following stages: 385 * - \ref SCIP_STAGE_PROBLEM 386 * - \ref SCIP_STAGE_TRANSFORMING 387 * - \ref SCIP_STAGE_INITPRESOLVE 388 * - \ref SCIP_STAGE_PRESOLVING 389 * - \ref SCIP_STAGE_EXITPRESOLVE 390 * - \ref SCIP_STAGE_PRESOLVED 391 * - \ref SCIP_STAGE_SOLVING 392 * 393 * @note The pointer success in only set to FALSE in the case that a variable with a parsed variable name does not exist. 394 * 395 * @note If the number of (parsed) variables is greater than the available slots in the variable array, nothing happens 396 * except that the required size is stored in the corresponding integer; the reason for this approach is that we 397 * cannot reallocate memory, since we do not know how the memory has been allocated (e.g., by a C++ 'new' or SCIP 398 * memory functions). 399 */ 400 SCIP_EXPORT 401 SCIP_RETCODE SCIPparseVarsLinearsum( 402 SCIP* scip, /**< SCIP data structure */ 403 const char* str, /**< string to parse */ 404 SCIP_VAR** vars, /**< array to store the parsed variables */ 405 SCIP_Real* vals, /**< array to store the parsed coefficients */ 406 int* nvars, /**< pointer to store number of parsed variables */ 407 int varssize, /**< size of the variable array */ 408 int* requiredsize, /**< pointer to store the required array size for the active variables */ 409 char** endptr, /**< pointer to store the final string position if successful */ 410 SCIP_Bool* success /**< pointer to store the whether the parsing was successful or not */ 411 ); 412 413 /** parse the given string as signomial of variables and coefficients 414 * (c1 \<x11\>^e11 \<x12\>^e12 ... \<x1n\>^e1n + c2 \<x21\>^e21 \<x22\>^e22 ... + ... + cn \<xn1\>^en1 ...) 415 * (see SCIPwriteVarsPolynomial()); if it was successful, the pointer success is set to TRUE 416 * 417 * The user has to call SCIPfreeParseVarsPolynomialData(scip, monomialvars, monomialexps, 418 * monomialcoefs, monomialnvars, *nmonomials) short after SCIPparseVarsPolynomial to free all the 419 * allocated memory again. Do not keep the arrays created by SCIPparseVarsPolynomial around, since 420 * they use buffer memory that is intended for short term use only. 421 * 422 * Parsing is stopped at the end of string (indicated by the \\0-character) or when no more monomials 423 * are recognized. 424 * 425 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 426 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 427 * 428 * @pre This method can be called if @p scip is in one of the following stages: 429 * - \ref SCIP_STAGE_PROBLEM 430 * - \ref SCIP_STAGE_TRANSFORMING 431 * - \ref SCIP_STAGE_INITPRESOLVE 432 * - \ref SCIP_STAGE_PRESOLVING 433 * - \ref SCIP_STAGE_EXITPRESOLVE 434 * - \ref SCIP_STAGE_PRESOLVED 435 * - \ref SCIP_STAGE_SOLVING 436 */ 437 SCIP_EXPORT 438 SCIP_RETCODE SCIPparseVarsPolynomial( 439 SCIP* scip, /**< SCIP data structure */ 440 const char* str, /**< string to parse */ 441 SCIP_VAR**** monomialvars, /**< pointer to store arrays with variables for each monomial */ 442 SCIP_Real*** monomialexps, /**< pointer to store arrays with variable exponents */ 443 SCIP_Real** monomialcoefs, /**< pointer to store array with monomial coefficients */ 444 int** monomialnvars, /**< pointer to store array with number of variables for each monomial */ 445 int* nmonomials, /**< pointer to store number of parsed monomials */ 446 char** endptr, /**< pointer to store the final string position if successful */ 447 SCIP_Bool* success /**< pointer to store the whether the parsing was successful or not */ 448 ); 449 450 /** frees memory allocated when parsing a signomial from a string 451 * 452 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 453 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 454 * 455 * @pre This method can be called if @p scip is in one of the following stages: 456 * - \ref SCIP_STAGE_PROBLEM 457 * - \ref SCIP_STAGE_TRANSFORMING 458 * - \ref SCIP_STAGE_INITPRESOLVE 459 * - \ref SCIP_STAGE_PRESOLVING 460 * - \ref SCIP_STAGE_EXITPRESOLVE 461 * - \ref SCIP_STAGE_PRESOLVED 462 * - \ref SCIP_STAGE_SOLVING 463 */ 464 SCIP_EXPORT 465 void SCIPfreeParseVarsPolynomialData( 466 SCIP* scip, /**< SCIP data structure */ 467 SCIP_VAR**** monomialvars, /**< pointer to store arrays with variables for each monomial */ 468 SCIP_Real*** monomialexps, /**< pointer to store arrays with variable exponents */ 469 SCIP_Real** monomialcoefs, /**< pointer to store array with monomial coefficients */ 470 int** monomialnvars, /**< pointer to store array with number of variables for each monomial */ 471 int nmonomials /**< pointer to store number of parsed monomials */ 472 ); 473 474 /** increases usage counter of variable 475 * 476 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 477 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 478 * 479 * @pre This method can be called if @p scip is in one of the following stages: 480 * - \ref SCIP_STAGE_PROBLEM 481 * - \ref SCIP_STAGE_TRANSFORMING 482 * - \ref SCIP_STAGE_TRANSFORMED 483 * - \ref SCIP_STAGE_INITPRESOLVE 484 * - \ref SCIP_STAGE_PRESOLVING 485 * - \ref SCIP_STAGE_EXITPRESOLVE 486 * - \ref SCIP_STAGE_PRESOLVED 487 * - \ref SCIP_STAGE_INITSOLVE 488 * - \ref SCIP_STAGE_SOLVING 489 * - \ref SCIP_STAGE_SOLVED 490 * - \ref SCIP_STAGE_EXITSOLVE 491 */ 492 SCIP_EXPORT 493 SCIP_RETCODE SCIPcaptureVar( 494 SCIP* scip, /**< SCIP data structure */ 495 SCIP_VAR* var /**< variable to capture */ 496 ); 497 498 /** decreases usage counter of variable, if the usage pointer reaches zero the variable gets freed 499 * 500 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 501 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 502 * 503 * @pre This method can be called if @p scip is in one of the following stages: 504 * - \ref SCIP_STAGE_PROBLEM 505 * - \ref SCIP_STAGE_TRANSFORMING 506 * - \ref SCIP_STAGE_TRANSFORMED 507 * - \ref SCIP_STAGE_INITPRESOLVE 508 * - \ref SCIP_STAGE_PRESOLVING 509 * - \ref SCIP_STAGE_EXITPRESOLVE 510 * - \ref SCIP_STAGE_PRESOLVED 511 * - \ref SCIP_STAGE_INITSOLVE 512 * - \ref SCIP_STAGE_SOLVING 513 * - \ref SCIP_STAGE_SOLVED 514 * - \ref SCIP_STAGE_EXITSOLVE 515 * - \ref SCIP_STAGE_FREETRANS 516 * 517 * @note the pointer of the variable will be NULLed 518 */ 519 SCIP_EXPORT 520 SCIP_RETCODE SCIPreleaseVar( 521 SCIP* scip, /**< SCIP data structure */ 522 SCIP_VAR** var /**< pointer to variable */ 523 ); 524 525 /** changes the name of a variable 526 * 527 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 528 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 529 * 530 * @pre This method can only be called if @p scip is in stage \ref SCIP_STAGE_PROBLEM 531 * 532 * @note to get the current name of a variable, use SCIPvarGetName() from pub_var.h 533 */ 534 SCIP_EXPORT 535 SCIP_RETCODE SCIPchgVarName( 536 SCIP* scip, /**< SCIP data structure */ 537 SCIP_VAR* var, /**< variable */ 538 const char* name /**< new name of constraint */ 539 ); 540 541 /** gets and captures transformed variable of a given variable; if the variable is not yet transformed, 542 * a new transformed variable for this variable is created 543 * 544 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 545 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 546 * 547 * @pre This method can be called if @p scip is in one of the following stages: 548 * - \ref SCIP_STAGE_TRANSFORMING 549 * - \ref SCIP_STAGE_TRANSFORMED 550 * - \ref SCIP_STAGE_INITPRESOLVE 551 * - \ref SCIP_STAGE_PRESOLVING 552 * - \ref SCIP_STAGE_EXITPRESOLVE 553 * - \ref SCIP_STAGE_PRESOLVED 554 * - \ref SCIP_STAGE_INITSOLVE 555 * - \ref SCIP_STAGE_SOLVING 556 */ 557 SCIP_EXPORT 558 SCIP_RETCODE SCIPtransformVar( 559 SCIP* scip, /**< SCIP data structure */ 560 SCIP_VAR* var, /**< variable to get/create transformed variable for */ 561 SCIP_VAR** transvar /**< pointer to store the transformed variable */ 562 ); 563 564 /** gets and captures transformed variables for an array of variables; 565 * if a variable of the array is not yet transformed, a new transformed variable for this variable is created; 566 * it is possible to call this method with vars == transvars 567 * 568 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 569 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 570 * 571 * @pre This method can be called if @p scip is in one of the following stages: 572 * - \ref SCIP_STAGE_TRANSFORMING 573 * - \ref SCIP_STAGE_TRANSFORMED 574 * - \ref SCIP_STAGE_INITPRESOLVE 575 * - \ref SCIP_STAGE_PRESOLVING 576 * - \ref SCIP_STAGE_EXITPRESOLVE 577 * - \ref SCIP_STAGE_PRESOLVED 578 * - \ref SCIP_STAGE_INITSOLVE 579 * - \ref SCIP_STAGE_SOLVING 580 */ 581 SCIP_EXPORT 582 SCIP_RETCODE SCIPtransformVars( 583 SCIP* scip, /**< SCIP data structure */ 584 int nvars, /**< number of variables to get/create transformed variables for */ 585 SCIP_VAR** vars, /**< array with variables to get/create transformed variables for */ 586 SCIP_VAR** transvars /**< array to store the transformed variables */ 587 ); 588 589 /** gets corresponding transformed variable of a given variable; 590 * returns NULL as transvar, if transformed variable is not yet existing 591 * 592 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 593 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 594 * 595 * @pre This method can be called if @p scip is in one of the following stages: 596 * - \ref SCIP_STAGE_TRANSFORMING 597 * - \ref SCIP_STAGE_TRANSFORMED 598 * - \ref SCIP_STAGE_INITPRESOLVE 599 * - \ref SCIP_STAGE_PRESOLVING 600 * - \ref SCIP_STAGE_EXITPRESOLVE 601 * - \ref SCIP_STAGE_PRESOLVED 602 * - \ref SCIP_STAGE_INITSOLVE 603 * - \ref SCIP_STAGE_SOLVING 604 * - \ref SCIP_STAGE_SOLVED 605 * - \ref SCIP_STAGE_EXITSOLVE 606 * - \ref SCIP_STAGE_FREETRANS 607 */ 608 SCIP_EXPORT 609 SCIP_RETCODE SCIPgetTransformedVar( 610 SCIP* scip, /**< SCIP data structure */ 611 SCIP_VAR* var, /**< variable to get transformed variable for */ 612 SCIP_VAR** transvar /**< pointer to store the transformed variable */ 613 ); 614 615 /** gets corresponding transformed variables for an array of variables; 616 * stores NULL in a transvars slot, if the transformed variable is not yet existing; 617 * it is possible to call this method with vars == transvars, but remember that variables that are not 618 * yet transformed will be replaced with NULL 619 * 620 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 621 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 622 * 623 * @pre This method can be called if @p scip is in one of the following stages: 624 * - \ref SCIP_STAGE_TRANSFORMING 625 * - \ref SCIP_STAGE_TRANSFORMED 626 * - \ref SCIP_STAGE_INITPRESOLVE 627 * - \ref SCIP_STAGE_PRESOLVING 628 * - \ref SCIP_STAGE_EXITPRESOLVE 629 * - \ref SCIP_STAGE_PRESOLVED 630 * - \ref SCIP_STAGE_INITSOLVE 631 * - \ref SCIP_STAGE_SOLVING 632 * - \ref SCIP_STAGE_SOLVED 633 * - \ref SCIP_STAGE_EXITSOLVE 634 * - \ref SCIP_STAGE_FREETRANS 635 */ 636 SCIP_EXPORT 637 SCIP_RETCODE SCIPgetTransformedVars( 638 SCIP* scip, /**< SCIP data structure */ 639 int nvars, /**< number of variables to get transformed variables for */ 640 SCIP_VAR** vars, /**< array with variables to get transformed variables for */ 641 SCIP_VAR** transvars /**< array to store the transformed variables */ 642 ); 643 644 /** gets negated variable x' = lb + ub - x of variable x; negated variable is created, if not yet existing 645 * 646 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 647 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 648 * 649 * @pre This method can be called if @p scip is in one of the following stages: 650 * - \ref SCIP_STAGE_PROBLEM 651 * - \ref SCIP_STAGE_TRANSFORMING 652 * - \ref SCIP_STAGE_TRANSFORMED 653 * - \ref SCIP_STAGE_INITPRESOLVE 654 * - \ref SCIP_STAGE_PRESOLVING 655 * - \ref SCIP_STAGE_EXITPRESOLVE 656 * - \ref SCIP_STAGE_PRESOLVED 657 * - \ref SCIP_STAGE_INITSOLVE 658 * - \ref SCIP_STAGE_SOLVING 659 * - \ref SCIP_STAGE_SOLVED 660 * - \ref SCIP_STAGE_EXITSOLVE 661 * - \ref SCIP_STAGE_FREETRANS 662 */ 663 SCIP_EXPORT 664 SCIP_RETCODE SCIPgetNegatedVar( 665 SCIP* scip, /**< SCIP data structure */ 666 SCIP_VAR* var, /**< variable to get negated variable for */ 667 SCIP_VAR** negvar /**< pointer to store the negated variable */ 668 ); 669 670 /** gets negated variables x' = lb + ub - x of variables x; negated variables are created, if not yet existing; 671 * in difference to \ref SCIPcreateVar, the negated variable must not be released (unless captured explicitly) 672 * 673 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 674 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 675 * 676 * @pre This method can be called if @p scip is in one of the following stages: 677 * - \ref SCIP_STAGE_PROBLEM 678 * - \ref SCIP_STAGE_TRANSFORMING 679 * - \ref SCIP_STAGE_TRANSFORMED 680 * - \ref SCIP_STAGE_INITPRESOLVE 681 * - \ref SCIP_STAGE_PRESOLVING 682 * - \ref SCIP_STAGE_EXITPRESOLVE 683 * - \ref SCIP_STAGE_PRESOLVED 684 * - \ref SCIP_STAGE_INITSOLVE 685 * - \ref SCIP_STAGE_SOLVING 686 * - \ref SCIP_STAGE_SOLVED 687 * - \ref SCIP_STAGE_EXITSOLVE 688 * - \ref SCIP_STAGE_FREETRANS 689 */ 690 SCIP_EXPORT 691 SCIP_RETCODE SCIPgetNegatedVars( 692 SCIP* scip, /**< SCIP data structure */ 693 int nvars, /**< number of variables to get negated variables for */ 694 SCIP_VAR** vars, /**< array of variables to get negated variables for */ 695 SCIP_VAR** negvars /**< array to store the negated variables */ 696 ); 697 698 /** gets a binary variable that is equal to the given binary variable, and that is either active, fixed, or 699 * multi-aggregated, or the negated variable of an active, fixed, or multi-aggregated variable 700 * 701 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 702 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 703 * 704 * @pre This method can be called if @p scip is in one of the following stages: 705 * - \ref SCIP_STAGE_PROBLEM 706 * - \ref SCIP_STAGE_TRANSFORMED 707 * - \ref SCIP_STAGE_INITPRESOLVE 708 * - \ref SCIP_STAGE_PRESOLVING 709 * - \ref SCIP_STAGE_EXITPRESOLVE 710 * - \ref SCIP_STAGE_PRESOLVED 711 * - \ref SCIP_STAGE_INITSOLVE 712 * - \ref SCIP_STAGE_SOLVING 713 * - \ref SCIP_STAGE_SOLVED 714 * - \ref SCIP_STAGE_EXITSOLVE 715 */ 716 SCIP_EXPORT 717 SCIP_RETCODE SCIPgetBinvarRepresentative( 718 SCIP* scip, /**< SCIP data structure */ 719 SCIP_VAR* var, /**< binary variable to get binary representative for */ 720 SCIP_VAR** repvar, /**< pointer to store the binary representative */ 721 SCIP_Bool* negated /**< pointer to store whether the negation of an active variable was returned */ 722 ); 723 724 /** gets binary variables that are equal to the given binary variables, and which are either active, fixed, or 725 * multi-aggregated, or the negated variables of active, fixed, or multi-aggregated variables 726 * 727 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 728 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 729 * 730 * @pre This method can be called if @p scip is in one of the following stages: 731 * - \ref SCIP_STAGE_PROBLEM 732 * - \ref SCIP_STAGE_TRANSFORMED 733 * - \ref SCIP_STAGE_INITPRESOLVE 734 * - \ref SCIP_STAGE_PRESOLVING 735 * - \ref SCIP_STAGE_EXITPRESOLVE 736 * - \ref SCIP_STAGE_PRESOLVED 737 * - \ref SCIP_STAGE_INITSOLVE 738 * - \ref SCIP_STAGE_SOLVING 739 * - \ref SCIP_STAGE_SOLVED 740 * - \ref SCIP_STAGE_EXITSOLVE 741 */ 742 SCIP_EXPORT 743 SCIP_RETCODE SCIPgetBinvarRepresentatives( 744 SCIP* scip, /**< SCIP data structure */ 745 int nvars, /**< number of binary variables to get representatives for */ 746 SCIP_VAR** vars, /**< binary variables to get binary representatives for */ 747 SCIP_VAR** repvars, /**< array to store the binary representatives */ 748 SCIP_Bool* negated /**< array to store whether the negation of an active variable was returned */ 749 ); 750 751 /** flattens aggregation graph of multi-aggregated variable in order to avoid exponential recursion later on 752 * 753 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 754 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 755 * 756 * @pre This method can be called if @p scip is in one of the following stages: 757 * - \ref SCIP_STAGE_INITPRESOLVE 758 * - \ref SCIP_STAGE_PRESOLVING 759 * - \ref SCIP_STAGE_EXITPRESOLVE 760 * - \ref SCIP_STAGE_PRESOLVED 761 * - \ref SCIP_STAGE_INITSOLVE 762 * - \ref SCIP_STAGE_SOLVING 763 * - \ref SCIP_STAGE_SOLVED 764 */ 765 SCIP_EXPORT 766 SCIP_RETCODE SCIPflattenVarAggregationGraph( 767 SCIP* scip, /**< SCIP data structure */ 768 SCIP_VAR* var /**< problem variable */ 769 ); 770 771 /** Transforms a given linear sum of variables, that is a_1*x_1 + ... + a_n*x_n + c into a corresponding linear sum of 772 * active variables, that is b_1*y_1 + ... + b_m*y_m + d. 773 * 774 * If the number of needed active variables is greater than the available slots in the variable array, nothing happens 775 * except that the required size is stored in the corresponding variable (requiredsize). Otherwise, the active variable 776 * representation is stored in the variable array, scalar array and constant. 777 * 778 * The reason for this approach is that we cannot reallocate memory, since we do not know how the memory has been 779 * allocated (e.g., by a C++ 'new' or SCIP functions). 780 * 781 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 782 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 783 * 784 * @pre This method can be called if @p scip is in one of the following stages: 785 * - \ref SCIP_STAGE_TRANSFORMED 786 * - \ref SCIP_STAGE_INITPRESOLVE 787 * - \ref SCIP_STAGE_PRESOLVING 788 * - \ref SCIP_STAGE_EXITPRESOLVE 789 * - \ref SCIP_STAGE_PRESOLVED 790 * - \ref SCIP_STAGE_INITSOLVE 791 * - \ref SCIP_STAGE_SOLVING 792 * - \ref SCIP_STAGE_SOLVED 793 * - \ref SCIP_STAGE_EXITSOLVE 794 * - \ref SCIP_STAGE_FREETRANS 795 * 796 * @note The resulting linear sum is stored into the given variable array, scalar array, and constant. That means the 797 * given entries are overwritten. 798 * 799 * @note That method can be used to convert a single variables into variable space of active variables. Therefore call 800 * the method with the linear sum 1.0*x + 0.0. 801 */ 802 SCIP_EXPORT 803 SCIP_RETCODE SCIPgetProbvarLinearSum( 804 SCIP* scip, /**< SCIP data structure */ 805 SCIP_VAR** vars, /**< variable array x_1, ..., x_n in the linear sum which will be 806 * overwritten by the variable array y_1, ..., y_m in the linear sum 807 * w.r.t. active variables */ 808 SCIP_Real* scalars, /**< scalars a_1, ..., a_n in linear sum which will be overwritten to the 809 * scalars b_1, ..., b_m in the linear sum of the active variables */ 810 int* nvars, /**< pointer to number of variables in the linear sum which will be 811 * overwritten by the number of variables in the linear sum corresponding 812 * to the active variables */ 813 int varssize, /**< available slots in vars and scalars array which is needed to check if 814 * the array are large enough for the linear sum w.r.t. active 815 * variables */ 816 SCIP_Real* constant, /**< pointer to constant c in linear sum a_1*x_1 + ... + a_n*x_n + c which 817 * will chnage to constant d in the linear sum b_1*y_1 + ... + b_m*y_m + 818 * d w.r.t. the active variables */ 819 int* requiredsize, /**< pointer to store the required array size for the linear sum w.r.t. the 820 * active variables */ 821 SCIP_Bool mergemultiples /**< should multiple occurrences of a var be replaced by a single coeff? */ 822 ); 823 824 /** transforms given variable, scalar and constant to the corresponding active, fixed, or 825 * multi-aggregated variable, scalar and constant; if the variable resolves to a fixed variable, 826 * "scalar" will be 0.0 and the value of the sum will be stored in "constant"; a multi-aggregation 827 * with only one active variable (this can happen due to fixings after the multi-aggregation), 828 * is treated like an aggregation; if the multi-aggregation constant is infinite, "scalar" will be 0.0 829 * 830 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 831 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 832 * 833 * @pre This method can be called if @p scip is in one of the following stages: 834 * - \ref SCIP_STAGE_TRANSFORMED 835 * - \ref SCIP_STAGE_INITPRESOLVE 836 * - \ref SCIP_STAGE_PRESOLVING 837 * - \ref SCIP_STAGE_EXITPRESOLVE 838 * - \ref SCIP_STAGE_PRESOLVED 839 * - \ref SCIP_STAGE_INITSOLVE 840 * - \ref SCIP_STAGE_SOLVING 841 * - \ref SCIP_STAGE_SOLVED 842 * - \ref SCIP_STAGE_EXITSOLVE 843 * - \ref SCIP_STAGE_FREETRANS 844 */ 845 SCIP_EXPORT 846 SCIP_RETCODE SCIPgetProbvarSum( 847 SCIP* scip, /**< SCIP data structure */ 848 SCIP_VAR** var, /**< pointer to problem variable x in sum a*x + c */ 849 SCIP_Real* scalar, /**< pointer to scalar a in sum a*x + c */ 850 SCIP_Real* constant /**< pointer to constant c in sum a*x + c */ 851 ); 852 853 /** return for given variables all their active counterparts; all active variables will be pairwise different 854 * @note It does not hold that the first output variable is the active variable for the first input variable. 855 * 856 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 857 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 858 * 859 * @pre This method can be called if @p scip is in one of the following stages: 860 * - \ref SCIP_STAGE_TRANSFORMED 861 * - \ref SCIP_STAGE_INITPRESOLVE 862 * - \ref SCIP_STAGE_PRESOLVING 863 * - \ref SCIP_STAGE_EXITPRESOLVE 864 * - \ref SCIP_STAGE_PRESOLVED 865 * - \ref SCIP_STAGE_INITSOLVE 866 * - \ref SCIP_STAGE_SOLVING 867 * - \ref SCIP_STAGE_SOLVED 868 * - \ref SCIP_STAGE_EXITSOLVE 869 * - \ref SCIP_STAGE_FREETRANS 870 */ 871 SCIP_EXPORT 872 SCIP_RETCODE SCIPgetActiveVars( 873 SCIP* scip, /**< SCIP data structure */ 874 SCIP_VAR** vars, /**< variable array with given variables and as output all active 875 * variables, if enough slots exist */ 876 int* nvars, /**< number of given variables, and as output number of active variables, 877 * if enough slots exist */ 878 int varssize, /**< available slots in vars array */ 879 int* requiredsize /**< pointer to store the required array size for the active variables */ 880 ); 881 882 /** returns the reduced costs of the variable in the current node's LP relaxation; 883 * the current node has to have a feasible LP. 884 * 885 * returns SCIP_INVALID if the variable is active but not in the current LP; 886 * returns 0 if the variable has been aggregated out or fixed in presolving. 887 * 888 * @pre This method can only be called if @p scip is in stage \ref SCIP_STAGE_SOLVING 889 * 890 * @note The return value of this method should be used carefully if the dual feasibility check was explictely disabled. 891 */ 892 SCIP_EXPORT 893 SCIP_Real SCIPgetVarRedcost( 894 SCIP* scip, /**< SCIP data structure */ 895 SCIP_VAR* var /**< variable to get reduced costs, should be a column in current node LP */ 896 ); 897 898 /** returns the implied reduced costs of the variable in the current node's LP relaxation; 899 * the current node has to have a feasible LP. 900 * 901 * returns SCIP_INVALID if the variable is active but not in the current LP; 902 * returns 0 if the variable has been aggregated out or fixed in presolving. 903 * 904 * @pre This method can only be called if @p scip is in stage \ref SCIP_STAGE_SOLVING 905 * 906 * @note The return value of this method should be used carefully if the dual feasibility check was explictely disabled. 907 */ 908 SCIP_EXPORT 909 SCIP_Real SCIPgetVarImplRedcost( 910 SCIP* scip, /**< SCIP data structure */ 911 SCIP_VAR* var, /**< variable to get reduced costs, should be a column in current node LP */ 912 SCIP_Bool varfixing /**< FALSE if for x == 0, TRUE for x == 1 */ 913 ); 914 915 /** returns the Farkas coefficient of the variable in the current node's LP relaxation; 916 * the current node has to have an infeasible LP. 917 * 918 * returns SCIP_INVALID if the variable is active but not in the current LP; 919 * returns 0 if the variable has been aggregated out or fixed in presolving. 920 * 921 * @pre This method can only be called if @p scip is in stage \ref SCIP_STAGE_SOLVING 922 */ 923 SCIP_EXPORT 924 SCIP_Real SCIPgetVarFarkasCoef( 925 SCIP* scip, /**< SCIP data structure */ 926 SCIP_VAR* var /**< variable to get reduced costs, should be a column in current node LP */ 927 ); 928 929 /** returns lower bound of variable directly before or after the bound change given by the bound change index 930 * was applied 931 */ 932 SCIP_EXPORT 933 SCIP_Real SCIPgetVarLbAtIndex( 934 SCIP* scip, /**< SCIP data structure */ 935 SCIP_VAR* var, /**< problem variable */ 936 SCIP_BDCHGIDX* bdchgidx, /**< bound change index representing time on path to current node */ 937 SCIP_Bool after /**< should the bound change with given index be included? */ 938 ); 939 940 /** returns upper bound of variable directly before or after the bound change given by the bound change index 941 * was applied 942 */ 943 SCIP_EXPORT 944 SCIP_Real SCIPgetVarUbAtIndex( 945 SCIP* scip, /**< SCIP data structure */ 946 SCIP_VAR* var, /**< problem variable */ 947 SCIP_BDCHGIDX* bdchgidx, /**< bound change index representing time on path to current node */ 948 SCIP_Bool after /**< should the bound change with given index be included? */ 949 ); 950 951 /** returns lower or upper bound of variable directly before or after the bound change given by the bound change index 952 * was applied 953 */ 954 SCIP_EXPORT 955 SCIP_Real SCIPgetVarBdAtIndex( 956 SCIP* scip, /**< SCIP data structure */ 957 SCIP_VAR* var, /**< problem variable */ 958 SCIP_BOUNDTYPE boundtype, /**< type of bound: lower or upper bound */ 959 SCIP_BDCHGIDX* bdchgidx, /**< bound change index representing time on path to current node */ 960 SCIP_Bool after /**< should the bound change with given index be included? */ 961 ); 962 963 /** returns whether the binary variable was fixed at the time given by the bound change index */ 964 SCIP_EXPORT 965 SCIP_Bool SCIPgetVarWasFixedAtIndex( 966 SCIP* scip, /**< SCIP data structure */ 967 SCIP_VAR* var, /**< problem variable */ 968 SCIP_BDCHGIDX* bdchgidx, /**< bound change index representing time on path to current node */ 969 SCIP_Bool after /**< should the bound change with given index be included? */ 970 ); 971 972 /** gets solution value for variable in current node 973 * 974 * @return solution value for variable in current node 975 * 976 * @pre This method can be called if @p scip is in one of the following stages: 977 * - \ref SCIP_STAGE_PRESOLVED 978 * - \ref SCIP_STAGE_SOLVING 979 */ 980 SCIP_EXPORT 981 SCIP_Real SCIPgetVarSol( 982 SCIP* scip, /**< SCIP data structure */ 983 SCIP_VAR* var /**< variable to get solution value for */ 984 ); 985 986 /** gets solution values of multiple variables in current node 987 * 988 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 989 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 990 * 991 * @pre This method can be called if @p scip is in one of the following stages: 992 * - \ref SCIP_STAGE_PRESOLVED 993 * - \ref SCIP_STAGE_SOLVING 994 */ 995 SCIP_EXPORT 996 SCIP_RETCODE SCIPgetVarSols( 997 SCIP* scip, /**< SCIP data structure */ 998 int nvars, /**< number of variables to get solution value for */ 999 SCIP_VAR** vars, /**< array with variables to get value for */ 1000 SCIP_Real* vals /**< array to store solution values of variables */ 1001 ); 1002 1003 /** sets the solution value of all variables in the global relaxation solution to zero 1004 * 1005 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 1006 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 1007 * 1008 * @pre This method can be called if @p scip is in one of the following stages: 1009 * - \ref SCIP_STAGE_PRESOLVED 1010 * - \ref SCIP_STAGE_SOLVING 1011 */ 1012 SCIP_EXPORT 1013 SCIP_RETCODE SCIPclearRelaxSolVals( 1014 SCIP* scip, /**< SCIP data structure */ 1015 SCIP_RELAX* relax /**< relaxator data structure */ 1016 ); 1017 1018 /** sets the value of the given variable in the global relaxation solution; 1019 * this solution can be filled by the relaxation handlers and can be used by heuristics and for separation; 1020 * You can use SCIPclearRelaxSolVals() to set all values to zero, initially; 1021 * after setting all solution values, you have to call SCIPmarkRelaxSolValid() 1022 * to inform SCIP that the stored solution is valid 1023 * 1024 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 1025 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 1026 * 1027 * @pre This method can be called if @p scip is in one of the following stages: 1028 * - \ref SCIP_STAGE_PRESOLVED 1029 * - \ref SCIP_STAGE_SOLVING 1030 * 1031 * @note This method incrementally updates the objective value of the relaxation solution. If the whole solution 1032 * should be updated, using SCIPsetRelaxSolVals() instead or calling SCIPclearRelaxSolVals() before setting 1033 * the first value to reset the solution and the objective value to 0 may help the numerics. 1034 */ 1035 SCIP_EXPORT 1036 SCIP_RETCODE SCIPsetRelaxSolVal( 1037 SCIP* scip, /**< SCIP data structure */ 1038 SCIP_RELAX* relax, /**< relaxator data structure */ 1039 SCIP_VAR* var, /**< variable to set value for */ 1040 SCIP_Real val /**< solution value of variable */ 1041 ); 1042 1043 /** sets the values of the given variables in the global relaxation solution and informs SCIP about the validity 1044 * and whether the solution can be enforced via linear cuts; 1045 * this solution can be filled by the relaxation handlers and can be used by heuristics and for separation; 1046 * the solution is automatically cleared, s.t. all other variables get value 0.0 1047 * 1048 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 1049 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 1050 * 1051 * @pre This method can be called if @p scip is in one of the following stages: 1052 * - \ref SCIP_STAGE_PRESOLVED 1053 * - \ref SCIP_STAGE_SOLVING 1054 */ 1055 SCIP_EXPORT 1056 SCIP_RETCODE SCIPsetRelaxSolVals( 1057 SCIP* scip, /**< SCIP data structure */ 1058 SCIP_RELAX* relax, /**< relaxator data structure */ 1059 int nvars, /**< number of variables to set relaxation solution value for */ 1060 SCIP_VAR** vars, /**< array with variables to set value for */ 1061 SCIP_Real* vals, /**< array with solution values of variables */ 1062 SCIP_Bool includeslp /**< does the relaxator contain all cuts in the LP? */ 1063 ); 1064 1065 /** sets the values of the variables in the global relaxation solution to the values in the given primal solution 1066 * and informs SCIP about the validity and whether the solution can be enforced via linear cuts; 1067 * the relaxation solution can be filled by the relaxation handlers and might be used by heuristics and for separation 1068 * 1069 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 1070 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 1071 * 1072 * @pre This method can be called if @p scip is in one of the following stages: 1073 * - \ref SCIP_STAGE_PRESOLVED 1074 * - \ref SCIP_STAGE_SOLVING 1075 */ 1076 SCIP_EXPORT 1077 SCIP_RETCODE SCIPsetRelaxSolValsSol( 1078 SCIP* scip, /**< SCIP data structure */ 1079 SCIP_RELAX* relax, /**< relaxator data structure */ 1080 SCIP_SOL* sol, /**< primal relaxation solution */ 1081 SCIP_Bool includeslp /**< does the relaxator contain all cuts in the LP? */ 1082 ); 1083 1084 /** returns whether the relaxation solution is valid 1085 * 1086 * @return TRUE, if the relaxation solution is valid; FALSE, otherwise 1087 * 1088 * @pre This method can be called if @p scip is in one of the following stages: 1089 * - \ref SCIP_STAGE_PRESOLVED 1090 * - \ref SCIP_STAGE_SOLVING 1091 */ 1092 SCIP_EXPORT 1093 SCIP_Bool SCIPisRelaxSolValid( 1094 SCIP* scip /**< SCIP data structure */ 1095 ); 1096 1097 /** informs SCIP that the relaxation solution is valid and whether the relaxation can be enforced through linear cuts 1098 * 1099 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 1100 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 1101 * 1102 * @pre This method can be called if @p scip is in one of the following stages: 1103 * - \ref SCIP_STAGE_PRESOLVED 1104 * - \ref SCIP_STAGE_SOLVING 1105 */ 1106 SCIP_EXPORT 1107 SCIP_RETCODE SCIPmarkRelaxSolValid( 1108 SCIP* scip, /**< SCIP data structure */ 1109 SCIP_RELAX* relax, /**< relaxator data structure that set the current relaxation solution */ 1110 SCIP_Bool includeslp /**< does the relaxator contain all cuts in the LP? */ 1111 ); 1112 1113 /** informs SCIP, that the relaxation solution is invalid 1114 * 1115 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 1116 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 1117 * 1118 * @pre This method can be called if @p scip is in one of the following stages: 1119 * - \ref SCIP_STAGE_PRESOLVED 1120 * - \ref SCIP_STAGE_SOLVING 1121 */ 1122 SCIP_EXPORT 1123 SCIP_RETCODE SCIPmarkRelaxSolInvalid( 1124 SCIP* scip /**< SCIP data structure */ 1125 ); 1126 1127 /** gets the relaxation solution value of the given variable 1128 * 1129 * @return the relaxation solution value of the given variable 1130 * 1131 * @pre This method can be called if @p scip is in one of the following stages: 1132 * - \ref SCIP_STAGE_PRESOLVED 1133 * - \ref SCIP_STAGE_SOLVING 1134 */ 1135 SCIP_EXPORT 1136 SCIP_Real SCIPgetRelaxSolVal( 1137 SCIP* scip, /**< SCIP data structure */ 1138 SCIP_VAR* var /**< variable to get value for */ 1139 ); 1140 1141 /** gets the relaxation solution objective value 1142 * 1143 * @return the objective value of the relaxation solution 1144 * 1145 * @pre This method can be called if @p scip is in one of the following stages: 1146 * - \ref SCIP_STAGE_PRESOLVED 1147 * - \ref SCIP_STAGE_SOLVING 1148 */ 1149 SCIP_EXPORT 1150 SCIP_Real SCIPgetRelaxSolObj( 1151 SCIP* scip /**< SCIP data structure */ 1152 ); 1153 1154 /** determine which branching direction should be evaluated first by strong branching 1155 * 1156 * @return TRUE iff strong branching should first evaluate the down child 1157 * 1158 */ 1159 SCIP_EXPORT 1160 SCIP_Bool SCIPisStrongbranchDownFirst( 1161 SCIP* scip, /**< SCIP data structure */ 1162 SCIP_VAR* var /**< variable to determine the branching direction on */ 1163 ); 1164 1165 /** start strong branching - call before any strong branching 1166 * 1167 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 1168 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 1169 * 1170 * @pre This method can be called if @p scip is in one of the following stages: 1171 * - \ref SCIP_STAGE_PRESOLVED 1172 * - \ref SCIP_STAGE_SOLVING 1173 * 1174 * @note if propagation is enabled, strong branching is not done directly on the LP, but probing nodes are created 1175 * which allow to perform propagation but also creates some overhead 1176 */ 1177 SCIP_EXPORT 1178 SCIP_RETCODE SCIPstartStrongbranch( 1179 SCIP* scip, /**< SCIP data structure */ 1180 SCIP_Bool enablepropagation /**< should propagation be done before solving the strong branching LP? */ 1181 ); 1182 1183 /** end strong branching - call after any strong branching 1184 * 1185 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 1186 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 1187 * 1188 * @pre This method can be called if @p scip is in one of the following stages: 1189 * - \ref SCIP_STAGE_PRESOLVED 1190 * - \ref SCIP_STAGE_SOLVING 1191 */ 1192 SCIP_EXPORT 1193 SCIP_RETCODE SCIPendStrongbranch( 1194 SCIP* scip /**< SCIP data structure */ 1195 ); 1196 1197 /** gets strong branching information on column variable with fractional value 1198 * 1199 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 1200 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 1201 * 1202 * @pre This method can be called if @p scip is in one of the following stages: 1203 * - \ref SCIP_STAGE_PRESOLVED 1204 * - \ref SCIP_STAGE_SOLVING 1205 */ 1206 SCIP_EXPORT 1207 SCIP_RETCODE SCIPgetVarStrongbranchFrac( 1208 SCIP* scip, /**< SCIP data structure */ 1209 SCIP_VAR* var, /**< variable to get strong branching values for */ 1210 int itlim, /**< iteration limit for strong branchings */ 1211 SCIP_Bool idempotent, /**< should scip's state remain the same after the call (statistics, column states...), or should it be updated ? */ 1212 SCIP_Real* down, /**< stores dual bound after branching column down */ 1213 SCIP_Real* up, /**< stores dual bound after branching column up */ 1214 SCIP_Bool* downvalid, /**< stores whether the returned down value is a valid dual bound, or NULL; 1215 * otherwise, it can only be used as an estimate value */ 1216 SCIP_Bool* upvalid, /**< stores whether the returned up value is a valid dual bound, or NULL; 1217 * otherwise, it can only be used as an estimate value */ 1218 SCIP_Bool* downinf, /**< pointer to store whether the downwards branch is infeasible, or NULL */ 1219 SCIP_Bool* upinf, /**< pointer to store whether the upwards branch is infeasible, or NULL */ 1220 SCIP_Bool* downconflict, /**< pointer to store whether a conflict constraint was created for an 1221 * infeasible downwards branch, or NULL */ 1222 SCIP_Bool* upconflict, /**< pointer to store whether a conflict constraint was created for an 1223 * infeasible upwards branch, or NULL */ 1224 SCIP_Bool* lperror /**< pointer to store whether an unresolved LP error occurred or the 1225 * solving process should be stopped (e.g., due to a time limit) */ 1226 ); 1227 1228 /** gets strong branching information with previous domain propagation on column variable 1229 * 1230 * Before calling this method, the strong branching mode must have been activated by calling SCIPstartStrongbranch(); 1231 * after strong branching was done for all candidate variables, the strong branching mode must be ended by 1232 * SCIPendStrongbranch(). Since this method applies domain propagation before strongbranching, propagation has to be be 1233 * enabled in the SCIPstartStrongbranch() call. 1234 * 1235 * Before solving the strong branching LP, domain propagation can be performed. The number of propagation rounds 1236 * can be specified by the parameter @p maxproprounds. 1237 * 1238 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 1239 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 1240 * 1241 * @pre This method can be called if @p scip is in one of the following stages: 1242 * - \ref SCIP_STAGE_PRESOLVED 1243 * - \ref SCIP_STAGE_SOLVING 1244 * 1245 * @warning When using this method, LP banching candidates and solution values must be copied beforehand, because 1246 * they are updated w.r.t. the strong branching LP solution. 1247 */ 1248 SCIP_EXPORT 1249 SCIP_RETCODE SCIPgetVarStrongbranchWithPropagation( 1250 SCIP* scip, /**< SCIP data structure */ 1251 SCIP_VAR* var, /**< variable to get strong branching values for */ 1252 SCIP_Real solval, /**< value of the variable in the current LP solution */ 1253 SCIP_Real lpobjval, /**< LP objective value of the current LP solution */ 1254 int itlim, /**< iteration limit for strong branchings */ 1255 int maxproprounds, /**< maximum number of propagation rounds (-1: no limit, -2: parameter 1256 * settings) */ 1257 SCIP_Real* down, /**< stores dual bound after branching column down */ 1258 SCIP_Real* up, /**< stores dual bound after branching column up */ 1259 SCIP_Bool* downvalid, /**< stores whether the returned down value is a valid dual bound, or NULL; 1260 * otherwise, it can only be used as an estimate value */ 1261 SCIP_Bool* upvalid, /**< stores whether the returned up value is a valid dual bound, or NULL; 1262 * otherwise, it can only be used as an estimate value */ 1263 SCIP_Longint* ndomredsdown, /**< pointer to store the number of domain reductions down, or NULL */ 1264 SCIP_Longint* ndomredsup, /**< pointer to store the number of domain reductions up, or NULL */ 1265 SCIP_Bool* downinf, /**< pointer to store whether the downwards branch is infeasible, or NULL */ 1266 SCIP_Bool* upinf, /**< pointer to store whether the upwards branch is infeasible, or NULL */ 1267 SCIP_Bool* downconflict, /**< pointer to store whether a conflict constraint was created for an 1268 * infeasible downwards branch, or NULL */ 1269 SCIP_Bool* upconflict, /**< pointer to store whether a conflict constraint was created for an 1270 * infeasible upwards branch, or NULL */ 1271 SCIP_Bool* lperror, /**< pointer to store whether an unresolved LP error occurred or the 1272 * solving process should be stopped (e.g., due to a time limit) */ 1273 SCIP_Real* newlbs, /**< array to store valid lower bounds for all active variables, or NULL */ 1274 SCIP_Real* newubs /**< array to store valid upper bounds for all active variables, or NULL */ 1275 ); 1276 1277 /** gets strong branching information on column variable x with integral LP solution value (val); that is, the down branch 1278 * is (val -1.0) and the up brach ins (val +1.0) 1279 * 1280 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 1281 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 1282 * 1283 * @pre This method can be called if @p scip is in one of the following stages: 1284 * - \ref SCIP_STAGE_PRESOLVED 1285 * - \ref SCIP_STAGE_SOLVING 1286 * 1287 * @note If the integral LP solution value is the lower or upper bound of the variable, the corresponding branch will be 1288 * marked as infeasible. That is, the valid pointer and the infeasible pointer are set to TRUE. 1289 */ 1290 SCIP_EXPORT 1291 SCIP_RETCODE SCIPgetVarStrongbranchInt( 1292 SCIP* scip, /**< SCIP data structure */ 1293 SCIP_VAR* var, /**< variable to get strong branching values for */ 1294 int itlim, /**< iteration limit for strong branchings */ 1295 SCIP_Bool idempotent, /**< should scip's state remain the same after the call (statistics, column states...), or should it be updated ? */ 1296 SCIP_Real* down, /**< stores dual bound after branching column down */ 1297 SCIP_Real* up, /**< stores dual bound after branching column up */ 1298 SCIP_Bool* downvalid, /**< stores whether the returned down value is a valid dual bound, or NULL; 1299 * otherwise, it can only be used as an estimate value */ 1300 SCIP_Bool* upvalid, /**< stores whether the returned up value is a valid dual bound, or NULL; 1301 * otherwise, it can only be used as an estimate value */ 1302 SCIP_Bool* downinf, /**< pointer to store whether the downwards branch is infeasible, or NULL */ 1303 SCIP_Bool* upinf, /**< pointer to store whether the upwards branch is infeasible, or NULL */ 1304 SCIP_Bool* downconflict, /**< pointer to store whether a conflict constraint was created for an 1305 * infeasible downwards branch, or NULL */ 1306 SCIP_Bool* upconflict, /**< pointer to store whether a conflict constraint was created for an 1307 * infeasible upwards branch, or NULL */ 1308 SCIP_Bool* lperror /**< pointer to store whether an unresolved LP error occurred or the 1309 * solving process should be stopped (e.g., due to a time limit) */ 1310 ); 1311 1312 /** gets strong branching information on column variables with fractional values 1313 * 1314 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 1315 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 1316 * 1317 * @pre This method can be called if @p scip is in one of the following stages: 1318 * - \ref SCIP_STAGE_PRESOLVED 1319 * - \ref SCIP_STAGE_SOLVING 1320 */ 1321 SCIP_EXPORT 1322 SCIP_RETCODE SCIPgetVarsStrongbranchesFrac( 1323 SCIP* scip, /**< SCIP data structure */ 1324 SCIP_VAR** vars, /**< variables to get strong branching values for */ 1325 int nvars, /**< number of variables */ 1326 int itlim, /**< iteration limit for strong branchings */ 1327 SCIP_Real* down, /**< stores dual bounds after branching variables down */ 1328 SCIP_Real* up, /**< stores dual bounds after branching variables up */ 1329 SCIP_Bool* downvalid, /**< stores whether the returned down values are valid dual bounds, or NULL; 1330 * otherwise, they can only be used as an estimate value */ 1331 SCIP_Bool* upvalid, /**< stores whether the returned up values are valid dual bounds, or NULL; 1332 * otherwise, they can only be used as an estimate value */ 1333 SCIP_Bool* downinf, /**< array to store whether the downward branches are infeasible, or NULL */ 1334 SCIP_Bool* upinf, /**< array to store whether the upward branches are infeasible, or NULL */ 1335 SCIP_Bool* downconflict, /**< array to store whether conflict constraints were created for 1336 * infeasible downward branches, or NULL */ 1337 SCIP_Bool* upconflict, /**< array to store whether conflict constraints were created for 1338 * infeasible upward branches, or NULL */ 1339 SCIP_Bool* lperror /**< pointer to store whether an unresolved LP error occurred or the 1340 * solving process should be stopped (e.g., due to a time limit) */ 1341 ); 1342 1343 /** gets strong branching information on column variables with integral values 1344 * 1345 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 1346 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 1347 * 1348 * @pre This method can be called if @p scip is in one of the following stages: 1349 * - \ref SCIP_STAGE_PRESOLVED 1350 * - \ref SCIP_STAGE_SOLVING 1351 */ 1352 SCIP_EXPORT 1353 SCIP_RETCODE SCIPgetVarsStrongbranchesInt( 1354 SCIP* scip, /**< SCIP data structure */ 1355 SCIP_VAR** vars, /**< variables to get strong branching values for */ 1356 int nvars, /**< number of variables */ 1357 int itlim, /**< iteration limit for strong branchings */ 1358 SCIP_Real* down, /**< stores dual bounds after branching variables down */ 1359 SCIP_Real* up, /**< stores dual bounds after branching variables up */ 1360 SCIP_Bool* downvalid, /**< stores whether the returned down values are valid dual bounds, or NULL; 1361 * otherwise, they can only be used as an estimate value */ 1362 SCIP_Bool* upvalid, /**< stores whether the returned up values are valid dual bounds, or NULL; 1363 * otherwise, they can only be used as an estimate value */ 1364 SCIP_Bool* downinf, /**< array to store whether the downward branches are infeasible, or NULL */ 1365 SCIP_Bool* upinf, /**< array to store whether the upward branches are infeasible, or NULL */ 1366 SCIP_Bool* downconflict, /**< array to store whether conflict constraints were created for 1367 * infeasible downward branches, or NULL */ 1368 SCIP_Bool* upconflict, /**< array to store whether conflict constraints were created for 1369 * infeasible upward branches, or NULL */ 1370 SCIP_Bool* lperror /**< pointer to store whether an unresolved LP error occurred or the 1371 * solving process should be stopped (e.g., due to a time limit) */ 1372 ); 1373 1374 /** get LP solution status of last strong branching call (currently only works for strong branching with propagation) */ 1375 SCIP_EXPORT 1376 SCIP_LPSOLSTAT SCIPgetLastStrongbranchLPSolStat( 1377 SCIP* scip, /**< SCIP data structure */ 1378 SCIP_BRANCHDIR branchdir /**< branching direction for which LP solution status is requested */ 1379 ); 1380 1381 /** gets strong branching information on COLUMN variable of the last SCIPgetVarStrongbranch() call; 1382 * returns values of SCIP_INVALID, if strong branching was not yet called on the given variable; 1383 * keep in mind, that the returned old values may have nothing to do with the current LP solution 1384 * 1385 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 1386 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 1387 * 1388 * @pre This method can be called if @p scip is in one of the following stages: 1389 * - \ref SCIP_STAGE_SOLVING 1390 * - \ref SCIP_STAGE_SOLVED 1391 */ 1392 SCIP_EXPORT 1393 SCIP_RETCODE SCIPgetVarStrongbranchLast( 1394 SCIP* scip, /**< SCIP data structure */ 1395 SCIP_VAR* var, /**< variable to get last strong branching values for */ 1396 SCIP_Real* down, /**< stores dual bound after branching column down, or NULL */ 1397 SCIP_Real* up, /**< stores dual bound after branching column up, or NULL */ 1398 SCIP_Bool* downvalid, /**< stores whether the returned down value is a valid dual bound, or NULL; 1399 * otherwise, it can only be used as an estimate value */ 1400 SCIP_Bool* upvalid, /**< stores whether the returned up value is a valid dual bound, or NULL; 1401 * otherwise, it can only be used as an estimate value */ 1402 SCIP_Real* solval, /**< stores LP solution value of variable at last strong branching call, or NULL */ 1403 SCIP_Real* lpobjval /**< stores LP objective value at last strong branching call, or NULL */ 1404 ); 1405 1406 /** sets strong branching information for a column variable 1407 * 1408 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 1409 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 1410 * 1411 * @pre This method can be called if @p scip is in one of the following stages: 1412 * - \ref SCIP_STAGE_SOLVING 1413 */ 1414 SCIP_EXPORT 1415 SCIP_RETCODE SCIPsetVarStrongbranchData( 1416 SCIP* scip, /**< SCIP data structure */ 1417 SCIP_VAR* var, /**< variable to set last strong branching values for */ 1418 SCIP_Real lpobjval, /**< objective value of the current LP */ 1419 SCIP_Real primsol, /**< primal solution value of the column in the current LP */ 1420 SCIP_Real down, /**< dual bound after branching column down */ 1421 SCIP_Real up, /**< dual bound after branching column up */ 1422 SCIP_Bool downvalid, /**< is the returned down value a valid dual bound? */ 1423 SCIP_Bool upvalid, /**< is the returned up value a valid dual bound? */ 1424 SCIP_Longint iter, /**< total number of strong branching iterations */ 1425 int itlim /**< iteration limit applied to the strong branching call */ 1426 ); 1427 1428 /** rounds the current solution and tries it afterwards; if feasible, adds it to storage 1429 * 1430 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 1431 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 1432 * 1433 * @pre This method can be called if @p scip is in one of the following stages: 1434 * - \ref SCIP_STAGE_SOLVING 1435 */ 1436 SCIP_EXPORT 1437 SCIP_RETCODE SCIPtryStrongbranchLPSol( 1438 SCIP* scip, /**< SCIP data structure */ 1439 SCIP_Bool* foundsol, /**< stores whether solution was feasible and good enough to keep */ 1440 SCIP_Bool* cutoff /**< stores whether solution was cutoff due to exceeding the cutoffbound */ 1441 ); 1442 1443 /** gets node number of the last node in current branch and bound run, where strong branching was used on the 1444 * given variable, or -1 if strong branching was never applied to the variable in current run 1445 * 1446 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 1447 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 1448 * 1449 * @pre This method can be called if @p scip is in one of the following stages: 1450 * - \ref SCIP_STAGE_TRANSFORMING 1451 * - \ref SCIP_STAGE_TRANSFORMED 1452 * - \ref SCIP_STAGE_INITPRESOLVE 1453 * - \ref SCIP_STAGE_PRESOLVING 1454 * - \ref SCIP_STAGE_EXITPRESOLVE 1455 * - \ref SCIP_STAGE_PRESOLVED 1456 * - \ref SCIP_STAGE_INITSOLVE 1457 * - \ref SCIP_STAGE_SOLVING 1458 * - \ref SCIP_STAGE_SOLVED 1459 * - \ref SCIP_STAGE_EXITSOLVE 1460 */ 1461 SCIP_EXPORT 1462 SCIP_Longint SCIPgetVarStrongbranchNode( 1463 SCIP* scip, /**< SCIP data structure */ 1464 SCIP_VAR* var /**< variable to get last strong branching node for */ 1465 ); 1466 1467 /** if strong branching was already applied on the variable at the current node, returns the number of LPs solved after 1468 * the LP where the strong branching on this variable was applied; 1469 * if strong branching was not yet applied on the variable at the current node, returns INT_MAX 1470 * 1471 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 1472 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 1473 * 1474 * @pre This method can be called if @p scip is in one of the following stages: 1475 * - \ref SCIP_STAGE_TRANSFORMING 1476 * - \ref SCIP_STAGE_TRANSFORMED 1477 * - \ref SCIP_STAGE_INITPRESOLVE 1478 * - \ref SCIP_STAGE_PRESOLVING 1479 * - \ref SCIP_STAGE_EXITPRESOLVE 1480 * - \ref SCIP_STAGE_PRESOLVED 1481 * - \ref SCIP_STAGE_INITSOLVE 1482 * - \ref SCIP_STAGE_SOLVING 1483 * - \ref SCIP_STAGE_SOLVED 1484 * - \ref SCIP_STAGE_EXITSOLVE 1485 */ 1486 SCIP_EXPORT 1487 SCIP_Longint SCIPgetVarStrongbranchLPAge( 1488 SCIP* scip, /**< SCIP data structure */ 1489 SCIP_VAR* var /**< variable to get strong branching LP age for */ 1490 ); 1491 1492 /** gets number of times, strong branching was applied in current run on the given variable 1493 * 1494 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 1495 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 1496 * 1497 * @pre This method can be called if @p scip is in one of the following stages: 1498 * - \ref SCIP_STAGE_TRANSFORMING 1499 * - \ref SCIP_STAGE_TRANSFORMED 1500 * - \ref SCIP_STAGE_INITPRESOLVE 1501 * - \ref SCIP_STAGE_PRESOLVING 1502 * - \ref SCIP_STAGE_EXITPRESOLVE 1503 * - \ref SCIP_STAGE_PRESOLVED 1504 * - \ref SCIP_STAGE_INITSOLVE 1505 * - \ref SCIP_STAGE_SOLVING 1506 * - \ref SCIP_STAGE_SOLVED 1507 * - \ref SCIP_STAGE_EXITSOLVE 1508 */ 1509 SCIP_EXPORT 1510 int SCIPgetVarNStrongbranchs( 1511 SCIP* scip, /**< SCIP data structure */ 1512 SCIP_VAR* var /**< variable to get last strong branching node for */ 1513 ); 1514 1515 /** adds given values to lock numbers of type @p locktype of variable for rounding 1516 * 1517 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 1518 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 1519 * 1520 * @pre This method can be called if @p scip is in one of the following stages: 1521 * - \ref SCIP_STAGE_PROBLEM 1522 * - \ref SCIP_STAGE_TRANSFORMING 1523 * - \ref SCIP_STAGE_TRANSFORMED 1524 * - \ref SCIP_STAGE_INITPRESOLVE 1525 * - \ref SCIP_STAGE_PRESOLVING 1526 * - \ref SCIP_STAGE_EXITPRESOLVE 1527 * - \ref SCIP_STAGE_PRESOLVED 1528 * - \ref SCIP_STAGE_INITSOLVE 1529 * - \ref SCIP_STAGE_SOLVING 1530 * - \ref SCIP_STAGE_EXITSOLVE 1531 * - \ref SCIP_STAGE_FREETRANS 1532 */ 1533 SCIP_EXPORT 1534 SCIP_RETCODE SCIPaddVarLocksType( 1535 SCIP* scip, /**< SCIP data structure */ 1536 SCIP_VAR* var, /**< problem variable */ 1537 SCIP_LOCKTYPE locktype, /**< type of the variable locks */ 1538 int nlocksdown, /**< modification in number of rounding down locks */ 1539 int nlocksup /**< modification in number of rounding up locks */ 1540 ); 1541 1542 1543 /** adds given values to lock numbers of variable for rounding 1544 * 1545 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 1546 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 1547 * 1548 * @pre This method can be called if @p scip is in one of the following stages: 1549 * - \ref SCIP_STAGE_PROBLEM 1550 * - \ref SCIP_STAGE_TRANSFORMING 1551 * - \ref SCIP_STAGE_TRANSFORMED 1552 * - \ref SCIP_STAGE_INITPRESOLVE 1553 * - \ref SCIP_STAGE_PRESOLVING 1554 * - \ref SCIP_STAGE_EXITPRESOLVE 1555 * - \ref SCIP_STAGE_PRESOLVED 1556 * - \ref SCIP_STAGE_INITSOLVE 1557 * - \ref SCIP_STAGE_SOLVING 1558 * - \ref SCIP_STAGE_EXITSOLVE 1559 * - \ref SCIP_STAGE_FREETRANS 1560 * 1561 * @note This method will always add variable locks of type model 1562 */ 1563 SCIP_EXPORT 1564 SCIP_RETCODE SCIPaddVarLocks( 1565 SCIP* scip, /**< SCIP data structure */ 1566 SCIP_VAR* var, /**< problem variable */ 1567 int nlocksdown, /**< modification in number of rounding down locks */ 1568 int nlocksup /**< modification in number of rounding up locks */ 1569 ); 1570 1571 1572 /** add locks of type @p locktype of variable with respect to the lock status of the constraint and its negation; 1573 * this method should be called whenever the lock status of a variable in a constraint changes, for example if 1574 * the coefficient of the variable changed its sign or if the left or right hand sides of the constraint were 1575 * added or removed 1576 * 1577 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 1578 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 1579 * 1580 * @pre This method can be called if @p scip is in one of the following stages: 1581 * - \ref SCIP_STAGE_PROBLEM 1582 * - \ref SCIP_STAGE_TRANSFORMING 1583 * - \ref SCIP_STAGE_INITPRESOLVE 1584 * - \ref SCIP_STAGE_PRESOLVING 1585 * - \ref SCIP_STAGE_EXITPRESOLVE 1586 * - \ref SCIP_STAGE_INITSOLVE 1587 * - \ref SCIP_STAGE_SOLVING 1588 * - \ref SCIP_STAGE_EXITSOLVE 1589 * - \ref SCIP_STAGE_FREETRANS 1590 */ 1591 SCIP_EXPORT 1592 SCIP_RETCODE SCIPlockVarCons( 1593 SCIP* scip, /**< SCIP data structure */ 1594 SCIP_VAR* var, /**< problem variable */ 1595 SCIP_CONS* cons, /**< constraint */ 1596 SCIP_Bool lockdown, /**< should the rounding be locked in downwards direction? */ 1597 SCIP_Bool lockup /**< should the rounding be locked in upwards direction? */ 1598 ); 1599 1600 /** remove locks of type @p locktype of variable with respect to the lock status of the constraint and its negation; 1601 * this method should be called whenever the lock status of a variable in a constraint changes, for example if 1602 * the coefficient of the variable changed its sign or if the left or right hand sides of the constraint were 1603 * added or removed 1604 * 1605 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 1606 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 1607 * 1608 * @pre This method can be called if @p scip is in one of the following stages: 1609 * - \ref SCIP_STAGE_PROBLEM 1610 * - \ref SCIP_STAGE_TRANSFORMING 1611 * - \ref SCIP_STAGE_INITPRESOLVE 1612 * - \ref SCIP_STAGE_PRESOLVING 1613 * - \ref SCIP_STAGE_EXITPRESOLVE 1614 * - \ref SCIP_STAGE_INITSOLVE 1615 * - \ref SCIP_STAGE_SOLVING 1616 * - \ref SCIP_STAGE_EXITSOLVE 1617 * - \ref SCIP_STAGE_FREETRANS 1618 */ 1619 SCIP_EXPORT 1620 SCIP_RETCODE SCIPunlockVarCons( 1621 SCIP* scip, /**< SCIP data structure */ 1622 SCIP_VAR* var, /**< problem variable */ 1623 SCIP_CONS* cons, /**< constraint */ 1624 SCIP_Bool lockdown, /**< should the rounding be unlocked in downwards direction? */ 1625 SCIP_Bool lockup /**< should the rounding be unlocked in upwards direction? */ 1626 ); 1627 1628 /** changes variable's objective value 1629 * 1630 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 1631 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 1632 * 1633 * @pre This method can be called if @p scip is in one of the following stages: 1634 * - \ref SCIP_STAGE_PROBLEM 1635 * - \ref SCIP_STAGE_TRANSFORMING 1636 * - \ref SCIP_STAGE_PRESOLVING 1637 */ 1638 SCIP_EXPORT 1639 SCIP_RETCODE SCIPchgVarObj( 1640 SCIP* scip, /**< SCIP data structure */ 1641 SCIP_VAR* var, /**< variable to change the objective value for */ 1642 SCIP_Real newobj /**< new objective value */ 1643 ); 1644 1645 /** adds value to variable's objective value 1646 * 1647 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 1648 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 1649 * 1650 * @pre This method can be called if @p scip is in one of the following stages: 1651 * - \ref SCIP_STAGE_PROBLEM 1652 * - \ref SCIP_STAGE_TRANSFORMING 1653 * - \ref SCIP_STAGE_PRESOLVING 1654 * - \ref SCIP_STAGE_EXITPRESOLVE 1655 * - \ref SCIP_STAGE_PRESOLVED 1656 */ 1657 SCIP_EXPORT 1658 SCIP_RETCODE SCIPaddVarObj( 1659 SCIP* scip, /**< SCIP data structure */ 1660 SCIP_VAR* var, /**< variable to change the objective value for */ 1661 SCIP_Real addobj /**< additional objective value */ 1662 ); 1663 1664 /** returns the adjusted (i.e. rounded, if the given variable is of integral type) lower bound value; 1665 * does not change the bounds of the variable 1666 * 1667 * @return adjusted lower bound for the given variable; the bound of the variable is not changed 1668 * 1669 * @pre This method can be called if @p scip is in one of the following stages: 1670 * - \ref SCIP_STAGE_PROBLEM 1671 * - \ref SCIP_STAGE_TRANSFORMING 1672 * - \ref SCIP_STAGE_TRANSFORMED 1673 * - \ref SCIP_STAGE_INITPRESOLVE 1674 * - \ref SCIP_STAGE_PRESOLVING 1675 * - \ref SCIP_STAGE_EXITPRESOLVE 1676 * - \ref SCIP_STAGE_PRESOLVED 1677 * - \ref SCIP_STAGE_INITSOLVE 1678 * - \ref SCIP_STAGE_SOLVING 1679 * - \ref SCIP_STAGE_SOLVED 1680 * - \ref SCIP_STAGE_EXITSOLVE 1681 * - \ref SCIP_STAGE_FREETRANS 1682 */ 1683 SCIP_EXPORT 1684 SCIP_Real SCIPadjustedVarLb( 1685 SCIP* scip, /**< SCIP data structure */ 1686 SCIP_VAR* var, /**< variable to adjust the bound for */ 1687 SCIP_Real lb /**< lower bound value to adjust */ 1688 ); 1689 1690 /** returns the adjusted (i.e. rounded, if the given variable is of integral type) upper bound value; 1691 * does not change the bounds of the variable 1692 * 1693 * @return adjusted upper bound for the given variable; the bound of the variable is not changed 1694 * 1695 * @pre This method can be called if @p scip is in one of the following stages: 1696 * - \ref SCIP_STAGE_PROBLEM 1697 * - \ref SCIP_STAGE_TRANSFORMING 1698 * - \ref SCIP_STAGE_TRANSFORMED 1699 * - \ref SCIP_STAGE_INITPRESOLVE 1700 * - \ref SCIP_STAGE_PRESOLVING 1701 * - \ref SCIP_STAGE_EXITPRESOLVE 1702 * - \ref SCIP_STAGE_PRESOLVED 1703 * - \ref SCIP_STAGE_INITSOLVE 1704 * - \ref SCIP_STAGE_SOLVING 1705 * - \ref SCIP_STAGE_SOLVED 1706 * - \ref SCIP_STAGE_EXITSOLVE 1707 * - \ref SCIP_STAGE_FREETRANS 1708 */ 1709 SCIP_EXPORT 1710 SCIP_Real SCIPadjustedVarUb( 1711 SCIP* scip, /**< SCIP data structure */ 1712 SCIP_VAR* var, /**< variable to adjust the bound for */ 1713 SCIP_Real ub /**< upper bound value to adjust */ 1714 ); 1715 1716 /** depending on SCIP's stage, changes lower bound of variable in the problem, in preprocessing, or in current node; 1717 * if possible, adjusts bound to integral value; doesn't store any inference information in the bound change, such 1718 * that in conflict analysis, this change is treated like a branching decision 1719 * 1720 * @warning If SCIP is in presolving stage, it can happen that the internal variable array (which can be accessed via 1721 * SCIPgetVars()) gets resorted. 1722 * 1723 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 1724 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 1725 * 1726 * @pre This method can be called if @p scip is in one of the following stages: 1727 * - \ref SCIP_STAGE_PROBLEM 1728 * - \ref SCIP_STAGE_TRANSFORMING 1729 * - \ref SCIP_STAGE_PRESOLVING 1730 * - \ref SCIP_STAGE_SOLVING 1731 * 1732 * @note During presolving, an integer variable whose bound changes to {0,1} is upgraded to a binary variable. 1733 */ 1734 SCIP_EXPORT 1735 SCIP_RETCODE SCIPchgVarLb( 1736 SCIP* scip, /**< SCIP data structure */ 1737 SCIP_VAR* var, /**< variable to change the bound for */ 1738 SCIP_Real newbound /**< new value for bound */ 1739 ); 1740 1741 /** depending on SCIP's stage, changes upper bound of variable in the problem, in preprocessing, or in current node; 1742 * if possible, adjusts bound to integral value; doesn't store any inference information in the bound change, such 1743 * that in conflict analysis, this change is treated like a branching decision 1744 * 1745 * @warning If SCIP is in presolving stage, it can happen that the internal variable array (which can be accessed via 1746 * SCIPgetVars()) gets resorted. 1747 * 1748 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 1749 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 1750 * 1751 * @pre This method can be called if @p scip is in one of the following stages: 1752 * - \ref SCIP_STAGE_PROBLEM 1753 * - \ref SCIP_STAGE_TRANSFORMING 1754 * - \ref SCIP_STAGE_PRESOLVING 1755 * - \ref SCIP_STAGE_SOLVING 1756 * 1757 * @note During presolving, an integer variable whose bound changes to {0,1} is upgraded to a binary variable. 1758 */ 1759 SCIP_EXPORT 1760 SCIP_RETCODE SCIPchgVarUb( 1761 SCIP* scip, /**< SCIP data structure */ 1762 SCIP_VAR* var, /**< variable to change the bound for */ 1763 SCIP_Real newbound /**< new value for bound */ 1764 ); 1765 1766 /** changes lower bound of variable in the given node; if possible, adjust bound to integral value; doesn't store any 1767 * inference information in the bound change, such that in conflict analysis, this change is treated like a branching 1768 * decision 1769 * 1770 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 1771 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 1772 * 1773 * @pre This method can only be called if @p scip is in stage \ref SCIP_STAGE_SOLVING 1774 */ 1775 SCIP_EXPORT 1776 SCIP_RETCODE SCIPchgVarLbNode( 1777 SCIP* scip, /**< SCIP data structure */ 1778 SCIP_NODE* node, /**< node to change bound at, or NULL for current node */ 1779 SCIP_VAR* var, /**< variable to change the bound for */ 1780 SCIP_Real newbound /**< new value for bound */ 1781 ); 1782 1783 /** changes upper bound of variable in the given node; if possible, adjust bound to integral value; doesn't store any 1784 * inference information in the bound change, such that in conflict analysis, this change is treated like a branching 1785 * decision 1786 * 1787 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 1788 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 1789 * 1790 * @pre This method can only be called if @p scip is in stage \ref SCIP_STAGE_SOLVING 1791 */ 1792 SCIP_EXPORT 1793 SCIP_RETCODE SCIPchgVarUbNode( 1794 SCIP* scip, /**< SCIP data structure */ 1795 SCIP_NODE* node, /**< node to change bound at, or NULL for current node */ 1796 SCIP_VAR* var, /**< variable to change the bound for */ 1797 SCIP_Real newbound /**< new value for bound */ 1798 ); 1799 1800 /** changes global lower bound of variable; if possible, adjust bound to integral value; also tightens the local bound, 1801 * if the global bound is better than the local bound 1802 * 1803 * @warning If SCIP is in presolving stage, it can happen that the internal variable array (which can be accessed via 1804 * SCIPgetVars()) gets resorted. 1805 * 1806 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 1807 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 1808 * 1809 * @pre This method can be called if @p scip is in one of the following stages: 1810 * - \ref SCIP_STAGE_PROBLEM 1811 * - \ref SCIP_STAGE_TRANSFORMING 1812 * - \ref SCIP_STAGE_TRANSFORMED 1813 * - \ref SCIP_STAGE_PRESOLVING 1814 * - \ref SCIP_STAGE_SOLVING 1815 * 1816 * @note During presolving, an integer variable whose bound changes to {0,1} is upgraded to a binary variable. 1817 */ 1818 SCIP_EXPORT 1819 SCIP_RETCODE SCIPchgVarLbGlobal( 1820 SCIP* scip, /**< SCIP data structure */ 1821 SCIP_VAR* var, /**< variable to change the bound for */ 1822 SCIP_Real newbound /**< new value for bound */ 1823 ); 1824 1825 /** changes global upper bound of variable; if possible, adjust bound to integral value; also tightens the local bound, 1826 * if the global bound is better than the local bound 1827 * 1828 * @warning If SCIP is in presolving stage, it can happen that the internal variable array (which can be accessed via 1829 * SCIPgetVars()) gets resorted. 1830 * 1831 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 1832 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 1833 * 1834 * @pre This method can be called if @p scip is in one of the following stages: 1835 * - \ref SCIP_STAGE_PROBLEM 1836 * - \ref SCIP_STAGE_TRANSFORMING 1837 * - \ref SCIP_STAGE_TRANSFORMED 1838 * - \ref SCIP_STAGE_PRESOLVING 1839 * - \ref SCIP_STAGE_SOLVING 1840 * 1841 * @note During presolving, an integer variable whose bound changes to {0,1} is upgraded to a binary variable. 1842 */ 1843 SCIP_EXPORT 1844 SCIP_RETCODE SCIPchgVarUbGlobal( 1845 SCIP* scip, /**< SCIP data structure */ 1846 SCIP_VAR* var, /**< variable to change the bound for */ 1847 SCIP_Real newbound /**< new value for bound */ 1848 ); 1849 1850 /** changes lazy lower bound of the variable, this is only possible if the variable is not in the LP yet 1851 * 1852 * Lazy bounds are bounds that are already enforced by constraints and the objective function. 1853 * Setting a lazy lower bound has the consequence that for variables which lower bound equals the lazy lower bound, 1854 * the lower bound does not need to be passed on to the LP solver. 1855 * This is especially useful in a column generation (branch-and-price) setting. 1856 * 1857 * @attention If the variable has a global lower bound below lazylb, then the global lower bound is tightened to 1858 * lazylb by a call to SCIPchgVarLbGlobal(). 1859 * 1860 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 1861 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 1862 * 1863 * @pre This method can be called if @p scip is in one of the following stages: 1864 * - \ref SCIP_STAGE_PROBLEM 1865 * - \ref SCIP_STAGE_TRANSFORMING 1866 * - \ref SCIP_STAGE_TRANSFORMED 1867 * - \ref SCIP_STAGE_PRESOLVING 1868 * - \ref SCIP_STAGE_SOLVING 1869 */ 1870 SCIP_EXPORT 1871 SCIP_RETCODE SCIPchgVarLbLazy( 1872 SCIP* scip, /**< SCIP data structure */ 1873 SCIP_VAR* var, /**< problem variable */ 1874 SCIP_Real lazylb /**< the lazy lower bound to be set */ 1875 ); 1876 1877 /** changes lazy upper bound of the variable, this is only possible if the variable is not in the LP yet 1878 * 1879 * Lazy bounds are bounds that are already enforced by constraints and the objective function. 1880 * Setting a lazy upper bound has the consequence that for variables which upper bound equals the lazy upper bound, 1881 * the upper bound does not need to be passed on to the LP solver. 1882 * This is especially useful in a column generation (branch-and-price) setting. 1883 * 1884 * @attention If the variable has a global upper bound above lazyub, then the global upper bound is tightened to 1885 * lazyub by a call to SCIPchgVarUbGlobal(). 1886 * 1887 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 1888 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 1889 * 1890 * @pre This method can be called if @p scip is in one of the following stages: 1891 * - \ref SCIP_STAGE_PROBLEM 1892 * - \ref SCIP_STAGE_TRANSFORMING 1893 * - \ref SCIP_STAGE_TRANSFORMED 1894 * - \ref SCIP_STAGE_PRESOLVING 1895 * - \ref SCIP_STAGE_SOLVING 1896 */ 1897 SCIP_EXPORT 1898 SCIP_RETCODE SCIPchgVarUbLazy( 1899 SCIP* scip, /**< SCIP data structure */ 1900 SCIP_VAR* var, /**< problem variable */ 1901 SCIP_Real lazyub /**< the lazy lower bound to be set */ 1902 ); 1903 1904 /** changes lower bound of variable in preprocessing or in the current node, if the new bound is tighter 1905 * (w.r.t. bound strengthening epsilon) than the current bound; if possible, adjusts bound to integral value; 1906 * doesn't store any inference information in the bound change, such that in conflict analysis, this change 1907 * is treated like a branching decision 1908 * 1909 * @warning If SCIP is in presolving stage, it can happen that the internal variable array (which can be accessed via 1910 * SCIPgetVars()) gets resorted. 1911 * 1912 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 1913 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 1914 * 1915 * @pre This method can be called if @p scip is in one of the following stages: 1916 * - \ref SCIP_STAGE_PROBLEM 1917 * - \ref SCIP_STAGE_PRESOLVING 1918 * - \ref SCIP_STAGE_SOLVING 1919 * 1920 * @note During presolving, an integer variable whose bound changes to {0,1} is upgraded to a binary variable. 1921 */ 1922 SCIP_EXPORT 1923 SCIP_RETCODE SCIPtightenVarLb( 1924 SCIP* scip, /**< SCIP data structure */ 1925 SCIP_VAR* var, /**< variable to change the bound for */ 1926 SCIP_Real newbound, /**< new value for bound */ 1927 SCIP_Bool force, /**< force tightening even if below bound strengthening tolerance */ 1928 SCIP_Bool* infeasible, /**< pointer to store whether the new domain is empty */ 1929 SCIP_Bool* tightened /**< pointer to store whether the bound was tightened, or NULL */ 1930 ); 1931 1932 /** changes upper bound of variable in preprocessing or in the current node, if the new bound is tighter 1933 * (w.r.t. bound strengthening epsilon) than the current bound; if possible, adjusts bound to integral value; 1934 * doesn't store any inference information in the bound change, such that in conflict analysis, this change 1935 * is treated like a branching decision 1936 * 1937 * @warning If SCIP is in presolving stage, it can happen that the internal variable array (which can be accessed via 1938 * SCIPgetVars()) gets resorted. 1939 * 1940 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 1941 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 1942 * 1943 * @pre This method can be called if @p scip is in one of the following stages: 1944 * - \ref SCIP_STAGE_PROBLEM 1945 * - \ref SCIP_STAGE_PRESOLVING 1946 * - \ref SCIP_STAGE_SOLVING 1947 * 1948 * @note During presolving, an integer variable whose bound changes to {0,1} is upgraded to a binary variable. 1949 */ 1950 SCIP_EXPORT 1951 SCIP_RETCODE SCIPtightenVarUb( 1952 SCIP* scip, /**< SCIP data structure */ 1953 SCIP_VAR* var, /**< variable to change the bound for */ 1954 SCIP_Real newbound, /**< new value for bound */ 1955 SCIP_Bool force, /**< force tightening even if below bound strengthening tolerance */ 1956 SCIP_Bool* infeasible, /**< pointer to store whether the new domain is empty */ 1957 SCIP_Bool* tightened /**< pointer to store whether the bound was tightened, or NULL */ 1958 ); 1959 1960 /** fixes variable in preprocessing or in the current node, if the new bound is tighter (w.r.t. bound strengthening 1961 * epsilon) than the current bound; if possible, adjusts bound to integral value; the given inference constraint is 1962 * stored, such that the conflict analysis is able to find out the reason for the deduction of the bound change 1963 * 1964 * @note In presolving stage when not in probing mode the variable will be fixed directly, otherwise this method 1965 * changes first the lowerbound by calling SCIPinferVarLbCons and second the upperbound by calling 1966 * SCIPinferVarUbCons 1967 * 1968 * @note If SCIP is in presolving stage, it can happen that the internal variable array (which get be accessed via 1969 * SCIPgetVars()) gets resorted. 1970 * 1971 * @note During presolving, an integer variable which bound changes to {0,1} is upgraded to a binary variable. 1972 */ 1973 SCIP_EXPORT 1974 SCIP_RETCODE SCIPinferVarFixCons( 1975 SCIP* scip, /**< SCIP data structure */ 1976 SCIP_VAR* var, /**< variable to change the bound for */ 1977 SCIP_Real fixedval, /**< new value for fixation */ 1978 SCIP_CONS* infercons, /**< constraint that deduced the bound change */ 1979 int inferinfo, /**< user information for inference to help resolving the conflict */ 1980 SCIP_Bool force, /**< force tightening even if below bound strengthening tolerance */ 1981 SCIP_Bool* infeasible, /**< pointer to store whether the bound change is infeasible */ 1982 SCIP_Bool* tightened /**< pointer to store whether the bound was tightened, or NULL */ 1983 ); 1984 1985 /** changes lower bound of variable in preprocessing or in the current node, if the new bound is tighter 1986 * (w.r.t. bound strengthening epsilon) than the current bound; if possible, adjusts bound to integral value; 1987 * the given inference constraint is stored, such that the conflict analysis is able to find out the reason 1988 * for the deduction of the bound change 1989 * 1990 * @warning If SCIP is in presolving stage, it can happen that the internal variable array (which can be accessed via 1991 * SCIPgetVars()) gets resorted. 1992 * 1993 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 1994 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 1995 * 1996 * @pre This method can be called if @p scip is in one of the following stages: 1997 * - \ref SCIP_STAGE_PROBLEM 1998 * - \ref SCIP_STAGE_PRESOLVING 1999 * - \ref SCIP_STAGE_SOLVING 2000 * 2001 * @note During presolving, an integer variable whose bound changes to {0,1} is upgraded to a binary variable. 2002 */ 2003 SCIP_EXPORT 2004 SCIP_RETCODE SCIPinferVarLbCons( 2005 SCIP* scip, /**< SCIP data structure */ 2006 SCIP_VAR* var, /**< variable to change the bound for */ 2007 SCIP_Real newbound, /**< new value for bound */ 2008 SCIP_CONS* infercons, /**< constraint that deduced the bound change, or NULL */ 2009 int inferinfo, /**< user information for inference to help resolving the conflict */ 2010 SCIP_Bool force, /**< force tightening even if below bound strengthening tolerance */ 2011 SCIP_Bool* infeasible, /**< pointer to store whether the bound change is infeasible */ 2012 SCIP_Bool* tightened /**< pointer to store whether the bound was tightened, or NULL */ 2013 ); 2014 2015 /** changes upper bound of variable in preprocessing or in the current node, if the new bound is tighter 2016 * (w.r.t. bound strengthening epsilon) than the current bound; if possible, adjusts bound to integral value; 2017 * the given inference constraint is stored, such that the conflict analysis is able to find out the reason 2018 * for the deduction of the bound change 2019 * 2020 * @warning If SCIP is in presolving stage, it can happen that the internal variable array (which can be accessed via 2021 * SCIPgetVars()) gets resorted. 2022 * 2023 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 2024 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 2025 * 2026 * @pre This method can be called if @p scip is in one of the following stages: 2027 * - \ref SCIP_STAGE_PROBLEM 2028 * - \ref SCIP_STAGE_PRESOLVING 2029 * - \ref SCIP_STAGE_SOLVING 2030 * 2031 * @note During presolving, an integer variable whose bound changes to {0,1} is upgraded to a binary variable. 2032 */ 2033 SCIP_EXPORT 2034 SCIP_RETCODE SCIPinferVarUbCons( 2035 SCIP* scip, /**< SCIP data structure */ 2036 SCIP_VAR* var, /**< variable to change the bound for */ 2037 SCIP_Real newbound, /**< new value for bound */ 2038 SCIP_CONS* infercons, /**< constraint that deduced the bound change */ 2039 int inferinfo, /**< user information for inference to help resolving the conflict */ 2040 SCIP_Bool force, /**< force tightening even if below bound strengthening tolerance */ 2041 SCIP_Bool* infeasible, /**< pointer to store whether the bound change is infeasible */ 2042 SCIP_Bool* tightened /**< pointer to store whether the bound was tightened, or NULL */ 2043 ); 2044 2045 /** depending on SCIP's stage, fixes binary variable in the problem, in preprocessing, or in current node; 2046 * the given inference constraint is stored, such that the conflict analysis is able to find out the reason for the 2047 * deduction of the fixing 2048 * 2049 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 2050 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 2051 * 2052 * @pre This method can be called if @p scip is in one of the following stages: 2053 * - \ref SCIP_STAGE_PROBLEM 2054 * - \ref SCIP_STAGE_PRESOLVING 2055 * - \ref SCIP_STAGE_SOLVING 2056 */ 2057 SCIP_EXPORT 2058 SCIP_RETCODE SCIPinferBinvarCons( 2059 SCIP* scip, /**< SCIP data structure */ 2060 SCIP_VAR* var, /**< binary variable to fix */ 2061 SCIP_Bool fixedval, /**< value to fix binary variable to */ 2062 SCIP_CONS* infercons, /**< constraint that deduced the fixing */ 2063 int inferinfo, /**< user information for inference to help resolving the conflict */ 2064 SCIP_Bool* infeasible, /**< pointer to store whether the fixing is infeasible */ 2065 SCIP_Bool* tightened /**< pointer to store whether the fixing tightened the local bounds, or NULL */ 2066 ); 2067 2068 /** fixes variable in preprocessing or in the current node, if the new bound is tighter (w.r.t. bound strengthening 2069 * epsilon) than the current bound; if possible, adjusts bound to integral value; the given inference constraint is 2070 * stored, such that the conflict analysis is able to find out the reason for the deduction of the bound change 2071 * 2072 * @note In presolving stage when not in probing mode the variable will be fixed directly, otherwise this method 2073 * changes first the lowerbound by calling SCIPinferVarLbProp and second the upperbound by calling 2074 * SCIPinferVarUbProp 2075 * 2076 * @note If SCIP is in presolving stage, it can happen that the internal variable array (which get be accessed via 2077 * SCIPgetVars()) gets resorted. 2078 * 2079 * @note During presolving, an integer variable which bound changes to {0,1} is upgraded to a binary variable. 2080 */ 2081 SCIP_EXPORT 2082 SCIP_RETCODE SCIPinferVarFixProp( 2083 SCIP* scip, /**< SCIP data structure */ 2084 SCIP_VAR* var, /**< variable to change the bound for */ 2085 SCIP_Real fixedval, /**< new value for fixation */ 2086 SCIP_PROP* inferprop, /**< propagator that deduced the bound change */ 2087 int inferinfo, /**< user information for inference to help resolving the conflict */ 2088 SCIP_Bool force, /**< force tightening even if below bound strengthening tolerance */ 2089 SCIP_Bool* infeasible, /**< pointer to store whether the bound change is infeasible */ 2090 SCIP_Bool* tightened /**< pointer to store whether the bound was tightened, or NULL */ 2091 ); 2092 2093 /** changes lower bound of variable in preprocessing or in the current node, if the new bound is tighter 2094 * (w.r.t. bound strengthening epsilon) than the current bound; if possible, adjusts bound to integral value; 2095 * the given inference propagator is stored, such that the conflict analysis is able to find out the reason 2096 * for the deduction of the bound change 2097 * 2098 * @warning If SCIP is in presolving stage, it can happen that the internal variable array (which can be accessed via 2099 * SCIPgetVars()) gets resorted. 2100 * 2101 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 2102 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 2103 * 2104 * @pre This method can be called if @p scip is in one of the following stages: 2105 * - \ref SCIP_STAGE_PROBLEM 2106 * - \ref SCIP_STAGE_PRESOLVING 2107 * - \ref SCIP_STAGE_SOLVING 2108 * 2109 * @note During presolving, an integer variable whose bound changes to {0,1} is upgraded to a binary variable. 2110 */ 2111 SCIP_EXPORT 2112 SCIP_RETCODE SCIPinferVarLbProp( 2113 SCIP* scip, /**< SCIP data structure */ 2114 SCIP_VAR* var, /**< variable to change the bound for */ 2115 SCIP_Real newbound, /**< new value for bound */ 2116 SCIP_PROP* inferprop, /**< propagator that deduced the bound change, or NULL */ 2117 int inferinfo, /**< user information for inference to help resolving the conflict */ 2118 SCIP_Bool force, /**< force tightening even if below bound strengthening tolerance */ 2119 SCIP_Bool* infeasible, /**< pointer to store whether the bound change is infeasible */ 2120 SCIP_Bool* tightened /**< pointer to store whether the bound was tightened, or NULL */ 2121 ); 2122 2123 /** changes upper bound of variable in preprocessing or in the current node, if the new bound is tighter 2124 * (w.r.t. bound strengthening epsilon) than the current bound; if possible, adjusts bound to integral value; 2125 * the given inference propagator is stored, such that the conflict analysis is able to find out the reason 2126 * for the deduction of the bound change 2127 * 2128 * @warning If SCIP is in presolving stage, it can happen that the internal variable array (which can be accessed via 2129 * SCIPgetVars()) gets resorted. 2130 * 2131 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 2132 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 2133 * 2134 * @pre This method can be called if @p scip is in one of the following stages: 2135 * - \ref SCIP_STAGE_PROBLEM 2136 * - \ref SCIP_STAGE_PRESOLVING 2137 * - \ref SCIP_STAGE_SOLVING 2138 * 2139 * @note During presolving, an integer variable whose bound changes to {0,1} is upgraded to a binary variable. 2140 */ 2141 SCIP_EXPORT 2142 SCIP_RETCODE SCIPinferVarUbProp( 2143 SCIP* scip, /**< SCIP data structure */ 2144 SCIP_VAR* var, /**< variable to change the bound for */ 2145 SCIP_Real newbound, /**< new value for bound */ 2146 SCIP_PROP* inferprop, /**< propagator that deduced the bound change */ 2147 int inferinfo, /**< user information for inference to help resolving the conflict */ 2148 SCIP_Bool force, /**< force tightening even if below bound strengthening tolerance */ 2149 SCIP_Bool* infeasible, /**< pointer to store whether the bound change is infeasible */ 2150 SCIP_Bool* tightened /**< pointer to store whether the bound was tightened, or NULL */ 2151 ); 2152 2153 /** depending on SCIP's stage, fixes binary variable in the problem, in preprocessing, or in current node; 2154 * the given inference propagator is stored, such that the conflict analysis is able to find out the reason for the 2155 * deduction of the fixing 2156 * 2157 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 2158 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 2159 * 2160 * @pre This method can be called if @p scip is in one of the following stages: 2161 * - \ref SCIP_STAGE_PROBLEM 2162 * - \ref SCIP_STAGE_PRESOLVING 2163 * - \ref SCIP_STAGE_PRESOLVED 2164 * - \ref SCIP_STAGE_SOLVING 2165 */ 2166 SCIP_EXPORT 2167 SCIP_RETCODE SCIPinferBinvarProp( 2168 SCIP* scip, /**< SCIP data structure */ 2169 SCIP_VAR* var, /**< binary variable to fix */ 2170 SCIP_Bool fixedval, /**< value to fix binary variable to */ 2171 SCIP_PROP* inferprop, /**< propagator that deduced the fixing */ 2172 int inferinfo, /**< user information for inference to help resolving the conflict */ 2173 SCIP_Bool* infeasible, /**< pointer to store whether the fixing is infeasible */ 2174 SCIP_Bool* tightened /**< pointer to store whether the fixing tightened the local bounds, or NULL */ 2175 ); 2176 2177 /** changes global lower bound of variable in preprocessing or in the current node, if the new bound is tighter 2178 * (w.r.t. bound strengthening epsilon) than the current global bound; if possible, adjusts bound to integral value; 2179 * also tightens the local bound, if the global bound is better than the local bound 2180 * 2181 * @warning If SCIP is in presolving stage, it can happen that the internal variable array (which can be accessed via 2182 * SCIPgetVars()) gets resorted. 2183 * 2184 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 2185 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 2186 * 2187 * @pre This method can be called if @p scip is in one of the following stages: 2188 * - \ref SCIP_STAGE_PROBLEM 2189 * - \ref SCIP_STAGE_TRANSFORMING 2190 * - \ref SCIP_STAGE_PRESOLVING 2191 * - \ref SCIP_STAGE_SOLVING 2192 * 2193 * @note During presolving, an integer variable whose bound changes to {0,1} is upgraded to a binary variable. 2194 */ 2195 SCIP_EXPORT 2196 SCIP_RETCODE SCIPtightenVarLbGlobal( 2197 SCIP* scip, /**< SCIP data structure */ 2198 SCIP_VAR* var, /**< variable to change the bound for */ 2199 SCIP_Real newbound, /**< new value for bound */ 2200 SCIP_Bool force, /**< force tightening even if below bound strengthening tolerance */ 2201 SCIP_Bool* infeasible, /**< pointer to store whether the new domain is empty */ 2202 SCIP_Bool* tightened /**< pointer to store whether the bound was tightened, or NULL */ 2203 ); 2204 2205 /** changes global upper bound of variable in preprocessing or in the current node, if the new bound is tighter 2206 * (w.r.t. bound strengthening epsilon) than the current global bound; if possible, adjusts bound to integral value; 2207 * also tightens the local bound, if the global bound is better than the local bound 2208 * 2209 * @warning If SCIP is in presolving stage, it can happen that the internal variable array (which can be accessed via 2210 * SCIPgetVars()) gets resorted. 2211 * 2212 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 2213 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 2214 * 2215 * @pre This method can be called if @p scip is in one of the following stages: 2216 * - \ref SCIP_STAGE_PROBLEM 2217 * - \ref SCIP_STAGE_TRANSFORMING 2218 * - \ref SCIP_STAGE_PRESOLVING 2219 * - \ref SCIP_STAGE_SOLVING 2220 * 2221 * @note During presolving, an integer variable whose bound changes to {0,1} is upgraded to a binary variable. 2222 */ 2223 SCIP_EXPORT 2224 SCIP_RETCODE SCIPtightenVarUbGlobal( 2225 SCIP* scip, /**< SCIP data structure */ 2226 SCIP_VAR* var, /**< variable to change the bound for */ 2227 SCIP_Real newbound, /**< new value for bound */ 2228 SCIP_Bool force, /**< force tightening even if below bound strengthening tolerance */ 2229 SCIP_Bool* infeasible, /**< pointer to store whether the new domain is empty */ 2230 SCIP_Bool* tightened /**< pointer to store whether the bound was tightened, or NULL */ 2231 ); 2232 2233 /** for a multi-aggregated variable, returns the global lower bound computed by adding the global bounds from all aggregation variables 2234 * 2235 * This global bound may be tighter than the one given by SCIPvarGetLbGlobal, since the latter is not updated if bounds of aggregation variables are changing 2236 * calling this function for a non-multi-aggregated variable results in a call to SCIPvarGetLbGlobal. 2237 * 2238 * @return the global lower bound computed by adding the global bounds from all aggregation variables 2239 */ 2240 SCIP_EXPORT 2241 SCIP_Real SCIPcomputeVarLbGlobal( 2242 SCIP* scip, /**< SCIP data structure */ 2243 SCIP_VAR* var /**< variable to compute the bound for */ 2244 ); 2245 2246 /** for a multi-aggregated variable, returns the global upper bound computed by adding the global bounds from all aggregation variables 2247 * 2248 * This global bound may be tighter than the one given by SCIPvarGetUbGlobal, since the latter is not updated if bounds of aggregation variables are changing 2249 * calling this function for a non-multi-aggregated variable results in a call to SCIPvarGetUbGlobal. 2250 * 2251 * @return the global upper bound computed by adding the global bounds from all aggregation variables 2252 */ 2253 SCIP_EXPORT 2254 SCIP_Real SCIPcomputeVarUbGlobal( 2255 SCIP* scip, /**< SCIP data structure */ 2256 SCIP_VAR* var /**< variable to compute the bound for */ 2257 ); 2258 2259 /** for a multi-aggregated variable, returns the local lower bound computed by adding the local bounds from all aggregation variables 2260 * 2261 * This local bound may be tighter than the one given by SCIPvarGetLbLocal, since the latter is not updated if bounds of aggregation variables are changing 2262 * calling this function for a non-multi-aggregated variable results in a call to SCIPvarGetLbLocal. 2263 * 2264 * @return the local lower bound computed by adding the global bounds from all aggregation variables 2265 */ 2266 SCIP_EXPORT 2267 SCIP_Real SCIPcomputeVarLbLocal( 2268 SCIP* scip, /**< SCIP data structure */ 2269 SCIP_VAR* var /**< variable to compute the bound for */ 2270 ); 2271 2272 /** for a multi-aggregated variable, returns the local upper bound computed by adding the local bounds from all aggregation variables 2273 * 2274 * This local bound may be tighter than the one given by SCIPvarGetUbLocal, since the latter is not updated if bounds of aggregation variables are changing 2275 * calling this function for a non-multi-aggregated variable results in a call to SCIPvarGetUbLocal. 2276 * 2277 * @return the local upper bound computed by adding the global bounds from all aggregation variables 2278 */ 2279 SCIP_EXPORT 2280 SCIP_Real SCIPcomputeVarUbLocal( 2281 SCIP* scip, /**< SCIP data structure */ 2282 SCIP_VAR* var /**< variable to compute the bound for */ 2283 ); 2284 2285 /** for a multi-aggregated variable, gives the global lower bound computed by adding the global bounds from all 2286 * aggregation variables, this global bound may be tighter than the one given by SCIPvarGetLbGlobal, since the latter is 2287 * not updated if bounds of aggregation variables are changing 2288 * 2289 * calling this function for a non-multi-aggregated variable is not allowed 2290 */ 2291 SCIP_EXPORT 2292 SCIP_Real SCIPgetVarMultaggrLbGlobal( 2293 SCIP* scip, /**< SCIP data structure */ 2294 SCIP_VAR* var /**< variable to compute the bound for */ 2295 ); 2296 2297 /** for a multi-aggregated variable, gives the global upper bound computed by adding the global bounds from all 2298 * aggregation variables, this upper bound may be tighter than the one given by SCIPvarGetUbGlobal, since the latter is 2299 * not updated if bounds of aggregation variables are changing 2300 * 2301 * calling this function for a non-multi-aggregated variable is not allowed 2302 */ 2303 SCIP_EXPORT 2304 SCIP_Real SCIPgetVarMultaggrUbGlobal( 2305 SCIP* scip, /**< SCIP data structure */ 2306 SCIP_VAR* var /**< variable to compute the bound for */ 2307 ); 2308 2309 /** for a multi-aggregated variable, gives the local lower bound computed by adding the local bounds from all 2310 * aggregation variables, this lower bound may be tighter than the one given by SCIPvarGetLbLocal, since the latter is 2311 * not updated if bounds of aggregation variables are changing 2312 * 2313 * calling this function for a non-multi-aggregated variable is not allowed 2314 */ 2315 SCIP_EXPORT 2316 SCIP_Real SCIPgetVarMultaggrLbLocal( 2317 SCIP* scip, /**< SCIP data structure */ 2318 SCIP_VAR* var /**< variable to compute the bound for */ 2319 ); 2320 2321 /** for a multi-aggregated variable, gives the local upper bound computed by adding the local bounds from all 2322 * aggregation variables, this upper bound may be tighter than the one given by SCIPvarGetUbLocal, since the latter is 2323 * not updated if bounds of aggregation variables are changing 2324 * 2325 * calling this function for a non-multi-aggregated variable is not allowed 2326 */ 2327 SCIP_EXPORT 2328 SCIP_Real SCIPgetVarMultaggrUbLocal( 2329 SCIP* scip, /**< SCIP data structure */ 2330 SCIP_VAR* var /**< variable to compute the bound for */ 2331 ); 2332 2333 #ifdef NDEBUG 2334 2335 /* In optimized mode, the function calls are overwritten by defines to reduce the number of function calls and 2336 * speed up the algorithms. 2337 */ 2338 2339 #define SCIPcomputeVarLbGlobal(scip, var) (SCIPvarGetStatus(var) == SCIP_VARSTATUS_MULTAGGR ? SCIPgetVarMultaggrLbGlobal(scip, var) : SCIPvarGetLbGlobal(var)) 2340 #define SCIPcomputeVarUbGlobal(scip, var) (SCIPvarGetStatus(var) == SCIP_VARSTATUS_MULTAGGR ? SCIPgetVarMultaggrUbGlobal(scip, var) : SCIPvarGetUbGlobal(var)) 2341 #define SCIPcomputeVarLbLocal(scip, var) (SCIPvarGetStatus(var) == SCIP_VARSTATUS_MULTAGGR ? SCIPgetVarMultaggrLbLocal(scip, var) : SCIPvarGetLbLocal(var)) 2342 #define SCIPcomputeVarUbLocal(scip, var) (SCIPvarGetStatus(var) == SCIP_VARSTATUS_MULTAGGR ? SCIPgetVarMultaggrUbLocal(scip, var) : SCIPvarGetUbLocal(var)) 2343 2344 #endif 2345 2346 /** returns solution value and index of variable lower bound that is closest to the variable's value in the given primal 2347 * solution or current LP solution if no primal solution is given; returns an index of -1 if no variable lower bound is 2348 * available 2349 * 2350 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 2351 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 2352 * 2353 * @pre This method can only be called if @p scip is in stage \ref SCIP_STAGE_SOLVING 2354 */ 2355 SCIP_EXPORT 2356 SCIP_RETCODE SCIPgetVarClosestVlb( 2357 SCIP* scip, /**< SCIP data structure */ 2358 SCIP_VAR* var, /**< active problem variable */ 2359 SCIP_SOL* sol, /**< primal solution, or NULL for LP solution */ 2360 SCIP_Real* closestvlb, /**< pointer to store the value of the closest variable lower bound */ 2361 int* closestvlbidx /**< pointer to store the index of the closest variable lower bound */ 2362 ); 2363 2364 /** returns solution value and index of variable upper bound that is closest to the variable's value in the given primal solution; 2365 * or current LP solution if no primal solution is given; returns an index of -1 if no variable upper bound is available 2366 * 2367 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 2368 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 2369 * 2370 * @pre This method can only be called if @p scip is in stage \ref SCIP_STAGE_SOLVING 2371 */ 2372 SCIP_EXPORT 2373 SCIP_RETCODE SCIPgetVarClosestVub( 2374 SCIP* scip, /**< SCIP data structure */ 2375 SCIP_VAR* var, /**< active problem variable */ 2376 SCIP_SOL* sol, /**< primal solution, or NULL for LP solution */ 2377 SCIP_Real* closestvub, /**< pointer to store the value of the closest variable lower bound */ 2378 int* closestvubidx /**< pointer to store the index of the closest variable lower bound */ 2379 ); 2380 2381 /** informs variable x about a globally valid variable lower bound x >= b*z + d with integer variable z; 2382 * if z is binary, the corresponding valid implication for z is also added; 2383 * if z is non-continuous and 1/b not too small, the corresponding valid upper/lower bound 2384 * z <= (x-d)/b or z >= (x-d)/b (depending on the sign of of b) is added, too; 2385 * improves the global bounds of the variable and the vlb variable if possible 2386 * 2387 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 2388 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 2389 * 2390 * @pre This method can be called if @p scip is in one of the following stages: 2391 * - \ref SCIP_STAGE_PRESOLVING 2392 * - \ref SCIP_STAGE_PRESOLVED 2393 * - \ref SCIP_STAGE_SOLVING 2394 */ 2395 SCIP_EXPORT 2396 SCIP_RETCODE SCIPaddVarVlb( 2397 SCIP* scip, /**< SCIP data structure */ 2398 SCIP_VAR* var, /**< problem variable */ 2399 SCIP_VAR* vlbvar, /**< variable z in x >= b*z + d */ 2400 SCIP_Real vlbcoef, /**< coefficient b in x >= b*z + d */ 2401 SCIP_Real vlbconstant, /**< constant d in x >= b*z + d */ 2402 SCIP_Bool* infeasible, /**< pointer to store whether an infeasibility was detected */ 2403 int* nbdchgs /**< pointer to store the number of performed bound changes, or NULL */ 2404 ); 2405 2406 2407 /** informs variable x about a globally valid variable upper bound x <= b*z + d with integer variable z; 2408 * if z is binary, the corresponding valid implication for z is also added; 2409 * if z is non-continuous and 1/b not too small, the corresponding valid lower/upper bound 2410 * z >= (x-d)/b or z <= (x-d)/b (depending on the sign of of b) is added, too; 2411 * improves the global bounds of the variable and the vlb variable if possible 2412 * 2413 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 2414 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 2415 * 2416 * @pre This method can be called if @p scip is in one of the following stages: 2417 * - \ref SCIP_STAGE_PRESOLVING 2418 * - \ref SCIP_STAGE_PRESOLVED 2419 * - \ref SCIP_STAGE_SOLVING 2420 */ 2421 SCIP_EXPORT 2422 SCIP_RETCODE SCIPaddVarVub( 2423 SCIP* scip, /**< SCIP data structure */ 2424 SCIP_VAR* var, /**< problem variable */ 2425 SCIP_VAR* vubvar, /**< variable z in x <= b*z + d */ 2426 SCIP_Real vubcoef, /**< coefficient b in x <= b*z + d */ 2427 SCIP_Real vubconstant, /**< constant d in x <= b*z + d */ 2428 SCIP_Bool* infeasible, /**< pointer to store whether an infeasibility was detected */ 2429 int* nbdchgs /**< pointer to store the number of performed bound changes, or NULL */ 2430 ); 2431 2432 /** informs binary variable x about a globally valid implication: x == 0 or x == 1 ==> y <= b or y >= b; 2433 * also adds the corresponding implication or variable bound to the implied variable; 2434 * if the implication is conflicting, the variable is fixed to the opposite value; 2435 * if the variable is already fixed to the given value, the implication is performed immediately; 2436 * if the implication is redundant with respect to the variables' global bounds, it is ignored 2437 * 2438 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 2439 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 2440 * 2441 * @pre This method can be called if @p scip is in one of the following stages: 2442 * - \ref SCIP_STAGE_TRANSFORMED 2443 * - \ref SCIP_STAGE_PRESOLVING 2444 * - \ref SCIP_STAGE_PRESOLVED 2445 * - \ref SCIP_STAGE_SOLVING 2446 */ 2447 SCIP_EXPORT 2448 SCIP_RETCODE SCIPaddVarImplication( 2449 SCIP* scip, /**< SCIP data structure */ 2450 SCIP_VAR* var, /**< problem variable */ 2451 SCIP_Bool varfixing, /**< FALSE if y should be added in implications for x == 0, TRUE for x == 1 */ 2452 SCIP_VAR* implvar, /**< variable y in implication y <= b or y >= b */ 2453 SCIP_BOUNDTYPE impltype, /**< type of implication y <= b (SCIP_BOUNDTYPE_UPPER) 2454 * or y >= b (SCIP_BOUNDTYPE_LOWER) */ 2455 SCIP_Real implbound, /**< bound b in implication y <= b or y >= b */ 2456 SCIP_Bool* infeasible, /**< pointer to store whether an infeasibility was detected */ 2457 int* nbdchgs /**< pointer to store the number of performed bound changes, or NULL */ 2458 ); 2459 2460 /** adds a clique information to SCIP, stating that at most one of the given binary variables can be set to 1; 2461 * if a variable appears twice in the same clique, the corresponding implications are performed 2462 * 2463 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 2464 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 2465 * 2466 * @pre This method can be called if @p scip is in one of the following stages: 2467 * - \ref SCIP_STAGE_TRANSFORMED 2468 * - \ref SCIP_STAGE_PRESOLVING 2469 * - \ref SCIP_STAGE_PRESOLVED 2470 * - \ref SCIP_STAGE_SOLVING 2471 */ 2472 SCIP_EXPORT 2473 SCIP_RETCODE SCIPaddClique( 2474 SCIP* scip, /**< SCIP data structure */ 2475 SCIP_VAR** vars, /**< binary variables in the clique from which at most one can be set to 1 */ 2476 SCIP_Bool* values, /**< values of the variables in the clique; NULL to use TRUE for all vars */ 2477 int nvars, /**< number of variables in the clique */ 2478 SCIP_Bool isequation, /**< is the clique an equation or an inequality? */ 2479 SCIP_Bool* infeasible, /**< pointer to store whether an infeasibility was detected */ 2480 int* nbdchgs /**< pointer to store the number of performed bound changes, or NULL */ 2481 ); 2482 2483 /** calculates a partition of the given set of binary variables into cliques; takes into account independent clique components 2484 * 2485 * The algorithm performs the following steps: 2486 * - recomputes connected components of the clique table, if necessary 2487 * - computes a clique partition for every connected component greedily. 2488 * - relabels the resulting clique partition such that it satisfies the description below 2489 * 2490 * afterwards the output array contains one value for each variable, such that two variables got the same value iff they 2491 * were assigned to the same clique; 2492 * the first variable is always assigned to clique 0, and a variable can only be assigned to clique i if at least one of 2493 * the preceding variables was assigned to clique i-1; 2494 * for each clique at most 1 variables can be set to TRUE in a feasible solution; 2495 * 2496 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 2497 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 2498 * 2499 * @pre This method can be called if @p scip is in one of the following stages: 2500 * - \ref SCIP_STAGE_INITPRESOLVE 2501 * - \ref SCIP_STAGE_PRESOLVING 2502 * - \ref SCIP_STAGE_EXITPRESOLVE 2503 * - \ref SCIP_STAGE_PRESOLVED 2504 * - \ref SCIP_STAGE_SOLVING 2505 */ 2506 SCIP_EXPORT 2507 SCIP_RETCODE SCIPcalcCliquePartition( 2508 SCIP*const scip, /**< SCIP data structure */ 2509 SCIP_VAR**const vars, /**< binary variables in the clique from which at most one can be set to 1 */ 2510 int const nvars, /**< number of variables in the clique */ 2511 int*const cliquepartition, /**< array of length nvars to store the clique partition */ 2512 int*const ncliques /**< pointer to store the number of cliques actually contained in the partition */ 2513 ); 2514 2515 /** calculates a partition of the given set of binary variables into negated cliques; 2516 * afterwards the output array contains one value for each variable, such that two variables got the same value iff they 2517 * were assigned to the same negated clique; 2518 * the first variable is always assigned to clique 0 and a variable can only be assigned to clique i if at least one of 2519 * the preceding variables was assigned to clique i-1; 2520 * for each clique with n_c variables at least n_c-1 variables can be set to TRUE in a feasible solution; 2521 * 2522 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 2523 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 2524 * 2525 * @pre This method can be called if @p scip is in one of the following stages: 2526 * - \ref SCIP_STAGE_INITPRESOLVE 2527 * - \ref SCIP_STAGE_PRESOLVING 2528 * - \ref SCIP_STAGE_EXITPRESOLVE 2529 * - \ref SCIP_STAGE_PRESOLVED 2530 * - \ref SCIP_STAGE_SOLVING 2531 */ 2532 SCIP_EXPORT 2533 SCIP_RETCODE SCIPcalcNegatedCliquePartition( 2534 SCIP*const scip, /**< SCIP data structure */ 2535 SCIP_VAR**const vars, /**< binary variables in the clique from which at most one can be set to 1 */ 2536 int const nvars, /**< number of variables in the clique */ 2537 int*const cliquepartition, /**< array of length nvars to store the clique partition */ 2538 int*const ncliques /**< pointer to store the number of cliques actually contained in the partition */ 2539 ); 2540 2541 /** force SCIP to clean up all cliques; cliques do not get automatically cleaned up after presolving. Use 2542 * this method to prevent inactive variables in cliques when retrieved via SCIPgetCliques() 2543 * 2544 * @return SCIP_OKAY if everything worked, otherwise a suitable error code is passed 2545 * 2546 * @pre This method can be called if @p scip is in one of the following stages: 2547 * - \ref SCIP_STAGE_TRANSFORMED 2548 * - \ref SCIP_STAGE_INITPRESOLVE 2549 * - \ref SCIP_STAGE_PRESOLVING 2550 * - \ref SCIP_STAGE_EXITPRESOLVE 2551 * - \ref SCIP_STAGE_PRESOLVED 2552 * - \ref SCIP_STAGE_INITSOLVE 2553 * - \ref SCIP_STAGE_SOLVING 2554 * - \ref SCIP_STAGE_SOLVED 2555 * - \ref SCIP_STAGE_EXITSOLVE 2556 */ 2557 SCIP_EXPORT 2558 SCIP_RETCODE SCIPcleanupCliques( 2559 SCIP* scip, /**< SCIP data structure */ 2560 SCIP_Bool* infeasible /**< pointer to store if cleanup detected infeasibility */ 2561 ); 2562 2563 /** gets the number of cliques in the clique table 2564 * 2565 * @return number of cliques in the clique table 2566 * 2567 * @pre This method can be called if @p scip is in one of the following stages: 2568 * - \ref SCIP_STAGE_TRANSFORMED 2569 * - \ref SCIP_STAGE_INITPRESOLVE 2570 * - \ref SCIP_STAGE_PRESOLVING 2571 * - \ref SCIP_STAGE_EXITPRESOLVE 2572 * - \ref SCIP_STAGE_PRESOLVED 2573 * - \ref SCIP_STAGE_INITSOLVE 2574 * - \ref SCIP_STAGE_SOLVING 2575 * - \ref SCIP_STAGE_SOLVED 2576 * - \ref SCIP_STAGE_EXITSOLVE 2577 */ 2578 SCIP_EXPORT 2579 int SCIPgetNCliques( 2580 SCIP* scip /**< SCIP data structure */ 2581 ); 2582 2583 /** gets the number of cliques created so far by the cliquetable 2584 * 2585 * @return number of cliques created so far by the cliquetable 2586 * 2587 * @pre This method can be called if @p scip is in one of the following stages: 2588 * - \ref SCIP_STAGE_TRANSFORMED 2589 * - \ref SCIP_STAGE_INITPRESOLVE 2590 * - \ref SCIP_STAGE_PRESOLVING 2591 * - \ref SCIP_STAGE_EXITPRESOLVE 2592 * - \ref SCIP_STAGE_PRESOLVED 2593 * - \ref SCIP_STAGE_INITSOLVE 2594 * - \ref SCIP_STAGE_SOLVING 2595 * - \ref SCIP_STAGE_SOLVED 2596 * - \ref SCIP_STAGE_EXITSOLVE 2597 */ 2598 SCIP_EXPORT 2599 int SCIPgetNCliquesCreated( 2600 SCIP* scip /**< SCIP data structure */ 2601 ); 2602 2603 /** gets the array of cliques in the clique table 2604 * 2605 * @return array of cliques in the clique table 2606 * 2607 * @pre This method can be called if @p scip is in one of the following stages: 2608 * - \ref SCIP_STAGE_TRANSFORMED 2609 * - \ref SCIP_STAGE_INITPRESOLVE 2610 * - \ref SCIP_STAGE_PRESOLVING 2611 * - \ref SCIP_STAGE_EXITPRESOLVE 2612 * - \ref SCIP_STAGE_PRESOLVED 2613 * - \ref SCIP_STAGE_INITSOLVE 2614 * - \ref SCIP_STAGE_SOLVING 2615 * - \ref SCIP_STAGE_SOLVED 2616 * - \ref SCIP_STAGE_EXITSOLVE 2617 */ 2618 SCIP_EXPORT 2619 SCIP_CLIQUE** SCIPgetCliques( 2620 SCIP* scip /**< SCIP data structure */ 2621 ); 2622 2623 /** returns whether there is a clique that contains both given variable/value pairs; 2624 * the variables must be active binary variables; 2625 * if regardimplics is FALSE, only the cliques in the clique table are looked at; 2626 * if regardimplics is TRUE, both the cliques and the implications of the implication graph are regarded 2627 * 2628 * @return TRUE, if there is a clique that contains both variable/clique pairs; FALSE, otherwise 2629 * 2630 * @pre This method can be called if @p scip is in one of the following stages: 2631 * - \ref SCIP_STAGE_TRANSFORMED 2632 * - \ref SCIP_STAGE_INITPRESOLVE 2633 * - \ref SCIP_STAGE_PRESOLVING 2634 * - \ref SCIP_STAGE_EXITPRESOLVE 2635 * - \ref SCIP_STAGE_PRESOLVED 2636 * - \ref SCIP_STAGE_INITSOLVE 2637 * - \ref SCIP_STAGE_SOLVING 2638 * - \ref SCIP_STAGE_SOLVED 2639 * - \ref SCIP_STAGE_EXITSOLVE 2640 * 2641 * @note a variable with it's negated variable are NOT! in a clique 2642 * @note a variable with itself are in a clique 2643 */ 2644 SCIP_EXPORT 2645 SCIP_Bool SCIPhaveVarsCommonClique( 2646 SCIP* scip, /**< SCIP data structure */ 2647 SCIP_VAR* var1, /**< first variable */ 2648 SCIP_Bool value1, /**< value of first variable */ 2649 SCIP_VAR* var2, /**< second variable */ 2650 SCIP_Bool value2, /**< value of second variable */ 2651 SCIP_Bool regardimplics /**< should the implication graph also be searched for a clique? */ 2652 ); 2653 2654 /** writes the clique graph to a gml file 2655 * 2656 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 2657 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 2658 * 2659 * @pre This method can be called if @p scip is in one of the following stages: 2660 * - \ref SCIP_STAGE_TRANSFORMED 2661 * - \ref SCIP_STAGE_INITPRESOLVE 2662 * - \ref SCIP_STAGE_PRESOLVING 2663 * - \ref SCIP_STAGE_EXITPRESOLVE 2664 * - \ref SCIP_STAGE_PRESOLVED 2665 * - \ref SCIP_STAGE_INITSOLVE 2666 * - \ref SCIP_STAGE_SOLVING 2667 * - \ref SCIP_STAGE_SOLVED 2668 * - \ref SCIP_STAGE_EXITSOLVE 2669 * 2670 * @note there can be duplicated arcs in the output file 2671 * 2672 * If @p writenodeweights is true, only nodes corresponding to variables that have a fractional value and only edges 2673 * between such nodes are written. 2674 */ 2675 SCIP_EXPORT 2676 SCIP_RETCODE SCIPwriteCliqueGraph( 2677 SCIP* scip, /**< SCIP data structure */ 2678 const char* fname, /**< name of file */ 2679 SCIP_Bool writenodeweights /**< should we write weights of nodes? */ 2680 ); 2681 2682 /** Removes (irrelevant) variable from all its global structures, i.e. cliques, implications and variable bounds. 2683 * This is an advanced method which should be used with care. 2684 * 2685 * @return SCIP_OKAY if everything worked, otherwise a suitable error code is passed 2686 * 2687 * @pre This method can be called if @p scip is in one of the following stages: 2688 * - \ref SCIP_STAGE_TRANSFORMED 2689 * - \ref SCIP_STAGE_INITPRESOLVE 2690 * - \ref SCIP_STAGE_PRESOLVING 2691 * - \ref SCIP_STAGE_EXITPRESOLVE 2692 * - \ref SCIP_STAGE_PRESOLVED 2693 * - \ref SCIP_STAGE_INITSOLVE 2694 * - \ref SCIP_STAGE_SOLVING 2695 * - \ref SCIP_STAGE_SOLVED 2696 * - \ref SCIP_STAGE_EXITSOLVE 2697 */ 2698 SCIP_EXPORT 2699 SCIP_RETCODE SCIPremoveVarFromGlobalStructures( 2700 SCIP* scip, /**< SCIP data structure */ 2701 SCIP_VAR* var /**< variable to remove from global structures */ 2702 ); 2703 2704 /** sets the branch factor of the variable; this value can be used in the branching methods to scale the score 2705 * values of the variables; higher factor leads to a higher probability that this variable is chosen for branching 2706 * 2707 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 2708 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 2709 * 2710 * @pre This method can be called if @p scip is in one of the following stages: 2711 * - \ref SCIP_STAGE_PROBLEM 2712 * - \ref SCIP_STAGE_TRANSFORMING 2713 * - \ref SCIP_STAGE_TRANSFORMED 2714 * - \ref SCIP_STAGE_INITPRESOLVE 2715 * - \ref SCIP_STAGE_PRESOLVING 2716 * - \ref SCIP_STAGE_EXITPRESOLVE 2717 * - \ref SCIP_STAGE_PRESOLVED 2718 * - \ref SCIP_STAGE_SOLVING 2719 */ 2720 SCIP_EXPORT 2721 SCIP_RETCODE SCIPchgVarBranchFactor( 2722 SCIP* scip, /**< SCIP data structure */ 2723 SCIP_VAR* var, /**< problem variable */ 2724 SCIP_Real branchfactor /**< factor to weigh variable's branching score with */ 2725 ); 2726 2727 /** scales the branch factor of the variable with the given value 2728 * 2729 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 2730 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 2731 * 2732 * @pre This method can be called if @p scip is in one of the following stages: 2733 * - \ref SCIP_STAGE_PROBLEM 2734 * - \ref SCIP_STAGE_TRANSFORMING 2735 * - \ref SCIP_STAGE_TRANSFORMED 2736 * - \ref SCIP_STAGE_INITPRESOLVE 2737 * - \ref SCIP_STAGE_PRESOLVING 2738 * - \ref SCIP_STAGE_EXITPRESOLVE 2739 * - \ref SCIP_STAGE_PRESOLVED 2740 * - \ref SCIP_STAGE_SOLVING 2741 */ 2742 SCIP_EXPORT 2743 SCIP_RETCODE SCIPscaleVarBranchFactor( 2744 SCIP* scip, /**< SCIP data structure */ 2745 SCIP_VAR* var, /**< problem variable */ 2746 SCIP_Real scale /**< factor to scale variable's branching factor with */ 2747 ); 2748 2749 /** adds the given value to the branch factor of the variable 2750 * 2751 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 2752 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 2753 * 2754 * @pre This method can be called if @p scip is in one of the following stages: 2755 * - \ref SCIP_STAGE_PROBLEM 2756 * - \ref SCIP_STAGE_TRANSFORMING 2757 * - \ref SCIP_STAGE_TRANSFORMED 2758 * - \ref SCIP_STAGE_INITPRESOLVE 2759 * - \ref SCIP_STAGE_PRESOLVING 2760 * - \ref SCIP_STAGE_EXITPRESOLVE 2761 * - \ref SCIP_STAGE_PRESOLVED 2762 * - \ref SCIP_STAGE_SOLVING 2763 */ 2764 SCIP_EXPORT 2765 SCIP_RETCODE SCIPaddVarBranchFactor( 2766 SCIP* scip, /**< SCIP data structure */ 2767 SCIP_VAR* var, /**< problem variable */ 2768 SCIP_Real addfactor /**< value to add to the branch factor of the variable */ 2769 ); 2770 2771 /** sets the branch priority of the variable; variables with higher branch priority are always preferred to variables 2772 * with lower priority in selection of branching variable 2773 * 2774 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 2775 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 2776 * 2777 * @pre This method can be called if @p scip is in one of the following stages: 2778 * - \ref SCIP_STAGE_PROBLEM 2779 * - \ref SCIP_STAGE_TRANSFORMING 2780 * - \ref SCIP_STAGE_TRANSFORMED 2781 * - \ref SCIP_STAGE_INITPRESOLVE 2782 * - \ref SCIP_STAGE_PRESOLVING 2783 * - \ref SCIP_STAGE_EXITPRESOLVE 2784 * - \ref SCIP_STAGE_PRESOLVED 2785 * - \ref SCIP_STAGE_SOLVING 2786 * 2787 * @note the default branching priority is 0 2788 */ 2789 SCIP_EXPORT 2790 SCIP_RETCODE SCIPchgVarBranchPriority( 2791 SCIP* scip, /**< SCIP data structure */ 2792 SCIP_VAR* var, /**< problem variable */ 2793 int branchpriority /**< branch priority of the variable */ 2794 ); 2795 2796 /** changes the branch priority of the variable to the given value, if it is larger than the current priority 2797 * 2798 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 2799 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 2800 * 2801 * @pre This method can be called if @p scip is in one of the following stages: 2802 * - \ref SCIP_STAGE_PROBLEM 2803 * - \ref SCIP_STAGE_TRANSFORMING 2804 * - \ref SCIP_STAGE_TRANSFORMED 2805 * - \ref SCIP_STAGE_INITPRESOLVE 2806 * - \ref SCIP_STAGE_PRESOLVING 2807 * - \ref SCIP_STAGE_EXITPRESOLVE 2808 * - \ref SCIP_STAGE_PRESOLVED 2809 * - \ref SCIP_STAGE_SOLVING 2810 */ 2811 SCIP_EXPORT 2812 SCIP_RETCODE SCIPupdateVarBranchPriority( 2813 SCIP* scip, /**< SCIP data structure */ 2814 SCIP_VAR* var, /**< problem variable */ 2815 int branchpriority /**< new branch priority of the variable, if it is larger than current priority */ 2816 ); 2817 2818 /** adds the given value to the branch priority of the variable 2819 * 2820 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 2821 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 2822 * 2823 * @pre This method can be called if @p scip is in one of the following stages: 2824 * - \ref SCIP_STAGE_PROBLEM 2825 * - \ref SCIP_STAGE_TRANSFORMING 2826 * - \ref SCIP_STAGE_TRANSFORMED 2827 * - \ref SCIP_STAGE_INITPRESOLVE 2828 * - \ref SCIP_STAGE_PRESOLVING 2829 * - \ref SCIP_STAGE_EXITPRESOLVE 2830 * - \ref SCIP_STAGE_PRESOLVED 2831 * - \ref SCIP_STAGE_SOLVING 2832 */ 2833 SCIP_EXPORT 2834 SCIP_RETCODE SCIPaddVarBranchPriority( 2835 SCIP* scip, /**< SCIP data structure */ 2836 SCIP_VAR* var, /**< problem variable */ 2837 int addpriority /**< value to add to the branch priority of the variable */ 2838 ); 2839 2840 /** sets the branch direction of the variable (-1: prefer downwards branch, 0: automatic selection, +1: prefer upwards 2841 * branch) 2842 * 2843 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 2844 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 2845 * 2846 * @pre This method can be called if @p scip is in one of the following stages: 2847 * - \ref SCIP_STAGE_PROBLEM 2848 * - \ref SCIP_STAGE_TRANSFORMING 2849 * - \ref SCIP_STAGE_TRANSFORMED 2850 * - \ref SCIP_STAGE_INITPRESOLVE 2851 * - \ref SCIP_STAGE_PRESOLVING 2852 * - \ref SCIP_STAGE_EXITPRESOLVE 2853 * - \ref SCIP_STAGE_PRESOLVED 2854 * - \ref SCIP_STAGE_SOLVING 2855 */ 2856 SCIP_EXPORT 2857 SCIP_RETCODE SCIPchgVarBranchDirection( 2858 SCIP* scip, /**< SCIP data structure */ 2859 SCIP_VAR* var, /**< problem variable */ 2860 SCIP_BRANCHDIR branchdirection /**< preferred branch direction of the variable (downwards, upwards, auto) */ 2861 ); 2862 2863 /** changes type of variable in the problem; 2864 * 2865 * @warning This type change might change the variable array returned from SCIPgetVars() and SCIPgetVarsData(); 2866 * 2867 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 2868 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 2869 * 2870 * @pre This method can be called if @p scip is in one of the following stages: 2871 * - \ref SCIP_STAGE_PROBLEM 2872 * - \ref SCIP_STAGE_TRANSFORMING 2873 * - \ref SCIP_STAGE_PRESOLVING 2874 * 2875 * @note If SCIP is already beyond the SCIP_STAGE_PROBLEM and a original variable is passed, the variable type of the 2876 * corresponding transformed variable is changed; the type of the original variable does not change 2877 * 2878 * @note If the type changes from a continuous variable to a non-continuous variable the bounds of the variable get 2879 * adjusted w.r.t. to integrality information 2880 */ 2881 SCIP_EXPORT 2882 SCIP_RETCODE SCIPchgVarType( 2883 SCIP* scip, /**< SCIP data structure */ 2884 SCIP_VAR* var, /**< variable to change the bound for */ 2885 SCIP_VARTYPE vartype, /**< new type of variable */ 2886 SCIP_Bool* infeasible /**< pointer to store whether an infeasibility was detected (, due to 2887 * integrality condition of the new variable type) */ 2888 ); 2889 2890 /** in problem creation and solving stage, both bounds of the variable are set to the given value; 2891 * in presolving stage, the variable is converted into a fixed variable, and bounds are changed respectively; 2892 * conversion into a fixed variable changes the vars array returned from SCIPgetVars() and SCIPgetVarsData(), 2893 * and also renders arrays returned from the SCIPvarGetImpl...() methods invalid 2894 * 2895 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 2896 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 2897 * 2898 * @pre This method can be called if @p scip is in one of the following stages: 2899 * - \ref SCIP_STAGE_PROBLEM 2900 * - \ref SCIP_STAGE_PRESOLVING 2901 * - \ref SCIP_STAGE_SOLVING 2902 */ 2903 SCIP_EXPORT 2904 SCIP_RETCODE SCIPfixVar( 2905 SCIP* scip, /**< SCIP data structure */ 2906 SCIP_VAR* var, /**< variable to fix */ 2907 SCIP_Real fixedval, /**< value to fix variable to */ 2908 SCIP_Bool* infeasible, /**< pointer to store whether the fixing is infeasible */ 2909 SCIP_Bool* fixed /**< pointer to store whether the fixing was performed (variable was unfixed) */ 2910 ); 2911 2912 /** From a given equality a*x + b*y == c, aggregates one of the variables and removes it from the set of 2913 * active problem variables. This changes the vars array returned from SCIPgetVars() and SCIPgetVarsData(), 2914 * and also renders the arrays returned from the SCIPvarGetImpl...() methods for the two variables invalid. 2915 * In the first step, the equality is transformed into an equality with active problem variables 2916 * a'*x' + b'*y' == c'. If x' == y', this leads to the detection of redundancy if a' == -b' and c' == 0, 2917 * of infeasibility, if a' == -b' and c' != 0, or to a variable fixing x' == c'/(a'+b') (and possible 2918 * infeasibility) otherwise. 2919 * In the second step, the variable to be aggregated is chosen among x' and y', prefering a less strict variable 2920 * type as aggregation variable (i.e. continuous variables are preferred over implicit integers, implicit integers 2921 * over integers, and integers over binaries). If none of the variables is continuous, it is tried to find an integer 2922 * aggregation (i.e. integral coefficients a'' and b'', such that a''*x' + b''*y' == c''). This can lead to 2923 * the detection of infeasibility (e.g. if c'' is fractional), or to a rejection of the aggregation (denoted by 2924 * aggregated == FALSE), if the resulting integer coefficients are too large and thus numerically instable. 2925 * 2926 * The output flags have the following meaning: 2927 * - infeasible: the problem is infeasible 2928 * - redundant: the equality can be deleted from the constraint set 2929 * - aggregated: the aggregation was successfully performed (the variables were not aggregated before) 2930 * 2931 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 2932 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 2933 * 2934 * @pre This method can only be called if @p scip is in stage \ref SCIP_STAGE_PRESOLVING 2935 */ 2936 SCIP_EXPORT 2937 SCIP_RETCODE SCIPaggregateVars( 2938 SCIP* scip, /**< SCIP data structure */ 2939 SCIP_VAR* varx, /**< variable x in equality a*x + b*y == c */ 2940 SCIP_VAR* vary, /**< variable y in equality a*x + b*y == c */ 2941 SCIP_Real scalarx, /**< multiplier a in equality a*x + b*y == c */ 2942 SCIP_Real scalary, /**< multiplier b in equality a*x + b*y == c */ 2943 SCIP_Real rhs, /**< right hand side c in equality a*x + b*y == c */ 2944 SCIP_Bool* infeasible, /**< pointer to store whether the aggregation is infeasible */ 2945 SCIP_Bool* redundant, /**< pointer to store whether the equality is (now) redundant */ 2946 SCIP_Bool* aggregated /**< pointer to store whether the aggregation was successful */ 2947 ); 2948 2949 /** converts variable into multi-aggregated variable; this changes the variable array returned from 2950 * SCIPgetVars() and SCIPgetVarsData(); 2951 * 2952 * @warning The integrality condition is not checked anymore on the multi-aggregated variable. You must not 2953 * multi-aggregate an integer variable without being sure, that integrality on the aggregation variables 2954 * implies integrality on the aggregated variable. 2955 * 2956 * The output flags have the following meaning: 2957 * - infeasible: the problem is infeasible 2958 * - aggregated: the aggregation was successfully performed (the variables were not aggregated before) 2959 * 2960 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 2961 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 2962 * 2963 * @pre This method can only be called if @p scip is in stage \ref SCIP_STAGE_PRESOLVING 2964 */ 2965 SCIP_EXPORT 2966 SCIP_RETCODE SCIPmultiaggregateVar( 2967 SCIP* scip, /**< SCIP data structure */ 2968 SCIP_VAR* var, /**< variable x to aggregate */ 2969 int naggvars, /**< number n of variables in aggregation x = a_1*y_1 + ... + a_n*y_n + c */ 2970 SCIP_VAR** aggvars, /**< variables y_i in aggregation x = a_1*y_1 + ... + a_n*y_n + c */ 2971 SCIP_Real* scalars, /**< multipliers a_i in aggregation x = a_1*y_1 + ... + a_n*y_n + c */ 2972 SCIP_Real constant, /**< constant shift c in aggregation x = a_1*y_1 + ... + a_n*y_n + c */ 2973 SCIP_Bool* infeasible, /**< pointer to store whether the aggregation is infeasible */ 2974 SCIP_Bool* aggregated /**< pointer to store whether the aggregation was successful */ 2975 ); 2976 2977 /** returns whether aggregation of variables is not allowed */ 2978 SCIP_EXPORT 2979 SCIP_Bool SCIPdoNotAggr( 2980 SCIP* scip /**< SCIP data structure */ 2981 ); 2982 2983 /** returns whether multi-aggregation is disabled */ 2984 SCIP_EXPORT 2985 SCIP_Bool SCIPdoNotMultaggr( 2986 SCIP* scip /**< SCIP data structure */ 2987 ); 2988 2989 /** returns whether variable is not allowed to be aggregated */ 2990 SCIP_EXPORT 2991 SCIP_Bool SCIPdoNotAggrVar( 2992 SCIP* scip, /**< SCIP data structure */ 2993 SCIP_VAR* var /**< variable x to aggregate */ 2994 ); 2995 2996 /** returns whether variable is not allowed to be multi-aggregated */ 2997 SCIP_EXPORT 2998 SCIP_Bool SCIPdoNotMultaggrVar( 2999 SCIP* scip, /**< SCIP data structure */ 3000 SCIP_VAR* var /**< variable x to aggregate */ 3001 ); 3002 3003 /** returns whether dual reductions are allowed during propagation and presolving 3004 * 3005 * @deprecated Please use SCIPallowStrongDualReds() 3006 */ 3007 SCIP_EXPORT 3008 SCIP_DEPRECATED 3009 SCIP_Bool SCIPallowDualReds( 3010 SCIP* scip /**< SCIP data structure */ 3011 ); 3012 3013 /** returns whether strong dual reductions are allowed during propagation and presolving 3014 * 3015 * @note A reduction is called strong dual, if it may discard feasible/optimal solutions, but leaves at least one 3016 * optimal solution intact. Often such reductions are based on analyzing the objective function and variable 3017 * locks. 3018 */ 3019 SCIP_EXPORT 3020 SCIP_Bool SCIPallowStrongDualReds( 3021 SCIP* scip /**< SCIP data structure */ 3022 ); 3023 3024 /** returns whether propagation w.r.t. current objective is allowed 3025 * 3026 * @deprecated Please use SCIPallowWeakDualReds() 3027 */ 3028 SCIP_EXPORT 3029 SCIP_DEPRECATED 3030 SCIP_Bool SCIPallowObjProp( 3031 SCIP* scip /**< SCIP data structure */ 3032 ); 3033 3034 /** returns whether weak dual reductions are allowed during propagation and presolving 3035 * 3036 * @note A reduction is called weak dual, if it may discard feasible solutions, but leaves at all optimal solutions 3037 * intact. Often such reductions are based on analyzing the objective function, reduced costs, and/or dual LPs. 3038 */ 3039 SCIP_EXPORT 3040 SCIP_Bool SCIPallowWeakDualReds( 3041 SCIP* scip /**< SCIP data structure */ 3042 ); 3043 3044 /** marks the variable that it must not be aggregated 3045 * 3046 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 3047 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 3048 * 3049 * @pre This method can be called if @p scip is in one of the following stages: 3050 * - \ref SCIP_STAGE_INIT 3051 * - \ref SCIP_STAGE_PROBLEM 3052 * - \ref SCIP_STAGE_TRANSFORMING 3053 * - \ref SCIP_STAGE_TRANSFORMED 3054 * - \ref SCIP_STAGE_INITPRESOLVE 3055 * - \ref SCIP_STAGE_PRESOLVING 3056 * - \ref SCIP_STAGE_EXITPRESOLVE 3057 * 3058 * @note There exists no "unmark" method since it has to be ensured that if a plugin requires that a variable is not 3059 * aggregated that this is will be the case. 3060 */ 3061 SCIP_EXPORT 3062 SCIP_RETCODE SCIPmarkDoNotAggrVar( 3063 SCIP* scip, /**< SCIP data structure */ 3064 SCIP_VAR* var /**< variable to delete */ 3065 ); 3066 3067 /** marks the variable that it must not be multi-aggregated 3068 * 3069 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 3070 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 3071 * 3072 * @pre This method can be called if @p scip is in one of the following stages: 3073 * - \ref SCIP_STAGE_INIT 3074 * - \ref SCIP_STAGE_PROBLEM 3075 * - \ref SCIP_STAGE_TRANSFORMING 3076 * - \ref SCIP_STAGE_TRANSFORMED 3077 * - \ref SCIP_STAGE_INITPRESOLVE 3078 * - \ref SCIP_STAGE_PRESOLVING 3079 * - \ref SCIP_STAGE_EXITPRESOLVE 3080 * 3081 * @note There exists no "unmark" method since it has to be ensured that if a plugin requires that a variable is not 3082 * multi-aggregated that this is will be the case. 3083 */ 3084 SCIP_EXPORT 3085 SCIP_RETCODE SCIPmarkDoNotMultaggrVar( 3086 SCIP* scip, /**< SCIP data structure */ 3087 SCIP_VAR* var /**< variable to delete */ 3088 ); 3089 3090 /** enables the collection of statistics for a variable 3091 * 3092 * @pre This method can be called if @p scip is in one of the following stages: 3093 * - \ref SCIP_STAGE_PROBLEM 3094 * - \ref SCIP_STAGE_INITPRESOLVE 3095 * - \ref SCIP_STAGE_PRESOLVING 3096 * - \ref SCIP_STAGE_EXITPRESOLVE 3097 * - \ref SCIP_STAGE_SOLVING 3098 * - \ref SCIP_STAGE_SOLVED 3099 */ 3100 SCIP_EXPORT 3101 void SCIPenableVarHistory( 3102 SCIP* scip /**< SCIP data structure */ 3103 ); 3104 3105 /** disables the collection of any statistic for a variable 3106 * 3107 * @pre This method can be called if @p scip is in one of the following stages: 3108 * - \ref SCIP_STAGE_PROBLEM 3109 * - \ref SCIP_STAGE_INITPRESOLVE 3110 * - \ref SCIP_STAGE_PRESOLVING 3111 * - \ref SCIP_STAGE_EXITPRESOLVE 3112 * - \ref SCIP_STAGE_SOLVING 3113 * - \ref SCIP_STAGE_SOLVED 3114 */ 3115 SCIP_EXPORT 3116 void SCIPdisableVarHistory( 3117 SCIP* scip /**< SCIP data structure */ 3118 ); 3119 3120 /** updates the pseudo costs of the given variable and the global pseudo costs after a change of "solvaldelta" in the 3121 * variable's solution value and resulting change of "objdelta" in the in the LP's objective value; 3122 * the update is ignored, if the objective value difference is infinite 3123 * 3124 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 3125 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 3126 * 3127 * @pre This method can be called if @p scip is in one of the following stages: 3128 * - \ref SCIP_STAGE_SOLVING 3129 * - \ref SCIP_STAGE_SOLVED 3130 */ 3131 SCIP_EXPORT 3132 SCIP_RETCODE SCIPupdateVarPseudocost( 3133 SCIP* scip, /**< SCIP data structure */ 3134 SCIP_VAR* var, /**< problem variable */ 3135 SCIP_Real solvaldelta, /**< difference of variable's new LP value - old LP value */ 3136 SCIP_Real objdelta, /**< difference of new LP's objective value - old LP's objective value */ 3137 SCIP_Real weight /**< weight in (0,1] of this update in pseudo cost sum */ 3138 ); 3139 3140 /** gets the variable's pseudo cost value for the given change of the variable's LP value 3141 * 3142 * @return the variable's pseudo cost value for the given change of the variable's LP value 3143 * 3144 * @pre This method can be called if @p scip is in one of the following stages: 3145 * - \ref SCIP_STAGE_INITPRESOLVE 3146 * - \ref SCIP_STAGE_PRESOLVING 3147 * - \ref SCIP_STAGE_EXITPRESOLVE 3148 * - \ref SCIP_STAGE_PRESOLVED 3149 * - \ref SCIP_STAGE_INITSOLVE 3150 * - \ref SCIP_STAGE_SOLVING 3151 * - \ref SCIP_STAGE_SOLVED 3152 */ 3153 SCIP_EXPORT 3154 SCIP_Real SCIPgetVarPseudocostVal( 3155 SCIP* scip, /**< SCIP data structure */ 3156 SCIP_VAR* var, /**< problem variable */ 3157 SCIP_Real solvaldelta /**< difference of variable's new LP value - old LP value */ 3158 ); 3159 3160 /** gets the variable's pseudo cost value for the given change of the variable's LP value, 3161 * only using the pseudo cost information of the current run 3162 * 3163 * @return the variable's pseudo cost value for the given change of the variable's LP value, 3164 * only using the pseudo cost information of the current run 3165 * 3166 * @pre This method can be called if @p scip is in one of the following stages: 3167 * - \ref SCIP_STAGE_INITPRESOLVE 3168 * - \ref SCIP_STAGE_PRESOLVING 3169 * - \ref SCIP_STAGE_EXITPRESOLVE 3170 * - \ref SCIP_STAGE_PRESOLVED 3171 * - \ref SCIP_STAGE_INITSOLVE 3172 * - \ref SCIP_STAGE_SOLVING 3173 * - \ref SCIP_STAGE_SOLVED 3174 */ 3175 SCIP_EXPORT 3176 SCIP_Real SCIPgetVarPseudocostValCurrentRun( 3177 SCIP* scip, /**< SCIP data structure */ 3178 SCIP_VAR* var, /**< problem variable */ 3179 SCIP_Real solvaldelta /**< difference of variable's new LP value - old LP value */ 3180 ); 3181 3182 /** gets the variable's pseudo cost value for the given direction 3183 * 3184 * @return the variable's pseudo cost value for the given direction 3185 * 3186 * @pre This method can be called if @p scip is in one of the following stages: 3187 * - \ref SCIP_STAGE_INITPRESOLVE 3188 * - \ref SCIP_STAGE_PRESOLVING 3189 * - \ref SCIP_STAGE_EXITPRESOLVE 3190 * - \ref SCIP_STAGE_PRESOLVED 3191 * - \ref SCIP_STAGE_INITSOLVE 3192 * - \ref SCIP_STAGE_SOLVING 3193 * - \ref SCIP_STAGE_SOLVED 3194 */ 3195 SCIP_EXPORT 3196 SCIP_Real SCIPgetVarPseudocost( 3197 SCIP* scip, /**< SCIP data structure */ 3198 SCIP_VAR* var, /**< problem variable */ 3199 SCIP_BRANCHDIR dir /**< branching direction (downwards, or upwards) */ 3200 ); 3201 3202 /** gets the variable's pseudo cost value for the given direction, 3203 * only using the pseudo cost information of the current run 3204 * 3205 * @return the variable's pseudo cost value for the given direction, 3206 * only using the pseudo cost information of the current run 3207 * 3208 * @pre This method can be called if @p scip is in one of the following stages: 3209 * - \ref SCIP_STAGE_INITPRESOLVE 3210 * - \ref SCIP_STAGE_PRESOLVING 3211 * - \ref SCIP_STAGE_EXITPRESOLVE 3212 * - \ref SCIP_STAGE_PRESOLVED 3213 * - \ref SCIP_STAGE_INITSOLVE 3214 * - \ref SCIP_STAGE_SOLVING 3215 * - \ref SCIP_STAGE_SOLVED 3216 */ 3217 SCIP_EXPORT 3218 SCIP_Real SCIPgetVarPseudocostCurrentRun( 3219 SCIP* scip, /**< SCIP data structure */ 3220 SCIP_VAR* var, /**< problem variable */ 3221 SCIP_BRANCHDIR dir /**< branching direction (downwards, or upwards) */ 3222 ); 3223 3224 /** gets the variable's (possible fractional) number of pseudo cost updates for the given direction 3225 * 3226 * @return the variable's (possible fractional) number of pseudo cost updates for the given direction 3227 * 3228 * @pre This method can be called if @p scip is in one of the following stages: 3229 * - \ref SCIP_STAGE_INITPRESOLVE 3230 * - \ref SCIP_STAGE_PRESOLVING 3231 * - \ref SCIP_STAGE_EXITPRESOLVE 3232 * - \ref SCIP_STAGE_PRESOLVED 3233 * - \ref SCIP_STAGE_INITSOLVE 3234 * - \ref SCIP_STAGE_SOLVING 3235 * - \ref SCIP_STAGE_SOLVED 3236 */ 3237 SCIP_EXPORT 3238 SCIP_Real SCIPgetVarPseudocostCount( 3239 SCIP* scip, /**< SCIP data structure */ 3240 SCIP_VAR* var, /**< problem variable */ 3241 SCIP_BRANCHDIR dir /**< branching direction (downwards, or upwards) */ 3242 ); 3243 3244 /** gets the variable's (possible fractional) number of pseudo cost updates for the given direction, 3245 * only using the pseudo cost information of the current run 3246 * 3247 * @return the variable's (possible fractional) number of pseudo cost updates for the given direction, 3248 * only using the pseudo cost information of the current run 3249 * 3250 * @pre This method can be called if @p scip is in one of the following stages: 3251 * - \ref SCIP_STAGE_INITPRESOLVE 3252 * - \ref SCIP_STAGE_PRESOLVING 3253 * - \ref SCIP_STAGE_EXITPRESOLVE 3254 * - \ref SCIP_STAGE_PRESOLVED 3255 * - \ref SCIP_STAGE_INITSOLVE 3256 * - \ref SCIP_STAGE_SOLVING 3257 * - \ref SCIP_STAGE_SOLVED 3258 */ 3259 SCIP_EXPORT 3260 SCIP_Real SCIPgetVarPseudocostCountCurrentRun( 3261 SCIP* scip, /**< SCIP data structure */ 3262 SCIP_VAR* var, /**< problem variable */ 3263 SCIP_BRANCHDIR dir /**< branching direction (downwards, or upwards) */ 3264 ); 3265 3266 /** get pseudo cost variance of the variable, either for entire solve or only for current branch and bound run 3267 * 3268 * @return returns the (corrected) variance of pseudo code information collected so far. 3269 * 3270 * @pre This method can be called if @p scip is in one of the following stages: 3271 * - \ref SCIP_STAGE_INITPRESOLVE 3272 * - \ref SCIP_STAGE_PRESOLVING 3273 * - \ref SCIP_STAGE_EXITPRESOLVE 3274 * - \ref SCIP_STAGE_PRESOLVED 3275 * - \ref SCIP_STAGE_INITSOLVE 3276 * - \ref SCIP_STAGE_SOLVING 3277 * - \ref SCIP_STAGE_SOLVED 3278 */ 3279 SCIP_EXPORT 3280 SCIP_Real SCIPgetVarPseudocostVariance( 3281 SCIP* scip, /**< SCIP data structure */ 3282 SCIP_VAR* var, /**< problem variable */ 3283 SCIP_BRANCHDIR dir, /**< branching direction (downwards, or upwards) */ 3284 SCIP_Bool onlycurrentrun /**< only for pseudo costs of current branch and bound run */ 3285 ); 3286 3287 /** calculates a confidence bound for this variable under the assumption of normally distributed pseudo costs 3288 * 3289 * The confidence bound \f$ \theta \geq 0\f$ denotes the interval borders \f$ [X - \theta, \ X + \theta]\f$, which contains 3290 * the true pseudo costs of the variable, i.e., the expected value of the normal distribution, with a probability 3291 * of 2 * clevel - 1. 3292 * 3293 * @return value of confidence bound for this variable 3294 */ 3295 SCIP_EXPORT 3296 SCIP_Real SCIPcalculatePscostConfidenceBound( 3297 SCIP* scip, /**< SCIP data structure */ 3298 SCIP_VAR* var, /**< variable in question */ 3299 SCIP_BRANCHDIR dir, /**< the branching direction for the confidence bound */ 3300 SCIP_Bool onlycurrentrun, /**< should only the current run be taken into account */ 3301 SCIP_CONFIDENCELEVEL clevel /**< confidence level for the interval */ 3302 ); 3303 3304 /** check if variable pseudo-costs have a significant difference in location. The significance depends on 3305 * the choice of \p clevel and on the kind of tested hypothesis. The one-sided hypothesis, which 3306 * should be rejected, is that fracy * mu_y >= fracx * mu_x, where mu_y and mu_x denote the 3307 * unknown location means of the underlying pseudo-cost distributions of x and y. 3308 * 3309 * This method is applied best if variable x has a better pseudo-cost score than y. The method hypothesizes that y were actually 3310 * better than x (despite the current information), meaning that y can be expected to yield branching 3311 * decisions as least as good as x in the long run. If the method returns TRUE, the current history information is 3312 * sufficient to safely rely on the alternative hypothesis that x yields indeed a better branching score (on average) 3313 * than y. 3314 * 3315 * @note The order of x and y matters for the one-sided hypothesis 3316 * 3317 * @note set \p onesided to FALSE if you are not sure which variable is better. The hypothesis tested then reads 3318 * fracy * mu_y == fracx * mu_x vs the alternative hypothesis fracy * mu_y != fracx * mu_x. 3319 * 3320 * @return TRUE if the hypothesis can be safely rejected at the given confidence level 3321 */ 3322 SCIP_EXPORT 3323 SCIP_Bool SCIPsignificantVarPscostDifference( 3324 SCIP* scip, /**< SCIP data structure */ 3325 SCIP_VAR* varx, /**< variable x */ 3326 SCIP_Real fracx, /**< the fractionality of variable x */ 3327 SCIP_VAR* vary, /**< variable y */ 3328 SCIP_Real fracy, /**< the fractionality of variable y */ 3329 SCIP_BRANCHDIR dir, /**< branching direction */ 3330 SCIP_CONFIDENCELEVEL clevel, /**< confidence level for rejecting hypothesis */ 3331 SCIP_Bool onesided /**< should a one-sided hypothesis y >= x be tested? */ 3332 ); 3333 3334 /** tests at a given confidence level whether the variable pseudo-costs only have a small probability to 3335 * exceed a \p threshold. This is useful to determine if past observations provide enough evidence 3336 * to skip an expensive strong-branching step if there is already a candidate that has been proven to yield an improvement 3337 * of at least \p threshold. 3338 * 3339 * @note use \p clevel to adjust the level of confidence. For SCIP_CONFIDENCELEVEL_MIN, the method returns TRUE if 3340 * the estimated probability to exceed \p threshold is less than 25 %. 3341 * 3342 * @see SCIP_Confidencelevel for a list of available levels. The used probability limits refer to the one-sided levels 3343 * of confidence. 3344 * 3345 * @return TRUE if the variable pseudo-cost probabilistic model is likely to be smaller than \p threshold 3346 * at the given confidence level \p clevel. 3347 */ 3348 SCIP_EXPORT 3349 SCIP_Bool SCIPpscostThresholdProbabilityTest( 3350 SCIP* scip, /**< SCIP data structure */ 3351 SCIP_VAR* var, /**< variable x */ 3352 SCIP_Real frac, /**< the fractionality of variable x */ 3353 SCIP_Real threshold, /**< the threshold to test against */ 3354 SCIP_BRANCHDIR dir, /**< branching direction */ 3355 SCIP_CONFIDENCELEVEL clevel /**< confidence level for rejecting hypothesis */ 3356 ); 3357 3358 /** check if the current pseudo cost relative error in a direction violates the given threshold. The Relative 3359 * Error is calculated at a specific confidence level 3360 * 3361 * @return TRUE if relative error in variable pseudo costs is smaller than \p threshold 3362 */ 3363 SCIP_EXPORT 3364 SCIP_Bool SCIPisVarPscostRelerrorReliable( 3365 SCIP* scip, /**< SCIP data structure */ 3366 SCIP_VAR* var, /**< variable in question */ 3367 SCIP_Real threshold, /**< threshold for relative errors to be considered reliable (enough) */ 3368 SCIP_CONFIDENCELEVEL clevel /**< a given confidence level */ 3369 ); 3370 3371 /** gets the variable's pseudo cost score value for the given LP solution value 3372 * 3373 * @return the variable's pseudo cost score value for the given LP solution value 3374 * 3375 * @pre This method can be called if @p scip is in one of the following stages: 3376 * - \ref SCIP_STAGE_INITPRESOLVE 3377 * - \ref SCIP_STAGE_PRESOLVING 3378 * - \ref SCIP_STAGE_EXITPRESOLVE 3379 * - \ref SCIP_STAGE_PRESOLVED 3380 * - \ref SCIP_STAGE_INITSOLVE 3381 * - \ref SCIP_STAGE_SOLVING 3382 * - \ref SCIP_STAGE_SOLVED 3383 */ 3384 SCIP_EXPORT 3385 SCIP_Real SCIPgetVarPseudocostScore( 3386 SCIP* scip, /**< SCIP data structure */ 3387 SCIP_VAR* var, /**< problem variable */ 3388 SCIP_Real solval /**< variable's LP solution value */ 3389 ); 3390 3391 /** gets the variable's pseudo cost score value for the given LP solution value, 3392 * only using the pseudo cost information of the current run 3393 * 3394 * @return the variable's pseudo cost score value for the given LP solution value, 3395 * only using the pseudo cost information of the current run 3396 * 3397 * @pre This method can be called if @p scip is in one of the following stages: 3398 * - \ref SCIP_STAGE_INITPRESOLVE 3399 * - \ref SCIP_STAGE_PRESOLVING 3400 * - \ref SCIP_STAGE_EXITPRESOLVE 3401 * - \ref SCIP_STAGE_PRESOLVED 3402 * - \ref SCIP_STAGE_INITSOLVE 3403 * - \ref SCIP_STAGE_SOLVING 3404 * - \ref SCIP_STAGE_SOLVED 3405 */ 3406 SCIP_EXPORT 3407 SCIP_Real SCIPgetVarPseudocostScoreCurrentRun( 3408 SCIP* scip, /**< SCIP data structure */ 3409 SCIP_VAR* var, /**< problem variable */ 3410 SCIP_Real solval /**< variable's LP solution value */ 3411 ); 3412 3413 /** returns the variable's VSIDS value 3414 * 3415 * @return the variable's VSIDS value 3416 * 3417 * @pre This method can be called if @p scip is in one of the following stages: 3418 * - \ref SCIP_STAGE_INITPRESOLVE 3419 * - \ref SCIP_STAGE_PRESOLVING 3420 * - \ref SCIP_STAGE_EXITPRESOLVE 3421 * - \ref SCIP_STAGE_PRESOLVED 3422 * - \ref SCIP_STAGE_INITSOLVE 3423 * - \ref SCIP_STAGE_SOLVING 3424 * - \ref SCIP_STAGE_SOLVED 3425 */ 3426 SCIP_EXPORT 3427 SCIP_Real SCIPgetVarVSIDS( 3428 SCIP* scip, /**< SCIP data structure */ 3429 SCIP_VAR* var, /**< problem variable */ 3430 SCIP_BRANCHDIR dir /**< branching direction (downwards, or upwards) */ 3431 ); 3432 3433 /** returns the variable's VSIDS value only using conflicts of the current run 3434 * 3435 * @return the variable's VSIDS value only using conflicts of the current run 3436 * 3437 * @pre This method can be called if @p scip is in one of the following stages: 3438 * - \ref SCIP_STAGE_INITPRESOLVE 3439 * - \ref SCIP_STAGE_PRESOLVING 3440 * - \ref SCIP_STAGE_EXITPRESOLVE 3441 * - \ref SCIP_STAGE_PRESOLVED 3442 * - \ref SCIP_STAGE_INITSOLVE 3443 * - \ref SCIP_STAGE_SOLVING 3444 * - \ref SCIP_STAGE_SOLVED 3445 */ 3446 SCIP_EXPORT 3447 SCIP_Real SCIPgetVarVSIDSCurrentRun( 3448 SCIP* scip, /**< SCIP data structure */ 3449 SCIP_VAR* var, /**< problem variable */ 3450 SCIP_BRANCHDIR dir /**< branching direction (downwards, or upwards) */ 3451 ); 3452 3453 /** returns the variable's conflict score value 3454 * 3455 * @return the variable's conflict score value 3456 * 3457 * @pre This method can be called if @p scip is in one of the following stages: 3458 * - \ref SCIP_STAGE_INITPRESOLVE 3459 * - \ref SCIP_STAGE_PRESOLVING 3460 * - \ref SCIP_STAGE_EXITPRESOLVE 3461 * - \ref SCIP_STAGE_PRESOLVED 3462 * - \ref SCIP_STAGE_INITSOLVE 3463 * - \ref SCIP_STAGE_SOLVING 3464 * - \ref SCIP_STAGE_SOLVED 3465 */ 3466 SCIP_EXPORT 3467 SCIP_Real SCIPgetVarConflictScore( 3468 SCIP* scip, /**< SCIP data structure */ 3469 SCIP_VAR* var /**< problem variable */ 3470 ); 3471 3472 /** returns the variable's conflict score value only using conflicts of the current run 3473 * 3474 * @return the variable's conflict score value only using conflicts of the current run 3475 * 3476 * @pre This method can be called if @p scip is in one of the following stages: 3477 * - \ref SCIP_STAGE_INITPRESOLVE 3478 * - \ref SCIP_STAGE_PRESOLVING 3479 * - \ref SCIP_STAGE_EXITPRESOLVE 3480 * - \ref SCIP_STAGE_PRESOLVED 3481 * - \ref SCIP_STAGE_INITSOLVE 3482 * - \ref SCIP_STAGE_SOLVING 3483 * - \ref SCIP_STAGE_SOLVED 3484 */ 3485 SCIP_EXPORT 3486 SCIP_Real SCIPgetVarConflictScoreCurrentRun( 3487 SCIP* scip, /**< SCIP data structure */ 3488 SCIP_VAR* var /**< problem variable */ 3489 ); 3490 3491 /** returns the variable's conflict length score 3492 * 3493 * @return the variable's conflict length score 3494 * 3495 * @pre This method can be called if @p scip is in one of the following stages: 3496 * - \ref SCIP_STAGE_INITPRESOLVE 3497 * - \ref SCIP_STAGE_PRESOLVING 3498 * - \ref SCIP_STAGE_EXITPRESOLVE 3499 * - \ref SCIP_STAGE_PRESOLVED 3500 * - \ref SCIP_STAGE_INITSOLVE 3501 * - \ref SCIP_STAGE_SOLVING 3502 * - \ref SCIP_STAGE_SOLVED 3503 */ 3504 SCIP_EXPORT 3505 SCIP_Real SCIPgetVarConflictlengthScore( 3506 SCIP* scip, /**< SCIP data structure */ 3507 SCIP_VAR* var /**< problem variable */ 3508 ); 3509 3510 /** returns the variable's conflict length score only using conflicts of the current run 3511 * 3512 * @return the variable's conflict length score only using conflicts of the current run 3513 * 3514 * @pre This method can be called if @p scip is in one of the following stages: 3515 * - \ref SCIP_STAGE_INITPRESOLVE 3516 * - \ref SCIP_STAGE_PRESOLVING 3517 * - \ref SCIP_STAGE_EXITPRESOLVE 3518 * - \ref SCIP_STAGE_PRESOLVED 3519 * - \ref SCIP_STAGE_INITSOLVE 3520 * - \ref SCIP_STAGE_SOLVING 3521 * - \ref SCIP_STAGE_SOLVED 3522 */ 3523 SCIP_EXPORT 3524 SCIP_Real SCIPgetVarConflictlengthScoreCurrentRun( 3525 SCIP* scip, /**< SCIP data structure */ 3526 SCIP_VAR* var /**< problem variable */ 3527 ); 3528 3529 /** returns the variable's average conflict length 3530 * 3531 * @return the variable's average conflict length 3532 * 3533 * @pre This method can be called if @p scip is in one of the following stages: 3534 * - \ref SCIP_STAGE_INITPRESOLVE 3535 * - \ref SCIP_STAGE_PRESOLVING 3536 * - \ref SCIP_STAGE_EXITPRESOLVE 3537 * - \ref SCIP_STAGE_PRESOLVED 3538 * - \ref SCIP_STAGE_INITSOLVE 3539 * - \ref SCIP_STAGE_SOLVING 3540 * - \ref SCIP_STAGE_SOLVED 3541 */ 3542 SCIP_EXPORT 3543 SCIP_Real SCIPgetVarAvgConflictlength( 3544 SCIP* scip, /**< SCIP data structure */ 3545 SCIP_VAR* var, /**< problem variable */ 3546 SCIP_BRANCHDIR dir /**< branching direction (downwards, or upwards) */ 3547 ); 3548 3549 /** returns the variable's average conflict length only using conflicts of the current run 3550 * 3551 * @return the variable's average conflict length only using conflicts of the current run 3552 * 3553 * @pre This method can be called if @p scip is in one of the following stages: 3554 * - \ref SCIP_STAGE_INITPRESOLVE 3555 * - \ref SCIP_STAGE_PRESOLVING 3556 * - \ref SCIP_STAGE_EXITPRESOLVE 3557 * - \ref SCIP_STAGE_PRESOLVED 3558 * - \ref SCIP_STAGE_INITSOLVE 3559 * - \ref SCIP_STAGE_SOLVING 3560 * - \ref SCIP_STAGE_SOLVED 3561 */ 3562 SCIP_EXPORT 3563 SCIP_Real SCIPgetVarAvgConflictlengthCurrentRun( 3564 SCIP* scip, /**< SCIP data structure */ 3565 SCIP_VAR* var, /**< problem variable */ 3566 SCIP_BRANCHDIR dir /**< branching direction (downwards, or upwards) */ 3567 ); 3568 3569 /** returns the average number of inferences found after branching on the variable in given direction; 3570 * if branching on the variable in the given direction was yet evaluated, the average number of inferences 3571 * over all variables for branching in the given direction is returned 3572 * 3573 * @return the average number of inferences found after branching on the variable in given direction 3574 * 3575 * @pre This method can be called if @p scip is in one of the following stages: 3576 * - \ref SCIP_STAGE_INITPRESOLVE 3577 * - \ref SCIP_STAGE_PRESOLVING 3578 * - \ref SCIP_STAGE_EXITPRESOLVE 3579 * - \ref SCIP_STAGE_PRESOLVED 3580 * - \ref SCIP_STAGE_INITSOLVE 3581 * - \ref SCIP_STAGE_SOLVING 3582 * - \ref SCIP_STAGE_SOLVED 3583 */ 3584 SCIP_EXPORT 3585 SCIP_Real SCIPgetVarAvgInferences( 3586 SCIP* scip, /**< SCIP data structure */ 3587 SCIP_VAR* var, /**< problem variable */ 3588 SCIP_BRANCHDIR dir /**< branching direction (downwards, or upwards) */ 3589 ); 3590 3591 /** returns the average number of inferences found after branching on the variable in given direction in the current run; 3592 * if branching on the variable in the given direction was yet evaluated, the average number of inferences 3593 * over all variables for branching in the given direction is returned 3594 * 3595 * @return the average number of inferences found after branching on the variable in given direction in the current run 3596 * 3597 * @pre This method can be called if @p scip is in one of the following stages: 3598 * - \ref SCIP_STAGE_INITPRESOLVE 3599 * - \ref SCIP_STAGE_PRESOLVING 3600 * - \ref SCIP_STAGE_EXITPRESOLVE 3601 * - \ref SCIP_STAGE_PRESOLVED 3602 * - \ref SCIP_STAGE_INITSOLVE 3603 * - \ref SCIP_STAGE_SOLVING 3604 * - \ref SCIP_STAGE_SOLVED 3605 */ 3606 SCIP_EXPORT 3607 SCIP_Real SCIPgetVarAvgInferencesCurrentRun( 3608 SCIP* scip, /**< SCIP data structure */ 3609 SCIP_VAR* var, /**< problem variable */ 3610 SCIP_BRANCHDIR dir /**< branching direction (downwards, or upwards) */ 3611 ); 3612 3613 /** returns the variable's average inference score value 3614 * 3615 * @return the variable's average inference score value 3616 * 3617 * @pre This method can be called if @p scip is in one of the following stages: 3618 * - \ref SCIP_STAGE_INITPRESOLVE 3619 * - \ref SCIP_STAGE_PRESOLVING 3620 * - \ref SCIP_STAGE_EXITPRESOLVE 3621 * - \ref SCIP_STAGE_PRESOLVED 3622 * - \ref SCIP_STAGE_INITSOLVE 3623 * - \ref SCIP_STAGE_SOLVING 3624 * - \ref SCIP_STAGE_SOLVED 3625 */ 3626 SCIP_EXPORT 3627 SCIP_Real SCIPgetVarAvgInferenceScore( 3628 SCIP* scip, /**< SCIP data structure */ 3629 SCIP_VAR* var /**< problem variable */ 3630 ); 3631 3632 /** returns the variable's average inference score value only using inferences of the current run 3633 * 3634 * @return the variable's average inference score value only using inferences of the current run 3635 * 3636 * @pre This method can be called if @p scip is in one of the following stages: 3637 * - \ref SCIP_STAGE_INITPRESOLVE 3638 * - \ref SCIP_STAGE_PRESOLVING 3639 * - \ref SCIP_STAGE_EXITPRESOLVE 3640 * - \ref SCIP_STAGE_PRESOLVED 3641 * - \ref SCIP_STAGE_INITSOLVE 3642 * - \ref SCIP_STAGE_SOLVING 3643 * - \ref SCIP_STAGE_SOLVED 3644 */ 3645 SCIP_EXPORT 3646 SCIP_Real SCIPgetVarAvgInferenceScoreCurrentRun( 3647 SCIP* scip, /**< SCIP data structure */ 3648 SCIP_VAR* var /**< problem variable */ 3649 ); 3650 3651 /** initializes the upwards and downwards pseudocosts, conflict scores, conflict lengths, inference scores, cutoff scores 3652 * of a variable to the given values 3653 * 3654 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 3655 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 3656 * 3657 * @pre This method can be called if @p scip is in one of the following stages: 3658 * - \ref SCIP_STAGE_TRANSFORMED 3659 * - \ref SCIP_STAGE_INITPRESOLVE 3660 * - \ref SCIP_STAGE_PRESOLVING 3661 * - \ref SCIP_STAGE_EXITPRESOLVE 3662 * - \ref SCIP_STAGE_PRESOLVED 3663 * - \ref SCIP_STAGE_INITSOLVE 3664 * - \ref SCIP_STAGE_SOLVING 3665 */ 3666 SCIP_EXPORT 3667 SCIP_RETCODE SCIPinitVarBranchStats( 3668 SCIP* scip, /**< SCIP data structure */ 3669 SCIP_VAR* var, /**< variable which should be initialized */ 3670 SCIP_Real downpscost, /**< value to which pseudocosts for downwards branching should be initialized */ 3671 SCIP_Real uppscost, /**< value to which pseudocosts for upwards branching should be initialized */ 3672 SCIP_Real downvsids, /**< value to which VSIDS score for downwards branching should be initialized */ 3673 SCIP_Real upvsids, /**< value to which VSIDS score for upwards branching should be initialized */ 3674 SCIP_Real downconflen, /**< value to which conflict length score for downwards branching should be initialized */ 3675 SCIP_Real upconflen, /**< value to which conflict length score for upwards branching should be initialized */ 3676 SCIP_Real downinfer, /**< value to which inference counter for downwards branching should be initialized */ 3677 SCIP_Real upinfer, /**< value to which inference counter for upwards branching should be initialized */ 3678 SCIP_Real downcutoff, /**< value to which cutoff counter for downwards branching should be initialized */ 3679 SCIP_Real upcutoff /**< value to which cutoff counter for upwards branching should be initialized */ 3680 ); 3681 3682 /** initializes the upwards and downwards conflict scores, conflict lengths, inference scores, cutoff scores of a 3683 * variable w.r.t. a value by the given values (SCIP_VALUEHISTORY) 3684 * 3685 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 3686 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 3687 * 3688 * @pre This method can be called if @p scip is in one of the following stages: 3689 * - \ref SCIP_STAGE_TRANSFORMED 3690 * - \ref SCIP_STAGE_INITPRESOLVE 3691 * - \ref SCIP_STAGE_PRESOLVING 3692 * - \ref SCIP_STAGE_EXITPRESOLVE 3693 * - \ref SCIP_STAGE_PRESOLVED 3694 * - \ref SCIP_STAGE_INITSOLVE 3695 * - \ref SCIP_STAGE_SOLVING 3696 */ 3697 SCIP_EXPORT 3698 SCIP_RETCODE SCIPinitVarValueBranchStats( 3699 SCIP* scip, /**< SCIP data structure */ 3700 SCIP_VAR* var, /**< variable which should be initialized */ 3701 SCIP_Real value, /**< domain value, or SCIP_UNKNOWN */ 3702 SCIP_Real downvsids, /**< value to which VSIDS score for downwards branching should be initialized */ 3703 SCIP_Real upvsids, /**< value to which VSIDS score for upwards branching should be initialized */ 3704 SCIP_Real downconflen, /**< value to which conflict length score for downwards branching should be initialized */ 3705 SCIP_Real upconflen, /**< value to which conflict length score for upwards branching should be initialized */ 3706 SCIP_Real downinfer, /**< value to which inference counter for downwards branching should be initialized */ 3707 SCIP_Real upinfer, /**< value to which inference counter for upwards branching should be initialized */ 3708 SCIP_Real downcutoff, /**< value to which cutoff counter for downwards branching should be initialized */ 3709 SCIP_Real upcutoff /**< value to which cutoff counter for upwards branching should be initialized */ 3710 ); 3711 3712 /** returns the average number of cutoffs found after branching on the variable in given direction; 3713 * if branching on the variable in the given direction was yet evaluated, the average number of cutoffs 3714 * over all variables for branching in the given direction is returned 3715 * 3716 * @return the average number of cutoffs found after branching on the variable in given direction 3717 * 3718 * @pre This method can be called if @p scip is in one of the following stages: 3719 * - \ref SCIP_STAGE_INITPRESOLVE 3720 * - \ref SCIP_STAGE_PRESOLVING 3721 * - \ref SCIP_STAGE_EXITPRESOLVE 3722 * - \ref SCIP_STAGE_PRESOLVED 3723 * - \ref SCIP_STAGE_INITSOLVE 3724 * - \ref SCIP_STAGE_SOLVING 3725 * - \ref SCIP_STAGE_SOLVED 3726 */ 3727 SCIP_EXPORT 3728 SCIP_Real SCIPgetVarAvgCutoffs( 3729 SCIP* scip, /**< SCIP data structure */ 3730 SCIP_VAR* var, /**< problem variable */ 3731 SCIP_BRANCHDIR dir /**< branching direction (downwards, or upwards) */ 3732 ); 3733 3734 /** returns the average number of cutoffs found after branching on the variable in given direction in the current run; 3735 * if branching on the variable in the given direction was yet evaluated, the average number of cutoffs 3736 * over all variables for branching in the given direction is returned 3737 * 3738 * @return the average number of cutoffs found after branching on the variable in given direction in the current run 3739 * 3740 * @pre This method can be called if @p scip is in one of the following stages: 3741 * - \ref SCIP_STAGE_INITPRESOLVE 3742 * - \ref SCIP_STAGE_PRESOLVING 3743 * - \ref SCIP_STAGE_EXITPRESOLVE 3744 * - \ref SCIP_STAGE_PRESOLVED 3745 * - \ref SCIP_STAGE_INITSOLVE 3746 * - \ref SCIP_STAGE_SOLVING 3747 * - \ref SCIP_STAGE_SOLVED 3748 */ 3749 SCIP_EXPORT 3750 SCIP_Real SCIPgetVarAvgCutoffsCurrentRun( 3751 SCIP* scip, /**< SCIP data structure */ 3752 SCIP_VAR* var, /**< problem variable */ 3753 SCIP_BRANCHDIR dir /**< branching direction (downwards, or upwards) */ 3754 ); 3755 3756 /** returns the variable's average cutoff score value 3757 * 3758 * @return the variable's average cutoff score value 3759 * 3760 * @pre This method can be called if @p scip is in one of the following stages: 3761 * - \ref SCIP_STAGE_INITPRESOLVE 3762 * - \ref SCIP_STAGE_PRESOLVING 3763 * - \ref SCIP_STAGE_EXITPRESOLVE 3764 * - \ref SCIP_STAGE_PRESOLVED 3765 * - \ref SCIP_STAGE_INITSOLVE 3766 * - \ref SCIP_STAGE_SOLVING 3767 * - \ref SCIP_STAGE_SOLVED 3768 */ 3769 SCIP_EXPORT 3770 SCIP_Real SCIPgetVarAvgCutoffScore( 3771 SCIP* scip, /**< SCIP data structure */ 3772 SCIP_VAR* var /**< problem variable */ 3773 ); 3774 3775 /** returns the variable's average cutoff score value, only using cutoffs of the current run 3776 * 3777 * @return the variable's average cutoff score value, only using cutoffs of the current run 3778 * 3779 * @pre This method can be called if @p scip is in one of the following stages: 3780 * - \ref SCIP_STAGE_INITPRESOLVE 3781 * - \ref SCIP_STAGE_PRESOLVING 3782 * - \ref SCIP_STAGE_EXITPRESOLVE 3783 * - \ref SCIP_STAGE_PRESOLVED 3784 * - \ref SCIP_STAGE_INITSOLVE 3785 * - \ref SCIP_STAGE_SOLVING 3786 * - \ref SCIP_STAGE_SOLVED 3787 */ 3788 SCIP_EXPORT 3789 SCIP_Real SCIPgetVarAvgCutoffScoreCurrentRun( 3790 SCIP* scip, /**< SCIP data structure */ 3791 SCIP_VAR* var /**< problem variable */ 3792 ); 3793 3794 /** returns the variable's average inference/cutoff score value, weighting the cutoffs of the variable with the given 3795 * factor 3796 * 3797 * @return the variable's average inference/cutoff score value 3798 * 3799 * @pre This method can be called if @p scip is in one of the following stages: 3800 * - \ref SCIP_STAGE_INITPRESOLVE 3801 * - \ref SCIP_STAGE_PRESOLVING 3802 * - \ref SCIP_STAGE_EXITPRESOLVE 3803 * - \ref SCIP_STAGE_PRESOLVED 3804 * - \ref SCIP_STAGE_INITSOLVE 3805 * - \ref SCIP_STAGE_SOLVING 3806 * - \ref SCIP_STAGE_SOLVED 3807 */ 3808 SCIP_EXPORT 3809 SCIP_Real SCIPgetVarAvgInferenceCutoffScore( 3810 SCIP* scip, /**< SCIP data structure */ 3811 SCIP_VAR* var, /**< problem variable */ 3812 SCIP_Real cutoffweight /**< factor to weigh average number of cutoffs in branching score */ 3813 ); 3814 3815 /** returns the variable's average inference/cutoff score value, weighting the cutoffs of the variable with the given 3816 * factor, only using inferences and cutoffs of the current run 3817 * 3818 * @return the variable's average inference/cutoff score value, only using inferences and cutoffs of the current run 3819 * 3820 * @pre This method can be called if @p scip is in one of the following stages: 3821 * - \ref SCIP_STAGE_INITPRESOLVE 3822 * - \ref SCIP_STAGE_PRESOLVING 3823 * - \ref SCIP_STAGE_EXITPRESOLVE 3824 * - \ref SCIP_STAGE_PRESOLVED 3825 * - \ref SCIP_STAGE_INITSOLVE 3826 * - \ref SCIP_STAGE_SOLVING 3827 * - \ref SCIP_STAGE_SOLVED 3828 */ 3829 SCIP_EXPORT 3830 SCIP_Real SCIPgetVarAvgInferenceCutoffScoreCurrentRun( 3831 SCIP* scip, /**< SCIP data structure */ 3832 SCIP_VAR* var, /**< problem variable */ 3833 SCIP_Real cutoffweight /**< factor to weigh average number of cutoffs in branching score */ 3834 ); 3835 3836 /** returns the variable's average GMI efficacy score value 3837 * 3838 * @return the variable's average GMI efficacy score value (for when it was fractional and basic in the LP) 3839 * 3840 * @pre This method can be called if @p scip is in one of the following stages: 3841 * - \ref SCIP_STAGE_INITPRESOLVE 3842 * - \ref SCIP_STAGE_PRESOLVING 3843 * - \ref SCIP_STAGE_EXITPRESOLVE 3844 * - \ref SCIP_STAGE_PRESOLVED 3845 * - \ref SCIP_STAGE_INITSOLVE 3846 * - \ref SCIP_STAGE_SOLVING 3847 * - \ref SCIP_STAGE_SOLVED 3848 */ 3849 SCIP_EXPORT 3850 SCIP_Real SCIPgetVarAvgGMIScore( 3851 SCIP* scip, /**< SCIP data structure */ 3852 SCIP_VAR* var /**< problem variable */ 3853 ); 3854 3855 /** sets the variable's avg GMI efficacy score value 3856 * 3857 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 3858 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 3859 * 3860 * @pre This method can be called if @p scip is in one of the following stages: 3861 * - \ref SCIP_STAGE_INITPRESOLVE 3862 * - \ref SCIP_STAGE_PRESOLVING 3863 * - \ref SCIP_STAGE_EXITPRESOLVE 3864 * - \ref SCIP_STAGE_PRESOLVED 3865 * - \ref SCIP_STAGE_INITSOLVE 3866 * - \ref SCIP_STAGE_SOLVING 3867 * - \ref SCIP_STAGE_SOLVED 3868 */ 3869 SCIP_EXPORT 3870 SCIP_RETCODE SCIPincVarGMISumScore( 3871 SCIP* scip, /**< SCIP data structure */ 3872 SCIP_VAR* var, /**< problem variable */ 3873 SCIP_Real gmieff /**< Efficacy of last GMI cut generated from when var was basic /frac */ 3874 ); 3875 3876 /** returns the variable's last GMI efficacy score value 3877 * 3878 * @return the variable's last GMI efficacy score value (for when it was fractional and basic in the LP) 3879 * 3880 * @pre This method can be called if @p scip is in one of the following stages: 3881 * - \ref SCIP_STAGE_INITPRESOLVE 3882 * - \ref SCIP_STAGE_PRESOLVING 3883 * - \ref SCIP_STAGE_EXITPRESOLVE 3884 * - \ref SCIP_STAGE_PRESOLVED 3885 * - \ref SCIP_STAGE_INITSOLVE 3886 * - \ref SCIP_STAGE_SOLVING 3887 * - \ref SCIP_STAGE_SOLVED 3888 */ 3889 SCIP_EXPORT 3890 SCIP_Real SCIPgetVarLastGMIScore( 3891 SCIP* scip, /**< SCIP data structure */ 3892 SCIP_VAR* var /**< problem variable */ 3893 ); 3894 3895 /** sets the variable's last GMI efficacy score value 3896 * 3897 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 3898 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 3899 * 3900 * @pre This method can be called if @p scip is in one of the following stages: 3901 * - \ref SCIP_STAGE_INITPRESOLVE 3902 * - \ref SCIP_STAGE_PRESOLVING 3903 * - \ref SCIP_STAGE_EXITPRESOLVE 3904 * - \ref SCIP_STAGE_PRESOLVED 3905 * - \ref SCIP_STAGE_INITSOLVE 3906 * - \ref SCIP_STAGE_SOLVING 3907 * - \ref SCIP_STAGE_SOLVED 3908 */ 3909 SCIP_EXPORT 3910 SCIP_RETCODE SCIPsetVarLastGMIScore( 3911 SCIP* scip, /**< SCIP data structure */ 3912 SCIP_VAR* var, /**< problem variable */ 3913 SCIP_Real gmieff /**< Efficacy of last GMI cut generated from when var was basic /frac */ 3914 ); 3915 3916 /** outputs variable information to file stream via the message system 3917 * 3918 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 3919 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 3920 * 3921 * @pre This method can be called if @p scip is in one of the following stages: 3922 * - \ref SCIP_STAGE_PROBLEM 3923 * - \ref SCIP_STAGE_TRANSFORMING 3924 * - \ref SCIP_STAGE_TRANSFORMED 3925 * - \ref SCIP_STAGE_INITPRESOLVE 3926 * - \ref SCIP_STAGE_PRESOLVING 3927 * - \ref SCIP_STAGE_EXITPRESOLVE 3928 * - \ref SCIP_STAGE_PRESOLVED 3929 * - \ref SCIP_STAGE_INITSOLVE 3930 * - \ref SCIP_STAGE_SOLVING 3931 * - \ref SCIP_STAGE_SOLVED 3932 * - \ref SCIP_STAGE_EXITSOLVE 3933 * - \ref SCIP_STAGE_FREETRANS 3934 * 3935 * @note If the message handler is set to a NULL pointer nothing will be printed 3936 */ 3937 SCIP_EXPORT 3938 SCIP_RETCODE SCIPprintVar( 3939 SCIP* scip, /**< SCIP data structure */ 3940 SCIP_VAR* var, /**< problem variable */ 3941 FILE* file /**< output file (or NULL for standard output) */ 3942 ); 3943 3944 /**@} */ 3945 3946 #ifdef __cplusplus 3947 } 3948 #endif 3949 3950 #endif 3951