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 lp.h 26 * @ingroup INTERNALAPI 27 * @brief internal methods for LP management 28 * @author Tobias Achterberg 29 * @author Marc Pfetsch 30 * @author Kati Wolter 31 * @author Gerald Gamrath 32 */ 33 34 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/ 35 36 #ifndef __SCIP_LP_H__ 37 #define __SCIP_LP_H__ 38 39 40 #include <stdio.h> 41 42 #include "scip/def.h" 43 #include "blockmemshell/memory.h" 44 #include "scip/type_set.h" 45 #include "scip/type_stat.h" 46 #include "scip/type_misc.h" 47 #include "scip/type_lp.h" 48 #include "scip/type_var.h" 49 #include "scip/type_prob.h" 50 #include "scip/type_sol.h" 51 #include "scip/type_branch.h" 52 #include "scip/pub_lp.h" 53 54 #include "scip/struct_lp.h" 55 56 #ifdef __cplusplus 57 extern "C" { 58 #endif 59 60 61 /* 62 * double linked coefficient matrix methods 63 */ 64 65 /** insert column coefficients in corresponding rows */ 66 SCIP_RETCODE colLink( 67 SCIP_COL* col, /**< column data */ 68 BMS_BLKMEM* blkmem, /**< block memory */ 69 SCIP_SET* set, /**< global SCIP settings */ 70 SCIP_EVENTQUEUE* eventqueue, /**< event queue */ 71 SCIP_LP* lp /**< current LP data */ 72 ); 73 74 /** removes column coefficients from corresponding rows */ 75 SCIP_RETCODE colUnlink( 76 SCIP_COL* col, /**< column data */ 77 BMS_BLKMEM* blkmem, /**< block memory */ 78 SCIP_SET* set, /**< global SCIP settings */ 79 SCIP_EVENTQUEUE* eventqueue, /**< event queue */ 80 SCIP_LP* lp /**< current LP data */ 81 ); 82 83 /** insert row coefficients in corresponding columns */ 84 SCIP_RETCODE rowLink( 85 SCIP_ROW* row, /**< row data */ 86 BMS_BLKMEM* blkmem, /**< block memory */ 87 SCIP_SET* set, /**< global SCIP settings */ 88 SCIP_EVENTQUEUE* eventqueue, /**< event queue */ 89 SCIP_LP* lp /**< current LP data */ 90 ); 91 92 /** removes row coefficients from corresponding columns */ 93 SCIP_RETCODE rowUnlink( 94 SCIP_ROW* row, /**< row data */ 95 SCIP_SET* set, /**< global SCIP settings */ 96 SCIP_LP* lp /**< current LP data */ 97 ); 98 99 /* 100 * Column methods 101 */ 102 103 /** creates an LP column */ 104 SCIP_RETCODE SCIPcolCreate( 105 SCIP_COL** col, /**< pointer to column data */ 106 BMS_BLKMEM* blkmem, /**< block memory */ 107 SCIP_SET* set, /**< global SCIP settings */ 108 SCIP_STAT* stat, /**< problem statistics */ 109 SCIP_VAR* var, /**< variable, this column represents */ 110 int len, /**< number of nonzeros in the column */ 111 SCIP_ROW** rows, /**< array with rows of column entries */ 112 SCIP_Real* vals, /**< array with coefficients of column entries */ 113 SCIP_Bool removable /**< should the column be removed from the LP due to aging or cleanup? */ 114 ); 115 116 /** frees an LP column */ 117 SCIP_RETCODE SCIPcolFree( 118 SCIP_COL** col, /**< pointer to LP column */ 119 BMS_BLKMEM* blkmem, /**< block memory */ 120 SCIP_SET* set, /**< global SCIP settings */ 121 SCIP_EVENTQUEUE* eventqueue, /**< event queue */ 122 SCIP_LP* lp /**< current LP data */ 123 ); 124 125 /** output column to file stream */ 126 void SCIPcolPrint( 127 SCIP_COL* col, /**< LP column */ 128 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */ 129 FILE* file /**< output file (or NULL for standard output) */ 130 ); 131 132 /** adds a previously non existing coefficient to an LP column */ 133 SCIP_RETCODE SCIPcolAddCoef( 134 SCIP_COL* col, /**< LP column */ 135 BMS_BLKMEM* blkmem, /**< block memory */ 136 SCIP_SET* set, /**< global SCIP settings */ 137 SCIP_EVENTQUEUE* eventqueue, /**< event queue */ 138 SCIP_LP* lp, /**< current LP data */ 139 SCIP_ROW* row, /**< LP row */ 140 SCIP_Real val /**< value of coefficient */ 141 ); 142 143 /** deletes coefficient from column */ 144 SCIP_RETCODE SCIPcolDelCoef( 145 SCIP_COL* col, /**< column to be changed */ 146 BMS_BLKMEM* blkmem, /**< block memory */ 147 SCIP_SET* set, /**< global SCIP settings */ 148 SCIP_EVENTQUEUE* eventqueue, /**< event queue */ 149 SCIP_LP* lp, /**< current LP data */ 150 SCIP_ROW* row /**< coefficient to be deleted */ 151 ); 152 153 /** changes or adds a coefficient to an LP column */ 154 SCIP_RETCODE SCIPcolChgCoef( 155 SCIP_COL* col, /**< LP column */ 156 BMS_BLKMEM* blkmem, /**< block memory */ 157 SCIP_SET* set, /**< global SCIP settings */ 158 SCIP_EVENTQUEUE* eventqueue, /**< event queue */ 159 SCIP_LP* lp, /**< current LP data */ 160 SCIP_ROW* row, /**< LP row */ 161 SCIP_Real val /**< value of coefficient */ 162 ); 163 164 /** increases value of an existing or nonexisting coefficient in an LP column */ 165 SCIP_RETCODE SCIPcolIncCoef( 166 SCIP_COL* col, /**< LP column */ 167 BMS_BLKMEM* blkmem, /**< block memory */ 168 SCIP_SET* set, /**< global SCIP settings */ 169 SCIP_EVENTQUEUE* eventqueue, /**< event queue */ 170 SCIP_LP* lp, /**< current LP data */ 171 SCIP_ROW* row, /**< LP row */ 172 SCIP_Real incval /**< value to add to the coefficient */ 173 ); 174 175 /** changes objective value of column */ 176 SCIP_RETCODE SCIPcolChgObj( 177 SCIP_COL* col, /**< LP column to change */ 178 SCIP_SET* set, /**< global SCIP settings */ 179 SCIP_LP* lp, /**< current LP data */ 180 SCIP_Real newobj /**< new objective value */ 181 ); 182 183 /** changes lower bound of column */ 184 SCIP_RETCODE SCIPcolChgLb( 185 SCIP_COL* col, /**< LP column to change */ 186 SCIP_SET* set, /**< global SCIP settings */ 187 SCIP_LP* lp, /**< current LP data */ 188 SCIP_Real newlb /**< new lower bound value */ 189 ); 190 191 /** changes upper bound of column */ 192 SCIP_RETCODE SCIPcolChgUb( 193 SCIP_COL* col, /**< LP column to change */ 194 SCIP_SET* set, /**< global SCIP settings */ 195 SCIP_LP* lp, /**< current LP data */ 196 SCIP_Real newub /**< new upper bound value */ 197 ); 198 199 /** calculates the reduced costs of a column using the given dual solution vector */ 200 SCIP_Real SCIPcolCalcRedcost( 201 SCIP_COL* col, /**< LP column */ 202 SCIP_Real* dualsol /**< dual solution vector for current LP rows */ 203 ); 204 205 /** gets the reduced costs of a column in last LP or after recalculation */ 206 SCIP_Real SCIPcolGetRedcost( 207 SCIP_COL* col, /**< LP column */ 208 SCIP_STAT* stat, /**< problem statistics */ 209 SCIP_LP* lp /**< current LP data */ 210 ); 211 212 /** gets the feasibility of (the dual row of) a column in last LP or after recalculation */ 213 SCIP_Real SCIPcolGetFeasibility( 214 SCIP_COL* col, /**< LP column */ 215 SCIP_SET* set, /**< global SCIP settings */ 216 SCIP_STAT* stat, /**< problem statistics */ 217 SCIP_LP* lp /**< current LP data */ 218 ); 219 220 /** calculates the Farkas coefficient y^T A_i of a column i using the given dual Farkas vector y */ 221 SCIP_Real SCIPcolCalcFarkasCoef( 222 SCIP_COL* col, /**< LP column */ 223 SCIP_Real* dualfarkas /**< dense dual Farkas vector for current LP rows */ 224 ); 225 226 /** gets the Farkas coefficient y^T A_i of a column i in last LP (which must be infeasible) */ 227 SCIP_Real SCIPcolGetFarkasCoef( 228 SCIP_COL* col, /**< LP column */ 229 SCIP_STAT* stat, /**< problem statistics */ 230 SCIP_LP* lp /**< current LP data */ 231 ); 232 233 /** gets the Farkas value of a column in last LP (which must be infeasible), i.e. the Farkas coefficient y^T A_i times 234 * the best bound for this coefficient, i.e. max{y^T A_i x_i | lb <= x_i <= ub} 235 */ 236 SCIP_Real SCIPcolGetFarkasValue( 237 SCIP_COL* col, /**< LP column */ 238 SCIP_STAT* stat, /**< problem statistics */ 239 SCIP_LP* lp /**< current LP data */ 240 ); 241 242 /** start strong branching - call before any strong branching */ 243 SCIP_RETCODE SCIPlpStartStrongbranch( 244 SCIP_LP* lp /**< LP data */ 245 ); 246 247 /** end strong branching - call after any strong branching */ 248 SCIP_RETCODE SCIPlpEndStrongbranch( 249 SCIP_LP* lp /**< LP data */ 250 ); 251 252 /** sets strong branching information for a column variable */ 253 void SCIPcolSetStrongbranchData( 254 SCIP_COL* col, /**< LP column */ 255 SCIP_SET* set, /**< global SCIP settings */ 256 SCIP_STAT* stat, /**< dynamic problem statistics */ 257 SCIP_LP* lp, /**< LP data */ 258 SCIP_Real lpobjval, /**< objective value of the current LP */ 259 SCIP_Real primsol, /**< primal solution value of the column in the current LP */ 260 SCIP_Real sbdown, /**< dual bound after branching column down */ 261 SCIP_Real sbup, /**< dual bound after branching column up */ 262 SCIP_Bool sbdownvalid, /**< is the returned down value a valid dual bound? */ 263 SCIP_Bool sbupvalid, /**< is the returned up value a valid dual bound? */ 264 SCIP_Longint iter, /**< total number of strong branching iterations */ 265 int itlim /**< iteration limit applied to the strong branching call */ 266 ); 267 268 /** invalidates strong branching information for a column variable */ 269 void SCIPcolInvalidateStrongbranchData( 270 SCIP_COL* col, /**< LP column */ 271 SCIP_SET* set, /**< global SCIP settings */ 272 SCIP_STAT* stat, /**< dynamic problem statistics */ 273 SCIP_LP* lp /**< LP data */ 274 ); 275 276 /** gets strong branching information on a column variable */ 277 SCIP_RETCODE SCIPcolGetStrongbranch( 278 SCIP_COL* col, /**< LP column */ 279 SCIP_Bool integral, /**< should integral strong branching be performed? */ 280 SCIP_SET* set, /**< global SCIP settings */ 281 SCIP_STAT* stat, /**< dynamic problem statistics */ 282 SCIP_PROB* prob, /**< problem data */ 283 SCIP_LP* lp, /**< LP data */ 284 int itlim, /**< iteration limit for strong branchings */ 285 SCIP_Bool updatecol, /**< should col be updated, or should it stay in its current state ? */ 286 SCIP_Bool updatestat, /**< should stat be updated, or should it stay in its current state ? */ 287 SCIP_Real* down, /**< stores dual bound after branching column down */ 288 SCIP_Real* up, /**< stores dual bound after branching column up */ 289 SCIP_Bool* downvalid, /**< stores whether the returned down value is a valid dual bound, or NULL; 290 * otherwise, it can only be used as an estimate value */ 291 SCIP_Bool* upvalid, /**< stores whether the returned up value is a valid dual bound, or NULL; 292 * otherwise, it can only be used as an estimate value */ 293 SCIP_Bool* lperror /**< pointer to store whether an unresolved LP error occurred */ 294 ); 295 296 /** gets strong branching information on column variables */ 297 SCIP_RETCODE SCIPcolGetStrongbranches( 298 SCIP_COL** cols, /**< LP columns */ 299 int ncols, /**< number of columns */ 300 SCIP_Bool integral, /**< should integral strong branching be performed? */ 301 SCIP_SET* set, /**< global SCIP settings */ 302 SCIP_STAT* stat, /**< dynamic problem statistics */ 303 SCIP_PROB* prob, /**< problem data */ 304 SCIP_LP* lp, /**< LP data */ 305 int itlim, /**< iteration limit for strong branchings */ 306 SCIP_Real* down, /**< stores dual bounds after branching columns down */ 307 SCIP_Real* up, /**< stores dual bounds after branching columns up */ 308 SCIP_Bool* downvalid, /**< stores whether the returned down values are valid dual bounds, or NULL; 309 * otherwise, they can only be used as an estimate value */ 310 SCIP_Bool* upvalid, /**< stores whether the returned up values are valid dual bounds, or NULL; 311 * otherwise, they can only be used as an estimate value */ 312 SCIP_Bool* lperror /**< pointer to store whether an unresolved LP error occurred */ 313 ); 314 315 /** gets last strong branching information available for a column variable; 316 * returns values of SCIP_INVALID, if strong branching was not yet called on the given column; 317 * keep in mind, that the returned old values may have nothing to do with the current LP solution 318 */ 319 void SCIPcolGetStrongbranchLast( 320 SCIP_COL* col, /**< LP column */ 321 SCIP_Real* down, /**< stores dual bound after branching column down, or NULL */ 322 SCIP_Real* up, /**< stores dual bound after branching column up, or NULL */ 323 SCIP_Bool* downvalid, /**< stores whether the returned down value is a valid dual bound, or NULL; 324 * otherwise, it can only be used as an estimate value */ 325 SCIP_Bool* upvalid, /**< stores whether the returned up value is a valid dual bound, or NULL; 326 * otherwise, it can only be used as an estimate value */ 327 SCIP_Real* solval, /**< stores LP solution value of column at last strong branching call, or NULL */ 328 SCIP_Real* lpobjval /**< stores LP objective value at last strong branching call, or NULL */ 329 ); 330 331 /** if strong branching was already applied on the column at the current node, returns the number of LPs solved after 332 * the LP where the strong branching on this column was applied; 333 * if strong branching was not yet applied on the column at the current node, returns INT_MAX 334 */ 335 SCIP_Longint SCIPcolGetStrongbranchLPAge( 336 SCIP_COL* col, /**< LP column */ 337 SCIP_STAT* stat /**< dynamic problem statistics */ 338 ); 339 340 /** marks a column to be not removable from the LP in the current node because it became obsolete */ 341 void SCIPcolMarkNotRemovableLocal( 342 SCIP_COL* col, /**< LP column */ 343 SCIP_STAT* stat /**< problem statistics */ 344 ); 345 346 347 /* 348 * Row methods 349 */ 350 351 /** creates and captures an LP row */ 352 SCIP_RETCODE SCIProwCreate( 353 SCIP_ROW** row, /**< pointer to LP row data */ 354 BMS_BLKMEM* blkmem, /**< block memory */ 355 SCIP_SET* set, /**< global SCIP settings */ 356 SCIP_STAT* stat, /**< problem statistics */ 357 const char* name, /**< name of row */ 358 int len, /**< number of nonzeros in the row */ 359 SCIP_COL** cols, /**< array with columns of row entries */ 360 SCIP_Real* vals, /**< array with coefficients of row entries */ 361 SCIP_Real lhs, /**< left hand side of row */ 362 SCIP_Real rhs, /**< right hand side of row */ 363 SCIP_ROWORIGINTYPE origintype, /**< type of origin of row */ 364 void* origin, /**< pointer to constraint handler or separator who created the row (NULL if unkown) */ 365 SCIP_Bool local, /**< is row only valid locally? */ 366 SCIP_Bool modifiable, /**< is row modifiable during node processing (subject to column generation)? */ 367 SCIP_Bool removable /**< should the row be removed from the LP due to aging or cleanup? */ 368 ); 369 370 /** frees an LP row */ 371 SCIP_RETCODE SCIProwFree( 372 SCIP_ROW** row, /**< pointer to LP row */ 373 BMS_BLKMEM* blkmem, /**< block memory */ 374 SCIP_SET* set, /**< global SCIP settings */ 375 SCIP_LP* lp /**< current LP data */ 376 ); 377 378 /** output row to file stream */ 379 void SCIProwPrint( 380 SCIP_ROW* row, /**< LP row */ 381 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */ 382 FILE* file /**< output file (or NULL for standard output) */ 383 ); 384 385 /** ensures, that column array of row can store at least num entries */ 386 SCIP_RETCODE SCIProwEnsureSize( 387 SCIP_ROW* row, /**< LP row */ 388 BMS_BLKMEM* blkmem, /**< block memory */ 389 SCIP_SET* set, /**< global SCIP settings */ 390 int num /**< minimum number of entries to store */ 391 ); 392 393 /** increases usage counter of LP row */ 394 void SCIProwCapture( 395 SCIP_ROW* row /**< LP row */ 396 ); 397 398 /** decreases usage counter of LP row, and frees memory if necessary */ 399 SCIP_RETCODE SCIProwRelease( 400 SCIP_ROW** row, /**< pointer to LP row */ 401 BMS_BLKMEM* blkmem, /**< block memory */ 402 SCIP_SET* set, /**< global SCIP settings */ 403 SCIP_LP* lp /**< current LP data */ 404 ); 405 406 /** enables delaying of row sorting */ 407 void SCIProwDelaySort( 408 SCIP_ROW* row /**< LP row */ 409 ); 410 411 /** disables delaying of row sorting, sorts row and merges coefficients with equal columns */ 412 void SCIProwForceSort( 413 SCIP_ROW* row, /**< LP row */ 414 SCIP_SET* set /**< global SCIP settings */ 415 ); 416 417 /** adds a previously non existing coefficient to an LP row */ 418 SCIP_RETCODE SCIProwAddCoef( 419 SCIP_ROW* row, /**< LP row */ 420 BMS_BLKMEM* blkmem, /**< block memory */ 421 SCIP_SET* set, /**< global SCIP settings */ 422 SCIP_EVENTQUEUE* eventqueue, /**< event queue */ 423 SCIP_LP* lp, /**< current LP data */ 424 SCIP_COL* col, /**< LP column */ 425 SCIP_Real val /**< value of coefficient */ 426 ); 427 428 /** deletes coefficient from row */ 429 SCIP_RETCODE SCIProwDelCoef( 430 SCIP_ROW* row, /**< LP row */ 431 BMS_BLKMEM* blkmem, /**< block memory */ 432 SCIP_SET* set, /**< global SCIP settings */ 433 SCIP_EVENTQUEUE* eventqueue, /**< event queue */ 434 SCIP_LP* lp, /**< current LP data */ 435 SCIP_COL* col /**< coefficient to be deleted */ 436 ); 437 438 /** changes or adds a coefficient to an LP row */ 439 SCIP_RETCODE SCIProwChgCoef( 440 SCIP_ROW* row, /**< LP row */ 441 BMS_BLKMEM* blkmem, /**< block memory */ 442 SCIP_SET* set, /**< global SCIP settings */ 443 SCIP_EVENTQUEUE* eventqueue, /**< event queue */ 444 SCIP_LP* lp, /**< current LP data */ 445 SCIP_COL* col, /**< LP column */ 446 SCIP_Real val /**< value of coefficient */ 447 ); 448 449 /** increases value of an existing or nonexisting coefficient in an LP column */ 450 SCIP_RETCODE SCIProwIncCoef( 451 SCIP_ROW* row, /**< LP row */ 452 BMS_BLKMEM* blkmem, /**< block memory */ 453 SCIP_SET* set, /**< global SCIP settings */ 454 SCIP_EVENTQUEUE* eventqueue, /**< event queue */ 455 SCIP_LP* lp, /**< current LP data */ 456 SCIP_COL* col, /**< LP column */ 457 SCIP_Real incval /**< value to add to the coefficient */ 458 ); 459 460 /** changes constant value of a row */ 461 SCIP_RETCODE SCIProwChgConstant( 462 SCIP_ROW* row, /**< LP row */ 463 BMS_BLKMEM* blkmem, /**< block memory */ 464 SCIP_SET* set, /**< global SCIP settings */ 465 SCIP_STAT* stat, /**< problem statistics */ 466 SCIP_EVENTQUEUE* eventqueue, /**< event queue */ 467 SCIP_LP* lp, /**< current LP data */ 468 SCIP_Real constant /**< new constant value */ 469 ); 470 471 /** add constant value to a row */ 472 SCIP_RETCODE SCIProwAddConstant( 473 SCIP_ROW* row, /**< LP row */ 474 BMS_BLKMEM* blkmem, /**< block memory */ 475 SCIP_SET* set, /**< global SCIP settings */ 476 SCIP_STAT* stat, /**< problem statistics */ 477 SCIP_EVENTQUEUE* eventqueue, /**< event queue */ 478 SCIP_LP* lp, /**< current LP data */ 479 SCIP_Real addval /**< constant value to add to the row */ 480 ); 481 482 /** changes left hand side of LP row */ 483 SCIP_RETCODE SCIProwChgLhs( 484 SCIP_ROW* row, /**< LP row */ 485 BMS_BLKMEM* blkmem, /**< block memory */ 486 SCIP_SET* set, /**< global SCIP settings */ 487 SCIP_EVENTQUEUE* eventqueue, /**< event queue */ 488 SCIP_LP* lp, /**< current LP data */ 489 SCIP_Real lhs /**< new left hand side */ 490 ); 491 492 /** changes right hand side of LP row */ 493 SCIP_RETCODE SCIProwChgRhs( 494 SCIP_ROW* row, /**< LP row */ 495 BMS_BLKMEM* blkmem, /**< block memory */ 496 SCIP_SET* set, /**< global SCIP settings */ 497 SCIP_EVENTQUEUE* eventqueue, /**< event queue */ 498 SCIP_LP* lp, /**< current LP data */ 499 SCIP_Real rhs /**< new right hand side */ 500 ); 501 502 /** changes the local flag of LP row */ 503 SCIP_RETCODE SCIProwChgLocal( 504 SCIP_ROW* row, /**< LP row */ 505 SCIP_Bool local /**< new value for local flag */ 506 ); 507 508 /** tries to find a value, such that all row coefficients, if scaled with this value become integral */ 509 SCIP_RETCODE SCIProwCalcIntegralScalar( 510 SCIP_ROW* row, /**< LP row */ 511 SCIP_SET* set, /**< global SCIP settings */ 512 SCIP_Real mindelta, /**< minimal relative allowed difference of scaled coefficient s*c and integral i */ 513 SCIP_Real maxdelta, /**< maximal relative allowed difference of scaled coefficient s*c and integral i */ 514 SCIP_Longint maxdnom, /**< maximal denominator allowed in rational numbers */ 515 SCIP_Real maxscale, /**< maximal allowed scalar */ 516 SCIP_Bool usecontvars, /**< should the coefficients of the continuous variables also be made integral? */ 517 SCIP_Real* intscalar, /**< pointer to store scalar that would make the coefficients integral */ 518 SCIP_Bool* success /**< stores whether returned value is valid */ 519 ); 520 521 /** tries to scale row, s.t. all coefficients become integral */ 522 SCIP_RETCODE SCIProwMakeIntegral( 523 SCIP_ROW* row, /**< LP row */ 524 BMS_BLKMEM* blkmem, /**< block memory */ 525 SCIP_SET* set, /**< global SCIP settings */ 526 SCIP_EVENTQUEUE* eventqueue, /**< event queue */ 527 SCIP_STAT* stat, /**< problem statistics */ 528 SCIP_LP* lp, /**< current LP data */ 529 SCIP_Real mindelta, /**< minimal relative allowed difference of scaled coefficient s*c and integral i */ 530 SCIP_Real maxdelta, /**< maximal relative allowed difference of scaled coefficient s*c and integral i */ 531 SCIP_Longint maxdnom, /**< maximal denominator allowed in rational numbers */ 532 SCIP_Real maxscale, /**< maximal value to scale row with */ 533 SCIP_Bool usecontvars, /**< should the coefficients of the continuous variables also be made integral? */ 534 SCIP_Bool* success /**< stores whether row could be made rational */ 535 ); 536 537 /** recalculates the current activity of a row */ 538 void SCIProwRecalcLPActivity( 539 SCIP_ROW* row, /**< LP row */ 540 SCIP_STAT* stat /**< problem statistics */ 541 ); 542 543 /** returns the activity of a row in the current LP solution */ 544 SCIP_Real SCIProwGetLPActivity( 545 SCIP_ROW* row, /**< LP row */ 546 SCIP_SET* set, /**< global SCIP settings */ 547 SCIP_STAT* stat, /**< problem statistics */ 548 SCIP_LP* lp /**< current LP data */ 549 ); 550 551 /** returns the feasibility of a row in the current LP solution: negative value means infeasibility */ 552 SCIP_Real SCIProwGetLPFeasibility( 553 SCIP_ROW* row, /**< LP row */ 554 SCIP_SET* set, /**< global SCIP settings */ 555 SCIP_STAT* stat, /**< problem statistics */ 556 SCIP_LP* lp /**< current LP data */ 557 ); 558 559 /** returns the feasibility of a row in the current relaxed solution: negative value means infeasibility */ 560 SCIP_Real SCIProwGetRelaxFeasibility( 561 SCIP_ROW* row, /**< LP row */ 562 SCIP_SET* set, /**< global SCIP settings */ 563 SCIP_STAT* stat /**< problem statistics */ 564 ); 565 566 /** returns the feasibility of a row in the current NLP solution: negative value means infeasibility */ 567 SCIP_Real SCIProwGetNLPFeasibility( 568 SCIP_ROW* row, /**< LP row */ 569 SCIP_SET* set, /**< global SCIP settings */ 570 SCIP_STAT* stat /**< problem statistics */ 571 ); 572 573 /** calculates the current pseudo activity of a row */ 574 void SCIProwRecalcPseudoActivity( 575 SCIP_ROW* row, /**< row data */ 576 SCIP_STAT* stat /**< problem statistics */ 577 ); 578 579 /** returns the pseudo activity of a row in the current pseudo solution */ 580 SCIP_Real SCIProwGetPseudoActivity( 581 SCIP_ROW* row, /**< LP row */ 582 SCIP_SET* set, /**< global SCIP settings */ 583 SCIP_STAT* stat /**< problem statistics */ 584 ); 585 586 /** returns the pseudo feasibility of a row in the current pseudo solution: negative value means infeasibility */ 587 SCIP_Real SCIProwGetPseudoFeasibility( 588 SCIP_ROW* row, /**< LP row */ 589 SCIP_SET* set, /**< global SCIP settings */ 590 SCIP_STAT* stat /**< problem statistics */ 591 ); 592 593 /** returns the activity of a row for a given solution */ 594 SCIP_Real SCIProwGetSolActivity( 595 SCIP_ROW* row, /**< LP row */ 596 SCIP_SET* set, /**< global SCIP settings */ 597 SCIP_STAT* stat, /**< problem statistics data */ 598 SCIP_SOL* sol /**< primal CIP solution */ 599 ); 600 601 /** returns the feasibility of a row for the given solution */ 602 SCIP_Real SCIProwGetSolFeasibility( 603 SCIP_ROW* row, /**< LP row */ 604 SCIP_SET* set, /**< global SCIP settings */ 605 SCIP_STAT* stat, /**< problem statistics data */ 606 SCIP_SOL* sol /**< primal CIP solution */ 607 ); 608 609 /** returns the minimal activity of a row w.r.t. the columns' bounds */ 610 SCIP_Real SCIProwGetMinActivity( 611 SCIP_ROW* row, /**< LP row */ 612 SCIP_SET* set, /**< global SCIP settings */ 613 SCIP_STAT* stat /**< problem statistics data */ 614 ); 615 616 /** returns the maximal activity of a row w.r.t. the columns' bounds */ 617 SCIP_Real SCIProwGetMaxActivity( 618 SCIP_ROW* row, /**< LP row */ 619 SCIP_SET* set, /**< global SCIP settings */ 620 SCIP_STAT* stat /**< problem statistics data */ 621 ); 622 623 /** returns whether the row is unmodifiable and redundant w.r.t. the columns' bounds */ 624 SCIP_Bool SCIProwIsRedundant( 625 SCIP_ROW* row, /**< LP row */ 626 SCIP_SET* set, /**< global SCIP settings */ 627 SCIP_STAT* stat /**< problem statistics data */ 628 ); 629 630 /** gets maximal absolute value of row vector coefficients */ 631 SCIP_Real SCIProwGetMaxval( 632 SCIP_ROW* row, /**< LP row */ 633 SCIP_SET* set /**< global SCIP settings */ 634 ); 635 636 /** gets minimal absolute value of row vector's non-zero coefficients */ 637 SCIP_Real SCIProwGetMinval( 638 SCIP_ROW* row, /**< LP row */ 639 SCIP_SET* set /**< global SCIP settings */ 640 ); 641 642 /** gets maximal column index of row entries */ 643 int SCIProwGetMaxidx( 644 SCIP_ROW* row, /**< LP row */ 645 SCIP_SET* set /**< global SCIP settings */ 646 ); 647 648 /** gets minimal column index of row entries */ 649 int SCIProwGetMinidx( 650 SCIP_ROW* row, /**< LP row */ 651 SCIP_SET* set /**< global SCIP settings */ 652 ); 653 654 /** gets number of integral columns in row */ 655 int SCIProwGetNumIntCols( 656 SCIP_ROW* row, /**< LP row */ 657 SCIP_SET* set /**< global SCIP settings */ 658 ); 659 660 /** returns row's cutoff distance in the direction of the given primal solution */ 661 SCIP_Real SCIProwGetLPSolCutoffDistance( 662 SCIP_ROW* row, /**< LP row */ 663 SCIP_SET* set, /**< global SCIP settings */ 664 SCIP_STAT* stat, /**< problem statistics data */ 665 SCIP_SOL* sol, /**< solution to compute direction for cutoff distance; must not be NULL */ 666 SCIP_LP* lp /**< current LP data */ 667 ); 668 669 /** returns row's efficacy with respect to the current LP solution: e = -feasibility/norm */ 670 SCIP_Real SCIProwGetLPEfficacy( 671 SCIP_ROW* row, /**< LP row */ 672 SCIP_SET* set, /**< global SCIP settings */ 673 SCIP_STAT* stat, /**< problem statistics data */ 674 SCIP_LP* lp /**< current LP data */ 675 ); 676 677 /** returns whether the row's efficacy with respect to the current LP solution is greater than the minimal cut efficacy */ 678 SCIP_Bool SCIProwIsLPEfficacious( 679 SCIP_ROW* row, /**< LP row */ 680 SCIP_SET* set, /**< global SCIP settings */ 681 SCIP_STAT* stat, /**< problem statistics data */ 682 SCIP_LP* lp, /**< current LP data */ 683 SCIP_Bool root /**< should the root's minimal cut efficacy be used? */ 684 ); 685 686 /** returns row's efficacy with respect to the given primal solution: e = -feasibility/norm */ 687 SCIP_Real SCIProwGetSolEfficacy( 688 SCIP_ROW* row, /**< LP row */ 689 SCIP_SET* set, /**< global SCIP settings */ 690 SCIP_STAT* stat, /**< problem statistics data */ 691 SCIP_SOL* sol /**< primal CIP solution */ 692 ); 693 694 /** returns whether the row's efficacy with respect to the given primal solution is greater than the minimal cut 695 * efficacy 696 */ 697 SCIP_Bool SCIProwIsSolEfficacious( 698 SCIP_ROW* row, /**< LP row */ 699 SCIP_SET* set, /**< global SCIP settings */ 700 SCIP_STAT* stat, /**< problem statistics data */ 701 SCIP_SOL* sol, /**< primal CIP solution */ 702 SCIP_Bool root /**< should the root's minimal cut efficacy be used? */ 703 ); 704 705 /** returns row's efficacy with respect to the relaxed solution: e = -feasibility/norm */ 706 SCIP_Real SCIProwGetRelaxEfficacy( 707 SCIP_ROW* row, /**< LP row */ 708 SCIP_SET* set, /**< global SCIP settings */ 709 SCIP_STAT* stat /**< problem statistics data */ 710 ); 711 712 /** returns row's efficacy with respect to the NLP solution: e = -feasibility/norm */ 713 SCIP_Real SCIProwGetNLPEfficacy( 714 SCIP_ROW* row, /**< LP row */ 715 SCIP_SET* set, /**< global SCIP settings */ 716 SCIP_STAT* stat /**< problem statistics data */ 717 ); 718 719 /** gets parallelism of row with objective function: if the returned value is 1, the row is parallel to the objective 720 * function, if the value is 0, it is orthogonal to the objective function 721 */ 722 SCIP_Real SCIProwGetObjParallelism( 723 SCIP_ROW* row, /**< LP row */ 724 SCIP_SET* set, /**< global SCIP settings */ 725 SCIP_LP* lp /**< current LP data */ 726 ); 727 728 /** includes event handler with given data in row's event filter */ 729 SCIP_RETCODE SCIProwCatchEvent( 730 SCIP_ROW* row, /**< row */ 731 BMS_BLKMEM* blkmem, /**< block memory */ 732 SCIP_SET* set, /**< global SCIP settings */ 733 SCIP_EVENTTYPE eventtype, /**< event type to catch */ 734 SCIP_EVENTHDLR* eventhdlr, /**< event handler to call for the event processing */ 735 SCIP_EVENTDATA* eventdata, /**< event data to pass to the event handler for the event processing */ 736 int* filterpos /**< pointer to store position of event filter entry, or NULL */ 737 ); 738 739 /** deletes event handler with given data from row's event filter */ 740 SCIP_RETCODE SCIProwDropEvent( 741 SCIP_ROW* row, /**< row */ 742 BMS_BLKMEM* blkmem, /**< block memory */ 743 SCIP_SET* set, /**< global SCIP settings */ 744 SCIP_EVENTTYPE eventtype, /**< event type mask of dropped event */ 745 SCIP_EVENTHDLR* eventhdlr, /**< event handler to call for the event processing */ 746 SCIP_EVENTDATA* eventdata, /**< event data to pass to the event handler for the event processing */ 747 int filterpos /**< position of event filter entry returned by SCIPvarCatchEvent(), or -1 */ 748 ); 749 750 /** marks a row to be not removable from the LP in the current node */ 751 void SCIProwMarkNotRemovableLocal( 752 SCIP_ROW* row, /**< LP row */ 753 SCIP_STAT* stat /**< problem statistics */ 754 ); 755 756 757 /* 758 * LP methods 759 */ 760 761 /** creates empty LP data object */ 762 SCIP_RETCODE SCIPlpCreate( 763 SCIP_LP** lp, /**< pointer to LP data object */ 764 SCIP_SET* set, /**< global SCIP settings */ 765 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */ 766 SCIP_STAT* stat, /**< problem statistics */ 767 const char* name /**< problem name */ 768 ); 769 770 /** frees LP data object */ 771 SCIP_RETCODE SCIPlpFree( 772 SCIP_LP** lp, /**< pointer to LP data object */ 773 BMS_BLKMEM* blkmem, /**< block memory */ 774 SCIP_SET* set, /**< global SCIP settings */ 775 SCIP_EVENTQUEUE* eventqueue, /**< event queue */ 776 SCIP_EVENTFILTER* eventfilter /**< global event filter */ 777 ); 778 779 /** resets the LP to the empty LP by removing all columns and rows from LP, releasing all rows, and flushing the 780 * changes to the LP solver 781 */ 782 SCIP_RETCODE SCIPlpReset( 783 SCIP_LP* lp, /**< LP data */ 784 BMS_BLKMEM* blkmem, /**< block memory */ 785 SCIP_SET* set, /**< global SCIP settings */ 786 SCIP_PROB* prob, /**< problem data */ 787 SCIP_STAT* stat, /**< problem statistics */ 788 SCIP_EVENTQUEUE* eventqueue, /**< event queue */ 789 SCIP_EVENTFILTER* eventfilter /**< global event filter */ 790 ); 791 792 /** adds a column to the LP and captures the variable */ 793 SCIP_RETCODE SCIPlpAddCol( 794 SCIP_LP* lp, /**< LP data */ 795 SCIP_SET* set, /**< global SCIP settings */ 796 SCIP_COL* col, /**< LP column */ 797 int depth /**< depth in the tree where the column addition is performed */ 798 ); 799 800 /** adds a row to the LP and captures it */ 801 SCIP_RETCODE SCIPlpAddRow( 802 SCIP_LP* lp, /**< LP data */ 803 BMS_BLKMEM* blkmem, /**< block memory buffers */ 804 SCIP_SET* set, /**< global SCIP settings */ 805 SCIP_EVENTQUEUE* eventqueue, /**< event queue */ 806 SCIP_EVENTFILTER* eventfilter, /**< global event filter */ 807 SCIP_ROW* row, /**< LP row */ 808 int depth /**< depth in the tree where the row addition is performed */ 809 ); 810 811 /** removes all columns after the given number of columns from the LP */ 812 SCIP_RETCODE SCIPlpShrinkCols( 813 SCIP_LP* lp, /**< LP data */ 814 SCIP_SET* set, /**< global SCIP settings */ 815 int newncols /**< new number of columns in the LP */ 816 ); 817 818 /** removes and releases all rows after the given number of rows from the LP */ 819 SCIP_RETCODE SCIPlpShrinkRows( 820 SCIP_LP* lp, /**< LP data */ 821 BMS_BLKMEM* blkmem, /**< block memory */ 822 SCIP_SET* set, /**< global SCIP settings */ 823 SCIP_EVENTQUEUE* eventqueue, /**< event queue */ 824 SCIP_EVENTFILTER* eventfilter, /**< global event filter */ 825 int newnrows /**< new number of rows in the LP */ 826 ); 827 828 /** removes all columns and rows from LP, releases all rows */ 829 SCIP_RETCODE SCIPlpClear( 830 SCIP_LP* lp, /**< LP data */ 831 BMS_BLKMEM* blkmem, /**< block memory */ 832 SCIP_SET* set, /**< global SCIP settings */ 833 SCIP_EVENTQUEUE* eventqueue, /**< event queue */ 834 SCIP_EVENTFILTER* eventfilter /**< global event filter */ 835 ); 836 837 /** remembers number of columns and rows to track the newly added ones */ 838 void SCIPlpMarkSize( 839 SCIP_LP* lp /**< current LP data */ 840 ); 841 842 /** sets the remembered number of columns and rows to the given values */ 843 void SCIPlpSetSizeMark( 844 SCIP_LP* lp, /**< current LP data */ 845 int nrows, /**< number of rows to set the size marker to */ 846 int ncols /**< number of columns to set the size marker to */ 847 ); 848 849 /** gets all indices of basic columns and rows: index i >= 0 corresponds to column i, index i < 0 to row -i-1 */ 850 SCIP_RETCODE SCIPlpGetBasisInd( 851 SCIP_LP* lp, /**< LP data */ 852 int* basisind /**< pointer to store basis indices ready to keep number of rows entries */ 853 ); 854 855 /** gets current basis status for columns and rows; arrays must be large enough to store the basis status */ 856 SCIP_RETCODE SCIPlpGetBase( 857 SCIP_LP* lp, /**< LP data */ 858 int* cstat, /**< array to store column basis status, or NULL */ 859 int* rstat /**< array to store row basis status, or NULL */ 860 ); 861 862 /** gets a row from the inverse basis matrix B^-1 */ 863 SCIP_RETCODE SCIPlpGetBInvRow( 864 SCIP_LP* lp, /**< LP data */ 865 int r, /**< row number */ 866 SCIP_Real* coef, /**< pointer to store the coefficients of the row */ 867 int* inds, /**< array to store the non-zero indices, or NULL */ 868 int* ninds /**< pointer to store the number of non-zero indices, or NULL 869 * (-1: if we do not store sparsity informations) */ 870 ); 871 872 /** gets a column from the inverse basis matrix B^-1 */ 873 SCIP_RETCODE SCIPlpGetBInvCol( 874 SCIP_LP* lp, /**< LP data */ 875 int c, /**< column number of B^-1; this is NOT the number of the column in the LP 876 * returned by SCIPcolGetLPPos(); you have to call SCIPgetBasisInd() 877 * to get the array which links the B^-1 column numbers to the row and 878 * column numbers of the LP! c must be between 0 and nrows-1, since the 879 * basis has the size nrows * nrows */ 880 SCIP_Real* coef, /**< pointer to store the coefficients of the column */ 881 int* inds, /**< array to store the non-zero indices, or NULL */ 882 int* ninds /**< pointer to store the number of non-zero indices, or NULL 883 * (-1: if we do not store sparsity informations) */ 884 ); 885 886 /** gets a row from the product of inverse basis matrix B^-1 and coefficient matrix A (i.e. from B^-1 * A) */ 887 SCIP_RETCODE SCIPlpGetBInvARow( 888 SCIP_LP* lp, /**< LP data */ 889 int r, /**< row number */ 890 SCIP_Real* binvrow, /**< row in B^-1 from prior call to SCIPlpGetBInvRow(), or NULL */ 891 SCIP_Real* coef, /**< pointer to store the coefficients of the row */ 892 int* inds, /**< array to store the non-zero indices, or NULL */ 893 int* ninds /**< pointer to store the number of non-zero indices, or NULL 894 * (-1: if we do not store sparsity informations) */ 895 ); 896 897 /** gets a column from the product of inverse basis matrix B^-1 and coefficient matrix A (i.e. from B^-1 * A), 898 * i.e., it computes B^-1 * A_c with A_c being the c'th column of A 899 */ 900 SCIP_RETCODE SCIPlpGetBInvACol( 901 SCIP_LP* lp, /**< LP data */ 902 int c, /**< column number which can be accessed by SCIPcolGetLPPos() */ 903 SCIP_Real* coef, /**< pointer to store the coefficients of the column */ 904 int* inds, /**< array to store the non-zero indices, or NULL */ 905 int* ninds /**< pointer to store the number of non-zero indices, or NULL 906 * (-1: if we do not store sparsity informations) */ 907 ); 908 909 /** calculates a weighted sum of all LP rows; for negative weights, the left and right hand side of the corresponding 910 * LP row are swapped in the summation 911 */ 912 SCIP_RETCODE SCIPlpSumRows( 913 SCIP_LP* lp, /**< LP data */ 914 SCIP_SET* set, /**< global SCIP settings */ 915 SCIP_PROB* prob, /**< problem data */ 916 SCIP_Real* weights, /**< row weights in row summation */ 917 SCIP_REALARRAY* sumcoef, /**< array to store sum coefficients indexed by variables' probindex */ 918 SCIP_Real* sumlhs, /**< pointer to store the left hand side of the row summation */ 919 SCIP_Real* sumrhs /**< pointer to store the right hand side of the row summation */ 920 ); 921 922 /** stores LP state (like basis information) into LP state object */ 923 SCIP_RETCODE SCIPlpGetState( 924 SCIP_LP* lp, /**< LP data */ 925 BMS_BLKMEM* blkmem, /**< block memory */ 926 SCIP_LPISTATE** lpistate /**< pointer to LP state information (like basis information) */ 927 ); 928 929 /** loads LP state (like basis information) into solver */ 930 SCIP_RETCODE SCIPlpSetState( 931 SCIP_LP* lp, /**< LP data */ 932 BMS_BLKMEM* blkmem, /**< block memory */ 933 SCIP_SET* set, /**< global SCIP settings */ 934 SCIP_PROB* prob, /**< problem data */ 935 SCIP_EVENTQUEUE* eventqueue, /**< event queue */ 936 SCIP_LPISTATE* lpistate, /**< LP state information (like basis information) */ 937 SCIP_Bool wasprimfeas, /**< primal feasibility when LP state information was stored */ 938 SCIP_Bool wasprimchecked, /**< true if the LP solution has passed the primal feasibility check */ 939 SCIP_Bool wasdualfeas, /**< dual feasibility when LP state information was stored */ 940 SCIP_Bool wasdualchecked /**< true if the LP solution has passed the dual feasibility check */ 941 ); 942 943 /** frees LP state information */ 944 SCIP_RETCODE SCIPlpFreeState( 945 SCIP_LP* lp, /**< LP data */ 946 BMS_BLKMEM* blkmem, /**< block memory */ 947 SCIP_LPISTATE** lpistate /**< pointer to LP state information (like basis information) */ 948 ); 949 950 /** interrupts the currently ongoing lp solve or disables the interrupt */ 951 SCIP_RETCODE SCIPlpInterrupt( 952 SCIP_LP* lp, /**< LP data */ 953 SCIP_Bool interrupt /**< TRUE if interrupt should be set, FALSE if it should be disabled */ 954 ); 955 956 /** stores pricing norms into LP norms object */ 957 SCIP_RETCODE SCIPlpGetNorms( 958 SCIP_LP* lp, /**< LP data */ 959 BMS_BLKMEM* blkmem, /**< block memory */ 960 SCIP_LPINORMS** lpinorms /**< pointer to LP pricing norms information */ 961 ); 962 963 /** loads pricing norms from LP norms object into solver */ 964 SCIP_RETCODE SCIPlpSetNorms( 965 SCIP_LP* lp, /**< LP data */ 966 BMS_BLKMEM* blkmem, /**< block memory */ 967 SCIP_LPINORMS* lpinorms /**< LP pricing norms information */ 968 ); 969 970 /** frees pricing norms information */ 971 SCIP_RETCODE SCIPlpFreeNorms( 972 SCIP_LP* lp, /**< LP data */ 973 BMS_BLKMEM* blkmem, /**< block memory */ 974 SCIP_LPINORMS** lpinorms /**< pointer to LP pricing norms information */ 975 ); 976 977 /** return the current cutoff bound of the lp */ 978 SCIP_Real SCIPlpGetCutoffbound( 979 SCIP_LP* lp /**< current LP data */ 980 ); 981 982 /** sets the upper objective limit of the LP solver */ 983 SCIP_RETCODE SCIPlpSetCutoffbound( 984 SCIP_LP* lp, /**< current LP data */ 985 SCIP_SET* set, /**< global SCIP settings */ 986 SCIP_PROB* prob, /**< problem data */ 987 SCIP_Real cutoffbound /**< new upper objective limit */ 988 ); 989 990 /** gets current primal feasibility tolerance of LP solver */ 991 SCIP_Real SCIPlpGetFeastol( 992 SCIP_LP* lp /**< current LP data */ 993 ); 994 995 /** sets primal feasibility tolerance of LP solver */ 996 void SCIPlpSetFeastol( 997 SCIP_LP* lp, /**< current LP data */ 998 SCIP_SET* set, /**< global SCIP settings */ 999 SCIP_Real newfeastol /**< new primal feasibility tolerance for LP */ 1000 ); 1001 1002 /** resets primal feasibility tolerance of LP solver 1003 * 1004 * Sets primal feasibility tolerance to min of numerics/lpfeastolfactor * numerics/feastol and relaxfeastol. 1005 */ 1006 void SCIPlpResetFeastol( 1007 SCIP_LP* lp, /**< current LP data */ 1008 SCIP_SET* set /**< global SCIP settings */ 1009 ); 1010 1011 /** applies all cached changes to the LP solver */ 1012 SCIP_RETCODE SCIPlpFlush( 1013 SCIP_LP* lp, /**< current LP data */ 1014 BMS_BLKMEM* blkmem, /**< block memory */ 1015 SCIP_SET* set, /**< global SCIP settings */ 1016 SCIP_PROB* prob, /**< problem data */ 1017 SCIP_EVENTQUEUE* eventqueue /**< event queue */ 1018 ); 1019 1020 /** marks the LP to be flushed, even if the LP thinks it is not flushed */ 1021 SCIP_RETCODE SCIPlpMarkFlushed( 1022 SCIP_LP* lp, /**< current LP data */ 1023 SCIP_SET* set /**< global SCIP settings */ 1024 ); 1025 1026 /** solves the LP with simplex algorithm, and copy the solution into the column's data */ 1027 SCIP_RETCODE SCIPlpSolveAndEval( 1028 SCIP_LP* lp, /**< LP data */ 1029 SCIP_SET* set, /**< global SCIP settings */ 1030 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */ 1031 BMS_BLKMEM* blkmem, /**< block memory buffers */ 1032 SCIP_STAT* stat, /**< problem statistics */ 1033 SCIP_EVENTQUEUE* eventqueue, /**< event queue */ 1034 SCIP_EVENTFILTER* eventfilter, /**< global event filter */ 1035 SCIP_PROB* prob, /**< problem data */ 1036 SCIP_Longint itlim, /**< maximal number of LP iterations to perform, or -1 for no limit */ 1037 SCIP_Bool limitresolveiters, /**< should LP iterations for resolving calls be limited? 1038 * (limit is computed within the method w.r.t. the average LP iterations) */ 1039 SCIP_Bool aging, /**< should aging and removal of obsolete cols/rows be applied? */ 1040 SCIP_Bool keepsol, /**< should the old LP solution be kept if no iterations were performed? */ 1041 SCIP_Bool* lperror /**< pointer to store whether an unresolved LP error occurred */ 1042 ); 1043 1044 /** gets solution status of current LP */ 1045 SCIP_LPSOLSTAT SCIPlpGetSolstat( 1046 SCIP_LP* lp /**< current LP data */ 1047 ); 1048 1049 /** sets whether the root LP is a relaxation of the problem and its optimal objective value is a global lower bound */ 1050 void SCIPlpSetRootLPIsRelax( 1051 SCIP_LP* lp, /**< LP data */ 1052 SCIP_Bool isrelax /**< is the root lp a relaxation of the problem? */ 1053 ); 1054 1055 /** returns whether the root lp is a relaxation of the problem and its optimal objective value is a global lower bound */ 1056 SCIP_Bool SCIPlpIsRootLPRelax( 1057 SCIP_LP* lp /**< LP data */ 1058 ); 1059 1060 /** gets objective value of current LP 1061 * 1062 * @note This method returns the objective value of the current LP solution, which might be primal or dual infeasible 1063 * if a limit was hit during solving. It must not be used as a dual bound if the LP solution status is 1064 * SCIP_LPSOLSTAT_ITERLIMIT or SCIP_LPSOLSTAT_TIMELIMIT. 1065 */ 1066 SCIP_Real SCIPlpGetObjval( 1067 SCIP_LP* lp, /**< current LP data */ 1068 SCIP_SET* set, /**< global SCIP settings */ 1069 SCIP_PROB* prob /**< problem data */ 1070 ); 1071 1072 /** gets part of objective value of current LP that results from COLUMN variables only */ 1073 SCIP_Real SCIPlpGetColumnObjval( 1074 SCIP_LP* lp /**< current LP data */ 1075 ); 1076 1077 /** gets part of objective value of current LP that results from LOOSE variables only */ 1078 SCIP_Real SCIPlpGetLooseObjval( 1079 SCIP_LP* lp, /**< current LP data */ 1080 SCIP_SET* set, /**< global SCIP settings */ 1081 SCIP_PROB* prob /**< problem data */ 1082 ); 1083 1084 /** remembers the current LP objective value as root solution value */ 1085 void SCIPlpStoreRootObjval( 1086 SCIP_LP* lp, /**< current LP data */ 1087 SCIP_SET* set, /**< global SCIP settings */ 1088 SCIP_PROB* prob /**< problem data */ 1089 ); 1090 1091 /** invalidates the root LP solution value */ 1092 void SCIPlpInvalidateRootObjval( 1093 SCIP_LP* lp /**< current LP data */ 1094 ); 1095 1096 /** gets the global pseudo objective value; that is all variables set to their best (w.r.t. the objective function) 1097 * global bound 1098 */ 1099 SCIP_Real SCIPlpGetGlobalPseudoObjval( 1100 SCIP_LP* lp, /**< current LP data */ 1101 SCIP_SET* set, /**< global SCIP settings */ 1102 SCIP_PROB* prob /**< problem data */ 1103 ); 1104 1105 /** recomputes local and global pseudo objective values */ 1106 void SCIPlpRecomputeLocalAndGlobalPseudoObjval( 1107 SCIP_LP* lp, /**< current LP data */ 1108 SCIP_SET* set, /**< global SCIP settings */ 1109 SCIP_PROB* prob /**< problem data */ 1110 ); 1111 1112 /** gets the pseudo objective value for the current search node; that is all variables set to their best (w.r.t. the 1113 * objective function) local bound 1114 */ 1115 SCIP_Real SCIPlpGetPseudoObjval( 1116 SCIP_LP* lp, /**< current LP data */ 1117 SCIP_SET* set, /**< global SCIP settings */ 1118 SCIP_PROB* prob /**< problem data */ 1119 ); 1120 1121 /** gets pseudo objective value, if a bound of the given variable would be modified in the given way */ 1122 SCIP_Real SCIPlpGetModifiedPseudoObjval( 1123 SCIP_LP* lp, /**< current LP data */ 1124 SCIP_SET* set, /**< global SCIP settings */ 1125 SCIP_PROB* prob, /**< problem data */ 1126 SCIP_VAR* var, /**< problem variable */ 1127 SCIP_Real oldbound, /**< old value for bound */ 1128 SCIP_Real newbound, /**< new value for bound */ 1129 SCIP_BOUNDTYPE boundtype /**< type of bound: lower or upper bound */ 1130 ); 1131 1132 /** gets pseudo objective value, if a bound of the given variable would be modified in the given way; 1133 * perform calculations with interval arithmetic to get an exact lower bound 1134 */ 1135 SCIP_Real SCIPlpGetModifiedProvedPseudoObjval( 1136 SCIP_LP* lp, /**< current LP data */ 1137 SCIP_SET* set, /**< global SCIP settings */ 1138 SCIP_VAR* var, /**< problem variable */ 1139 SCIP_Real oldbound, /**< old value for bound */ 1140 SCIP_Real newbound, /**< new value for bound */ 1141 SCIP_BOUNDTYPE boundtype /**< type of bound: lower or upper bound */ 1142 ); 1143 1144 /** updates current pseudo and loose objective value for a change in a variable's objective coefficient */ 1145 SCIP_RETCODE SCIPlpUpdateVarObj( 1146 SCIP_LP* lp, /**< current LP data */ 1147 SCIP_SET* set, /**< global SCIP settings */ 1148 SCIP_VAR* var, /**< problem variable that changed */ 1149 SCIP_Real oldobj, /**< old objective coefficient of variable */ 1150 SCIP_Real newobj /**< new objective coefficient of variable */ 1151 ); 1152 1153 /** updates current root pseudo objective value for a global change in a variable's lower bound */ 1154 SCIP_RETCODE SCIPlpUpdateVarLbGlobal( 1155 SCIP_LP* lp, /**< current LP data */ 1156 SCIP_SET* set, /**< global SCIP settings */ 1157 SCIP_VAR* var, /**< problem variable that changed */ 1158 SCIP_Real oldlb, /**< old lower bound of variable */ 1159 SCIP_Real newlb /**< new lower bound of variable */ 1160 ); 1161 1162 /** updates current pseudo and loose objective value for a change in a variable's lower bound */ 1163 SCIP_RETCODE SCIPlpUpdateVarLb( 1164 SCIP_LP* lp, /**< current LP data */ 1165 SCIP_SET* set, /**< global SCIP settings */ 1166 SCIP_VAR* var, /**< problem variable that changed */ 1167 SCIP_Real oldlb, /**< old lower bound of variable */ 1168 SCIP_Real newlb /**< new lower bound of variable */ 1169 ); 1170 1171 /** updates current root pseudo objective value for a global change in a variable's upper bound */ 1172 SCIP_RETCODE SCIPlpUpdateVarUbGlobal( 1173 SCIP_LP* lp, /**< current LP data */ 1174 SCIP_SET* set, /**< global SCIP settings */ 1175 SCIP_VAR* var, /**< problem variable that changed */ 1176 SCIP_Real oldub, /**< old upper bound of variable */ 1177 SCIP_Real newub /**< new upper bound of variable */ 1178 ); 1179 1180 /** updates current pseudo objective value for a change in a variable's upper bound */ 1181 SCIP_RETCODE SCIPlpUpdateVarUb( 1182 SCIP_LP* lp, /**< current LP data */ 1183 SCIP_SET* set, /**< global SCIP settings */ 1184 SCIP_VAR* var, /**< problem variable that changed */ 1185 SCIP_Real oldub, /**< old upper bound of variable */ 1186 SCIP_Real newub /**< new upper bound of variable */ 1187 ); 1188 1189 /** informs LP, that given variable was added to the problem */ 1190 SCIP_RETCODE SCIPlpUpdateAddVar( 1191 SCIP_LP* lp, /**< current LP data */ 1192 SCIP_SET* set, /**< global SCIP settings */ 1193 SCIP_VAR* var /**< variable that is now a LOOSE problem variable */ 1194 ); 1195 1196 /** informs LP, that given variable is to be deleted from the problem */ 1197 SCIP_RETCODE SCIPlpUpdateDelVar( 1198 SCIP_LP* lp, /**< current LP data */ 1199 SCIP_SET* set, /**< global SCIP settings */ 1200 SCIP_VAR* var /**< variable that will be deleted from the problem */ 1201 ); 1202 1203 /** informs LP, that given formerly loose problem variable is now a column variable */ 1204 SCIP_RETCODE SCIPlpUpdateVarColumn( 1205 SCIP_LP* lp, /**< current LP data */ 1206 SCIP_SET* set, /**< global SCIP settings */ 1207 SCIP_VAR* var /**< problem variable that changed from LOOSE to COLUMN */ 1208 ); 1209 1210 /** informs LP, that given formerly column problem variable is now again a loose variable */ 1211 SCIP_RETCODE SCIPlpUpdateVarLoose( 1212 SCIP_LP* lp, /**< current LP data */ 1213 SCIP_SET* set, /**< global SCIP settings */ 1214 SCIP_VAR* var /**< problem variable that changed from COLUMN to LOOSE */ 1215 ); 1216 1217 /** decrease the number of loose variables by one */ 1218 void SCIPlpDecNLoosevars( 1219 SCIP_LP* lp /**< current LP data */ 1220 ); 1221 1222 /** stores the LP solution in the columns and rows */ 1223 SCIP_RETCODE SCIPlpGetSol( 1224 SCIP_LP* lp, /**< current LP data */ 1225 SCIP_SET* set, /**< global SCIP settings */ 1226 SCIP_STAT* stat, /**< problem statistics */ 1227 SCIP_Bool* primalfeasible, /**< pointer to store whether the solution is primal feasible, or NULL */ 1228 SCIP_Bool* dualfeasible /**< pointer to store whether the solution is dual feasible, or NULL */ 1229 ); 1230 1231 /** stores LP solution with infinite objective value in the columns and rows */ 1232 SCIP_RETCODE SCIPlpGetUnboundedSol( 1233 SCIP_LP* lp, /**< current LP data */ 1234 SCIP_SET* set, /**< global SCIP settings */ 1235 SCIP_STAT* stat, /**< problem statistics */ 1236 SCIP_Bool* primalfeasible, /**< pointer to store whether the solution is primal feasible, or NULL */ 1237 SCIP_Bool* rayfeasible /**< pointer to store whether the primal ray is a feasible unboundedness proof, or NULL */ 1238 ); 1239 1240 /** returns primal ray proving the unboundedness of the current LP */ 1241 SCIP_RETCODE SCIPlpGetPrimalRay( 1242 SCIP_LP* lp, /**< current LP data */ 1243 SCIP_SET* set, /**< global SCIP settings */ 1244 SCIP_Real* ray /**< array for storing primal ray values, they are stored w.r.t. the problem index of the variables, 1245 * so the size of this array should be at least number of active variables 1246 * (all entries have to be initialized to 0 before) */ 1247 ); 1248 1249 /** stores the dual Farkas multipliers for infeasibility proof in rows. besides, the proof is checked for validity if 1250 * lp/checkfarkas = TRUE. 1251 * 1252 * @note the check will not be performed if @p valid is NULL. 1253 */ 1254 SCIP_RETCODE SCIPlpGetDualfarkas( 1255 SCIP_LP* lp, /**< current LP data */ 1256 SCIP_SET* set, /**< global SCIP settings */ 1257 SCIP_STAT* stat, /**< problem statistics */ 1258 SCIP_Bool* valid /**< pointer to store whether the Farkas proof is valid or NULL */ 1259 ); 1260 1261 /** get number of iterations used in last LP solve */ 1262 SCIP_RETCODE SCIPlpGetIterations( 1263 SCIP_LP* lp, /**< current LP data */ 1264 int* iterations /**< pointer to store the iteration count */ 1265 ); 1266 1267 /** increases age of columns with solution value 0.0 and rows with activity not at its bounds, 1268 * resets age of non-zero columns and sharp rows 1269 */ 1270 SCIP_RETCODE SCIPlpUpdateAges( 1271 SCIP_LP* lp, /**< current LP data */ 1272 SCIP_STAT* stat /**< problem statistics */ 1273 ); 1274 1275 /** removes all non-basic columns and basic rows in the part of the LP created at the current node, that are too old */ 1276 SCIP_RETCODE SCIPlpRemoveNewObsoletes( 1277 SCIP_LP* lp, /**< current LP data */ 1278 BMS_BLKMEM* blkmem, /**< block memory buffers */ 1279 SCIP_SET* set, /**< global SCIP settings */ 1280 SCIP_STAT* stat, /**< problem statistics */ 1281 SCIP_EVENTQUEUE* eventqueue, /**< event queue */ 1282 SCIP_EVENTFILTER* eventfilter /**< global event filter */ 1283 ); 1284 1285 /** removes all non-basic columns and basic rows in whole LP, that are too old */ 1286 SCIP_RETCODE SCIPlpRemoveAllObsoletes( 1287 SCIP_LP* lp, /**< current LP data */ 1288 BMS_BLKMEM* blkmem, /**< block memory buffers */ 1289 SCIP_SET* set, /**< global SCIP settings */ 1290 SCIP_STAT* stat, /**< problem statistics */ 1291 SCIP_EVENTQUEUE* eventqueue, /**< event queue */ 1292 SCIP_EVENTFILTER* eventfilter /**< global event filter */ 1293 ); 1294 1295 /** removes all non-basic columns at 0.0 and basic rows in the part of the LP created at the current node */ 1296 SCIP_RETCODE SCIPlpCleanupNew( 1297 SCIP_LP* lp, /**< current LP data */ 1298 BMS_BLKMEM* blkmem, /**< block memory buffers */ 1299 SCIP_SET* set, /**< global SCIP settings */ 1300 SCIP_STAT* stat, /**< problem statistics */ 1301 SCIP_EVENTQUEUE* eventqueue, /**< event queue */ 1302 SCIP_EVENTFILTER* eventfilter, /**< global event filter */ 1303 SCIP_Bool root /**< are we at the root node? */ 1304 ); 1305 1306 /** removes all non-basic columns at 0.0 and basic rows in the whole LP */ 1307 SCIP_RETCODE SCIPlpCleanupAll( 1308 SCIP_LP* lp, /**< current LP data */ 1309 BMS_BLKMEM* blkmem, /**< block memory buffers */ 1310 SCIP_SET* set, /**< global SCIP settings */ 1311 SCIP_STAT* stat, /**< problem statistics */ 1312 SCIP_EVENTQUEUE* eventqueue, /**< event queue */ 1313 SCIP_EVENTFILTER* eventfilter, /**< global event filter */ 1314 SCIP_Bool root /**< are we at the root node? */ 1315 ); 1316 1317 /** removes all redundant rows that were added at the current node */ 1318 SCIP_RETCODE SCIPlpRemoveRedundantRows( 1319 SCIP_LP* lp, /**< current LP data */ 1320 BMS_BLKMEM* blkmem, /**< block memory buffers */ 1321 SCIP_SET* set, /**< global SCIP settings */ 1322 SCIP_STAT* stat, /**< problem statistics */ 1323 SCIP_EVENTQUEUE* eventqueue, /**< event queue */ 1324 SCIP_EVENTFILTER* eventfilter /**< global event filter */ 1325 ); 1326 1327 /** initiates LP diving */ 1328 SCIP_RETCODE SCIPlpStartDive( 1329 SCIP_LP* lp, /**< current LP data */ 1330 BMS_BLKMEM* blkmem, /**< block memory */ 1331 SCIP_SET* set, /**< global SCIP settings */ 1332 SCIP_STAT* stat /**< problem statistics */ 1333 ); 1334 1335 /** quits LP diving and resets bounds and objective values of columns to the current node's values */ 1336 SCIP_RETCODE SCIPlpEndDive( 1337 SCIP_LP* lp, /**< current LP data */ 1338 BMS_BLKMEM* blkmem, /**< block memory */ 1339 SCIP_SET* set, /**< global SCIP settings */ 1340 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */ 1341 SCIP_STAT* stat, /**< problem statistics */ 1342 SCIP_EVENTQUEUE* eventqueue, /**< event queue */ 1343 SCIP_EVENTFILTER* eventfilter, /**< global event filter */ 1344 SCIP_PROB* prob, /**< problem data */ 1345 SCIP_VAR** vars, /**< array with all active variables */ 1346 int nvars /**< number of active variables */ 1347 ); 1348 1349 /** records a current row side such that any change will be undone after diving */ 1350 SCIP_RETCODE SCIPlpRecordOldRowSideDive( 1351 SCIP_LP* lp, /**< LP data object */ 1352 SCIP_ROW* row, /**< row affected by the change */ 1353 SCIP_SIDETYPE sidetype /**< side type */ 1354 ); 1355 1356 /** informs the LP that probing mode was initiated */ 1357 SCIP_RETCODE SCIPlpStartProbing( 1358 SCIP_LP* lp /**< current LP data */ 1359 ); 1360 1361 /** informs the LP that probing mode was finished */ 1362 SCIP_RETCODE SCIPlpEndProbing( 1363 SCIP_LP* lp /**< current LP data */ 1364 ); 1365 1366 /** informs the LP that the probing mode is now used for strongbranching */ 1367 void SCIPlpStartStrongbranchProbing( 1368 SCIP_LP* lp /**< current LP data */ 1369 ); 1370 1371 /** informs the LP that the probing mode is not used for strongbranching anymore */ 1372 void SCIPlpEndStrongbranchProbing( 1373 SCIP_LP* lp /**< current LP data */ 1374 ); 1375 1376 /** gets proven lower (dual) bound of last LP solution */ 1377 SCIP_RETCODE SCIPlpGetProvedLowerbound( 1378 SCIP_LP* lp, /**< current LP data */ 1379 SCIP_SET* set, /**< global SCIP settings */ 1380 SCIP_Real* bound /**< pointer to store proven dual bound */ 1381 ); 1382 1383 /** gets proven dual bound of last LP solution */ 1384 SCIP_RETCODE SCIPlpIsInfeasibilityProved( 1385 SCIP_LP* lp, /**< current LP data */ 1386 SCIP_SET* set, /**< global SCIP settings */ 1387 SCIP_Bool* proved /**< pointer to store whether infeasibility is proven */ 1388 ); 1389 1390 /** writes LP to a file */ 1391 SCIP_RETCODE SCIPlpWrite( 1392 SCIP_LP* lp, /**< current LP data */ 1393 const char* fname /**< file name */ 1394 ); 1395 1396 /** writes MIP to a file */ 1397 SCIP_RETCODE SCIPlpWriteMip( 1398 SCIP_LP* lp, /**< current LP data */ 1399 SCIP_SET* set, /**< global SCIP settings */ 1400 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */ 1401 const char* fname, /**< file name */ 1402 SCIP_Bool genericnames, /**< should generic names like x_i and row_j be used in order to avoid 1403 * troubles with reserved symbols? */ 1404 SCIP_Bool origobj, /**< should the original objective function be used? */ 1405 SCIP_OBJSENSE objsense, /**< objective sense */ 1406 SCIP_Real objscale, /**< objective scaling factor */ 1407 SCIP_Real objoffset, /**< objective offset, e.g., caused by variable fixings in presolving */ 1408 SCIP_Bool lazyconss /**< output removable rows as lazy constraints? */ 1409 ); 1410 1411 /** recalculates Euclidean norm of objective function vector of column variables if it have gotten unreliable during calculation */ 1412 void SCIPlpRecalculateObjSqrNorm( 1413 SCIP_SET* set, /**< global SCIP settings */ 1414 SCIP_LP* lp /**< LP data */ 1415 ); 1416 1417 /** compute relative interior point */ 1418 SCIP_RETCODE SCIPlpComputeRelIntPoint( 1419 SCIP_SET* set, /**< global SCIP settings */ 1420 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */ 1421 SCIP_LP* lp, /**< LP data */ 1422 SCIP_PROB* prob, /**< problem data */ 1423 SCIP_Bool relaxrows, /**< should the rows be relaxed */ 1424 SCIP_Bool inclobjcutoff, /**< should a row for the objective cutoff be included */ 1425 SCIP_Real timelimit, /**< time limit for LP solver */ 1426 int iterlimit, /**< iteration limit for LP solver */ 1427 SCIP_Real* point, /**< array to store relative interior point on exit */ 1428 SCIP_Bool* success /**< buffer to indicate whether interior point was successfully computed */ 1429 ); 1430 1431 /** computes two measures for dual degeneracy (dual degeneracy rate and variable-constraint ratio) 1432 * based on the changes applied when reducing the problem to the optimal face 1433 * 1434 * returns the dual degeneracy rate, i.e., the share of nonbasic variables with reduced cost 0 1435 * and the variable-constraint ratio, i.e., the number of unfixed variables in relation to the basis size 1436 */ 1437 SCIP_RETCODE SCIPlpGetDualDegeneracy( 1438 SCIP_LP* lp, /**< LP data */ 1439 SCIP_SET* set, /**< global SCIP settings */ 1440 SCIP_STAT* stat, /**< problem statistics */ 1441 SCIP_Real* degeneracy, /**< pointer to store the dual degeneracy rate */ 1442 SCIP_Real* varconsratio /**< pointer to store the variable-constraint ratio */ 1443 ); 1444 1445 /** gets array with columns of the LP */ 1446 SCIP_COL** SCIPlpGetCols( 1447 SCIP_LP* lp /**< current LP data */ 1448 ); 1449 1450 /** gets current number of columns in LP */ 1451 int SCIPlpGetNCols( 1452 SCIP_LP* lp /**< current LP data */ 1453 ); 1454 1455 /** gets current number of unfixed columns in LP */ 1456 int SCIPlpGetNUnfixedCols( 1457 SCIP_LP* lp, /**< current LP data */ 1458 SCIP_Real eps /**< numerical tolerance */ 1459 ); 1460 1461 /** gets array with rows of the LP */ 1462 SCIP_ROW** SCIPlpGetRows( 1463 SCIP_LP* lp /**< current LP data */ 1464 ); 1465 1466 /** gets current number of rows in LP */ 1467 int SCIPlpGetNRows( 1468 SCIP_LP* lp /**< current LP data */ 1469 ); 1470 1471 /** gets array with newly added columns after the last mark */ 1472 SCIP_COL** SCIPlpGetNewcols( 1473 SCIP_LP* lp /**< current LP data */ 1474 ); 1475 1476 /** gets number of newly added columns after the last mark */ 1477 int SCIPlpGetNNewcols( 1478 SCIP_LP* lp /**< current LP data */ 1479 ); 1480 1481 /** gets array with newly added rows after the last mark */ 1482 SCIP_ROW** SCIPlpGetNewrows( 1483 SCIP_LP* lp /**< current LP data */ 1484 ); 1485 1486 /** gets number of newly added rows after the last mark */ 1487 int SCIPlpGetNNewrows( 1488 SCIP_LP* lp /**< current LP data */ 1489 ); 1490 1491 /** gets Euclidean norm of objective function vector of column variables, only use this method if 1492 * lp->objsqrnormunreliable == FALSE, so probably you have to call SCIPlpRecalculateObjSqrNorm before */ 1493 SCIP_Real SCIPlpGetObjNorm( 1494 SCIP_LP* lp /**< LP data */ 1495 ); 1496 1497 /** gets the objective value of the root node LP; returns SCIP_INVALID if the root node LP was not (yet) solved */ 1498 SCIP_Real SCIPlpGetRootObjval( 1499 SCIP_LP* lp /**< LP data */ 1500 ); 1501 1502 /** gets part of the objective value of the root node LP that results from COLUMN variables only; 1503 * returns SCIP_INVALID if the root node LP was not (yet) solved 1504 */ 1505 SCIP_Real SCIPlpGetRootColumnObjval( 1506 SCIP_LP* lp /**< LP data */ 1507 ); 1508 1509 /** gets part of the objective value of the root node LP that results from LOOSE variables only; 1510 * returns SCIP_INVALID if the root node LP was not (yet) solved 1511 */ 1512 SCIP_Real SCIPlpGetRootLooseObjval( 1513 SCIP_LP* lp /**< LP data */ 1514 ); 1515 1516 /** gets the LP solver interface */ 1517 SCIP_LPI* SCIPlpGetLPI( 1518 SCIP_LP* lp /**< current LP data */ 1519 ); 1520 1521 /** sets whether the current lp is a relaxation of the current problem and its optimal objective value is a local lower bound */ 1522 void SCIPlpSetIsRelax( 1523 SCIP_LP* lp, /**< LP data */ 1524 SCIP_Bool relax /**< is the current lp a relaxation? */ 1525 ); 1526 1527 /** returns whether the current LP is a relaxation of the problem for which it has been solved and its 1528 * solution value a valid local lower bound? 1529 */ 1530 SCIP_Bool SCIPlpIsRelax( 1531 SCIP_LP* lp /**< LP data */ 1532 ); 1533 1534 /** returns whether the current LP is flushed and solved */ 1535 SCIP_Bool SCIPlpIsSolved( 1536 SCIP_LP* lp /**< current LP data */ 1537 ); 1538 1539 /** return whether the current LP solution passed the primal feasibility check */ 1540 SCIP_Bool SCIPlpIsPrimalReliable( 1541 SCIP_LP* lp /**< current LP data */ 1542 ); 1543 1544 /** return whether the current LP solution passed the dual feasibility check */ 1545 SCIP_Bool SCIPlpIsDualReliable( 1546 SCIP_LP* lp /**< current LP data */ 1547 ); 1548 1549 /** returns whether the current LP solution is a basic solution */ 1550 SCIP_Bool SCIPlpIsSolBasic( 1551 SCIP_LP* lp /**< current LP data */ 1552 ); 1553 1554 /** returns whether the LP is in diving mode */ 1555 SCIP_Bool SCIPlpDiving( 1556 SCIP_LP* lp /**< current LP data */ 1557 ); 1558 1559 /** returns whether the LP is in diving mode and the objective value of at least one column was changed */ 1560 SCIP_Bool SCIPlpDivingObjChanged( 1561 SCIP_LP* lp /**< current LP data */ 1562 ); 1563 1564 /** marks the diving LP to have a changed objective function */ 1565 void SCIPlpMarkDivingObjChanged( 1566 SCIP_LP* lp /**< current LP data */ 1567 ); 1568 1569 /** marks the diving LP to not have a changed objective function anymore */ 1570 void SCIPlpUnmarkDivingObjChanged( 1571 SCIP_LP* lp /**< current LP data */ 1572 ); 1573 1574 /* returns TRUE if at least one left/right hand side of an LP row was changed during diving mode */ 1575 SCIP_Bool SCIPlpDivingRowsChanged( 1576 SCIP_LP* lp /**< current LP data */ 1577 ); 1578 1579 /** checks, if absolute difference of values is in range of LP primal feastol */ 1580 SCIP_Bool SCIPlpIsFeasEQ( 1581 SCIP_SET* set, /**< global SCIP settings */ 1582 SCIP_LP* lp, /**< current LP data */ 1583 SCIP_Real val1, /**< first value to be compared */ 1584 SCIP_Real val2 /**< second value to be compared */ 1585 ); 1586 1587 /** checks, if absolute difference of val1 and val2 is lower than LP primal feastol */ 1588 SCIP_Bool SCIPlpIsFeasLT( 1589 SCIP_SET* set, /**< global SCIP settings */ 1590 SCIP_LP* lp, /**< current LP data */ 1591 SCIP_Real val1, /**< first value to be compared */ 1592 SCIP_Real val2 /**< second value to be compared */ 1593 ); 1594 1595 /** checks, if absolute difference of val1 and val2 is not greater than LP primal feastol */ 1596 SCIP_Bool SCIPlpIsFeasLE( 1597 SCIP_SET* set, /**< global SCIP settings */ 1598 SCIP_LP* lp, /**< current LP data */ 1599 SCIP_Real val1, /**< first value to be compared */ 1600 SCIP_Real val2 /**< second value to be compared */ 1601 ); 1602 1603 /** checks, if absolute difference of val1 and val2 is greater than LP primal feastol */ 1604 SCIP_Bool SCIPlpIsFeasGT( 1605 SCIP_SET* set, /**< global SCIP settings */ 1606 SCIP_LP* lp, /**< current LP data */ 1607 SCIP_Real val1, /**< first value to be compared */ 1608 SCIP_Real val2 /**< second value to be compared */ 1609 ); 1610 1611 /** checks, if absolute difference of val1 and val2 is not lower than -LP primal feastol */ 1612 SCIP_Bool SCIPlpIsFeasGE( 1613 SCIP_SET* set, /**< global SCIP settings */ 1614 SCIP_LP* lp, /**< current LP data */ 1615 SCIP_Real val1, /**< first value to be compared */ 1616 SCIP_Real val2 /**< second value to be compared */ 1617 ); 1618 1619 /** checks, if value is in range LP primal feasibility tolerance of 0.0 */ 1620 SCIP_Bool SCIPlpIsFeasZero( 1621 SCIP_LP* lp, /**< current LP data */ 1622 SCIP_Real val /**< value to be compared against zero */ 1623 ); 1624 1625 /** checks, if value is greater than LP primal feasibility tolerance */ 1626 SCIP_Bool SCIPlpIsFeasPositive( 1627 SCIP_LP* lp, /**< current LP data */ 1628 SCIP_Real val /**< value to be compared against zero */ 1629 ); 1630 1631 /** checks, if value is lower than -LP primal feasibility tolerance */ 1632 SCIP_Bool SCIPlpIsFeasNegative( 1633 SCIP_LP* lp, /**< current LP data */ 1634 SCIP_Real val /**< value to be compared against zero */ 1635 ); 1636 1637 1638 #ifdef NDEBUG 1639 1640 /* In optimized mode, the function calls are overwritten by defines to reduce the number of function calls and 1641 * speed up the algorithms. 1642 */ 1643 1644 #define SCIPlpGetCols(lp) ((lp)->cols) 1645 #define SCIPlpGetNCols(lp) ((lp)->ncols) 1646 #define SCIPlpGetRows(lp) ((lp)->rows) 1647 #define SCIPlpGetNRows(lp) ((lp)->nrows) 1648 #define SCIPlpGetNewcols(lp) (&((lp)->cols[(lp)->firstnewcol])) 1649 #define SCIPlpGetNNewcols(lp) ((lp)->ncols - (lp)->firstnewcol) 1650 #define SCIPlpGetNewrows(lp) (&((lp)->rows[(lp)->firstnewrow])) 1651 #define SCIPlpGetNNewrows(lp) ((lp)->nrows - (lp)->firstnewrow) 1652 #define SCIPlpGetObjNorm(lp) (SQRT((lp)->objsqrnorm)) 1653 #define SCIPlpGetRootObjval(lp) (MIN((lp)->rootlpobjval + (lp)->rootlooseobjval, SCIP_INVALID)) 1654 #define SCIPlpGetRootColumnObjval(lp) ((lp)->rootlpobjval) 1655 #define SCIPlpGetRootLooseObjval(lp) ((lp)->rootlooseobjval) 1656 #define SCIPlpGetLPI(lp) (lp)->lpi 1657 #define SCIPlpSetIsRelax(lp,relax) ((lp)->isrelax = relax) 1658 #define SCIPlpIsRelax(lp) (lp)->isrelax 1659 #define SCIPlpIsSolved(lp) ((lp)->flushed && (lp)->solved) 1660 #define SCIPlpIsSolBasic(lp) ((lp)->solisbasic) 1661 #define SCIPlpDiving(lp) (lp)->diving 1662 #define SCIPlpDivingObjChanged(lp) (lp)->divingobjchg 1663 #define SCIPlpMarkDivingObjChanged(lp) ((lp)->divingobjchg = TRUE) 1664 #define SCIPlpUnmarkDivingObjChanged(lp) ((lp)->divingobjchg = FALSE) 1665 #define SCIPlpDivingRowsChanged(lp) ((lp)->ndivechgsides > 0) 1666 1667 #define SCIPlpIsFeasEQ(set, lp, val1, val2) ( EPSEQ(val1, val2, (lp)->feastol) ) 1668 #define SCIPlpIsFeasLT(set, lp, val1, val2) ( EPSLT(val1, val2, (lp)->feastol) ) 1669 #define SCIPlpIsFeasLE(set, lp, val1, val2) ( EPSLE(val1, val2, (lp)->feastol) ) 1670 #define SCIPlpIsFeasGT(set, lp, val1, val2) ( EPSGT(val1, val2, (lp)->feastol) ) 1671 #define SCIPlpIsFeasGE(set, lp, val1, val2) ( EPSGE(val1, val2, (lp)->feastol) ) 1672 #define SCIPlpIsFeasZero(lp, val) ( EPSZ(val, (lp)->feastol) ) 1673 #define SCIPlpIsFeasPositive(lp, val) ( EPSP(val, (lp)->feastol) ) 1674 #define SCIPlpIsFeasNegative(lp, val) ( EPSN(val, (lp)->feastol) ) 1675 1676 #endif 1677 1678 #ifdef __cplusplus 1679 } 1680 #endif 1681 1682 #endif 1683