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