1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 2 /* */ 3 /* This file is part of the program and library */ 4 /* SCIP --- Solving Constraint Integer Programs */ 5 /* */ 6 /* Copyright (C) 2002-2021 Konrad-Zuse-Zentrum */ 7 /* fuer Informationstechnik Berlin */ 8 /* */ 9 /* SCIP is distributed under the terms of the ZIB Academic License. */ 10 /* */ 11 /* You should have received a copy of the ZIB Academic License */ 12 /* along with SCIP; see the file COPYING. If not visit scipopt.org. */ 13 /* */ 14 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 15 16 /**@file var.h 17 * @ingroup INTERNALAPI 18 * @brief internal methods for problem variables 19 * @author Tobias Achterberg 20 */ 21 22 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/ 23 24 #ifndef __SCIP_VAR_H__ 25 #define __SCIP_VAR_H__ 26 27 28 #include "blockmemshell/memory.h" 29 #include "scip/def.h" 30 #include "scip/type_branch.h" 31 #include "scip/type_cons.h" 32 #include "scip/type_event.h" 33 #include "scip/type_history.h" 34 #include "scip/type_implics.h" 35 #include "scip/type_lp.h" 36 #include "scip/type_message.h" 37 #include "scip/type_misc.h" 38 #include "scip/type_primal.h" 39 #include "scip/type_prob.h" 40 #include "scip/type_prop.h" 41 #include "scip/type_relax.h" 42 #include "scip/type_reopt.h" 43 #include "scip/type_result.h" 44 #include "scip/type_retcode.h" 45 #include "scip/type_scip.h" 46 #include "scip/type_set.h" 47 #include "scip/type_sol.h" 48 #include "scip/type_stat.h" 49 #include "scip/type_tree.h" 50 #include "scip/type_var.h" 51 52 #ifndef NDEBUG 53 #include "scip/struct_var.h" 54 #else 55 #include "scip/event.h" 56 #include "scip/pub_history.h" 57 #endif 58 59 #ifdef __cplusplus 60 extern "C" { 61 #endif 62 63 /* 64 * domain change methods 65 */ 66 67 /** applies single bound change */ 68 SCIP_RETCODE SCIPboundchgApply( 69 SCIP_BOUNDCHG* boundchg, /**< bound change to apply */ 70 BMS_BLKMEM* blkmem, /**< block memory */ 71 SCIP_SET* set, /**< global SCIP settings */ 72 SCIP_STAT* stat, /**< problem statistics */ 73 SCIP_LP* lp, /**< current LP data */ 74 SCIP_BRANCHCAND* branchcand, /**< branching candidate storage */ 75 SCIP_EVENTQUEUE* eventqueue, /**< event queue */ 76 int depth, /**< depth in the tree, where the bound change takes place */ 77 int pos, /**< position of the bound change in its bound change array */ 78 SCIP_Bool* cutoff /**< pointer to store whether an infeasible bound change was detected */ 79 ); 80 81 /** undoes single bound change */ 82 SCIP_RETCODE SCIPboundchgUndo( 83 SCIP_BOUNDCHG* boundchg, /**< bound change to remove */ 84 BMS_BLKMEM* blkmem, /**< block memory */ 85 SCIP_SET* set, /**< global SCIP settings */ 86 SCIP_STAT* stat, /**< problem statistics */ 87 SCIP_LP* lp, /**< current LP data */ 88 SCIP_BRANCHCAND* branchcand, /**< branching candidate storage */ 89 SCIP_EVENTQUEUE* eventqueue /**< event queue */ 90 ); 91 92 /** applies domain change to the global problem */ 93 SCIP_RETCODE SCIPdomchgApplyGlobal( 94 SCIP_DOMCHG* domchg, /**< domain change to apply */ 95 BMS_BLKMEM* blkmem, /**< block memory */ 96 SCIP_SET* set, /**< global SCIP settings */ 97 SCIP_STAT* stat, /**< problem statistics */ 98 SCIP_LP* lp, /**< current LP data */ 99 SCIP_BRANCHCAND* branchcand, /**< branching candidate storage */ 100 SCIP_EVENTQUEUE* eventqueue, /**< event queue */ 101 SCIP_CLIQUETABLE* cliquetable, /**< clique table data structure */ 102 SCIP_Bool* cutoff /**< pointer to store whether an infeasible domain change was detected */ 103 ); 104 105 /** frees domain change data */ 106 SCIP_RETCODE SCIPdomchgFree( 107 SCIP_DOMCHG** domchg, /**< pointer to domain change */ 108 BMS_BLKMEM* blkmem, /**< block memory */ 109 SCIP_SET* set, /**< global SCIP settings */ 110 SCIP_EVENTQUEUE* eventqueue, /**< event queue */ 111 SCIP_LP* lp /**< current LP data */ 112 ); 113 114 /** converts a dynamic domain change data into a static one, using less memory than for a dynamic one */ 115 SCIP_RETCODE SCIPdomchgMakeStatic( 116 SCIP_DOMCHG** domchg, /**< pointer to domain change data */ 117 BMS_BLKMEM* blkmem, /**< block memory */ 118 SCIP_SET* set, /**< global SCIP settings */ 119 SCIP_EVENTQUEUE* eventqueue, /**< event queue */ 120 SCIP_LP* lp /**< current LP data */ 121 ); 122 123 /** applies domain change */ 124 SCIP_RETCODE SCIPdomchgApply( 125 SCIP_DOMCHG* domchg, /**< domain change to apply */ 126 BMS_BLKMEM* blkmem, /**< block memory */ 127 SCIP_SET* set, /**< global SCIP settings */ 128 SCIP_STAT* stat, /**< problem statistics */ 129 SCIP_LP* lp, /**< current LP data */ 130 SCIP_BRANCHCAND* branchcand, /**< branching candidate storage */ 131 SCIP_EVENTQUEUE* eventqueue, /**< event queue */ 132 int depth, /**< depth in the tree, where the domain change takes place */ 133 SCIP_Bool* cutoff /**< pointer to store whether an infeasible domain change was detected */ 134 ); 135 136 /** undoes domain change */ 137 SCIP_RETCODE SCIPdomchgUndo( 138 SCIP_DOMCHG* domchg, /**< domain change to remove */ 139 BMS_BLKMEM* blkmem, /**< block memory */ 140 SCIP_SET* set, /**< global SCIP settings */ 141 SCIP_STAT* stat, /**< problem statistics */ 142 SCIP_LP* lp, /**< current LP data */ 143 SCIP_BRANCHCAND* branchcand, /**< branching candidate storage */ 144 SCIP_EVENTQUEUE* eventqueue /**< event queue */ 145 ); 146 147 /** adds bound change to domain changes */ 148 SCIP_RETCODE SCIPdomchgAddBoundchg( 149 SCIP_DOMCHG** domchg, /**< pointer to domain change data structure */ 150 BMS_BLKMEM* blkmem, /**< block memory */ 151 SCIP_SET* set, /**< global SCIP settings */ 152 SCIP_VAR* var, /**< variable to change the bounds for */ 153 SCIP_Real newbound, /**< new value for bound */ 154 SCIP_BOUNDTYPE boundtype, /**< type of bound for var: lower or upper bound */ 155 SCIP_BOUNDCHGTYPE boundchgtype, /**< type of bound change: branching decision or inference */ 156 SCIP_Real lpsolval, /**< solval of variable in last LP on path to node, or SCIP_INVALID if unknown */ 157 SCIP_VAR* infervar, /**< variable that was changed (parent of var, or var itself) */ 158 SCIP_CONS* infercons, /**< constraint that deduced the bound change, or NULL */ 159 SCIP_PROP* inferprop, /**< propagator that deduced the bound change, or NULL */ 160 int inferinfo, /**< user information for inference to help resolving the conflict */ 161 SCIP_BOUNDTYPE inferboundtype /**< type of bound for inference var: lower or upper bound */ 162 ); 163 164 /** adds hole change to domain changes */ 165 SCIP_RETCODE SCIPdomchgAddHolechg( 166 SCIP_DOMCHG** domchg, /**< pointer to domain change data structure */ 167 BMS_BLKMEM* blkmem, /**< block memory */ 168 SCIP_SET* set, /**< global SCIP settings */ 169 SCIP_HOLELIST** ptr, /**< changed list pointer */ 170 SCIP_HOLELIST* newlist, /**< new value of list pointer */ 171 SCIP_HOLELIST* oldlist /**< old value of list pointer */ 172 ); 173 174 /** creates an artificial bound change information object with depth = INT_MAX and pos = -1 */ 175 SCIP_RETCODE SCIPbdchginfoCreate( 176 SCIP_BDCHGINFO** bdchginfo, /**< pointer to store bound change information */ 177 BMS_BLKMEM* blkmem, /**< block memory */ 178 SCIP_VAR* var, /**< active variable that changed the bounds */ 179 SCIP_BOUNDTYPE boundtype, /**< type of bound for var: lower or upper bound */ 180 SCIP_Real oldbound, /**< old value for bound */ 181 SCIP_Real newbound /**< new value for bound */ 182 ); 183 184 /** frees a bound change information object */ 185 void SCIPbdchginfoFree( 186 SCIP_BDCHGINFO** bdchginfo, /**< pointer to store bound change information */ 187 BMS_BLKMEM* blkmem /**< block memory */ 188 ); 189 190 /** returns the relaxed bound change type */ 191 SCIP_Real SCIPbdchginfoGetRelaxedBound( 192 SCIP_BDCHGINFO* bdchginfo /**< bound change to add to the conflict set */ 193 ); 194 195 /* 196 * methods for variables 197 */ 198 199 /** creates and captures an original problem variable; an integer variable with bounds 200 * zero and one is automatically converted into a binary variable 201 */ 202 SCIP_RETCODE SCIPvarCreateOriginal( 203 SCIP_VAR** var, /**< pointer to variable data */ 204 BMS_BLKMEM* blkmem, /**< block memory */ 205 SCIP_SET* set, /**< global SCIP settings */ 206 SCIP_STAT* stat, /**< problem statistics */ 207 const char* name, /**< name of variable */ 208 SCIP_Real lb, /**< lower bound of variable */ 209 SCIP_Real ub, /**< upper bound of variable */ 210 SCIP_Real obj, /**< objective function value */ 211 SCIP_VARTYPE vartype, /**< type of variable */ 212 SCIP_Bool initial, /**< should var's column be present in the initial root LP? */ 213 SCIP_Bool removable, /**< is var's column removable from the LP (due to aging or cleanup)? */ 214 SCIP_DECL_VARDELORIG ((*vardelorig)), /**< frees user data of original variable, or NULL */ 215 SCIP_DECL_VARTRANS ((*vartrans)), /**< creates transformed user data by transforming original user data, or NULL */ 216 SCIP_DECL_VARDELTRANS ((*vardeltrans)), /**< frees user data of transformed variable, or NULL */ 217 SCIP_DECL_VARCOPY ((*varcopy)), /**< copies variable data if wanted to subscip, or NULL */ 218 SCIP_VARDATA* vardata /**< user data for this specific variable */ 219 ); 220 221 /** creates and captures a loose variable belonging to the transformed problem; an integer variable with bounds 222 * zero and one is automatically converted into a binary variable 223 */ 224 SCIP_RETCODE SCIPvarCreateTransformed( 225 SCIP_VAR** var, /**< pointer to variable data */ 226 BMS_BLKMEM* blkmem, /**< block memory */ 227 SCIP_SET* set, /**< global SCIP settings */ 228 SCIP_STAT* stat, /**< problem statistics */ 229 const char* name, /**< name of variable */ 230 SCIP_Real lb, /**< lower bound of variable */ 231 SCIP_Real ub, /**< upper bound of variable */ 232 SCIP_Real obj, /**< objective function value */ 233 SCIP_VARTYPE vartype, /**< type of variable */ 234 SCIP_Bool initial, /**< should var's column be present in the initial root LP? */ 235 SCIP_Bool removable, /**< is var's column removable from the LP (due to aging or cleanup)? */ 236 SCIP_DECL_VARDELORIG ((*vardelorig)), /**< frees user data of original variable, or NULL */ 237 SCIP_DECL_VARTRANS ((*vartrans)), /**< creates transformed user data by transforming original user data, or NULL */ 238 SCIP_DECL_VARDELTRANS ((*vardeltrans)), /**< frees user data of transformed variable, or NULL */ 239 SCIP_DECL_VARCOPY ((*varcopy)), /**< copies variable data if wanted to subscip, or NULL */ 240 SCIP_VARDATA* vardata /**< user data for this specific variable */ 241 ); 242 243 /** copies and captures a variable from source to target SCIP; an integer variable with bounds zero and one is 244 * automatically converted into a binary variable; in case the variable data cannot be copied the variable is not 245 * copied at all 246 */ 247 SCIP_RETCODE SCIPvarCopy( 248 SCIP_VAR** var, /**< pointer to store the target variable */ 249 BMS_BLKMEM* blkmem, /**< block memory */ 250 SCIP_SET* set, /**< global SCIP settings */ 251 SCIP_STAT* stat, /**< problem statistics */ 252 SCIP* sourcescip, /**< source SCIP data structure */ 253 SCIP_VAR* sourcevar, /**< source variable */ 254 SCIP_HASHMAP* varmap, /**< a hashmap to store the mapping of source variables corresponding 255 * target variables */ 256 SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding 257 * target constraints */ 258 SCIP_Bool global /**< should global or local bounds be used? */ 259 ); 260 261 /** parses variable information (in cip format) out of a string; if the parsing process was successful an original 262 * variable is created and captured; if variable is of integral type, fractional bounds are automatically rounded; an 263 * integer variable with bounds zero and one is automatically converted into a binary variable 264 */ 265 SCIP_RETCODE SCIPvarParseOriginal( 266 SCIP_VAR** var, /**< pointer to variable data */ 267 BMS_BLKMEM* blkmem, /**< block memory */ 268 SCIP_SET* set, /**< global SCIP settings */ 269 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */ 270 SCIP_STAT* stat, /**< problem statistics */ 271 const char* str, /**< string to parse */ 272 SCIP_Bool initial, /**< should var's column be present in the initial root LP? */ 273 SCIP_Bool removable, /**< is var's column removable from the LP (due to aging or cleanup)? */ 274 SCIP_DECL_VARCOPY ((*varcopy)), /**< copies variable data if wanted to subscip, or NULL */ 275 SCIP_DECL_VARDELORIG ((*vardelorig)), /**< frees user data of original variable */ 276 SCIP_DECL_VARTRANS ((*vartrans)), /**< creates transformed user data by transforming original user data */ 277 SCIP_DECL_VARDELTRANS ((*vardeltrans)), /**< frees user data of transformed variable */ 278 SCIP_VARDATA* vardata, /**< user data for this specific variable */ 279 char** endptr, /**< pointer to store the final string position if successfully */ 280 SCIP_Bool* success /**< pointer store if the paring process was successful */ 281 ); 282 283 /** parses variable information (in cip format) out of a string; if the parsing process was successful a loose variable 284 * belonging to the transformed problem is created and captured; if variable is of integral type, fractional bounds are 285 * automatically rounded; an integer variable with bounds zero and one is automatically converted into a binary 286 * variable 287 */ 288 SCIP_RETCODE SCIPvarParseTransformed( 289 SCIP_VAR** var, /**< pointer to variable data */ 290 BMS_BLKMEM* blkmem, /**< block memory */ 291 SCIP_SET* set, /**< global SCIP settings */ 292 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */ 293 SCIP_STAT* stat, /**< problem statistics */ 294 const char* str, /**< string to parse */ 295 SCIP_Bool initial, /**< should var's column be present in the initial root LP? */ 296 SCIP_Bool removable, /**< is var's column removable from the LP (due to aging or cleanup)? */ 297 SCIP_DECL_VARCOPY ((*varcopy)), /**< copies variable data if wanted to subscip, or NULL */ 298 SCIP_DECL_VARDELORIG ((*vardelorig)), /**< frees user data of original variable */ 299 SCIP_DECL_VARTRANS ((*vartrans)), /**< creates transformed user data by transforming original user data */ 300 SCIP_DECL_VARDELTRANS ((*vardeltrans)), /**< frees user data of transformed variable */ 301 SCIP_VARDATA* vardata, /**< user data for this specific variable */ 302 char** endptr, /**< pointer to store the final string position if successfully */ 303 SCIP_Bool* success /**< pointer store if the paring process was successful */ 304 ); 305 306 /** increases usage counter of variable */ 307 void SCIPvarCapture( 308 SCIP_VAR* var /**< variable */ 309 ); 310 311 /** decreases usage counter of variable, and frees memory if necessary */ 312 SCIP_RETCODE SCIPvarRelease( 313 SCIP_VAR** var, /**< pointer to variable */ 314 BMS_BLKMEM* blkmem, /**< block memory */ 315 SCIP_SET* set, /**< global SCIP settings */ 316 SCIP_EVENTQUEUE* eventqueue, /**< event queue */ 317 SCIP_LP* lp /**< current LP data (may be NULL, if it's not a column variable) */ 318 ); 319 320 /** change variable name */ 321 /** change variable name */ 322 SCIP_RETCODE SCIPvarChgName( 323 SCIP_VAR* var, /**< problem variable */ 324 BMS_BLKMEM* blkmem, /**< block memory */ 325 const char* name /**< name of variable */ 326 ); 327 328 /** initializes variable data structure for solving */ 329 void SCIPvarInitSolve( 330 SCIP_VAR* var /**< problem variable */ 331 ); 332 333 /** gets and captures transformed variable of a given variable; if the variable is not yet transformed, 334 * a new transformed variable for this variable is created 335 */ 336 SCIP_RETCODE SCIPvarTransform( 337 SCIP_VAR* origvar, /**< original problem variable */ 338 BMS_BLKMEM* blkmem, /**< block memory of transformed problem */ 339 SCIP_SET* set, /**< global SCIP settings */ 340 SCIP_STAT* stat, /**< problem statistics */ 341 SCIP_OBJSENSE objsense, /**< objective sense of original problem; transformed is always MINIMIZE */ 342 SCIP_VAR** transvar /**< pointer to store the transformed variable */ 343 ); 344 345 /** gets corresponding transformed variable of an original or negated original variable */ 346 SCIP_RETCODE SCIPvarGetTransformed( 347 SCIP_VAR* origvar, /**< original problem variable */ 348 BMS_BLKMEM* blkmem, /**< block memory of transformed problem */ 349 SCIP_SET* set, /**< global SCIP settings */ 350 SCIP_STAT* stat, /**< problem statistics */ 351 SCIP_VAR** transvar /**< pointer to store the transformed variable, or NULL if not existing yet */ 352 ); 353 354 /** converts transformed variable into column variable and creates LP column */ 355 SCIP_RETCODE SCIPvarColumn( 356 SCIP_VAR* var, /**< problem variable */ 357 BMS_BLKMEM* blkmem, /**< block memory */ 358 SCIP_SET* set, /**< global SCIP settings */ 359 SCIP_STAT* stat, /**< problem statistics */ 360 SCIP_PROB* prob, /**< problem data */ 361 SCIP_LP* lp /**< current LP data */ 362 ); 363 364 /** converts column transformed variable back into loose variable, frees LP column */ 365 SCIP_RETCODE SCIPvarLoose( 366 SCIP_VAR* var, /**< problem variable */ 367 BMS_BLKMEM* blkmem, /**< block memory */ 368 SCIP_SET* set, /**< global SCIP settings */ 369 SCIP_EVENTQUEUE* eventqueue, /**< event queue */ 370 SCIP_PROB* prob, /**< problem data */ 371 SCIP_LP* lp /**< current LP data */ 372 ); 373 374 /** converts variable into fixed variable */ 375 SCIP_RETCODE SCIPvarFix( 376 SCIP_VAR* var, /**< problem variable */ 377 BMS_BLKMEM* blkmem, /**< block memory */ 378 SCIP_SET* set, /**< global SCIP settings */ 379 SCIP_STAT* stat, /**< problem statistics */ 380 SCIP_PROB* transprob, /**< tranformed problem data */ 381 SCIP_PROB* origprob, /**< original problem data */ 382 SCIP_PRIMAL* primal, /**< primal data */ 383 SCIP_TREE* tree, /**< branch and bound tree */ 384 SCIP_REOPT* reopt, /**< reoptimization data structure */ 385 SCIP_LP* lp, /**< current LP data */ 386 SCIP_BRANCHCAND* branchcand, /**< branching candidate storage */ 387 SCIP_EVENTFILTER* eventfilter, /**< event filter for global (not variable dependent) events */ 388 SCIP_EVENTQUEUE* eventqueue, /**< event queue */ 389 SCIP_CLIQUETABLE* cliquetable, /**< clique table data structure */ 390 SCIP_Real fixedval, /**< value to fix variable at */ 391 SCIP_Bool* infeasible, /**< pointer to store whether the fixing is infeasible */ 392 SCIP_Bool* fixed /**< pointer to store whether the fixing was performed (variable was unfixed) */ 393 ); 394 395 /** transforms given variables, scalars and constant to the corresponding active variables, scalars and constant 396 * 397 * If the number of needed active variables is greater than the available slots in the variable array, nothing happens except 398 * that the required size is stored in the corresponding variable; hence, if afterwards the required size is greater than the 399 * available slots (varssize), nothing happens; otherwise, the active variable representation is stored in the arrays. 400 * 401 * The reason for this approach is that we cannot reallocate memory, since we do not know how the 402 * memory has been allocated (e.g., by a C++ 'new' or SCIP functions). 403 */ 404 SCIP_RETCODE SCIPvarGetActiveRepresentatives( 405 SCIP_SET* set, /**< global SCIP settings */ 406 SCIP_VAR** vars, /**< variable array to get active variables */ 407 SCIP_Real* scalars, /**< scalars a_1, ..., a_n in linear sum a_1*x_1 + ... + a_n*x_n + c */ 408 int* nvars, /**< pointer to number of variables and values in vars and vals array */ 409 int varssize, /**< available slots in vars and scalars array */ 410 SCIP_Real* constant, /**< pointer to constant c in linear sum a_1*x_1 + ... + a_n*x_n + c */ 411 int* requiredsize, /**< pointer to store the required array size for the active variables */ 412 SCIP_Bool mergemultiples /**< should multiple occurrences of a var be replaced by a single coeff? */ 413 ); 414 415 /** transforms given variable, scalar and constant to the corresponding active, fixed, or 416 * multi-aggregated variable, scalar and constant; if the variable resolves to a fixed variable, 417 * "scalar" will be 0.0 and the value of the sum will be stored in "constant"; a multi-aggregation 418 * with only one active variable (this can happen due to fixings after the multi-aggregation), 419 * is treated like an aggregation; if the multi-aggregation constant is infinite, "scalar" will be 0.0 420 */ 421 SCIP_RETCODE SCIPvarGetProbvarSum( 422 SCIP_VAR** var, /**< pointer to problem variable x in sum a*x + c */ 423 SCIP_SET* set, /**< global SCIP settings */ 424 SCIP_Real* scalar, /**< pointer to scalar a in sum a*x + c */ 425 SCIP_Real* constant /**< pointer to constant c in sum a*x + c */ 426 ); 427 428 429 /** flattens aggregation graph of multi-aggregated variable in order to avoid exponential recursion later-on */ 430 SCIP_RETCODE SCIPvarFlattenAggregationGraph( 431 SCIP_VAR* var, /**< problem variable */ 432 BMS_BLKMEM* blkmem, /**< block memory */ 433 SCIP_SET* set, /**< global SCIP settings */ 434 SCIP_EVENTQUEUE* eventqueue /**< event queue */ 435 ); 436 437 /** return for given variables all their active counterparts; all active variables will be pairwise different */ 438 SCIP_RETCODE SCIPvarsGetActiveVars( 439 SCIP_SET* set, /**< global SCIP settings */ 440 SCIP_VAR** vars, /**< variable array with given variables and as output all active 441 * variables, if enough slots exist 442 */ 443 int* nvars, /**< number of given variables, and as output number of active variables, 444 * if enough slots exist 445 */ 446 int varssize, /**< available slots in vars array */ 447 int* requiredsize /**< pointer to store the required array size for the active variables */ 448 ); 449 450 /** performs second step of SCIPaggregateVars(): 451 * the variable to be aggregated is chosen among active problem variables x' and y', preferring a less strict variable 452 * type as aggregation variable (i.e. continuous variables are preferred over implicit integers, implicit integers 453 * or integers over binaries). If none of the variables is continuous, it is tried to find an integer 454 * aggregation (i.e. integral coefficients a'' and b'', such that a''*x' + b''*y' == c''). This can lead to 455 * the detection of infeasibility (e.g. if c'' is fractional), or to a rejection of the aggregation (denoted by 456 * aggregated == FALSE), if the resulting integer coefficients are too large and thus numerically instable. 457 */ 458 SCIP_RETCODE SCIPvarTryAggregateVars( 459 SCIP_SET* set, /**< global SCIP settings */ 460 BMS_BLKMEM* blkmem, /**< block memory */ 461 SCIP_STAT* stat, /**< problem statistics */ 462 SCIP_PROB* transprob, /**< tranformed problem data */ 463 SCIP_PROB* origprob, /**< original problem data */ 464 SCIP_PRIMAL* primal, /**< primal data */ 465 SCIP_TREE* tree, /**< branch and bound tree */ 466 SCIP_REOPT* reopt, /**< reoptimization data structure */ 467 SCIP_LP* lp, /**< current LP data */ 468 SCIP_CLIQUETABLE* cliquetable, /**< clique table data structure */ 469 SCIP_BRANCHCAND* branchcand, /**< branching candidate storage */ 470 SCIP_EVENTFILTER* eventfilter, /**< event filter for global (not variable dependent) events */ 471 SCIP_EVENTQUEUE* eventqueue, /**< event queue */ 472 SCIP_VAR* varx, /**< variable x in equality a*x + b*y == c */ 473 SCIP_VAR* vary, /**< variable y in equality a*x + b*y == c */ 474 SCIP_Real scalarx, /**< multiplier a in equality a*x + b*y == c */ 475 SCIP_Real scalary, /**< multiplier b in equality a*x + b*y == c */ 476 SCIP_Real rhs, /**< right hand side c in equality a*x + b*y == c */ 477 SCIP_Bool* infeasible, /**< pointer to store whether the aggregation is infeasible */ 478 SCIP_Bool* aggregated /**< pointer to store whether the aggregation was successful */ 479 ); 480 481 /** converts loose variable into aggregated variable */ 482 SCIP_RETCODE SCIPvarAggregate( 483 SCIP_VAR* var, /**< loose problem variable */ 484 BMS_BLKMEM* blkmem, /**< block memory */ 485 SCIP_SET* set, /**< global SCIP settings */ 486 SCIP_STAT* stat, /**< problem statistics */ 487 SCIP_PROB* transprob, /**< tranformed problem data */ 488 SCIP_PROB* origprob, /**< original problem data */ 489 SCIP_PRIMAL* primal, /**< primal data */ 490 SCIP_TREE* tree, /**< branch and bound tree */ 491 SCIP_REOPT* reopt, /**< reoptimization data structure */ 492 SCIP_LP* lp, /**< current LP data */ 493 SCIP_CLIQUETABLE* cliquetable, /**< clique table data structure */ 494 SCIP_BRANCHCAND* branchcand, /**< branching candidate storage */ 495 SCIP_EVENTFILTER* eventfilter, /**< event filter for global (not variable dependent) events */ 496 SCIP_EVENTQUEUE* eventqueue, /**< event queue */ 497 SCIP_VAR* aggvar, /**< loose variable y in aggregation x = a*y + c */ 498 SCIP_Real scalar, /**< multiplier a in aggregation x = a*y + c */ 499 SCIP_Real constant, /**< constant shift c in aggregation x = a*y + c */ 500 SCIP_Bool* infeasible, /**< pointer to store whether the aggregation is infeasible */ 501 SCIP_Bool* aggregated /**< pointer to store whether the aggregation was successful */ 502 ); 503 504 /** converts variable into multi-aggregated variable */ 505 SCIP_RETCODE SCIPvarMultiaggregate( 506 SCIP_VAR* var, /**< problem variable */ 507 BMS_BLKMEM* blkmem, /**< block memory */ 508 SCIP_SET* set, /**< global SCIP settings */ 509 SCIP_STAT* stat, /**< problem statistics */ 510 SCIP_PROB* transprob, /**< tranformed problem data */ 511 SCIP_PROB* origprob, /**< original problem data */ 512 SCIP_PRIMAL* primal, /**< primal data */ 513 SCIP_TREE* tree, /**< branch and bound tree */ 514 SCIP_REOPT* reopt, /**< reoptimization data structure */ 515 SCIP_LP* lp, /**< current LP data */ 516 SCIP_CLIQUETABLE* cliquetable, /**< clique table data structure */ 517 SCIP_BRANCHCAND* branchcand, /**< branching candidate storage */ 518 SCIP_EVENTFILTER* eventfilter, /**< event filter for global (not variable dependent) events */ 519 SCIP_EVENTQUEUE* eventqueue, /**< event queue */ 520 int naggvars, /**< number n of variables in aggregation x = a_1*y_1 + ... + a_n*y_n + c */ 521 SCIP_VAR** aggvars, /**< variables y_i in aggregation x = a_1*y_1 + ... + a_n*y_n + c */ 522 SCIP_Real* scalars, /**< multipliers a_i in aggregation x = a_1*y_1 + ... + a_n*y_n + c */ 523 SCIP_Real constant, /**< constant shift c in aggregation x = a_1*y_1 + ... + a_n*y_n + c */ 524 SCIP_Bool* infeasible, /**< pointer to store whether the aggregation is infeasible */ 525 SCIP_Bool* aggregated /**< pointer to store whether the aggregation was successful */ 526 ); 527 528 /** returns whether variable is not allowed to be multi-aggregated */ 529 SCIP_Bool SCIPvarDoNotMultaggr( 530 SCIP_VAR* var /**< problem variable */ 531 ); 532 533 /** returns whether the variable was flagged for deletion from global structures (cliques etc.) */ 534 SCIP_Bool SCIPvarIsMarkedDeleteGlobalStructures( 535 SCIP_VAR* var /**< problem variable */ 536 ); 537 538 /** gets negated variable x' = offset - x of problem variable x; the negated variable is created if not yet existing; 539 * the negation offset of binary variables is always 1, the offset of other variables is fixed to lb + ub when the 540 * negated variable is created 541 */ 542 SCIP_RETCODE SCIPvarNegate( 543 SCIP_VAR* var, /**< problem variable to negate */ 544 BMS_BLKMEM* blkmem, /**< block memory of transformed problem */ 545 SCIP_SET* set, /**< global SCIP settings */ 546 SCIP_STAT* stat, /**< problem statistics */ 547 SCIP_VAR** negvar /**< pointer to store the negated variable */ 548 ); 549 550 /** informs variable that its position in problem's vars array changed */ 551 void SCIPvarSetProbindex( 552 SCIP_VAR* var, /**< problem variable */ 553 int probindex /**< new problem index of variable */ 554 ); 555 556 /** gives the variable a new name 557 * 558 * @note the old pointer is overwritten, which might result in a memory leakage 559 */ 560 void SCIPvarSetNamePointer( 561 SCIP_VAR* var, /**< problem variable */ 562 const char* name /**< new name of variable */ 563 ); 564 565 /** informs variable that it will be removed from the problem; adjusts probindex and removes variable from the 566 * implication graph; 567 * If 'final' is TRUE, the thorough implication graph removal is not performed. Instead, only the 568 * variable bounds and implication data structures of the variable are freed. Since in the final removal 569 * of all variables from the transformed problem, this deletes the implication graph completely and is faster 570 * than removing the variables one by one, each time updating all lists of the other variables. 571 */ 572 SCIP_RETCODE SCIPvarRemove( 573 SCIP_VAR* var, /**< problem variable */ 574 BMS_BLKMEM* blkmem, /**< block memory buffer */ 575 SCIP_CLIQUETABLE* cliquetable, /**< clique table data structure */ 576 SCIP_SET* set, /**< global SCIP settings */ 577 SCIP_Bool final /**< is this the final removal of all problem variables? */ 578 ); 579 580 /** marks the variable to be deleted from the problem */ 581 void SCIPvarMarkDeleted( 582 SCIP_VAR* var /**< problem variable */ 583 ); 584 585 /** marks the variable to not to be multi-aggregated */ 586 SCIP_RETCODE SCIPvarMarkDoNotMultaggr( 587 SCIP_VAR* var /**< problem variable */ 588 ); 589 590 /** modifies lock numbers for rounding */ 591 SCIP_RETCODE SCIPvarAddLocks( 592 SCIP_VAR* var, /**< problem variable */ 593 BMS_BLKMEM* blkmem, /**< block memory */ 594 SCIP_SET* set, /**< global SCIP settings */ 595 SCIP_EVENTQUEUE* eventqueue, /**< event queue */ 596 SCIP_LOCKTYPE locktype, /**< type of the variable locks */ 597 int addnlocksdown, /**< increase in number of rounding down locks */ 598 int addnlocksup /**< increase in number of rounding up locks */ 599 ); 600 601 /** changes type of variable; cannot be called, if var belongs to a problem */ 602 SCIP_RETCODE SCIPvarChgType( 603 SCIP_VAR* var, /**< problem variable to change */ 604 BMS_BLKMEM* blkmem, /**< block memory */ 605 SCIP_SET* set, /**< global SCIP settings */ 606 SCIP_PRIMAL* primal, /**< primal data */ 607 SCIP_LP* lp, /**< current LP data */ 608 SCIP_EVENTQUEUE* eventqueue, /**< event queue */ 609 SCIP_VARTYPE vartype /**< new type of variable */ 610 ); 611 612 /** changes objective value of variable */ 613 SCIP_RETCODE SCIPvarChgObj( 614 SCIP_VAR* var, /**< variable to change */ 615 BMS_BLKMEM* blkmem, /**< block memory */ 616 SCIP_SET* set, /**< global SCIP settings */ 617 SCIP_PROB* prob, /**< problem data */ 618 SCIP_PRIMAL* primal, /**< primal data */ 619 SCIP_LP* lp, /**< current LP data */ 620 SCIP_EVENTQUEUE* eventqueue, /**< event queue */ 621 SCIP_Real newobj /**< new objective value for variable */ 622 ); 623 624 /** adds value to objective value of variable */ 625 SCIP_RETCODE SCIPvarAddObj( 626 SCIP_VAR* var, /**< variable to change */ 627 BMS_BLKMEM* blkmem, /**< block memory */ 628 SCIP_SET* set, /**< global SCIP settings */ 629 SCIP_STAT* stat, /**< problem statistics */ 630 SCIP_PROB* transprob, /**< tranformed problem data */ 631 SCIP_PROB* origprob, /**< original problem data */ 632 SCIP_PRIMAL* primal, /**< primal data */ 633 SCIP_TREE* tree, /**< branch and bound tree */ 634 SCIP_REOPT* reopt, /**< reoptimization data structure */ 635 SCIP_LP* lp, /**< current LP data */ 636 SCIP_EVENTFILTER* eventfilter, /**< event filter for global (not variable dependent) events */ 637 SCIP_EVENTQUEUE* eventqueue, /**< event queue */ 638 SCIP_Real addobj /**< additional objective value for variable */ 639 ); 640 641 /** changes objective value of variable in current dive */ 642 SCIP_RETCODE SCIPvarChgObjDive( 643 SCIP_VAR* var, /**< problem variable to change */ 644 SCIP_SET* set, /**< global SCIP settings */ 645 SCIP_LP* lp, /**< current LP data */ 646 SCIP_Real newobj /**< new objective value for variable */ 647 ); 648 649 /** adjust lower bound to integral value, if variable is integral */ 650 void SCIPvarAdjustLb( 651 SCIP_VAR* var, /**< problem variable */ 652 SCIP_SET* set, /**< global SCIP settings */ 653 SCIP_Real* lb /**< pointer to lower bound to adjust */ 654 ); 655 656 /** adjust upper bound to integral value, if variable is integral */ 657 void SCIPvarAdjustUb( 658 SCIP_VAR* var, /**< problem variable */ 659 SCIP_SET* set, /**< global SCIP settings */ 660 SCIP_Real* ub /**< pointer to upper bound to adjust */ 661 ); 662 663 /** adjust lower or upper bound to integral value, if variable is integral */ 664 void SCIPvarAdjustBd( 665 SCIP_VAR* var, /**< problem variable */ 666 SCIP_SET* set, /**< global SCIP settings */ 667 SCIP_BOUNDTYPE boundtype, /**< type of bound to adjust */ 668 SCIP_Real* bd /**< pointer to bound to adjust */ 669 ); 670 671 /** changes lower bound of original variable in original problem */ 672 SCIP_RETCODE SCIPvarChgLbOriginal( 673 SCIP_VAR* var, /**< problem variable to change */ 674 SCIP_SET* set, /**< global SCIP settings */ 675 SCIP_Real newbound /**< new bound for variable */ 676 ); 677 678 /** changes upper bound of original variable in original problem */ 679 SCIP_RETCODE SCIPvarChgUbOriginal( 680 SCIP_VAR* var, /**< problem variable to change */ 681 SCIP_SET* set, /**< global SCIP settings */ 682 SCIP_Real newbound /**< new bound for variable */ 683 ); 684 685 /** changes global lower bound of variable; if possible, adjusts bound to integral value; 686 * updates local lower bound if the global bound is tighter 687 */ 688 SCIP_RETCODE SCIPvarChgLbGlobal( 689 SCIP_VAR* var, /**< problem variable to change */ 690 BMS_BLKMEM* blkmem, /**< block memory */ 691 SCIP_SET* set, /**< global SCIP settings */ 692 SCIP_STAT* stat, /**< problem statistics */ 693 SCIP_LP* lp, /**< current LP data, may be NULL for original variables */ 694 SCIP_BRANCHCAND* branchcand, /**< branching candidate storage, may be NULL for original variables */ 695 SCIP_EVENTQUEUE* eventqueue, /**< event queue, may be NULL for original variables */ 696 SCIP_CLIQUETABLE* cliquetable, /**< clique table data structure */ 697 SCIP_Real newbound /**< new bound for variable */ 698 ); 699 700 /** changes global upper bound of variable; if possible, adjusts bound to integral value; 701 * updates local upper bound if the global bound is tighter 702 */ 703 SCIP_RETCODE SCIPvarChgUbGlobal( 704 SCIP_VAR* var, /**< problem variable to change */ 705 BMS_BLKMEM* blkmem, /**< block memory */ 706 SCIP_SET* set, /**< global SCIP settings */ 707 SCIP_STAT* stat, /**< problem statistics */ 708 SCIP_LP* lp, /**< current LP data, may be NULL for original variables */ 709 SCIP_BRANCHCAND* branchcand, /**< branching candidate storage, may be NULL for original variables */ 710 SCIP_EVENTQUEUE* eventqueue, /**< event queue, may be NULL for original variables */ 711 SCIP_CLIQUETABLE* cliquetable, /**< clique table data structure */ 712 SCIP_Real newbound /**< new bound for variable */ 713 ); 714 715 /** changes global bound of variable; if possible, adjusts bound to integral value; 716 * updates local bound if the global bound is tighter 717 */ 718 SCIP_RETCODE SCIPvarChgBdGlobal( 719 SCIP_VAR* var, /**< problem variable to change */ 720 BMS_BLKMEM* blkmem, /**< block memory */ 721 SCIP_SET* set, /**< global SCIP settings */ 722 SCIP_STAT* stat, /**< problem statistics */ 723 SCIP_LP* lp, /**< current LP data, may be NULL for original variables */ 724 SCIP_BRANCHCAND* branchcand, /**< branching candidate storage, may be NULL for original variables */ 725 SCIP_EVENTQUEUE* eventqueue, /**< event queue, may be NULL for original variables */ 726 SCIP_CLIQUETABLE* cliquetable, /**< clique table data structure */ 727 SCIP_Real newbound, /**< new bound for variable */ 728 SCIP_BOUNDTYPE boundtype /**< type of bound: lower or upper bound */ 729 ); 730 731 /** changes current local lower bound of variable; if possible, adjusts bound to integral value; stores inference 732 * information in variable 733 */ 734 SCIP_RETCODE SCIPvarChgLbLocal( 735 SCIP_VAR* var, /**< problem variable to change */ 736 BMS_BLKMEM* blkmem, /**< block memory */ 737 SCIP_SET* set, /**< global SCIP settings */ 738 SCIP_STAT* stat, /**< problem statistics */ 739 SCIP_LP* lp, /**< current LP data, may be NULL for original variables */ 740 SCIP_BRANCHCAND* branchcand, /**< branching candidate storage, may be NULL for original variables */ 741 SCIP_EVENTQUEUE* eventqueue, /**< event queue, may be NULL for original variables */ 742 SCIP_Real newbound /**< new bound for variable */ 743 ); 744 745 /** changes current local upper bound of variable; if possible, adjusts bound to integral value; stores inference 746 * information in variable 747 */ 748 SCIP_RETCODE SCIPvarChgUbLocal( 749 SCIP_VAR* var, /**< problem variable to change */ 750 BMS_BLKMEM* blkmem, /**< block memory */ 751 SCIP_SET* set, /**< global SCIP settings */ 752 SCIP_STAT* stat, /**< problem statistics */ 753 SCIP_LP* lp, /**< current LP data, may be NULL for original variables */ 754 SCIP_BRANCHCAND* branchcand, /**< branching candidate storage, may be NULL for original variables */ 755 SCIP_EVENTQUEUE* eventqueue, /**< event queue, may be NULL for original variables */ 756 SCIP_Real newbound /**< new bound for variable */ 757 ); 758 759 /** changes current local bound of variable; if possible, adjusts bound to integral value; stores inference 760 * information in variable 761 */ 762 SCIP_RETCODE SCIPvarChgBdLocal( 763 SCIP_VAR* var, /**< problem variable to change */ 764 BMS_BLKMEM* blkmem, /**< block memory */ 765 SCIP_SET* set, /**< global SCIP settings */ 766 SCIP_STAT* stat, /**< problem statistics */ 767 SCIP_LP* lp, /**< current LP data, may be NULL for original variables */ 768 SCIP_BRANCHCAND* branchcand, /**< branching candidate storage, may be NULL for original variables */ 769 SCIP_EVENTQUEUE* eventqueue, /**< event queue, may be NULL for original variables */ 770 SCIP_Real newbound, /**< new bound for variable */ 771 SCIP_BOUNDTYPE boundtype /**< type of bound: lower or upper bound */ 772 ); 773 774 /** changes lazy lower bound of the variable, this is only possible if the variable is not in the LP yet */ 775 SCIP_RETCODE SCIPvarChgLbLazy( 776 SCIP_VAR* var, /**< problem variable */ 777 SCIP_SET* set, /**< global SCIP settings */ 778 SCIP_Real lazylb /**< the lazy lower bound to be set */ 779 ); 780 781 /** changes lazy upper bound of the variable, this is only possible if the variable is not in the LP yet */ 782 SCIP_RETCODE SCIPvarChgUbLazy( 783 SCIP_VAR* var, /**< problem variable */ 784 SCIP_SET* set, /**< global SCIP settings */ 785 SCIP_Real lazylb /**< the lazy lower bound to be set */ 786 ); 787 788 /** changes lower bound of variable in current dive; if possible, adjusts bound to integral value */ 789 SCIP_RETCODE SCIPvarChgLbDive( 790 SCIP_VAR* var, /**< problem variable to change */ 791 SCIP_SET* set, /**< global SCIP settings */ 792 SCIP_LP* lp, /**< current LP data */ 793 SCIP_Real newbound /**< new bound for variable */ 794 ); 795 796 /** changes upper bound of variable in current dive; if possible, adjusts bound to integral value */ 797 SCIP_RETCODE SCIPvarChgUbDive( 798 SCIP_VAR* var, /**< problem variable to change */ 799 SCIP_SET* set, /**< global SCIP settings */ 800 SCIP_LP* lp, /**< current LP data */ 801 SCIP_Real newbound /**< new bound for variable */ 802 ); 803 804 /** for a multi-aggregated variable, gives the local lower bound computed by adding the local bounds from all aggregation variables 805 * this lower bound may be tighter than the one given by SCIPvarGetLbLocal, since the latter is not updated if bounds of aggregation variables are changing 806 * calling this function for a non-multi-aggregated variable is not allowed 807 */ 808 SCIP_Real SCIPvarGetMultaggrLbLocal( 809 SCIP_VAR* var, /**< problem variable */ 810 SCIP_SET* set /**< global SCIP settings */ 811 ); 812 813 /** for a multi-aggregated variable, gives the local upper bound computed by adding the local bounds from all aggregation variables 814 * this upper bound may be tighter than the one given by SCIPvarGetUbLocal, since the latter is not updated if bounds of aggregation variables are changing 815 * calling this function for a non-multi-aggregated variable is not allowed 816 */ 817 SCIP_Real SCIPvarGetMultaggrUbLocal( 818 SCIP_VAR* var, /**< problem variable */ 819 SCIP_SET* set /**< global SCIP settings */ 820 ); 821 822 /** for a multi-aggregated variable, gives the global lower bound computed by adding the global bounds from all aggregation variables 823 * 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 824 * calling this function for a non-multi-aggregated variable is not allowed 825 */ 826 SCIP_Real SCIPvarGetMultaggrLbGlobal( 827 SCIP_VAR* var, /**< problem variable */ 828 SCIP_SET* set /**< global SCIP settings */ 829 ); 830 831 /** for a multi-aggregated variable, gives the global upper bound computed by adding the global bounds from all aggregation variables 832 * this upper bound may be tighter than the one given by SCIPvarGetUbGlobal, since the latter is not updated if bounds of aggregation variables are changing 833 * calling this function for a non-multi-aggregated variable is not allowed 834 */ 835 SCIP_Real SCIPvarGetMultaggrUbGlobal( 836 SCIP_VAR* var, /**< problem variable */ 837 SCIP_SET* set /**< global SCIP settings */ 838 ); 839 840 /** adds a hole to the original domain of the variable*/ 841 SCIP_RETCODE SCIPvarAddHoleOriginal( 842 SCIP_VAR* var, /**< problem variable */ 843 BMS_BLKMEM* blkmem, /**< block memory */ 844 SCIP_SET* set, /**< global SCIP settings */ 845 SCIP_Real left, /**< left bound of open interval in new hole */ 846 SCIP_Real right /**< right bound of open interval in new hole */ 847 ); 848 849 /** adds a hole to the variable's global domain */ 850 SCIP_RETCODE SCIPvarAddHoleGlobal( 851 SCIP_VAR* var, /**< problem variable */ 852 BMS_BLKMEM* blkmem, /**< block memory */ 853 SCIP_SET* set, /**< global SCIP settings */ 854 SCIP_STAT* stat, /**< problem statistics */ 855 SCIP_EVENTQUEUE* eventqueue, /**< event queue, may be NULL for original variables */ 856 SCIP_Real left, /**< left bound of open interval in new hole */ 857 SCIP_Real right, /**< right bound of open interval in new hole */ 858 SCIP_Bool* added /**< pointer to store whether the hole was added, or NULL */ 859 ); 860 861 /** adds a hole to the variable's current local domain */ 862 SCIP_RETCODE SCIPvarAddHoleLocal( 863 SCIP_VAR* var, /**< problem variable */ 864 BMS_BLKMEM* blkmem, /**< block memory */ 865 SCIP_SET* set, /**< global SCIP settings */ 866 SCIP_STAT* stat, /**< problem statistics */ 867 SCIP_EVENTQUEUE* eventqueue, /**< event queue, may be NULL for original variables */ 868 SCIP_Real left, /**< left bound of open interval in new hole */ 869 SCIP_Real right, /**< right bound of open interval in new hole */ 870 SCIP_Bool* added /**< pointer to store whether the hole was added, or NULL */ 871 ); 872 873 /** resets the global and local bounds of original variable to their original values */ 874 SCIP_RETCODE SCIPvarResetBounds( 875 SCIP_VAR* var, /**< problem variable */ 876 BMS_BLKMEM* blkmem, /**< block memory */ 877 SCIP_SET* set, /**< global SCIP settings */ 878 SCIP_STAT* stat /**< problem statistics */ 879 ); 880 881 /** returns at which depth in the tree a bound change was applied to the variable that conflicts with the 882 * given bound; returns -1 if the bound does not conflict with the current local bounds of the variable 883 */ 884 int SCIPvarGetConflictingBdchgDepth( 885 SCIP_VAR* var, /**< problem variable */ 886 SCIP_SET* set, /**< global SCIP settings */ 887 SCIP_BOUNDTYPE boundtype, /**< bound type of the conflicting bound */ 888 SCIP_Real bound /**< conflicting bound */ 889 ); 890 891 /** informs variable x about a globally valid variable lower bound x >= b*z + d with integer variable z; 892 * if z is binary, the corresponding valid implication for z is also added; 893 * improves the global bounds of the variable and the vlb variable if possible 894 */ 895 SCIP_RETCODE SCIPvarAddVlb( 896 SCIP_VAR* var, /**< problem variable */ 897 BMS_BLKMEM* blkmem, /**< block memory */ 898 SCIP_SET* set, /**< global SCIP settings */ 899 SCIP_STAT* stat, /**< problem statistics */ 900 SCIP_PROB* transprob, /**< transformed problem */ 901 SCIP_PROB* origprob, /**< original problem */ 902 SCIP_TREE* tree, /**< branch and bound tree if in solving stage */ 903 SCIP_REOPT* reopt, /**< reoptimization data structure */ 904 SCIP_LP* lp, /**< current LP data */ 905 SCIP_CLIQUETABLE* cliquetable, /**< clique table data structure */ 906 SCIP_BRANCHCAND* branchcand, /**< branching candidate storage */ 907 SCIP_EVENTQUEUE* eventqueue, /**< event queue */ 908 SCIP_VAR* vlbvar, /**< variable z in x >= b*z + d */ 909 SCIP_Real vlbcoef, /**< coefficient b in x >= b*z + d */ 910 SCIP_Real vlbconstant, /**< constant d in x >= b*z + d */ 911 SCIP_Bool transitive, /**< should transitive closure of implication also be added? */ 912 SCIP_Bool* infeasible, /**< pointer to store whether an infeasibility was detected */ 913 int* nbdchgs /**< pointer to store the number of performed bound changes, or NULL */ 914 ); 915 916 /** informs variable x about a globally valid variable upper bound x <= b*z + d with integer variable z; 917 * if z is binary, the corresponding valid implication for z is also added; 918 * updates the global bounds of the variable and the vub variable correspondingly 919 */ 920 SCIP_RETCODE SCIPvarAddVub( 921 SCIP_VAR* var, /**< problem variable */ 922 BMS_BLKMEM* blkmem, /**< block memory */ 923 SCIP_SET* set, /**< global SCIP settings */ 924 SCIP_STAT* stat, /**< problem statistics */ 925 SCIP_PROB* transprob, /**< transformed problem */ 926 SCIP_PROB* origprob, /**< original problem */ 927 SCIP_TREE* tree, /**< branch and bound tree if in solving stage */ 928 SCIP_REOPT* reopt, /**< reoptimization data structure */ 929 SCIP_LP* lp, /**< current LP data */ 930 SCIP_CLIQUETABLE* cliquetable, /**< clique table data structure */ 931 SCIP_BRANCHCAND* branchcand, /**< branching candidate storage */ 932 SCIP_EVENTQUEUE* eventqueue, /**< event queue */ 933 SCIP_VAR* vubvar, /**< variable z in x <= b*z + d */ 934 SCIP_Real vubcoef, /**< coefficient b in x <= b*z + d */ 935 SCIP_Real vubconstant, /**< constant d in x <= b*z + d */ 936 SCIP_Bool transitive, /**< should transitive closure of implication also be added? */ 937 SCIP_Bool* infeasible, /**< pointer to store whether an infeasibility was detected */ 938 int* nbdchgs /**< pointer to store the number of performed bound changes, or NULL */ 939 ); 940 941 /** informs binary variable x about a globally valid implication: x == 0 or x == 1 ==> y <= b or y >= b; 942 * also adds the corresponding implication or variable bound to the implied variable; 943 * if the implication is conflicting, the variable is fixed to the opposite value; 944 * if the variable is already fixed to the given value, the implication is performed immediately; 945 * if the implication is redundant with respect to the variables' global bounds, it is ignored 946 */ 947 SCIP_RETCODE SCIPvarAddImplic( 948 SCIP_VAR* var, /**< problem variable */ 949 BMS_BLKMEM* blkmem, /**< block memory */ 950 SCIP_SET* set, /**< global SCIP settings */ 951 SCIP_STAT* stat, /**< problem statistics */ 952 SCIP_PROB* transprob, /**< transformed problem */ 953 SCIP_PROB* origprob, /**< original problem */ 954 SCIP_TREE* tree, /**< branch and bound tree if in solving stage */ 955 SCIP_REOPT* reopt, /**< reoptimization data structure */ 956 SCIP_LP* lp, /**< current LP data */ 957 SCIP_CLIQUETABLE* cliquetable, /**< clique table data structure */ 958 SCIP_BRANCHCAND* branchcand, /**< branching candidate storage */ 959 SCIP_EVENTQUEUE* eventqueue, /**< event queue */ 960 SCIP_Bool varfixing, /**< FALSE if y should be added in implications for x == 0, TRUE for x == 1 */ 961 SCIP_VAR* implvar, /**< variable y in implication y <= b or y >= b */ 962 SCIP_BOUNDTYPE impltype, /**< type of implication y <= b (SCIP_BOUNDTYPE_UPPER) or y >= b (SCIP_BOUNDTYPE_LOWER) */ 963 SCIP_Real implbound, /**< bound b in implication y <= b or y >= b */ 964 SCIP_Bool transitive, /**< should transitive closure of implication also be added? */ 965 SCIP_Bool* infeasible, /**< pointer to store whether an infeasibility was detected */ 966 int* nbdchgs /**< pointer to store the number of performed bound changes, or NULL */ 967 ); 968 969 /** fixes the bounds of a binary variable to the given value, counting bound changes and detecting infeasibility */ 970 SCIP_RETCODE SCIPvarFixBinary( 971 SCIP_VAR* var, /**< problem variable */ 972 BMS_BLKMEM* blkmem, /**< block memory */ 973 SCIP_SET* set, /**< global SCIP settings */ 974 SCIP_STAT* stat, /**< problem statistics */ 975 SCIP_PROB* transprob, /**< transformed problem */ 976 SCIP_PROB* origprob, /**< original problem */ 977 SCIP_TREE* tree, /**< branch and bound tree if in solving stage */ 978 SCIP_REOPT* reopt, /**< reoptimization data structure */ 979 SCIP_LP* lp, /**< current LP data */ 980 SCIP_BRANCHCAND* branchcand, /**< branching candidate storage */ 981 SCIP_EVENTQUEUE* eventqueue, /**< event queue */ 982 SCIP_CLIQUETABLE* cliquetable, /**< clique table data structure */ 983 SCIP_Bool value, /**< value to fix variable to */ 984 SCIP_Bool* infeasible, /**< pointer to store whether an infeasibility was detected */ 985 int* nbdchgs /**< pointer to count the number of performed bound changes, or NULL */ 986 ); 987 988 /** adds the variable to the given clique and updates the list of cliques the binary variable is member of; 989 * if the variable now appears twice in the clique with the same value, it is fixed to the opposite value; 990 * if the variable now appears twice in the clique with opposite values, all other variables are fixed to 991 * the opposite of the value they take in the clique 992 */ 993 SCIP_RETCODE SCIPvarAddClique( 994 SCIP_VAR* var, /**< problem variable */ 995 BMS_BLKMEM* blkmem, /**< block memory */ 996 SCIP_SET* set, /**< global SCIP settings */ 997 SCIP_STAT* stat, /**< problem statistics */ 998 SCIP_PROB* transprob, /**< transformed problem */ 999 SCIP_PROB* origprob, /**< original problem */ 1000 SCIP_TREE* tree, /**< branch and bound tree if in solving stage */ 1001 SCIP_REOPT* reopt, /**< reoptimization data structure */ 1002 SCIP_LP* lp, /**< current LP data */ 1003 SCIP_BRANCHCAND* branchcand, /**< branching candidate storage */ 1004 SCIP_EVENTQUEUE* eventqueue, /**< event queue */ 1005 SCIP_CLIQUETABLE* cliquetable, /**< clique table data structure */ 1006 SCIP_Bool value, /**< value of the variable in the clique */ 1007 SCIP_CLIQUE* clique, /**< clique the variable should be added to */ 1008 SCIP_Bool* infeasible, /**< pointer to store whether an infeasibility was detected */ 1009 int* nbdchgs /**< pointer to count the number of performed bound changes, or NULL */ 1010 ); 1011 1012 /** adds a filled clique to the cliquelists of all corresponding variables */ 1013 SCIP_RETCODE SCIPvarsAddClique( 1014 SCIP_VAR** vars, /**< problem variables */ 1015 SCIP_Bool* values, /**< values of the variables in the clique */ 1016 int nvars, /**< number of problem variables */ 1017 BMS_BLKMEM* blkmem, /**< block memory */ 1018 SCIP_SET* set, /**< global SCIP settings */ 1019 SCIP_CLIQUE* clique /**< clique that contains all given variables and values */ 1020 ); 1021 1022 /** deletes the variable from the given clique and updates the list of cliques the binary variable is member of */ 1023 SCIP_RETCODE SCIPvarDelClique( 1024 SCIP_VAR* var, /**< problem variable */ 1025 BMS_BLKMEM* blkmem, /**< block memory */ 1026 SCIP_CLIQUETABLE* cliquetable, /**< clique table data structure */ 1027 SCIP_Bool value, /**< value of the variable in the clique */ 1028 SCIP_CLIQUE* clique /**< clique the variable should be removed from */ 1029 ); 1030 1031 /** adds a clique to the list of cliques of the given binary variable, but does not change the clique 1032 * itself 1033 */ 1034 SCIP_RETCODE SCIPvarAddCliqueToList( 1035 SCIP_VAR* var, /**< problem variable */ 1036 BMS_BLKMEM* blkmem, /**< block memory */ 1037 SCIP_SET* set, /**< global SCIP settings */ 1038 SCIP_Bool value, /**< value of the variable in the clique */ 1039 SCIP_CLIQUE* clique /**< clique that should be removed from the variable's clique list */ 1040 ); 1041 1042 /** deletes a clique from the list of cliques the binary variable is member of, but does not change the clique 1043 * itself 1044 */ 1045 SCIP_RETCODE SCIPvarDelCliqueFromList( 1046 SCIP_VAR* var, /**< problem variable */ 1047 BMS_BLKMEM* blkmem, /**< block memory */ 1048 SCIP_Bool value, /**< value of the variable in the clique */ 1049 SCIP_CLIQUE* clique /**< clique that should be removed from the variable's clique list */ 1050 ); 1051 1052 /** sets the branch factor of the variable; this value can be used in the branching methods to scale the score 1053 * values of the variables; higher factor leads to a higher probability that this variable is chosen for branching 1054 */ 1055 SCIP_RETCODE SCIPvarChgBranchFactor( 1056 SCIP_VAR* var, /**< problem variable */ 1057 SCIP_SET* set, /**< global SCIP settings */ 1058 SCIP_Real branchfactor /**< factor to weigh variable's branching score with */ 1059 ); 1060 1061 /** sets the branch priority of the variable; variables with higher branch priority are always preferred to variables 1062 * with lower priority in selection of branching variable 1063 */ 1064 SCIP_RETCODE SCIPvarChgBranchPriority( 1065 SCIP_VAR* var, /**< problem variable */ 1066 int branchpriority /**< branching priority of the variable */ 1067 ); 1068 1069 /** sets the branch direction of the variable; variables with higher branch direction are always preferred to variables 1070 * with lower direction in selection of branching variable 1071 */ 1072 SCIP_RETCODE SCIPvarChgBranchDirection( 1073 SCIP_VAR* var, /**< problem variable */ 1074 SCIP_BRANCHDIR branchdirection /**< preferred branch direction of the variable (downwards, upwards, auto) */ 1075 ); 1076 1077 /** gets objective value of variable in current SCIP_LP; the value can be different from the bound stored in the variable's own 1078 * data due to diving, that operate only on the LP without updating the variables 1079 */ 1080 SCIP_Real SCIPvarGetObjLP( 1081 SCIP_VAR* var /**< problem variable */ 1082 ); 1083 1084 /** gets lower bound of variable in current SCIP_LP; the bound can be different from the bound stored in the variable's own 1085 * data due to diving or conflict analysis, that operate only on the LP without updating the variables 1086 */ 1087 SCIP_Real SCIPvarGetLbLP( 1088 SCIP_VAR* var, /**< problem variable */ 1089 SCIP_SET* set /**< global SCIP settings */ 1090 ); 1091 1092 /** gets upper bound of variable in current SCIP_LP; the bound can be different from the bound stored in the variable's own 1093 * data due to diving or conflict analysis, that operate only on the LP without updating the variables 1094 */ 1095 SCIP_Real SCIPvarGetUbLP( 1096 SCIP_VAR* var, /**< problem variable */ 1097 SCIP_SET* set /**< global SCIP settings */ 1098 ); 1099 1100 /** returns solution value and index of variable lower bound that is closest to the variable's value in the given primal solution 1101 * or current LP solution if no primal solution is given; returns an index of -1 if no variable lower bound is available 1102 */ 1103 void SCIPvarGetClosestVlb( 1104 SCIP_VAR* var, /**< active problem variable */ 1105 SCIP_SOL* sol, /**< primal solution, or NULL for LP solution */ 1106 SCIP_SET* set, /**< global SCIP settings */ 1107 SCIP_STAT* stat, /**< problem statistics */ 1108 SCIP_Real* closestvlb, /**< pointer to store the value of the closest variable lower bound */ 1109 int* closestvlbidx /**< pointer to store the index of the closest variable lower bound */ 1110 ); 1111 1112 /** returns solution value and index of variable upper bound that is closest to the variable's value in the given primal solution; 1113 * or current LP solution if no primal solution is given; returns an index of -1 if no variable upper bound is available 1114 */ 1115 void SCIPvarGetClosestVub( 1116 SCIP_VAR* var, /**< active problem variable */ 1117 SCIP_SOL* sol, /**< primal solution, or NULL for LP solution */ 1118 SCIP_SET* set, /**< global SCIP settings */ 1119 SCIP_STAT* stat, /**< problem statistics */ 1120 SCIP_Real* closestvub, /**< pointer to store the value of the closest variable upper bound */ 1121 int* closestvubidx /**< pointer to store the index of the closest variable upper bound */ 1122 ); 1123 1124 /** remembers the current solution as root solution in the problem variables */ 1125 void SCIPvarStoreRootSol( 1126 SCIP_VAR* var, /**< problem variable */ 1127 SCIP_Bool roothaslp /**< is the root solution from LP? */ 1128 ); 1129 1130 /** updates the current solution as best root solution in the problem variables if it is better */ 1131 void SCIPvarUpdateBestRootSol( 1132 SCIP_VAR* var, /**< problem variable */ 1133 SCIP_SET* set, /**< global SCIP settings */ 1134 SCIP_Real rootsol, /**< root solution value */ 1135 SCIP_Real rootredcost, /**< root reduced cost */ 1136 SCIP_Real rootlpobjval /**< objective value of the root LP */ 1137 ); 1138 1139 /** returns the solution value of the problem variables in the relaxation solution */ 1140 SCIP_Real SCIPvarGetRelaxSol( 1141 SCIP_VAR* var, /**< problem variable */ 1142 SCIP_SET* set /**< global SCIP settings */ 1143 ); 1144 1145 /** returns the solution value of the transformed problem variable in the relaxation solution */ 1146 SCIP_Real SCIPvarGetRelaxSolTransVar( 1147 SCIP_VAR* var /**< problem variable */ 1148 ); 1149 1150 /** returns for the given binary variable the reduced cost which are given by the variable itself and its implication if 1151 * the binary variable is fixed to the given value 1152 */ 1153 SCIP_Real SCIPvarGetImplRedcost( 1154 SCIP_VAR* var, /**< problem variable */ 1155 SCIP_SET* set, /**< global SCIP settings */ 1156 SCIP_Bool varfixing, /**< FALSE if for x == 0, TRUE for x == 1 */ 1157 SCIP_STAT* stat, /**< problem statistics */ 1158 SCIP_PROB* prob, /**< transformed problem, or NULL */ 1159 SCIP_LP* lp /**< current LP data */ 1160 ); 1161 1162 1163 /** stores the solution value as relaxation solution in the problem variable */ 1164 SCIP_RETCODE SCIPvarSetRelaxSol( 1165 SCIP_VAR* var, /**< problem variable */ 1166 SCIP_SET* set, /**< global SCIP settings */ 1167 SCIP_RELAXATION* relaxation, /**< global relaxation data */ 1168 SCIP_Real solval, /**< solution value in the current relaxation solution */ 1169 SCIP_Bool updateobj /**< should the objective value be updated? */ 1170 ); 1171 1172 /** stores the solution value as NLP solution in the problem variable */ 1173 SCIP_RETCODE SCIPvarSetNLPSol( 1174 SCIP_VAR* var, /**< problem variable */ 1175 SCIP_SET* set, /**< global SCIP settings */ 1176 SCIP_Real solval /**< solution value in the current NLP solution */ 1177 ); 1178 1179 /** resolves variable to columns and adds them with the coefficient to the row */ 1180 SCIP_RETCODE SCIPvarAddToRow( 1181 SCIP_VAR* var, /**< problem variable */ 1182 BMS_BLKMEM* blkmem, /**< block memory */ 1183 SCIP_SET* set, /**< global SCIP settings */ 1184 SCIP_STAT* stat, /**< problem statistics */ 1185 SCIP_EVENTQUEUE* eventqueue, /**< event queue */ 1186 SCIP_PROB* prob, /**< problem data */ 1187 SCIP_LP* lp, /**< current LP data */ 1188 SCIP_ROW* row, /**< LP row */ 1189 SCIP_Real val /**< value of coefficient */ 1190 ); 1191 1192 1193 /** merge two variable histories together; a typical use case is that \p othervar is an image of the target variable 1194 * in a SCIP copy. Method should be applied with care, especially because no internal checks are performed whether 1195 * the history merge is reasonable 1196 * 1197 * @note Do not use this method if the two variables originate from two SCIP's with different objective functions, since 1198 * this corrupts the variable pseudo costs 1199 * @note Apply with care; no internal checks are performed if the two variables should be merged 1200 */ 1201 void SCIPvarMergeHistories( 1202 SCIP_VAR* targetvar, /**< the variable that should contain both histories afterwards */ 1203 SCIP_VAR* othervar, /**< the variable whose history is to be merged with that of the target variable */ 1204 SCIP_STAT* stat /**< problem statistics */ 1205 ); 1206 1207 /** sets the history of a variable; this method is typacally used within reoptimization to keep and update the variable 1208 * history over several iteraions 1209 */ 1210 void SCIPvarSetHistory( 1211 SCIP_VAR* var, /**< variable */ 1212 SCIP_HISTORY* history, /**< the history which is to set */ 1213 SCIP_STAT* stat /**< problem statistics */ 1214 ); 1215 1216 /** updates the pseudo costs of the given variable and the global pseudo costs after a change of 1217 * "solvaldelta" in the variable's solution value and resulting change of "objdelta" in the in the LP's objective value 1218 */ 1219 SCIP_RETCODE SCIPvarUpdatePseudocost( 1220 SCIP_VAR* var, /**< problem variable */ 1221 SCIP_SET* set, /**< global SCIP settings */ 1222 SCIP_STAT* stat, /**< problem statistics */ 1223 SCIP_Real solvaldelta, /**< difference of variable's new LP value - old LP value */ 1224 SCIP_Real objdelta, /**< difference of new LP's objective value - old LP's objective value */ 1225 SCIP_Real weight /**< weight in (0,1] of this update in pseudo cost sum */ 1226 ); 1227 1228 /** gets the variable's pseudo cost value for the given step size "solvaldelta" in the variable's LP solution value */ 1229 SCIP_Real SCIPvarGetPseudocost( 1230 SCIP_VAR* var, /**< problem variable */ 1231 SCIP_STAT* stat, /**< problem statistics */ 1232 SCIP_Real solvaldelta /**< difference of variable's new LP value - old LP value */ 1233 ); 1234 1235 /** gets the variable's pseudo cost value for the given step size "solvaldelta" in the variable's LP solution value, 1236 * only using the pseudo cost information of the current run 1237 */ 1238 SCIP_Real SCIPvarGetPseudocostCurrentRun( 1239 SCIP_VAR* var, /**< problem variable */ 1240 SCIP_STAT* stat, /**< problem statistics */ 1241 SCIP_Real solvaldelta /**< difference of variable's new LP value - old LP value */ 1242 ); 1243 1244 /** gets the variable's (possible fractional) number of pseudo cost updates for the given direction */ 1245 SCIP_Real SCIPvarGetPseudocostCount( 1246 SCIP_VAR* var, /**< problem variable */ 1247 SCIP_BRANCHDIR dir /**< branching direction (downwards, or upwards) */ 1248 ); 1249 1250 /** gets the variable's (possible fractional) number of pseudo cost updates for the given direction, 1251 * only using the pseudo cost information of the current run 1252 */ 1253 SCIP_Real SCIPvarGetPseudocostCountCurrentRun( 1254 SCIP_VAR* var, /**< problem variable */ 1255 SCIP_BRANCHDIR dir /**< branching direction (downwards, or upwards) */ 1256 ); 1257 1258 1259 /** compares both possible directions for rounding the given solution value and returns the minimum pseudo-costs of the variable */ 1260 SCIP_Real SCIPvarGetMinPseudocostScore( 1261 SCIP_VAR* var, /**< problem variable */ 1262 SCIP_STAT* stat, /**< problem statistics */ 1263 SCIP_SET* set, /**< global SCIP settings */ 1264 SCIP_Real solval /**< solution value, e.g., LP solution value */ 1265 ); 1266 1267 /** gets the an estimate of the variable's pseudo cost variance in direction \p dir */ 1268 SCIP_Real SCIPvarGetPseudocostVariance( 1269 SCIP_VAR* var, /**< problem variable */ 1270 SCIP_BRANCHDIR dir, /**< branching direction (downwards, or upwards) */ 1271 SCIP_Bool onlycurrentrun /**< return pseudo cost variance only for current branch and bound run */ 1272 ); 1273 1274 /** calculates a confidence bound for this variable under the assumption of normally distributed pseudo costs 1275 * 1276 * The confidence bound \f$ \theta \geq 0\f$ denotes the interval borders \f$ [X - \theta, \ X + \theta]\f$, which contains 1277 * the true pseudo costs of the variable, i.e., the expected value of the normal distribution, with a probability 1278 * of 95 %. 1279 * 1280 * @return value of confidence bound for this variable 1281 */ 1282 SCIP_Real SCIPvarCalcPscostConfidenceBound( 1283 SCIP_VAR* var, /**< variable in question */ 1284 SCIP_SET* set, /**< global SCIP settings */ 1285 SCIP_BRANCHDIR dir, /**< the branching direction for the confidence bound */ 1286 SCIP_Bool onlycurrentrun, /**< should only the current run be taken into account */ 1287 SCIP_CONFIDENCELEVEL clevel /**< confidence level for the interval */ 1288 ); 1289 1290 /** check if the current pseudo cost relative error in a direction violates the given threshold. The Relative 1291 * Error is calculated at a specific confidence level 1292 */ 1293 SCIP_Bool SCIPvarIsPscostRelerrorReliable( 1294 SCIP_VAR* var, /**< variable in question */ 1295 SCIP_SET* set, /**< global SCIP settings */ 1296 SCIP_STAT* stat, /**< problem statistics */ 1297 SCIP_Real threshold, /**< threshold for relative errors to be considered reliable (enough) */ 1298 SCIP_CONFIDENCELEVEL clevel /**< a given confidence level */ 1299 ); 1300 1301 /** check if variable pseudo-costs have a significant difference in location. The significance depends on 1302 * the choice of \p clevel and on the kind of tested hypothesis. The one-sided hypothesis, which 1303 * should be rejected, is that fracy * mu_y >= fracx * mu_x, where mu_y and mu_x denote the 1304 * unknown location means of the underlying pseudo-cost distributions of x and y. 1305 * 1306 * This method is applied best if variable x has a better pseudo-cost score than y. The method hypothesizes that y were actually 1307 * better than x (despite the current information), meaning that y can be expected to yield branching 1308 * decisions as least as good as x in the long run. If the method returns TRUE, the current history information is 1309 * sufficient to safely rely on the alternative hypothesis that x yields indeed a better branching score (on average) 1310 * than y. 1311 * 1312 * @note The order of x and y matters for the one-sided hypothesis 1313 * 1314 * @note set \p onesided to FALSE if you are not sure which variable is better. The hypothesis tested then reads 1315 * fracy * mu_y == fracx * mu_x vs the alternative hypothesis fracy * mu_y != fracx * mu_x. 1316 * 1317 * @return TRUE if the hypothesis can be safely rejected at the given confidence level 1318 */ 1319 SCIP_Bool SCIPvarSignificantPscostDifference( 1320 SCIP_SET* set, /**< global SCIP settings */ 1321 SCIP_STAT* stat, /**< problem statistics */ 1322 SCIP_VAR* varx, /**< variable x */ 1323 SCIP_Real fracx, /**< the fractionality of variable x */ 1324 SCIP_VAR* vary, /**< variable y */ 1325 SCIP_Real fracy, /**< the fractionality of variable y */ 1326 SCIP_BRANCHDIR dir, /**< branching direction */ 1327 SCIP_CONFIDENCELEVEL clevel, /**< confidence level for rejecting hypothesis */ 1328 SCIP_Bool onesided /**< should a one-sided hypothesis y >= x be tested? */ 1329 ); 1330 1331 /** tests at a given confidence level whether the variable pseudo-costs only have a small probability to 1332 * exceed a \p threshold. This is useful to determine if past observations provide enough evidence 1333 * to skip an expensive strong-branching step if there is already a candidate that has been proven to yield an improvement 1334 * of at least \p threshold. 1335 * 1336 * @note use \p clevel to adjust the level of confidence. For SCIP_CONFIDENCELEVEL_MIN, the method returns TRUE if 1337 * the estimated probability to exceed \p threshold is less than 25 %. 1338 * 1339 * @see SCIP_Confidencelevel for a list of available levels. The used probability limits refer to the one-sided levels 1340 * of confidence. 1341 * 1342 * @return TRUE if the variable pseudo-cost probabilistic model is likely to be smaller than \p threshold 1343 * at the given confidence level \p clevel. 1344 */ 1345 SCIP_Bool SCIPvarPscostThresholdProbabilityTest( 1346 SCIP_SET* set, /**< global SCIP settings */ 1347 SCIP_STAT* stat, /**< problem statistics */ 1348 SCIP_VAR* var, /**< variable x */ 1349 SCIP_Real frac, /**< the fractionality of variable x */ 1350 SCIP_Real threshold, /**< the threshold to test against */ 1351 SCIP_BRANCHDIR dir, /**< branching direction */ 1352 SCIP_CONFIDENCELEVEL clevel /**< confidence level for rejecting hypothesis */ 1353 ); 1354 1355 /** increases the VSIDS of the variable by the given weight */ 1356 SCIP_RETCODE SCIPvarIncVSIDS( 1357 SCIP_VAR* var, /**< problem variable */ 1358 BMS_BLKMEM* blkmem, /**< block memory, or NULL if the domain value is SCIP_UNKNOWN */ 1359 SCIP_SET* set, /**< global SCIP settings, or NULL if the domain value is SCIP_UNKNOWN */ 1360 SCIP_STAT* stat, /**< problem statistics */ 1361 SCIP_BRANCHDIR dir, /**< branching direction */ 1362 SCIP_Real value, /**< domain value, or SCIP_UNKNOWN */ 1363 SCIP_Real weight /**< weight of this update in conflict score */ 1364 ); 1365 1366 /** scales the VSIDS of the variable by the given scalar */ 1367 SCIP_RETCODE SCIPvarScaleVSIDS( 1368 SCIP_VAR* var, /**< problem variable */ 1369 SCIP_Real scalar /**< scalar to multiply the conflict scores with */ 1370 ); 1371 1372 /** increases the number of active conflicts by one and the overall length of the variable by the given length */ 1373 SCIP_RETCODE SCIPvarIncNActiveConflicts( 1374 SCIP_VAR* var, /**< problem variable */ 1375 BMS_BLKMEM* blkmem, /**< block memory, or NULL if the domain value is SCIP_UNKNOWN */ 1376 SCIP_SET* set, /**< global SCIP settings, or NULL if the domain value is SCIP_UNKNOWN */ 1377 SCIP_STAT* stat, /**< problem statistics */ 1378 SCIP_BRANCHDIR dir, /**< branching direction */ 1379 SCIP_Real value, /**< domain value, or SCIP_UNKNOWN */ 1380 SCIP_Real length /**< length of the conflict */ 1381 ); 1382 1383 /** gets the number of active conflicts containing this variable in given direction */ 1384 SCIP_Longint SCIPvarGetNActiveConflicts( 1385 SCIP_VAR* var, /**< problem variable */ 1386 SCIP_STAT* stat, /**< problem statistics */ 1387 SCIP_BRANCHDIR dir /**< branching direction (downwards, or upwards) */ 1388 ); 1389 1390 /** gets the number of active conflicts containing this variable in given direction 1391 * in the current run 1392 */ 1393 SCIP_Longint SCIPvarGetNActiveConflictsCurrentRun( 1394 SCIP_VAR* var, /**< problem variable */ 1395 SCIP_STAT* stat, /**< problem statistics */ 1396 SCIP_BRANCHDIR dir /**< branching direction (downwards, or upwards) */ 1397 ); 1398 1399 /** gets the average conflict length in given direction due to branching on the variable */ 1400 SCIP_Real SCIPvarGetAvgConflictlength( 1401 SCIP_VAR* var, /**< problem variable */ 1402 SCIP_BRANCHDIR dir /**< branching direction (downwards, or upwards) */ 1403 ); 1404 1405 /** gets the average conflict length in given direction due to branching on the variable 1406 * in the current run 1407 */ 1408 SCIP_Real SCIPvarGetAvgConflictlengthCurrentRun( 1409 SCIP_VAR* var, /**< problem variable */ 1410 SCIP_BRANCHDIR dir /**< branching direction (downwards, or upwards) */ 1411 ); 1412 1413 /** increases the number of branchings counter of the variable */ 1414 SCIP_RETCODE SCIPvarIncNBranchings( 1415 SCIP_VAR* var, /**< problem variable */ 1416 BMS_BLKMEM* blkmem, /**< block memory, or NULL if the domain value is SCIP_UNKNOWN */ 1417 SCIP_SET* set, /**< global SCIP settings, or NULL if the domain value is SCIP_UNKNOWN */ 1418 SCIP_STAT* stat, /**< problem statistics */ 1419 SCIP_BRANCHDIR dir, /**< branching direction (downwards, or upwards) */ 1420 SCIP_Real value, /**< domain value, or SCIP_UNKNOWN */ 1421 int depth /**< depth at which the bound change took place */ 1422 ); 1423 1424 /** increases the inference score of the variable by the given weight */ 1425 SCIP_RETCODE SCIPvarIncInferenceSum( 1426 SCIP_VAR* var, /**< problem variable */ 1427 BMS_BLKMEM* blkmem, /**< block memory, or NULL if the domain value is SCIP_UNKNOWN */ 1428 SCIP_SET* set, /**< global SCIP settings, or NULL if the domain value is SCIP_UNKNOWN */ 1429 SCIP_STAT* stat, /**< problem statistics */ 1430 SCIP_BRANCHDIR dir, /**< branching direction (downwards, or upwards) */ 1431 SCIP_Real value, /**< domain value, or SCIP_UNKNOWN */ 1432 SCIP_Real weight /**< weight of this update in inference score */ 1433 ); 1434 1435 /** increases the cutoff score of the variable by the given weight */ 1436 SCIP_RETCODE SCIPvarIncCutoffSum( 1437 SCIP_VAR* var, /**< problem variable */ 1438 BMS_BLKMEM* blkmem, /**< block memory, or NULL if the domain value is SCIP_UNKNOWN */ 1439 SCIP_SET* set, /**< global SCIP settings, or NULL if the domain value is SCIP_UNKNOWN */ 1440 SCIP_STAT* stat, /**< problem statistics */ 1441 SCIP_BRANCHDIR dir, /**< branching direction (downwards, or upwards) */ 1442 SCIP_Real value, /**< domain value, or SCIP_UNKNOWN */ 1443 SCIP_Real weight /**< weight of this update in cutoff score */ 1444 ); 1445 1446 /** returns the variable's VSIDS score */ 1447 SCIP_Real SCIPvarGetVSIDS_rec( 1448 SCIP_VAR* var, /**< problem variable */ 1449 SCIP_STAT* stat, /**< problem statistics */ 1450 SCIP_BRANCHDIR dir /**< branching direction (downwards, or upwards) */ 1451 ); 1452 1453 /** returns the variable's VSIDS score only using conflicts of the current run */ 1454 SCIP_Real SCIPvarGetVSIDSCurrentRun( 1455 SCIP_VAR* var, /**< problem variable */ 1456 SCIP_STAT* stat, /**< problem statistics */ 1457 SCIP_BRANCHDIR dir /**< branching direction (downwards, or upwards) */ 1458 ); 1459 1460 /** returns the average number of inferences found after branching on the variable in given direction */ 1461 SCIP_Real SCIPvarGetAvgInferences( 1462 SCIP_VAR* var, /**< problem variable */ 1463 SCIP_STAT* stat, /**< problem statistics */ 1464 SCIP_BRANCHDIR dir /**< branching direction (downwards, or upwards) */ 1465 ); 1466 1467 /** returns the average number of inferences found after branching on the variable in given direction 1468 * in the current run 1469 */ 1470 SCIP_Real SCIPvarGetAvgInferencesCurrentRun( 1471 SCIP_VAR* var, /**< problem variable */ 1472 SCIP_STAT* stat, /**< problem statistics */ 1473 SCIP_BRANCHDIR dir /**< branching direction (downwards, or upwards) */ 1474 ); 1475 1476 /** returns the average number of cutoffs found after branching on the variable in given direction */ 1477 SCIP_Real SCIPvarGetAvgCutoffs( 1478 SCIP_VAR* var, /**< problem variable */ 1479 SCIP_STAT* stat, /**< problem statistics */ 1480 SCIP_BRANCHDIR dir /**< branching direction (downwards, or upwards) */ 1481 ); 1482 1483 /** returns the average number of cutoffs found after branching on the variable in given direction in the current run */ 1484 SCIP_Real SCIPvarGetAvgCutoffsCurrentRun( 1485 SCIP_VAR* var, /**< problem variable */ 1486 SCIP_STAT* stat, /**< problem statistics */ 1487 SCIP_BRANCHDIR dir /**< branching direction (downwards, or upwards) */ 1488 ); 1489 1490 /** outputs variable information into file stream */ 1491 SCIP_RETCODE SCIPvarPrint( 1492 SCIP_VAR* var, /**< problem variable */ 1493 SCIP_SET* set, /**< global SCIP settings */ 1494 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */ 1495 FILE* file /**< output file (or NULL for standard output) */ 1496 ); 1497 1498 /** includes event handler with given data in variable's event filter */ 1499 SCIP_RETCODE SCIPvarCatchEvent( 1500 SCIP_VAR* var, /**< problem variable */ 1501 BMS_BLKMEM* blkmem, /**< block memory */ 1502 SCIP_SET* set, /**< global SCIP settings */ 1503 SCIP_EVENTTYPE eventtype, /**< event type to catch */ 1504 SCIP_EVENTHDLR* eventhdlr, /**< event handler to call for the event processing */ 1505 SCIP_EVENTDATA* eventdata, /**< event data to pass to the event handler for the event processing */ 1506 int* filterpos /**< pointer to store position of event filter entry, or NULL */ 1507 ); 1508 1509 /** deletes event handler with given data from variable's event filter */ 1510 SCIP_RETCODE SCIPvarDropEvent( 1511 SCIP_VAR* var, /**< problem variable */ 1512 BMS_BLKMEM* blkmem, /**< block memory */ 1513 SCIP_SET* set, /**< global SCIP settings */ 1514 SCIP_EVENTTYPE eventtype, /**< event type mask of dropped event */ 1515 SCIP_EVENTHDLR* eventhdlr, /**< event handler to call for the event processing */ 1516 SCIP_EVENTDATA* eventdata, /**< event data to pass to the event handler for the event processing */ 1517 int filterpos /**< position of event filter entry returned by SCIPvarCatchEvent(), or -1 */ 1518 ); 1519 1520 /** returns the variable's VSIDS score */ 1521 SCIP_Real SCIPvarGetVSIDS( 1522 SCIP_VAR* var, /**< problem variable */ 1523 SCIP_STAT* stat, /**< problem statistics */ 1524 SCIP_BRANCHDIR dir /**< branching direction (downwards, or upwards) */ 1525 ); 1526 1527 /** returns the position of the bound change index */ 1528 int SCIPbdchgidxGetPos( 1529 SCIP_BDCHGIDX* bdchgidx /**< bound change index */ 1530 ); 1531 1532 /** removes (redundant) cliques, implications and variable bounds of variable from all other variables' implications and variable 1533 * bounds arrays, and optionally removes them also from the variable itself 1534 */ 1535 SCIP_RETCODE SCIPvarRemoveCliquesImplicsVbs( 1536 SCIP_VAR* var, /**< problem variable */ 1537 BMS_BLKMEM* blkmem, /**< block memory */ 1538 SCIP_CLIQUETABLE* cliquetable, /**< clique table data structure */ 1539 SCIP_SET* set, /**< global SCIP settings */ 1540 SCIP_Bool irrelevantvar, /**< has the variable become irrelevant? */ 1541 SCIP_Bool onlyredundant, /**< should only the redundant implications and variable bounds be removed? */ 1542 SCIP_Bool removefromvar /**< should the implications and variable bounds be removed from the var itself? */ 1543 ); 1544 1545 #ifdef NDEBUG 1546 1547 /* In optimized mode, the function calls are overwritten by defines to reduce the number of function calls and 1548 * speed up the algorithms. 1549 */ 1550 1551 #define SCIPvarCatchEvent(var, blkmem, set, eventtype, eventhdlr, eventdata, filterpos) \ 1552 SCIPeventfilterAdd(var->eventfilter, blkmem, set, eventtype, eventhdlr, eventdata, filterpos) 1553 #define SCIPvarDropEvent(var, blkmem, set, eventtype, eventhdlr, eventdata, filterpos) \ 1554 SCIPeventfilterDel(var->eventfilter, blkmem, set, eventtype, eventhdlr, eventdata, filterpos) 1555 #define SCIPvarGetVSIDS(var, stat, dir) ((var)->varstatus == SCIP_VARSTATUS_LOOSE || (var)->varstatus == SCIP_VARSTATUS_COLUMN ? \ 1556 SCIPhistoryGetVSIDS(var->history, dir)/stat->vsidsweight : SCIPvarGetVSIDS_rec(var, stat, dir)) 1557 #define SCIPbdchgidxGetPos(bdchgidx) ((bdchgidx)->pos) 1558 1559 #endif 1560 1561 /* 1562 * Hash functions 1563 */ 1564 1565 /** gets the key (i.e. the name) of the given variable */ 1566 SCIP_DECL_HASHGETKEY(SCIPhashGetKeyVar); 1567 1568 #ifdef __cplusplus 1569 } 1570 #endif 1571 1572 #endif 1573