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 pub_var.h 17 * @ingroup PUBLICCOREAPI 18 * @brief public 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_PUB_VAR_H__ 25 #define __SCIP_PUB_VAR_H__ 26 27 28 #include "scip/def.h" 29 #include "scip/type_cons.h" 30 #include "scip/type_history.h" 31 #include "scip/type_implics.h" 32 #include "scip/type_lp.h" 33 #include "scip/type_misc.h" 34 #include "scip/type_prop.h" 35 #include "scip/type_result.h" 36 #include "scip/type_retcode.h" 37 #include "scip/type_scip.h" 38 #include "scip/type_var.h" 39 40 #ifdef NDEBUG 41 #include "scip/struct_var.h" 42 #include "scip/implics.h" 43 #include "scip/history.h" 44 #include "scip/pub_lp.h" 45 #endif 46 47 #ifdef __cplusplus 48 extern "C" { 49 #endif 50 51 /* 52 * methods for variables 53 */ 54 55 /**@addtogroup PublicVariableMethods 56 * 57 * @{ 58 */ 59 60 /** gets number of locks for rounding down 61 * 62 * @note This method will always return variable locks of type model 63 * 64 * @note It is recommented to use SCIPvarGetNLocksDownType() 65 */ 66 SCIP_EXPORT 67 int SCIPvarGetNLocksDown( 68 SCIP_VAR* var /**< problem variable */ 69 ); 70 71 /** gets number of locks for rounding up 72 * 73 * @note This method will always return variable locks of type model 74 * 75 * @note It is recommented to use SCIPvarGetNLocksUpType() 76 */ 77 SCIP_EXPORT 78 int SCIPvarGetNLocksUp( 79 SCIP_VAR* var /**< problem variable */ 80 ); 81 82 /** gets number of locks for rounding up of a special type */ 83 SCIP_EXPORT 84 int SCIPvarGetNLocksUpType( 85 SCIP_VAR* var, /**< problem variable */ 86 SCIP_LOCKTYPE locktype /**< type of variable locks */ 87 ); 88 89 /** gets number of locks for rounding down of a special type */ 90 SCIP_EXPORT 91 int SCIPvarGetNLocksDownType( 92 SCIP_VAR* var, /**< problem variable */ 93 SCIP_LOCKTYPE locktype /**< type of variable locks */ 94 ); 95 96 /** is it possible, to round variable down and stay feasible? 97 * 98 * @note This method will always check w.r.t variable locks of type model 99 */ 100 SCIP_EXPORT 101 SCIP_Bool SCIPvarMayRoundDown( 102 SCIP_VAR* var /**< problem variable */ 103 ); 104 105 /** is it possible, to round variable up and stay feasible? 106 * 107 * @note This method will always check w.r.t. variable locks of type model 108 */ 109 SCIP_EXPORT 110 SCIP_Bool SCIPvarMayRoundUp( 111 SCIP_VAR* var /**< problem variable */ 112 ); 113 114 /** compares the index of two variables, only active or negated variables are allowed, if a variable 115 * is negated then the index of the corresponding active variable is taken, returns -1 if first is 116 * smaller than, and +1 if first is greater than second variable index; returns 0 if both indices 117 * are equal, which means both variables are equal 118 */ 119 SCIP_EXPORT 120 int SCIPvarCompareActiveAndNegated( 121 SCIP_VAR* var1, /**< first problem variable */ 122 SCIP_VAR* var2 /**< second problem variable */ 123 ); 124 125 /** comparison method for sorting active and negated variables by non-decreasing index, active and negated 126 * variables are handled as the same variables 127 */ 128 SCIP_EXPORT 129 SCIP_DECL_SORTPTRCOMP(SCIPvarCompActiveAndNegated); 130 131 /** compares the index of two variables, returns -1 if first is smaller than, and +1 if first is greater than second 132 * variable index; returns 0 if both indices are equal, which means both variables are equal 133 */ 134 SCIP_EXPORT 135 int SCIPvarCompare( 136 SCIP_VAR* var1, /**< first problem variable */ 137 SCIP_VAR* var2 /**< second problem variable */ 138 ); 139 140 /** comparison method for sorting variables by non-decreasing index */ 141 SCIP_EXPORT 142 SCIP_DECL_SORTPTRCOMP(SCIPvarComp); 143 144 /** comparison method for sorting variables by non-decreasing objective coefficient */ 145 SCIP_EXPORT 146 SCIP_DECL_SORTPTRCOMP(SCIPvarCompObj); 147 148 /** hash key retrieval function for variables */ 149 SCIP_EXPORT 150 SCIP_DECL_HASHGETKEY(SCIPvarGetHashkey); 151 152 /** returns TRUE iff the indices of both variables are equal */ 153 SCIP_EXPORT 154 SCIP_DECL_HASHKEYEQ(SCIPvarIsHashkeyEq); 155 156 /** returns the hash value of the key */ 157 SCIP_EXPORT 158 SCIP_DECL_HASHKEYVAL(SCIPvarGetHashkeyVal); 159 160 161 /** gets corresponding active, fixed, or multi-aggregated problem variables of given variables, 162 * @note the content of the given array will/might change 163 */ 164 SCIP_EXPORT 165 void SCIPvarsGetProbvar( 166 SCIP_VAR** vars, /**< array of problem variables */ 167 int nvars /**< number of variables */ 168 ); 169 170 /** gets corresponding active, fixed, or multi-aggregated problem variable of a variable */ 171 SCIP_EXPORT 172 SCIP_VAR* SCIPvarGetProbvar( 173 SCIP_VAR* var /**< problem variable */ 174 ); 175 176 /** gets corresponding active, fixed, or multi-aggregated problem variables of binary variables and 177 * updates the given negation status of each variable 178 */ 179 SCIP_EXPORT 180 SCIP_RETCODE SCIPvarsGetProbvarBinary( 181 SCIP_VAR*** vars, /**< pointer to binary problem variables */ 182 SCIP_Bool** negatedarr, /**< pointer to corresponding array to update the negation status */ 183 int nvars /**< number of variables and values in vars and negated array */ 184 ); 185 186 /** gets corresponding active, fixed, or multi-aggregated problem variable of a binary variable and 187 * updates the given negation status 188 */ 189 SCIP_EXPORT 190 SCIP_RETCODE SCIPvarGetProbvarBinary( 191 SCIP_VAR** var, /**< pointer to binary problem variable */ 192 SCIP_Bool* negated /**< pointer to update the negation status */ 193 ); 194 195 /** transforms given variable, boundtype and bound to the corresponding active, fixed, or multi-aggregated variable 196 * values 197 */ 198 SCIP_EXPORT 199 SCIP_RETCODE SCIPvarGetProbvarBound( 200 SCIP_VAR** var, /**< pointer to problem variable */ 201 SCIP_Real* bound, /**< pointer to bound value to transform */ 202 SCIP_BOUNDTYPE* boundtype /**< pointer to type of bound: lower or upper bound */ 203 ); 204 205 /** transforms given variable and domain hole to the corresponding active, fixed, or multi-aggregated variable 206 * values 207 */ 208 SCIP_EXPORT 209 SCIP_RETCODE SCIPvarGetProbvarHole( 210 SCIP_VAR** var, /**< pointer to problem variable */ 211 SCIP_Real* left, /**< pointer to left bound of open interval in hole to transform */ 212 SCIP_Real* right /**< pointer to right bound of open interval in hole to transform */ 213 ); 214 215 /** retransforms given variable, scalar and constant to the corresponding original variable, scalar 216 * and constant, if possible; if the retransformation is impossible, NULL is returned as variable 217 */ 218 SCIP_EXPORT 219 SCIP_RETCODE SCIPvarGetOrigvarSum( 220 SCIP_VAR** var, /**< pointer to problem variable x in sum a*x + c */ 221 SCIP_Real* scalar, /**< pointer to scalar a in sum a*x + c */ 222 SCIP_Real* constant /**< pointer to constant c in sum a*x + c */ 223 ); 224 225 /** returns whether the given variable is the direct counterpart of an original problem variable */ 226 SCIP_EXPORT 227 SCIP_Bool SCIPvarIsTransformedOrigvar( 228 SCIP_VAR* var /**< problem variable */ 229 ); 230 231 /** returns the number of times, a bound of the variable was changed in given direction due to branching */ 232 SCIP_EXPORT 233 SCIP_Longint SCIPvarGetNBranchings( 234 SCIP_VAR* var, /**< problem variable */ 235 SCIP_BRANCHDIR dir /**< branching direction (downwards, or upwards) */ 236 ); 237 238 /** returns the number of times, a bound of the variable was changed in given direction due to branching 239 * in the current run 240 */ 241 SCIP_EXPORT 242 SCIP_Longint SCIPvarGetNBranchingsCurrentRun( 243 SCIP_VAR* var, /**< problem variable */ 244 SCIP_BRANCHDIR dir /**< branching direction (downwards, or upwards) */ 245 ); 246 247 /** returns the number of inferences branching on this variable in given direction triggered */ 248 SCIP_EXPORT 249 SCIP_Real SCIPvarGetInferenceSum( 250 SCIP_VAR* var, /**< problem variable */ 251 SCIP_BRANCHDIR dir /**< branching direction (downwards, or upwards) */ 252 ); 253 254 /** returns the number of inferences branching on this variable in given direction triggered 255 * in the current run 256 */ 257 SCIP_EXPORT 258 SCIP_Real SCIPvarGetInferenceSumCurrentRun( 259 SCIP_VAR* var, /**< problem variable */ 260 SCIP_BRANCHDIR dir /**< branching direction (downwards, or upwards) */ 261 ); 262 263 /** returns the number of cutoffs branching on this variable in given direction produced */ 264 SCIP_EXPORT 265 SCIP_Real SCIPvarGetCutoffSum( 266 SCIP_VAR* var, /**< problem variable */ 267 SCIP_BRANCHDIR dir /**< branching direction (downwards, or upwards) */ 268 ); 269 270 /** returns the number of cutoffs branching on this variable in given direction produced in the current run */ 271 SCIP_EXPORT 272 SCIP_Real SCIPvarGetCutoffSumCurrentRun( 273 SCIP_VAR* var, /**< problem variable */ 274 SCIP_BRANCHDIR dir /**< branching direction (downwards, or upwards) */ 275 ); 276 277 /** returns the average depth of bound changes in given direction due to branching on the variable */ 278 SCIP_EXPORT 279 SCIP_Real SCIPvarGetAvgBranchdepth( 280 SCIP_VAR* var, /**< problem variable */ 281 SCIP_BRANCHDIR dir /**< branching direction (downwards, or upwards) */ 282 ); 283 284 /** returns the average depth of bound changes in given direction due to branching on the variable 285 * in the current run 286 */ 287 SCIP_EXPORT 288 SCIP_Real SCIPvarGetAvgBranchdepthCurrentRun( 289 SCIP_VAR* var, /**< problem variable */ 290 SCIP_BRANCHDIR dir /**< branching direction (downwards, or upwards) */ 291 ); 292 293 /** returns whether there is an implication x == varfixing -> y <= b or y >= b in the implication graph; 294 * implications that are represented as cliques in the clique table are not regarded (use SCIPvarsHaveCommonClique()); 295 * both variables must be active, variable x must be binary 296 */ 297 SCIP_EXPORT 298 SCIP_Bool SCIPvarHasImplic( 299 SCIP_VAR* var, /**< problem variable x */ 300 SCIP_Bool varfixing, /**< FALSE if y should be searched in implications for x == 0, TRUE for x == 1 */ 301 SCIP_VAR* implvar, /**< variable y to search for */ 302 SCIP_BOUNDTYPE impltype /**< type of implication y <=/>= b to search for */ 303 ); 304 305 /** returns whether there is an implication x == varfixing -> y == implvarfixing in the implication graph; 306 * implications that are represented as cliques in the clique table are not regarded (use SCIPvarsHaveCommonClique()); 307 * both variables must be active binary variables 308 */ 309 SCIP_EXPORT 310 SCIP_Bool SCIPvarHasBinaryImplic( 311 SCIP_VAR* var, /**< problem variable x */ 312 SCIP_Bool varfixing, /**< FALSE if y should be searched in implications for x == 0, TRUE for x == 1 */ 313 SCIP_VAR* implvar, /**< variable y to search for */ 314 SCIP_Bool implvarfixing /**< value of the implied variable to search for */ 315 ); 316 317 /** returns whether there is a clique that contains both given variable/value pairs; 318 * the variables must be active binary variables; 319 * if regardimplics is FALSE, only the cliques in the clique table are looked at; 320 * if regardimplics is TRUE, both the cliques and the implications of the implication graph are regarded 321 */ 322 SCIP_EXPORT 323 SCIP_Bool SCIPvarsHaveCommonClique( 324 SCIP_VAR* var1, /**< first variable */ 325 SCIP_Bool value1, /**< value of first variable */ 326 SCIP_VAR* var2, /**< second variable */ 327 SCIP_Bool value2, /**< value of second variable */ 328 SCIP_Bool regardimplics /**< should the implication graph also be searched for a clique? */ 329 ); 330 331 /** gets corresponding objective value of active, fixed, or multi-aggregated problem variable of given variable 332 * e.g. obj(x) = 1 this method returns for ~x the value -1 333 */ 334 SCIP_EXPORT 335 SCIP_RETCODE SCIPvarGetAggregatedObj( 336 SCIP_VAR* var, /**< problem variable */ 337 SCIP_Real* aggrobj /**< pointer to store the aggregated objective value */ 338 ); 339 340 /** sets the initial flag of a variable; only possible for original or loose variables */ 341 SCIP_EXPORT 342 SCIP_RETCODE SCIPvarSetInitial( 343 SCIP_VAR* var, /**< problem variable */ 344 SCIP_Bool initial /**< initial flag */ 345 ); 346 347 /** sets the removable flag of a variable; only possible for original or loose variables */ 348 SCIP_EXPORT 349 SCIP_RETCODE SCIPvarSetRemovable( 350 SCIP_VAR* var, /**< problem variable */ 351 SCIP_Bool removable /**< removable flag */ 352 ); 353 354 /** returns the name of the variable 355 * 356 * @note to change the name of a variable, use SCIPchgVarName() from scip.h 357 */ 358 SCIP_EXPORT 359 const char* SCIPvarGetName( 360 SCIP_VAR* var /**< problem variable */ 361 ); 362 363 /** gets number of times, the variable is currently captured */ 364 SCIP_EXPORT 365 int SCIPvarGetNUses( 366 SCIP_VAR* var /**< problem variable */ 367 ); 368 369 /** returns the user data of the variable */ 370 SCIP_EXPORT 371 SCIP_VARDATA* SCIPvarGetData( 372 SCIP_VAR* var /**< problem variable */ 373 ); 374 375 /** sets the user data for the variable */ 376 SCIP_EXPORT 377 void SCIPvarSetData( 378 SCIP_VAR* var, /**< problem variable */ 379 SCIP_VARDATA* vardata /**< user variable data */ 380 ); 381 382 /** sets method to free user data for the original variable */ 383 SCIP_EXPORT 384 void SCIPvarSetDelorigData( 385 SCIP_VAR* var, /**< problem variable */ 386 SCIP_DECL_VARDELORIG ((*vardelorig)) /**< frees user data of original variable */ 387 ); 388 389 /** sets method to transform user data of the variable */ 390 SCIP_EXPORT 391 void SCIPvarSetTransData( 392 SCIP_VAR* var, /**< problem variable */ 393 SCIP_DECL_VARTRANS ((*vartrans)) /**< creates transformed user data by transforming original user data */ 394 ); 395 396 /** sets method to free transformed user data for the variable */ 397 SCIP_EXPORT 398 void SCIPvarSetDeltransData( 399 SCIP_VAR* var, /**< problem variable */ 400 SCIP_DECL_VARDELTRANS ((*vardeltrans)) /**< frees user data of transformed variable */ 401 ); 402 403 /** sets method to copy this variable into sub-SCIPs */ 404 SCIP_EXPORT 405 void SCIPvarSetCopyData( 406 SCIP_VAR* var, /**< problem variable */ 407 SCIP_DECL_VARCOPY ((*varcopy)) /**< copy method of the variable */ 408 ); 409 410 /** gets status of variable */ 411 SCIP_EXPORT 412 SCIP_VARSTATUS SCIPvarGetStatus( 413 SCIP_VAR* var /**< problem variable */ 414 ); 415 416 /** returns whether the variable belongs to the original problem */ 417 SCIP_EXPORT 418 SCIP_Bool SCIPvarIsOriginal( 419 SCIP_VAR* var /**< problem variable */ 420 ); 421 422 /** returns whether the variable belongs to the transformed problem */ 423 SCIP_EXPORT 424 SCIP_Bool SCIPvarIsTransformed( 425 SCIP_VAR* var /**< problem variable */ 426 ); 427 428 /** returns whether the variable was created by negation of a different variable */ 429 SCIP_EXPORT 430 SCIP_Bool SCIPvarIsNegated( 431 SCIP_VAR* var /**< problem variable */ 432 ); 433 434 /** gets type of variable */ 435 SCIP_EXPORT 436 SCIP_VARTYPE SCIPvarGetType( 437 SCIP_VAR* var /**< problem variable */ 438 ); 439 440 /** returns TRUE if the variable is of binary type; this is the case if: 441 * (1) variable type is binary 442 * (2) variable type is integer or implicit integer and 443 * (i) the lazy lower bound or the global lower bound is greater than or equal to zero 444 * (ii) the lazy upper bound or the global upper bound is less than or equal to one 445 */ 446 SCIP_EXPORT 447 SCIP_Bool SCIPvarIsBinary( 448 SCIP_VAR* var /**< problem variable */ 449 ); 450 451 /** returns whether variable is of integral type (binary, integer, or implicit integer) */ 452 SCIP_EXPORT 453 SCIP_Bool SCIPvarIsIntegral( 454 SCIP_VAR* var /**< problem variable */ 455 ); 456 457 /** returns whether variable's column should be present in the initial root LP */ 458 SCIP_EXPORT 459 SCIP_Bool SCIPvarIsInitial( 460 SCIP_VAR* var /**< problem variable */ 461 ); 462 463 /** returns whether variable's column is removable from the LP (due to aging or cleanup) */ 464 SCIP_EXPORT 465 SCIP_Bool SCIPvarIsRemovable( 466 SCIP_VAR* var /**< problem variable */ 467 ); 468 469 /** returns whether the variable was deleted from the problem */ 470 SCIP_EXPORT 471 SCIP_Bool SCIPvarIsDeleted( 472 SCIP_VAR* var /**< problem variable */ 473 ); 474 475 /** marks the variable to be deletable, i.e., it may be deleted completely from the problem; 476 * method can only be called before the variable is added to the problem by SCIPaddVar() or SCIPaddPricedVar() 477 */ 478 SCIP_EXPORT 479 void SCIPvarMarkDeletable( 480 SCIP_VAR* var /**< problem variable */ 481 ); 482 483 /** marks the variable to be not deletable from the problem */ 484 SCIP_EXPORT 485 void SCIPvarMarkNotDeletable( 486 SCIP_VAR* var 487 ); 488 489 /** returns whether variable is allowed to be deleted completely from the problem */ 490 SCIP_EXPORT 491 SCIP_Bool SCIPvarIsDeletable( 492 SCIP_VAR* var 493 ); 494 495 /** marks variable to be deleted from global structures (cliques etc.) when cleaning up 496 * 497 * @note: this is not equivalent to marking the variable itself for deletion, this is done by using SCIPvarMarkDeletable() 498 */ 499 SCIP_EXPORT 500 void SCIPvarMarkDeleteGlobalStructures( 501 SCIP_VAR* var /**< problem variable */ 502 ); 503 504 /** returns whether variable is an active (neither fixed nor aggregated) variable */ 505 SCIP_EXPORT 506 SCIP_Bool SCIPvarIsActive( 507 SCIP_VAR* var /**< problem variable */ 508 ); 509 510 /** gets unique index of variable */ 511 SCIP_EXPORT 512 int SCIPvarGetIndex( 513 SCIP_VAR* var /**< problem variable */ 514 ); 515 516 /** gets position of variable in problem, or -1 if variable is not active */ 517 SCIP_EXPORT 518 int SCIPvarGetProbindex( 519 SCIP_VAR* var /**< problem variable */ 520 ); 521 522 /** gets transformed variable of ORIGINAL variable */ 523 SCIP_EXPORT 524 SCIP_VAR* SCIPvarGetTransVar( 525 SCIP_VAR* var /**< problem variable */ 526 ); 527 528 /** gets column of COLUMN variable */ 529 SCIP_EXPORT 530 SCIP_COL* SCIPvarGetCol( 531 SCIP_VAR* var /**< problem variable */ 532 ); 533 534 /** returns whether the variable is a COLUMN variable that is member of the current LP */ 535 SCIP_EXPORT 536 SCIP_Bool SCIPvarIsInLP( 537 SCIP_VAR* var /**< problem variable */ 538 ); 539 540 /** gets aggregation variable y of an aggregated variable x = a*y + c */ 541 SCIP_EXPORT 542 SCIP_VAR* SCIPvarGetAggrVar( 543 SCIP_VAR* var /**< problem variable */ 544 ); 545 546 /** gets aggregation scalar a of an aggregated variable x = a*y + c */ 547 SCIP_EXPORT 548 SCIP_Real SCIPvarGetAggrScalar( 549 SCIP_VAR* var /**< problem variable */ 550 ); 551 552 /** gets aggregation constant c of an aggregated variable x = a*y + c */ 553 SCIP_EXPORT 554 SCIP_Real SCIPvarGetAggrConstant( 555 SCIP_VAR* var /**< problem variable */ 556 ); 557 558 /** gets number n of aggregation variables of a multi aggregated variable x = a0*y0 + ... + a(n-1)*y(n-1) + c */ 559 SCIP_EXPORT 560 int SCIPvarGetMultaggrNVars( 561 SCIP_VAR* var /**< problem variable */ 562 ); 563 564 /** gets vector of aggregation variables y of a multi aggregated variable x = a0*y0 + ... + a(n-1)*y(n-1) + c */ 565 SCIP_EXPORT 566 SCIP_VAR** SCIPvarGetMultaggrVars( 567 SCIP_VAR* var /**< problem variable */ 568 ); 569 570 /** gets vector of aggregation scalars a of a multi aggregated variable x = a0*y0 + ... + a(n-1)*y(n-1) + c */ 571 SCIP_EXPORT 572 SCIP_Real* SCIPvarGetMultaggrScalars( 573 SCIP_VAR* var /**< problem variable */ 574 ); 575 576 /** gets aggregation constant c of a multi aggregated variable x = a0*y0 + ... + a(n-1)*y(n-1) + c */ 577 SCIP_EXPORT 578 SCIP_Real SCIPvarGetMultaggrConstant( 579 SCIP_VAR* var /**< problem variable */ 580 ); 581 582 /** gets the negation of the given variable; may return NULL, if no negation is existing yet */ 583 SCIP_EXPORT 584 SCIP_VAR* SCIPvarGetNegatedVar( 585 SCIP_VAR* var /**< negated problem variable */ 586 ); 587 588 /** gets the negation variable x of a negated variable x' = offset - x */ 589 SCIP_EXPORT 590 SCIP_VAR* SCIPvarGetNegationVar( 591 SCIP_VAR* var /**< negated problem variable */ 592 ); 593 594 /** gets the negation offset of a negated variable x' = offset - x */ 595 SCIP_EXPORT 596 SCIP_Real SCIPvarGetNegationConstant( 597 SCIP_VAR* var /**< negated problem variable */ 598 ); 599 600 /** gets objective function value of variable */ 601 SCIP_EXPORT 602 SCIP_Real SCIPvarGetObj( 603 SCIP_VAR* var /**< problem variable */ 604 ); 605 606 /** gets the unchanged objective function value of variable (ignoring temproray changes performed in probing mode) */ 607 SCIP_EXPORT 608 SCIP_Real SCIPvarGetUnchangedObj( 609 SCIP_VAR* var /**< problem variable */ 610 ); 611 612 /** gets original lower bound of original problem variable (i.e. the bound set in problem creation) */ 613 SCIP_EXPORT 614 SCIP_Real SCIPvarGetLbOriginal( 615 SCIP_VAR* var /**< original problem variable */ 616 ); 617 618 /** gets original upper bound of original problem variable (i.e. the bound set in problem creation) */ 619 SCIP_EXPORT 620 SCIP_Real SCIPvarGetUbOriginal( 621 SCIP_VAR* var /**< original problem variable */ 622 ); 623 624 /** gets the original hole list of an original variable */ 625 SCIP_EXPORT 626 SCIP_HOLELIST* SCIPvarGetHolelistOriginal( 627 SCIP_VAR* var /**< problem variable */ 628 ); 629 630 /** gets global lower bound of variable */ 631 SCIP_EXPORT 632 SCIP_Real SCIPvarGetLbGlobal( 633 SCIP_VAR* var /**< problem variable */ 634 ); 635 636 /** gets global upper bound of variable */ 637 SCIP_EXPORT 638 SCIP_Real SCIPvarGetUbGlobal( 639 SCIP_VAR* var /**< problem variable */ 640 ); 641 642 /** gets the global hole list of an active variable */ 643 SCIP_EXPORT 644 SCIP_HOLELIST* SCIPvarGetHolelistGlobal( 645 SCIP_VAR* var /**< problem variable */ 646 ); 647 648 /** gets best global bound of variable with respect to the objective function */ 649 SCIP_EXPORT 650 SCIP_Real SCIPvarGetBestBoundGlobal( 651 SCIP_VAR* var /**< problem variable */ 652 ); 653 654 /** gets worst global bound of variable with respect to the objective function */ 655 SCIP_EXPORT 656 SCIP_Real SCIPvarGetWorstBoundGlobal( 657 SCIP_VAR* var /**< problem variable */ 658 ); 659 660 /** gets current lower bound of variable */ 661 SCIP_EXPORT 662 SCIP_Real SCIPvarGetLbLocal( 663 SCIP_VAR* var /**< problem variable */ 664 ); 665 666 /** gets current upper bound of variable */ 667 SCIP_EXPORT 668 SCIP_Real SCIPvarGetUbLocal( 669 SCIP_VAR* var /**< problem variable */ 670 ); 671 672 /** gets the current hole list of an active variable */ 673 SCIP_EXPORT 674 SCIP_HOLELIST* SCIPvarGetHolelistLocal( 675 SCIP_VAR* var /**< problem variable */ 676 ); 677 678 /** gets best local bound of variable with respect to the objective function */ 679 SCIP_EXPORT 680 SCIP_Real SCIPvarGetBestBoundLocal( 681 SCIP_VAR* var /**< problem variable */ 682 ); 683 684 /** gets worst local bound of variable with respect to the objective function */ 685 SCIP_EXPORT 686 SCIP_Real SCIPvarGetWorstBoundLocal( 687 SCIP_VAR* var /**< problem variable */ 688 ); 689 690 /** gets type (lower or upper) of best bound of variable with respect to the objective function */ 691 SCIP_EXPORT 692 SCIP_BOUNDTYPE SCIPvarGetBestBoundType( 693 SCIP_VAR* var /**< problem variable */ 694 ); 695 696 /** gets type (lower or upper) of worst bound of variable with respect to the objective function */ 697 SCIP_EXPORT 698 SCIP_BOUNDTYPE SCIPvarGetWorstBoundType( 699 SCIP_VAR* var /**< problem variable */ 700 ); 701 702 /** gets lazy lower bound of variable */ 703 SCIP_EXPORT 704 SCIP_Real SCIPvarGetLbLazy( 705 SCIP_VAR* var /**< problem variable */ 706 ); 707 708 /** gets lazy upper bound of variable */ 709 SCIP_EXPORT 710 SCIP_Real SCIPvarGetUbLazy( 711 SCIP_VAR* var /**< problem variable */ 712 ); 713 714 /** gets the branch factor of the variable; this value can be used in the branching methods to scale the score 715 * values of the variables; higher factor leads to a higher probability that this variable is chosen for branching 716 */ 717 SCIP_EXPORT 718 SCIP_Real SCIPvarGetBranchFactor( 719 SCIP_VAR* var /**< problem variable */ 720 ); 721 722 /** gets the branch priority of the variable; variables with higher priority should always be preferred to variables 723 * with lower priority 724 */ 725 SCIP_EXPORT 726 int SCIPvarGetBranchPriority( 727 SCIP_VAR* var /**< problem variable */ 728 ); 729 730 /** gets the preferred branch direction of the variable (downwards, upwards, or auto) */ 731 SCIP_EXPORT 732 SCIP_BRANCHDIR SCIPvarGetBranchDirection( 733 SCIP_VAR* var /**< problem variable */ 734 ); 735 736 /** gets number of variable lower bounds x >= b_i*z_i + d_i of given variable x */ 737 SCIP_EXPORT 738 int SCIPvarGetNVlbs( 739 SCIP_VAR* var /**< problem variable */ 740 ); 741 742 /** gets array with bounding variables z_i in variable lower bounds x >= b_i*z_i + d_i of given variable x; 743 * the variable bounds are sorted by increasing variable index of the bounding variable z_i (see SCIPvarGetIndex()) 744 */ 745 SCIP_EXPORT 746 SCIP_VAR** SCIPvarGetVlbVars( 747 SCIP_VAR* var /**< problem variable */ 748 ); 749 750 /** gets array with bounding coefficients b_i in variable lower bounds x >= b_i*z_i + d_i of given variable x */ 751 SCIP_EXPORT 752 SCIP_Real* SCIPvarGetVlbCoefs( 753 SCIP_VAR* var /**< problem variable */ 754 ); 755 756 /** gets array with bounding constants d_i in variable lower bounds x >= b_i*z_i + d_i of given variable x */ 757 SCIP_EXPORT 758 SCIP_Real* SCIPvarGetVlbConstants( 759 SCIP_VAR* var /**< problem variable */ 760 ); 761 762 /** gets number of variable upper bounds x <= b_i*z_i + d_i of given variable x */ 763 SCIP_EXPORT 764 int SCIPvarGetNVubs( 765 SCIP_VAR* var /**< problem variable */ 766 ); 767 768 /** gets array with bounding variables z_i in variable upper bounds x <= b_i*z_i + d_i of given variable x; 769 * the variable bounds are sorted by increasing variable index of the bounding variable z_i (see SCIPvarGetIndex()) 770 */ 771 SCIP_EXPORT 772 SCIP_VAR** SCIPvarGetVubVars( 773 SCIP_VAR* var /**< problem variable */ 774 ); 775 776 /** gets array with bounding coefficients b_i in variable upper bounds x <= b_i*z_i + d_i of given variable x */ 777 SCIP_EXPORT 778 SCIP_Real* SCIPvarGetVubCoefs( 779 SCIP_VAR* var /**< problem variable */ 780 ); 781 782 /** gets array with bounding constants d_i in variable upper bounds x <= b_i*z_i + d_i of given variable x */ 783 SCIP_EXPORT 784 SCIP_Real* SCIPvarGetVubConstants( 785 SCIP_VAR* var /**< problem variable */ 786 ); 787 788 /** gets number of implications y <= b or y >= b for x == 0 or x == 1 of given active problem variable x, 789 * there are no implications for nonbinary variable x 790 */ 791 SCIP_EXPORT 792 int SCIPvarGetNImpls( 793 SCIP_VAR* var, /**< active problem variable */ 794 SCIP_Bool varfixing /**< FALSE for implications for x == 0, TRUE for x == 1 */ 795 ); 796 797 /** gets array with implication variables y of implications y <= b or y >= b for x == 0 or x == 1 of given active 798 * problem variable x, there are no implications for nonbinary variable x; 799 * the implications are sorted such that implications with binary implied variables precede the ones with non-binary 800 * implied variables, and as a second criteria, the implied variables are sorted by increasing variable index 801 * (see SCIPvarGetIndex()) 802 */ 803 SCIP_EXPORT 804 SCIP_VAR** SCIPvarGetImplVars( 805 SCIP_VAR* var, /**< active problem variable */ 806 SCIP_Bool varfixing /**< FALSE for implications for x == 0, TRUE for x == 1 */ 807 ); 808 809 /** gets array with implication types of implications y <= b or y >= b for x == 0 or x == 1 of given active problem 810 * variable x (SCIP_BOUNDTYPE_UPPER if y <= b, SCIP_BOUNDTYPE_LOWER if y >= b), 811 * there are no implications for nonbinary variable x 812 */ 813 SCIP_EXPORT 814 SCIP_BOUNDTYPE* SCIPvarGetImplTypes( 815 SCIP_VAR* var, /**< active problem variable */ 816 SCIP_Bool varfixing /**< FALSE for implications for x == 0, TRUE for x == 1 */ 817 ); 818 819 /** gets array with implication bounds b of implications y <= b or y >= b for x == 0 or x == 1 of given active problem 820 * variable x, there are no implications for nonbinary variable x 821 */ 822 SCIP_EXPORT 823 SCIP_Real* SCIPvarGetImplBounds( 824 SCIP_VAR* var, /**< active problem variable */ 825 SCIP_Bool varfixing /**< FALSE for implications for x == 0, TRUE for x == 1 */ 826 ); 827 828 /** Gets array with unique ids of implications y <= b or y >= b for x == 0 or x == 1 of given active problem variable x, 829 * there are no implications for nonbinary variable x. 830 * If an implication is a shortcut, i.e., it was added as part of the transitive closure of another implication, 831 * its id is negative, otherwise it is nonnegative. 832 */ 833 SCIP_EXPORT 834 int* SCIPvarGetImplIds( 835 SCIP_VAR* var, /**< active problem variable */ 836 SCIP_Bool varfixing /**< FALSE for implications for x == 0, TRUE for x == 1 */ 837 ); 838 839 /** gets number of cliques, the active variable is contained in */ 840 SCIP_EXPORT 841 int SCIPvarGetNCliques( 842 SCIP_VAR* var, /**< active problem variable */ 843 SCIP_Bool varfixing /**< FALSE for cliques containing x == 0, TRUE for x == 1 */ 844 ); 845 846 /** gets array of cliques, the active variable is contained in */ 847 SCIP_EXPORT 848 SCIP_CLIQUE** SCIPvarGetCliques( 849 SCIP_VAR* var, /**< active problem variable */ 850 SCIP_Bool varfixing /**< FALSE for cliques containing x == 0, TRUE for x == 1 */ 851 ); 852 853 /** gets primal LP solution value of variable */ 854 SCIP_EXPORT 855 SCIP_Real SCIPvarGetLPSol( 856 SCIP_VAR* var /**< problem variable */ 857 ); 858 859 /** gets primal NLP solution value of variable */ 860 SCIP_EXPORT 861 SCIP_Real SCIPvarGetNLPSol( 862 SCIP_VAR* var /**< problem variable */ 863 ); 864 865 /** return lower bound change info at requested position */ 866 SCIP_EXPORT 867 SCIP_BDCHGINFO* SCIPvarGetBdchgInfoLb( 868 SCIP_VAR* var, /**< problem variable */ 869 int pos /**< requested position */ 870 ); 871 872 /** gets the number of lower bound change info array */ 873 SCIP_EXPORT 874 int SCIPvarGetNBdchgInfosLb( 875 SCIP_VAR* var /**< problem variable */ 876 ); 877 878 /** return upper bound change info at requested position */ 879 SCIP_EXPORT 880 SCIP_BDCHGINFO* SCIPvarGetBdchgInfoUb( 881 SCIP_VAR* var, /**< problem variable */ 882 int pos /**< requested position */ 883 ); 884 885 /** gets the number upper bound change info array */ 886 SCIP_EXPORT 887 int SCIPvarGetNBdchgInfosUb( 888 SCIP_VAR* var /**< problem variable */ 889 ); 890 891 /** returns the value based history for the variable */ 892 SCIP_EXPORT 893 SCIP_VALUEHISTORY* SCIPvarGetValuehistory( 894 SCIP_VAR* var /**< problem variable */ 895 ); 896 897 /** returns whether a variable has been introduced to define a relaxation 898 * 899 * These variables are only valid for the current SCIP solve round, 900 * they are not contained in any (checked) constraints, but may be used 901 * in cutting planes, for example. 902 * Relaxation-only variables are not copied by SCIPcopyVars and cuts 903 * that contain these variables are not added as linear constraints when 904 * restarting or transferring information from a copied SCIP to a SCIP. 905 * Also conflicts with relaxation-only variables are not generated at 906 * the moment. 907 * Relaxation-only variables do not appear in the objective. 908 */ 909 SCIP_EXPORT 910 SCIP_Bool SCIPvarIsRelaxationOnly( 911 SCIP_VAR* var /**< problem variable */ 912 ); 913 914 /** marks that this variable has only been introduced to define a relaxation 915 * 916 * The variable must not have a coefficient in the objective. 917 * 918 * @see SCIPvarIsRelaxationOnly 919 */ 920 SCIP_EXPORT 921 void SCIPvarMarkRelaxationOnly( 922 SCIP_VAR* var /**< problem variable */ 923 ); 924 925 #ifdef NDEBUG 926 927 /* In optimized mode, the function calls are overwritten by defines to reduce the number of function calls and 928 * speed up the algorithms. 929 */ 930 931 #define SCIPvarGetName(var) (var)->name 932 #define SCIPvarGetNUses(var) (var)->nuses 933 #define SCIPvarGetData(var) (var)->vardata 934 #define SCIPvarSetData(var,vdata) (var)->vardata = (vdata) 935 #define SCIPvarSetDelorigData(var,func) (var)->vardelorig = (func) 936 #define SCIPvarSetTransData(var,func) (var)->vartrans = (func) 937 #define SCIPvarSetDeltransData(var,func) (var)->vardeltrans = (func) 938 #define SCIPvarGetStatus(var) (SCIP_VARSTATUS)((var)->varstatus) 939 #define SCIPvarIsOriginal(var) ((var)->varstatus == SCIP_VARSTATUS_ORIGINAL \ 940 || ((var)->varstatus == SCIP_VARSTATUS_NEGATED && (var)->negatedvar->varstatus == SCIP_VARSTATUS_ORIGINAL)) 941 #define SCIPvarIsTransformed(var) ((var)->varstatus != SCIP_VARSTATUS_ORIGINAL \ 942 && ((var)->varstatus != SCIP_VARSTATUS_NEGATED || (var)->negatedvar->varstatus != SCIP_VARSTATUS_ORIGINAL)) 943 #define SCIPvarIsNegated(var) ((var)->varstatus == SCIP_VARSTATUS_NEGATED) 944 #define SCIPvarGetType(var) ((SCIP_VARTYPE)((var)->vartype)) 945 #define SCIPvarIsBinary(var) ((var)->vartype == SCIP_VARTYPE_BINARY || \ 946 ((var)->vartype != SCIP_VARTYPE_CONTINUOUS && MAX((var)->glbdom.lb, (var)->lazylb) >= 0.0 && MIN((var)->glbdom.ub, (var)->lazyub) <= 1.0)) 947 #define SCIPvarIsIntegral(var) ((var)->vartype != SCIP_VARTYPE_CONTINUOUS) 948 #define SCIPvarIsInitial(var) (var)->initial 949 #define SCIPvarIsRemovable(var) (var)->removable 950 #define SCIPvarIsDeleted(var) (var)->deleted 951 #define SCIPvarMarkDeletable(var) (var)->deletable = TRUE 952 #define SCIPvarMarkNotDeletable(var) (var)->deletable = FALSE 953 #define SCIPvarIsDeletable(var) (var)->deletable 954 #define SCIPvarIsActive(var) ((var)->probindex >= 0) 955 #define SCIPvarGetIndex(var) (var)->index 956 #define SCIPvarGetProbindex(var) (var)->probindex 957 #define SCIPvarGetTransVar(var) (var)->data.original.transvar 958 #define SCIPvarGetCol(var) (var)->data.col 959 #define SCIPvarIsInLP(var) ((var)->varstatus == SCIP_VARSTATUS_COLUMN && SCIPcolIsInLP((var)->data.col)) 960 /* use different name for var - otherwise we have clash with the var at the end */ 961 #define SCIPvarGetAggrVar(war) (war)->data.aggregate.var 962 #define SCIPvarGetAggrScalar(var) (var)->data.aggregate.scalar 963 #define SCIPvarGetAggrConstant(var) (var)->data.aggregate.constant 964 #define SCIPvarGetMultaggrNVars(var) (var)->data.multaggr.nvars 965 #define SCIPvarGetMultaggrVars(var) (var)->data.multaggr.vars 966 #define SCIPvarGetMultaggrScalars(var) (var)->data.multaggr.scalars 967 #define SCIPvarGetMultaggrConstant(var) (var)->data.multaggr.constant 968 #define SCIPvarGetNegatedVar(var) (var)->negatedvar 969 #define SCIPvarGetNegationVar(var) (var)->negatedvar 970 #define SCIPvarGetNegationConstant(var) (var)->data.negate.constant 971 #define SCIPvarGetObj(var) (var)->obj 972 #define SCIPvarGetLbOriginal(var) ((var)->varstatus == SCIP_VARSTATUS_ORIGINAL \ 973 ? (var)->data.original.origdom.lb \ 974 : (var)->data.negate.constant - (var)->negatedvar->data.original.origdom.ub) 975 #define SCIPvarGetUbOriginal(var) ((var)->varstatus == SCIP_VARSTATUS_ORIGINAL \ 976 ? (var)->data.original.origdom.ub \ 977 : (var)->data.negate.constant - (var)->negatedvar->data.original.origdom.lb) 978 #define SCIPvarGetHolelistOriginal(var) ((var)->varstatus == SCIP_VARSTATUS_ORIGINAL \ 979 ? (var)->data.original.origdom.holelist \ 980 : NULL) 981 #define SCIPvarGetLbGlobal(var) (var)->glbdom.lb 982 #define SCIPvarGetUbGlobal(var) (var)->glbdom.ub 983 #define SCIPvarGetHolelistGlobal(var) (var)->glbdom.holelist 984 #define SCIPvarGetBestBoundGlobal(var) ((var)->obj >= 0.0 ? (var)->glbdom.lb : (var)->glbdom.ub) 985 #define SCIPvarGetWorstBoundGlobal(var) ((var)->obj >= 0.0 ? (var)->glbdom.ub : (var)->glbdom.lb) 986 #define SCIPvarGetLbLocal(var) (var)->locdom.lb 987 #define SCIPvarGetUbLocal(var) (var)->locdom.ub 988 #define SCIPvarGetHolelistLocal(var) (var)->locdom.holelist 989 #define SCIPvarGetBestBoundLocal(var) ((var)->obj >= 0.0 ? (var)->locdom.lb : (var)->locdom.ub) 990 #define SCIPvarGetWorstBoundLocal(var) ((var)->obj >= 0.0 ? (var)->locdom.ub : (var)->locdom.lb) 991 #define SCIPvarGetBestBoundType(var) ((var)->obj >= 0.0 ? SCIP_BOUNDTYPE_LOWER : SCIP_BOUNDTYPE_UPPER) 992 #define SCIPvarGetWorstBoundType(var) ((var)->obj >= 0.0 ? SCIP_BOUNDTYPE_UPPER : SCIP_BOUNDTYPE_LOWER) 993 #define SCIPvarGetLbLazy(var) (var)->lazylb 994 #define SCIPvarGetUbLazy(var) (var)->lazyub 995 #define SCIPvarGetBranchFactor(var) (var)->branchfactor 996 #define SCIPvarGetBranchPriority(var) (var)->branchpriority 997 #define SCIPvarGetBranchDirection(var) (var)->branchdirection 998 #define SCIPvarGetNVlbs(var) (SCIPvboundsGetNVbds((var)->vlbs)) 999 #define SCIPvarGetVlbVars(var) (SCIPvboundsGetVars((var)->vlbs)) 1000 #define SCIPvarGetVlbCoefs(var) (SCIPvboundsGetCoefs((var)->vlbs)) 1001 #define SCIPvarGetVlbConstants(var) (SCIPvboundsGetConstants((var)->vlbs)) 1002 #define SCIPvarGetNVubs(var) (SCIPvboundsGetNVbds((var)->vubs)) 1003 #define SCIPvarGetVubVars(var) (SCIPvboundsGetVars((var)->vubs)) 1004 #define SCIPvarGetVubCoefs(var) (SCIPvboundsGetCoefs((var)->vubs)) 1005 #define SCIPvarGetVubConstants(var) (SCIPvboundsGetConstants((var)->vubs)) 1006 #define SCIPvarGetNImpls(var, fix) (SCIPimplicsGetNImpls((var)->implics, fix)) 1007 #define SCIPvarGetImplVars(var, fix) (SCIPimplicsGetVars((var)->implics, fix)) 1008 #define SCIPvarGetImplTypes(var, fix) (SCIPimplicsGetTypes((var)->implics, fix)) 1009 #define SCIPvarGetImplBounds(var, fix) (SCIPimplicsGetBounds((var)->implics, fix)) 1010 #define SCIPvarGetImplIds(var, fix) (SCIPimplicsGetIds((var)->implics, fix)) 1011 #define SCIPvarGetNCliques(var, fix) (SCIPcliquelistGetNCliques((var)->cliquelist, fix)) 1012 #define SCIPvarGetCliques(var, fix) (SCIPcliquelistGetCliques((var)->cliquelist, fix)) 1013 #define SCIPvarGetLPSol(var) ((var)->varstatus == SCIP_VARSTATUS_COLUMN ? SCIPcolGetPrimsol((var)->data.col) : SCIPvarGetLPSol_rec(var)) 1014 #define SCIPvarGetNLPSol(var) (((var)->varstatus == SCIP_VARSTATUS_COLUMN || ((var)->varstatus == SCIP_VARSTATUS_LOOSE)) ? (var)->nlpsol : SCIPvarGetNLPSol_rec(var)) 1015 #define SCIPvarGetBdchgInfoLb(var, pos) (&((var)->lbchginfos[pos])) 1016 #define SCIPvarGetNBdchgInfosLb(var) ((var)->nlbchginfos) 1017 #define SCIPvarGetBdchgInfoUb(var, pos) (&((var)->ubchginfos[pos])) 1018 #define SCIPvarGetNBdchgInfosUb(var) ((var)->nubchginfos) 1019 #define SCIPvarGetValuehistory(var) (var)->valuehistory 1020 #define SCIPvarGetCliqueComponentIdx(var) ((var)->clqcomponentidx) 1021 #define SCIPvarIsRelaxationOnly(var)((var)->relaxationonly) 1022 #define SCIPvarMarkRelaxationOnly(var)((var)->relaxationonly = TRUE) 1023 1024 #endif 1025 1026 /** gets primal LP solution value of variable */ 1027 SCIP_EXPORT 1028 SCIP_Real SCIPvarGetLPSol_rec( 1029 SCIP_VAR* var /**< problem variable */ 1030 ); 1031 1032 /** gets primal NLP solution value of variable */ 1033 SCIP_EXPORT 1034 SCIP_Real SCIPvarGetNLPSol_rec( 1035 SCIP_VAR* var /**< problem variable */ 1036 ); 1037 1038 /** gets pseudo solution value of variable at current node */ 1039 SCIP_EXPORT 1040 SCIP_Real SCIPvarGetPseudoSol( 1041 SCIP_VAR* var /**< problem variable */ 1042 ); 1043 1044 /** gets current LP or pseudo solution value of variable */ 1045 SCIP_EXPORT 1046 SCIP_Real SCIPvarGetSol( 1047 SCIP_VAR* var, /**< problem variable */ 1048 SCIP_Bool getlpval /**< should the LP solution value be returned? */ 1049 ); 1050 1051 /** returns the solution of the variable in the last root node's relaxation, if the root relaxation is not yet 1052 * completely solved, zero is returned 1053 */ 1054 SCIP_EXPORT 1055 SCIP_Real SCIPvarGetRootSol( 1056 SCIP_VAR* var /**< problem variable */ 1057 ); 1058 1059 /** returns the best solution (w.r.t. root reduced cost propagation) of the variable in the root node's relaxation, if 1060 * the root relaxation is not yet completely solved, zero is returned 1061 */ 1062 SCIP_EXPORT 1063 SCIP_Real SCIPvarGetBestRootSol( 1064 SCIP_VAR* var /**< problem variable */ 1065 ); 1066 1067 /** returns the best reduced costs (w.r.t. root reduced cost propagation) of the variable in the root node's relaxation, 1068 * if the root relaxation is not yet completely solved, or the variable was no column of the root LP, SCIP_INVALID is 1069 * returned 1070 */ 1071 SCIP_EXPORT 1072 SCIP_Real SCIPvarGetBestRootRedcost( 1073 SCIP_VAR* var /**< problem variable */ 1074 ); 1075 1076 /** returns the best objective value (w.r.t. root reduced cost propagation) of the root LP which belongs the root 1077 * reduced cost which is accessible via SCIPvarGetRootRedcost() or the variable was no column of the root LP, 1078 * SCIP_INVALID is returned 1079 */ 1080 SCIP_EXPORT 1081 SCIP_Real SCIPvarGetBestRootLPObjval( 1082 SCIP_VAR* var /**< problem variable */ 1083 ); 1084 1085 /** set the given solution as the best root solution w.r.t. root reduced cost propagation in the variables */ 1086 SCIP_EXPORT 1087 void SCIPvarSetBestRootSol( 1088 SCIP_VAR* var, /**< problem variable */ 1089 SCIP_Real rootsol, /**< root solution value */ 1090 SCIP_Real rootredcost, /**< root reduced cost */ 1091 SCIP_Real rootlpobjval /**< objective value of the root LP */ 1092 ); 1093 1094 /** returns a weighted average solution value of the variable in all feasible primal solutions found so far */ 1095 SCIP_EXPORT 1096 SCIP_Real SCIPvarGetAvgSol( 1097 SCIP_VAR* var /**< problem variable */ 1098 ); 1099 1100 /** returns the bound change information for the last lower bound change on given active problem variable before or 1101 * after the bound change with the given index was applied; 1102 * returns NULL, if no change to the lower bound was applied up to this point of time 1103 */ 1104 SCIP_EXPORT 1105 SCIP_BDCHGINFO* SCIPvarGetLbchgInfo( 1106 SCIP_VAR* var, /**< active problem variable */ 1107 SCIP_BDCHGIDX* bdchgidx, /**< bound change index representing time on path to current node */ 1108 SCIP_Bool after /**< should the bound change with given index be included? */ 1109 ); 1110 1111 /** returns the bound change information for the last upper bound change on given active problem variable before or 1112 * after the bound change with the given index was applied; 1113 * returns NULL, if no change to the upper bound was applied up to this point of time 1114 */ 1115 SCIP_EXPORT 1116 SCIP_BDCHGINFO* SCIPvarGetUbchgInfo( 1117 SCIP_VAR* var, /**< active problem variable */ 1118 SCIP_BDCHGIDX* bdchgidx, /**< bound change index representing time on path to current node */ 1119 SCIP_Bool after /**< should the bound change with given index be included? */ 1120 ); 1121 1122 /** returns the bound change information for the last lower or upper bound change on given active problem variable 1123 * before or after the bound change with the given index was applied; 1124 * returns NULL, if no change to the lower/upper bound was applied up to this point of time 1125 */ 1126 SCIP_EXPORT 1127 SCIP_BDCHGINFO* SCIPvarGetBdchgInfo( 1128 SCIP_VAR* var, /**< active problem variable */ 1129 SCIP_BOUNDTYPE boundtype, /**< type of bound: lower or upper bound */ 1130 SCIP_BDCHGIDX* bdchgidx, /**< bound change index representing time on path to current node */ 1131 SCIP_Bool after /**< should the bound change with given index be included? */ 1132 ); 1133 1134 /** returns lower bound of variable directly before or after the bound change given by the bound change index 1135 * was applied 1136 * 1137 * @deprecated Please use SCIPgetVarLbAtIndex() 1138 */ 1139 SCIP_EXPORT 1140 SCIP_Real SCIPvarGetLbAtIndex( 1141 SCIP_VAR* var, /**< problem variable */ 1142 SCIP_BDCHGIDX* bdchgidx, /**< bound change index representing time on path to current node */ 1143 SCIP_Bool after /**< should the bound change with given index be included? */ 1144 ); 1145 1146 /** returns upper bound of variable directly before or after the bound change given by the bound change index 1147 * was applied 1148 * 1149 * @deprecated Please use SCIPgetVarUbAtIndex() 1150 */ 1151 SCIP_EXPORT 1152 SCIP_Real SCIPvarGetUbAtIndex( 1153 SCIP_VAR* var, /**< problem variable */ 1154 SCIP_BDCHGIDX* bdchgidx, /**< bound change index representing time on path to current node */ 1155 SCIP_Bool after /**< should the bound change with given index be included? */ 1156 ); 1157 1158 /** returns lower or upper bound of variable directly before or after the bound change given by the bound change index 1159 * was applied 1160 * 1161 * @deprecated Please use SCIPgetVarBdAtIndex() 1162 */ 1163 SCIP_EXPORT 1164 SCIP_Real SCIPvarGetBdAtIndex( 1165 SCIP_VAR* var, /**< problem variable */ 1166 SCIP_BOUNDTYPE boundtype, /**< type of bound: lower or upper bound */ 1167 SCIP_BDCHGIDX* bdchgidx, /**< bound change index representing time on path to current node */ 1168 SCIP_Bool after /**< should the bound change with given index be included? */ 1169 ); 1170 1171 /** returns whether the binary variable was fixed at the time given by the bound change index 1172 * 1173 * @deprecated Please use SCIPgetVarWasFixedAtIndex() 1174 */ 1175 SCIP_EXPORT 1176 SCIP_Bool SCIPvarWasFixedAtIndex( 1177 SCIP_VAR* var, /**< problem variable */ 1178 SCIP_BDCHGIDX* bdchgidx, /**< bound change index representing time on path to current node */ 1179 SCIP_Bool after /**< should the bound change with given index be included? */ 1180 ); 1181 1182 /** returns the last bound change index, at which the bounds of the given variable were tightened */ 1183 SCIP_EXPORT 1184 SCIP_BDCHGIDX* SCIPvarGetLastBdchgIndex( 1185 SCIP_VAR* var /**< problem variable */ 1186 ); 1187 1188 /** returns the last depth level, at which the bounds of the given variable were tightened; 1189 * returns -2, if the variable's bounds are still the global bounds 1190 * returns -1, if the variable was fixed in presolving 1191 */ 1192 SCIP_EXPORT 1193 int SCIPvarGetLastBdchgDepth( 1194 SCIP_VAR* var /**< problem variable */ 1195 ); 1196 1197 /** returns whether the first binary variable was fixed earlier than the second one; 1198 * returns FALSE, if the first variable is not fixed, and returns TRUE, if the first variable is fixed, but the 1199 * second one is not fixed 1200 */ 1201 SCIP_EXPORT 1202 SCIP_Bool SCIPvarWasFixedEarlier( 1203 SCIP_VAR* var1, /**< first binary variable */ 1204 SCIP_VAR* var2 /**< second binary variable */ 1205 ); 1206 1207 /** 1208 * @name Public SCIP_BDCHGIDX Methods 1209 * 1210 * @{ 1211 */ 1212 1213 /** returns whether first bound change index belongs to an earlier applied bound change than second one; 1214 * if a bound change index is NULL, the bound change index represents the current time, i.e. the time after the 1215 * last bound change was applied to the current node 1216 */ 1217 SCIP_EXPORT 1218 SCIP_Bool SCIPbdchgidxIsEarlier( 1219 SCIP_BDCHGIDX* bdchgidx1, /**< first bound change index, or NULL */ 1220 SCIP_BDCHGIDX* bdchgidx2 /**< second bound change index, or NULL */ 1221 ); 1222 1223 /** returns whether first bound change index belongs to an earlier applied bound change than second one */ 1224 SCIP_EXPORT 1225 SCIP_Bool SCIPbdchgidxIsEarlierNonNull( 1226 SCIP_BDCHGIDX* bdchgidx1, /**< first bound change index */ 1227 SCIP_BDCHGIDX* bdchgidx2 /**< second bound change index */ 1228 ); 1229 1230 /**@} */ 1231 1232 /** 1233 * @name Public SCIP_BDCHGINFO Methods 1234 * 1235 * @{ 1236 */ 1237 1238 /** returns old bound that was overwritten for given bound change information */ 1239 SCIP_EXPORT 1240 SCIP_Real SCIPbdchginfoGetOldbound( 1241 SCIP_BDCHGINFO* bdchginfo /**< bound change information */ 1242 ); 1243 1244 /** returns new bound installed for given bound change information */ 1245 SCIP_EXPORT 1246 SCIP_Real SCIPbdchginfoGetNewbound( 1247 SCIP_BDCHGINFO* bdchginfo /**< bound change information */ 1248 ); 1249 1250 /** returns variable that belongs to the given bound change information */ 1251 SCIP_EXPORT 1252 SCIP_VAR* SCIPbdchginfoGetVar( 1253 SCIP_BDCHGINFO* bdchginfo /**< bound change information */ 1254 ); 1255 1256 /** returns whether the bound change information belongs to a branching decision or a deduction */ 1257 SCIP_EXPORT 1258 SCIP_BOUNDCHGTYPE SCIPbdchginfoGetChgtype( 1259 SCIP_BDCHGINFO* bdchginfo /**< bound change information */ 1260 ); 1261 1262 /** returns whether the bound change information belongs to a lower or upper bound change */ 1263 SCIP_EXPORT 1264 SCIP_BOUNDTYPE SCIPbdchginfoGetBoundtype( 1265 SCIP_BDCHGINFO* bdchginfo /**< bound change information */ 1266 ); 1267 1268 /** returns depth level of given bound change information */ 1269 SCIP_EXPORT 1270 int SCIPbdchginfoGetDepth( 1271 SCIP_BDCHGINFO* bdchginfo /**< bound change information */ 1272 ); 1273 1274 /** returns bound change position in its depth level of given bound change information */ 1275 SCIP_EXPORT 1276 int SCIPbdchginfoGetPos( 1277 SCIP_BDCHGINFO* bdchginfo /**< bound change information */ 1278 ); 1279 1280 /** returns bound change index of given bound change information */ 1281 SCIP_EXPORT 1282 SCIP_BDCHGIDX* SCIPbdchginfoGetIdx( 1283 SCIP_BDCHGINFO* bdchginfo /**< bound change information */ 1284 ); 1285 1286 /** returns inference variable of given bound change information */ 1287 SCIP_EXPORT 1288 SCIP_VAR* SCIPbdchginfoGetInferVar( 1289 SCIP_BDCHGINFO* bdchginfo /**< bound change information */ 1290 ); 1291 1292 /** returns inference constraint of given bound change information */ 1293 SCIP_EXPORT 1294 SCIP_CONS* SCIPbdchginfoGetInferCons( 1295 SCIP_BDCHGINFO* bdchginfo /**< bound change information */ 1296 ); 1297 1298 /** returns inference propagator of given bound change information, or NULL if no propagator was responsible */ 1299 SCIP_EXPORT 1300 SCIP_PROP* SCIPbdchginfoGetInferProp( 1301 SCIP_BDCHGINFO* bdchginfo /**< bound change information */ 1302 ); 1303 1304 /** returns inference user information of given bound change information */ 1305 SCIP_EXPORT 1306 int SCIPbdchginfoGetInferInfo( 1307 SCIP_BDCHGINFO* bdchginfo /**< bound change information */ 1308 ); 1309 1310 /** returns inference bound of inference variable of given bound change information */ 1311 SCIP_EXPORT 1312 SCIP_BOUNDTYPE SCIPbdchginfoGetInferBoundtype( 1313 SCIP_BDCHGINFO* bdchginfo /**< bound change information */ 1314 ); 1315 1316 /** returns whether the bound change information belongs to a redundant bound change */ 1317 SCIP_EXPORT 1318 SCIP_Bool SCIPbdchginfoIsRedundant( 1319 SCIP_BDCHGINFO* bdchginfo /**< bound change information */ 1320 ); 1321 1322 /** returns whether the bound change has an inference reason (constraint or propagator), that can be resolved */ 1323 SCIP_EXPORT 1324 SCIP_Bool SCIPbdchginfoHasInferenceReason( 1325 SCIP_BDCHGINFO* bdchginfo /**< bound change information */ 1326 ); 1327 1328 /** for two bound change informations belonging to the same variable and bound, returns whether the first bound change 1329 * has a tighter new bound as the second bound change 1330 */ 1331 SCIP_EXPORT 1332 SCIP_Bool SCIPbdchginfoIsTighter( 1333 SCIP_BDCHGINFO* bdchginfo1, /**< first bound change information */ 1334 SCIP_BDCHGINFO* bdchginfo2 /**< second bound change information */ 1335 ); 1336 1337 /**@} */ 1338 1339 /** 1340 * @name Public SCIP_BOUNDCHG Methods 1341 * 1342 * @{ 1343 */ 1344 1345 /** returns the new value of the bound in the bound change data */ 1346 SCIP_EXPORT 1347 SCIP_Real SCIPboundchgGetNewbound( 1348 SCIP_BOUNDCHG* boundchg /**< bound change data */ 1349 ); 1350 1351 /** returns the variable of the bound change in the bound change data */ 1352 SCIP_EXPORT 1353 SCIP_VAR* SCIPboundchgGetVar( 1354 SCIP_BOUNDCHG* boundchg /**< bound change data */ 1355 ); 1356 1357 /** returns the bound change type of the bound change in the bound change data */ 1358 SCIP_EXPORT 1359 SCIP_BOUNDCHGTYPE SCIPboundchgGetBoundchgtype( 1360 SCIP_BOUNDCHG* boundchg /**< bound change data */ 1361 ); 1362 1363 /** returns the bound type of the bound change in the bound change data */ 1364 SCIP_EXPORT 1365 SCIP_BOUNDTYPE SCIPboundchgGetBoundtype( 1366 SCIP_BOUNDCHG* boundchg /**< bound change data */ 1367 ); 1368 1369 /** returns whether the bound change is redundant due to a more global bound that is at least as strong */ 1370 SCIP_EXPORT 1371 SCIP_Bool SCIPboundchgIsRedundant( 1372 SCIP_BOUNDCHG* boundchg /**< bound change data */ 1373 ); 1374 1375 /** @} */ 1376 1377 /** 1378 * @name Public SCIP_DOMCHG Methods 1379 * 1380 * @{ 1381 */ 1382 1383 /** returns the number of bound changes in the domain change data */ 1384 SCIP_EXPORT 1385 int SCIPdomchgGetNBoundchgs( 1386 SCIP_DOMCHG* domchg /**< domain change data */ 1387 ); 1388 1389 /** returns a particular bound change in the domain change data */ 1390 SCIP_EXPORT 1391 SCIP_BOUNDCHG* SCIPdomchgGetBoundchg( 1392 SCIP_DOMCHG* domchg, /**< domain change data */ 1393 int pos /**< position of the bound change in the domain change data */ 1394 ); 1395 1396 /**@} */ 1397 1398 /** 1399 * @name Public SCIP_HOLELIST Methods 1400 * 1401 * @{ 1402 */ 1403 1404 /** returns left bound of open interval in hole */ 1405 SCIP_EXPORT 1406 SCIP_Real SCIPholelistGetLeft( 1407 SCIP_HOLELIST* holelist /**< hole list pointer to hole of interest */ 1408 ); 1409 1410 /** returns right bound of open interval in hole */ 1411 SCIP_EXPORT 1412 SCIP_Real SCIPholelistGetRight( 1413 SCIP_HOLELIST* holelist /**< hole list pointer to hole of interest */ 1414 ); 1415 1416 /** returns next hole in list or NULL */ 1417 SCIP_EXPORT 1418 SCIP_HOLELIST* SCIPholelistGetNext( 1419 SCIP_HOLELIST* holelist /**< hole list pointer to hole of interest */ 1420 ); 1421 1422 /**@} */ 1423 1424 #ifdef NDEBUG 1425 1426 /* In optimized mode, the function calls are overwritten by defines to reduce the number of function calls and 1427 * speed up the algorithms. 1428 */ 1429 1430 #define SCIPbdchgidxIsEarlierNonNull(idx1,idx2) \ 1431 ((idx1)->depth < (idx2)->depth || ((idx1)->depth == (idx2)->depth && (idx1)->pos < (idx2)->pos)) 1432 #define SCIPbdchgidxIsEarlier(idx1,idx2) \ 1433 ((idx1) != NULL && ((idx2) == NULL || SCIPbdchgidxIsEarlierNonNull(idx1, idx2))) 1434 #define SCIPbdchginfoGetOldbound(bdchginfo) (bdchginfo)->oldbound 1435 #define SCIPbdchginfoGetNewbound(bdchginfo) (bdchginfo)->newbound 1436 #define SCIPbdchginfoGetVar(bdchginfo) (bdchginfo)->var 1437 #define SCIPbdchginfoGetChgtype(bdchginfo) (SCIP_BOUNDCHGTYPE)((bdchginfo)->boundchgtype) 1438 #define SCIPbdchginfoGetBoundtype(bdchginfo) (SCIP_BOUNDTYPE)((bdchginfo)->boundtype) 1439 #define SCIPbdchginfoGetDepth(bdchginfo) (bdchginfo)->bdchgidx.depth 1440 #define SCIPbdchginfoGetPos(bdchginfo) (bdchginfo)->bdchgidx.pos 1441 #define SCIPbdchginfoGetIdx(bdchginfo) (&(bdchginfo)->bdchgidx) 1442 #define SCIPbdchginfoGetInferVar(bdchginfo) (bdchginfo)->inferencedata.var 1443 #define SCIPbdchginfoGetInferCons(bdchginfo) (bdchginfo)->inferencedata.reason.cons 1444 #define SCIPbdchginfoGetInferProp(bdchginfo) (bdchginfo)->inferencedata.reason.prop 1445 #define SCIPbdchginfoGetInferInfo(bdchginfo) (bdchginfo)->inferencedata.info 1446 #define SCIPbdchginfoGetInferBoundtype(bdchginfo) (SCIP_BOUNDTYPE)((bdchginfo)->inferboundtype) 1447 #define SCIPbdchginfoIsRedundant(bdchginfo) (bdchginfo)->redundant 1448 #define SCIPbdchginfoHasInferenceReason(bdchginfo) \ 1449 (((bdchginfo)->boundchgtype == SCIP_BOUNDCHGTYPE_CONSINFER) \ 1450 || ((bdchginfo)->boundchgtype == SCIP_BOUNDCHGTYPE_PROPINFER && (bdchginfo)->inferencedata.reason.prop != NULL)) 1451 #define SCIPbdchginfoIsTighter(bdchginfo1,bdchginfo2) ((bdchginfo1)->boundtype == SCIP_BOUNDTYPE_LOWER \ 1452 ? (bdchginfo1)->newbound > bdchginfo2->newbound : (bdchginfo1)->newbound < bdchginfo2->newbound) 1453 #define SCIPboundchgGetNewbound(boundchg) ((boundchg)->newbound) 1454 #define SCIPboundchgGetVar(boundchg) ((boundchg)->var) 1455 #define SCIPboundchgGetBoundchgtype(boundchg) ((SCIP_BOUNDCHGTYPE)((boundchg)->boundchgtype)) 1456 #define SCIPboundchgGetBoundtype(boundchg) ((SCIP_BOUNDTYPE)((boundchg)->boundtype)) 1457 #define SCIPboundchgIsRedundant(boundchg) ((boundchg)->redundant) 1458 #define SCIPdomchgGetNBoundchgs(domchg) ((domchg) != NULL ? (domchg)->domchgbound.nboundchgs : 0) 1459 #define SCIPdomchgGetBoundchg(domchg, pos) (&(domchg)->domchgbound.boundchgs[pos]) 1460 #define SCIPholelistGetLeft(holelist) ((holelist)->hole.left) 1461 #define SCIPholelistGetRight(holelist) ((holelist)->hole.right) 1462 #define SCIPholelistGetNext(holelist) ((holelist)->next) 1463 1464 #endif 1465 1466 /**@} */ 1467 1468 #ifdef __cplusplus 1469 } 1470 #endif 1471 1472 #endif 1473