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 prob.h 26 * @ingroup INTERNALAPI 27 * @brief internal methods for storing and manipulating the main problem 28 * @author Tobias Achterberg 29 */ 30 31 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/ 32 33 #ifndef __SCIP_PROB_H__ 34 #define __SCIP_PROB_H__ 35 36 37 #include "scip/def.h" 38 #include "blockmemshell/memory.h" 39 #include "scip/type_retcode.h" 40 #include "scip/type_set.h" 41 #include "scip/type_stat.h" 42 #include "scip/type_event.h" 43 #include "scip/type_lp.h" 44 #include "scip/type_var.h" 45 #include "scip/type_implics.h" 46 #include "scip/type_prob.h" 47 #include "scip/type_primal.h" 48 #include "scip/type_tree.h" 49 #include "scip/type_reopt.h" 50 #include "scip/type_branch.h" 51 #include "scip/type_cons.h" 52 #include "scip/type_conflictstore.h" 53 54 #include "scip/struct_prob.h" 55 56 #ifdef __cplusplus 57 extern "C" { 58 #endif 59 60 /* 61 * problem creation 62 */ 63 64 /** creates problem data structure by copying the source problem; 65 * If the problem type requires the use of variable pricers, these pricers should be activated with calls 66 * to SCIPactivatePricer(). These pricers are automatically deactivated, when the problem is freed. 67 */ 68 SCIP_RETCODE SCIPprobCopy( 69 SCIP_PROB** prob, /**< pointer to problem data structure */ 70 BMS_BLKMEM* blkmem, /**< block memory */ 71 SCIP_SET* set, /**< global SCIP settings */ 72 const char* name, /**< problem name */ 73 SCIP* sourcescip, /**< source SCIP data structure */ 74 SCIP_PROB* sourceprob, /**< source problem structure */ 75 SCIP_HASHMAP* varmap, /**< a hashmap to store the mapping of source variables corresponding 76 * target variables, or NULL */ 77 SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding 78 * target constraints, or NULL */ 79 SCIP_Bool original, /**< copy original or transformed problem? */ 80 SCIP_Bool global /**< create a global or a local copy? */ 81 ); 82 83 /** creates problem data structure 84 * If the problem type requires the use of variable pricers, these pricers should be activated with calls 85 * to SCIPactivatePricer(). These pricers are automatically deactivated, when the problem is freed. 86 */ 87 SCIP_RETCODE SCIPprobCreate( 88 SCIP_PROB** prob, /**< pointer to problem data structure */ 89 BMS_BLKMEM* blkmem, /**< block memory */ 90 SCIP_SET* set, /**< global SCIP settings */ 91 const char* name, /**< problem name */ 92 SCIP_DECL_PROBDELORIG ((*probdelorig)), /**< frees user data of original problem */ 93 SCIP_DECL_PROBTRANS ((*probtrans)), /**< creates user data of transformed problem by transforming original user data */ 94 SCIP_DECL_PROBDELTRANS((*probdeltrans)), /**< frees user data of transformed problem */ 95 SCIP_DECL_PROBINITSOL ((*probinitsol)), /**< solving process initialization method of transformed data */ 96 SCIP_DECL_PROBEXITSOL ((*probexitsol)), /**< solving process deinitialization method of transformed data */ 97 SCIP_DECL_PROBCOPY ((*probcopy)), /**< copies user data if you want to copy it to a subscip, or NULL */ 98 SCIP_PROBDATA* probdata, /**< user problem data set by the reader */ 99 SCIP_Bool transformed /**< is this the transformed problem? */ 100 ); 101 102 /** sets callback to free user data of original problem */ 103 void SCIPprobSetDelorig( 104 SCIP_PROB* prob, /**< problem */ 105 SCIP_DECL_PROBDELORIG ((*probdelorig)) /**< frees user data of original problem */ 106 ); 107 108 /** sets callback to create user data of transformed problem by transforming original user data */ 109 void SCIPprobSetTrans( 110 SCIP_PROB* prob, /**< problem */ 111 SCIP_DECL_PROBTRANS ((*probtrans)) /**< creates user data of transformed problem by transforming original user data */ 112 ); 113 114 /** sets callback to free user data of transformed problem */ 115 void SCIPprobSetDeltrans( 116 SCIP_PROB* prob, /**< problem */ 117 SCIP_DECL_PROBDELTRANS((*probdeltrans)) /**< frees user data of transformed problem */ 118 ); 119 120 /** sets solving process initialization callback of transformed data */ 121 void SCIPprobSetInitsol( 122 SCIP_PROB* prob, /**< problem */ 123 SCIP_DECL_PROBINITSOL ((*probinitsol)) /**< solving process initialization callback of transformed data */ 124 ); 125 126 /** sets solving process deinitialization callback of transformed data */ 127 void SCIPprobSetExitsol( 128 SCIP_PROB* prob, /**< problem */ 129 SCIP_DECL_PROBEXITSOL ((*probexitsol)) /**< solving process deinitialization callback of transformed data */ 130 ); 131 132 /** sets callback to copy user data to copy it to a subscip, or NULL */ 133 void SCIPprobSetCopy( 134 SCIP_PROB* prob, /**< problem */ 135 SCIP_DECL_PROBCOPY ((*probcopy)) /**< copies user data if you want to copy it to a subscip, or NULL */ 136 ); 137 138 /** frees problem data structure */ 139 SCIP_RETCODE SCIPprobFree( 140 SCIP_PROB** prob, /**< pointer to problem data structure */ 141 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */ 142 BMS_BLKMEM* blkmem, /**< block memory buffer */ 143 SCIP_SET* set, /**< global SCIP settings */ 144 SCIP_STAT* stat, /**< dynamic problem statistics */ 145 SCIP_EVENTQUEUE* eventqueue, /**< event queue */ 146 SCIP_LP* lp /**< current LP data (or NULL, if it's the original problem) */ 147 ); 148 149 /** transform problem data into normalized form */ 150 SCIP_RETCODE SCIPprobTransform( 151 SCIP_PROB* source, /**< problem to transform */ 152 BMS_BLKMEM* blkmem, /**< block memory buffer */ 153 SCIP_SET* set, /**< global SCIP settings */ 154 SCIP_STAT* stat, /**< problem statistics */ 155 SCIP_PRIMAL* primal, /**< primal data */ 156 SCIP_TREE* tree, /**< branch and bound tree */ 157 SCIP_REOPT* reopt, /**< reoptimization data structure */ 158 SCIP_LP* lp, /**< current LP data */ 159 SCIP_BRANCHCAND* branchcand, /**< branching candidate storage */ 160 SCIP_EVENTFILTER* eventfilter, /**< event filter for global (not variable dependent) events */ 161 SCIP_EVENTQUEUE* eventqueue, /**< event queue */ 162 SCIP_CONFLICTSTORE* conflictstore, /**< conflict store */ 163 SCIP_PROB** target /**< pointer to target problem data structure */ 164 ); 165 166 /** resets the global and local bounds of original variables in original problem to their original values */ 167 SCIP_RETCODE SCIPprobResetBounds( 168 SCIP_PROB* prob, /**< original problem data */ 169 BMS_BLKMEM* blkmem, /**< block memory */ 170 SCIP_SET* set, /**< global SCIP settings */ 171 SCIP_STAT* stat /**< problem statistics */ 172 ); 173 174 /** (Re)Sort the variables, which appear in the four categories (binary, integer, implicit, continuous) after presolve 175 * with respect to their original index (within their categories). Adjust the problem index afterwards which is 176 * supposed to reflect the position in the variable array. This additional (re)sorting is supposed to get more robust 177 * against the order presolving fixed variables. (We also reobtain a possible block structure induced by the user 178 * model) 179 */ 180 void SCIPprobResortVars( 181 SCIP_PROB* prob /**< problem data */ 182 ); 183 184 /** possibly create and sort the constraints according to check priorties */ 185 SCIP_RETCODE SCIPprobSortConssCheck( 186 SCIP_PROB* prob /**< problem data */ 187 ); 188 189 /* 190 * problem modification 191 */ 192 193 /** sets user problem data */ 194 void SCIPprobSetData( 195 SCIP_PROB* prob, /**< problem */ 196 SCIP_PROBDATA* probdata /**< user problem data to use */ 197 ); 198 199 /** adds variable's name to the namespace */ 200 SCIP_RETCODE SCIPprobAddVarName( 201 SCIP_PROB* prob, /**< problem data */ 202 SCIP_VAR* var /**< variable */ 203 ); 204 205 /** removes variable's name from the namespace */ 206 SCIP_RETCODE SCIPprobRemoveVarName( 207 SCIP_PROB* prob, /**< problem data */ 208 SCIP_VAR* var /**< variable */ 209 ); 210 211 /** adds variable to the problem and captures it */ 212 SCIP_RETCODE SCIPprobAddVar( 213 SCIP_PROB* prob, /**< problem data */ 214 BMS_BLKMEM* blkmem, /**< block memory buffers */ 215 SCIP_SET* set, /**< global SCIP settings */ 216 SCIP_LP* lp, /**< current LP data */ 217 SCIP_BRANCHCAND* branchcand, /**< branching candidate storage */ 218 SCIP_EVENTFILTER* eventfilter, /**< event filter for global (not variable dependent) events */ 219 SCIP_EVENTQUEUE* eventqueue, /**< event queue */ 220 SCIP_VAR* var /**< variable to add */ 221 ); 222 223 /** marks variable to be removed from the problem; however, the variable is NOT removed from the constraints */ 224 SCIP_RETCODE SCIPprobDelVar( 225 SCIP_PROB* prob, /**< problem data */ 226 BMS_BLKMEM* blkmem, /**< block memory */ 227 SCIP_SET* set, /**< global SCIP settings */ 228 SCIP_EVENTQUEUE* eventqueue, /**< event queue */ 229 SCIP_VAR* var, /**< problem variable */ 230 SCIP_Bool* deleted /**< pointer to store whether marking variable to be deleted was successful */ 231 ); 232 233 /** actually removes the deleted variables from the problem and releases them */ 234 SCIP_RETCODE SCIPprobPerformVarDeletions( 235 SCIP_PROB* prob, /**< problem data */ 236 BMS_BLKMEM* blkmem, /**< block memory */ 237 SCIP_SET* set, /**< global SCIP settings */ 238 SCIP_STAT* stat, /**< dynamic problem statistics */ 239 SCIP_EVENTQUEUE* eventqueue, /**< event queue */ 240 SCIP_CLIQUETABLE* cliquetable, /**< clique table data structure */ 241 SCIP_LP* lp, /**< current LP data (may be NULL) */ 242 SCIP_BRANCHCAND* branchcand /**< branching candidate storage */ 243 ); 244 245 /** changes the type of a variable in the problem */ 246 SCIP_RETCODE SCIPprobChgVarType( 247 SCIP_PROB* prob, /**< problem data */ 248 BMS_BLKMEM* blkmem, /**< block memory */ 249 SCIP_SET* set, /**< global SCIP settings */ 250 SCIP_PRIMAL* primal, /**< primal data */ 251 SCIP_LP* lp, /**< current LP data */ 252 SCIP_BRANCHCAND* branchcand, /**< branching candidate storage */ 253 SCIP_EVENTQUEUE* eventqueue, /**< event queue */ 254 SCIP_CLIQUETABLE* cliquetable, /**< clique table data structure */ 255 SCIP_VAR* var, /**< variable to add */ 256 SCIP_VARTYPE vartype /**< new type of variable */ 257 ); 258 259 /** informs problem, that the given loose problem variable changed its status */ 260 SCIP_RETCODE SCIPprobVarChangedStatus( 261 SCIP_PROB* prob, /**< problem data */ 262 BMS_BLKMEM* blkmem, /**< block memory */ 263 SCIP_SET* set, /**< global SCIP settings */ 264 SCIP_BRANCHCAND* branchcand, /**< branching candidate storage */ 265 SCIP_CLIQUETABLE* cliquetable, /**< clique table data structure */ 266 SCIP_VAR* var /**< problem variable */ 267 ); 268 269 /** adds constraint's name to the namespace */ 270 SCIP_RETCODE SCIPprobAddConsName( 271 SCIP_PROB* prob, /**< problem data */ 272 SCIP_CONS* cons /**< constraint */ 273 ); 274 275 /** remove constraint's name from the namespace */ 276 SCIP_RETCODE SCIPprobRemoveConsName( 277 SCIP_PROB* prob, /**< problem data */ 278 SCIP_CONS* cons /**< constraint */ 279 ); 280 281 /** adds constraint to the problem and captures it; 282 * a local constraint is automatically upgraded into a global constraint 283 */ 284 SCIP_RETCODE SCIPprobAddCons( 285 SCIP_PROB* prob, /**< problem data */ 286 SCIP_SET* set, /**< global SCIP settings */ 287 SCIP_STAT* stat, /**< dynamic problem statistics */ 288 SCIP_CONS* cons /**< constraint to add */ 289 ); 290 291 /** releases and removes constraint from the problem; if the user has not captured the constraint for his own use, the 292 * constraint may be invalid after the call 293 */ 294 SCIP_RETCODE SCIPprobDelCons( 295 SCIP_PROB* prob, /**< problem data */ 296 BMS_BLKMEM* blkmem, /**< block memory */ 297 SCIP_SET* set, /**< global SCIP settings */ 298 SCIP_STAT* stat, /**< dynamic problem statistics */ 299 SCIP_CONS* cons /**< constraint to remove */ 300 ); 301 302 /** remembers the current number of constraints in the problem's internal data structure 303 * - resets maximum number of constraints to current number of constraints 304 * - remembers current number of constraints as starting number of constraints 305 */ 306 void SCIPprobMarkNConss( 307 SCIP_PROB* prob /**< problem data */ 308 ); 309 310 /** sets objective sense: minimization or maximization */ 311 void SCIPprobSetObjsense( 312 SCIP_PROB* prob, /**< problem data */ 313 SCIP_OBJSENSE objsense /**< new objective sense */ 314 ); 315 316 /** adds value to objective offset */ 317 void SCIPprobAddObjoffset( 318 SCIP_PROB* prob, /**< problem data */ 319 SCIP_Real addval /**< value to add to objective offset */ 320 ); 321 322 /** sets the dual bound on objective function */ 323 void SCIPprobSetDualbound( 324 SCIP_PROB* prob, /**< problem data */ 325 SCIP_Real dualbound /**< external dual bound */ 326 ); 327 328 /** sets limit on objective function, such that only solutions better than this limit are accepted */ 329 void SCIPprobSetObjlim( 330 SCIP_PROB* prob, /**< problem data */ 331 SCIP_Real objlim /**< external objective limit */ 332 ); 333 334 /** informs the problem, that its objective value is always integral in every feasible solution */ 335 void SCIPprobSetObjIntegral( 336 SCIP_PROB* prob /**< problem data */ 337 ); 338 339 /** sets integral objective value flag, if all variables with non-zero objective values are integral and have 340 * integral objective value and also updates the cutoff bound if primal solution is already known 341 */ 342 SCIP_RETCODE SCIPprobCheckObjIntegral( 343 SCIP_PROB* transprob, /**< tranformed problem data */ 344 SCIP_PROB* origprob, /**< original problem data */ 345 BMS_BLKMEM* blkmem, /**< block memory */ 346 SCIP_SET* set, /**< global SCIP settings */ 347 SCIP_STAT* stat, /**< problem statistics data */ 348 SCIP_PRIMAL* primal, /**< primal data */ 349 SCIP_TREE* tree, /**< branch and bound tree */ 350 SCIP_REOPT* reopt, /**< reoptimization data structure */ 351 SCIP_LP* lp, /**< current LP data */ 352 SCIP_EVENTFILTER* eventfilter, /**< event filter for global (not variable dependent) events */ 353 SCIP_EVENTQUEUE* eventqueue /**< event queue */ 354 ); 355 356 /** if possible, scales objective function such that it is integral with gcd = 1 */ 357 SCIP_RETCODE SCIPprobScaleObj( 358 SCIP_PROB* transprob, /**< tranformed problem data */ 359 SCIP_PROB* origprob, /**< original problem data */ 360 BMS_BLKMEM* blkmem, /**< block memory */ 361 SCIP_SET* set, /**< global SCIP settings */ 362 SCIP_STAT* stat, /**< problem statistics data */ 363 SCIP_PRIMAL* primal, /**< primal data */ 364 SCIP_TREE* tree, /**< branch and bound tree */ 365 SCIP_REOPT* reopt, /**< reoptimization data structure */ 366 SCIP_LP* lp, /**< current LP data */ 367 SCIP_EVENTFILTER* eventfilter, /**< event filter for global (not variable dependent) events */ 368 SCIP_EVENTQUEUE* eventqueue /**< event queue */ 369 ); 370 371 /** remembers the current solution as root solution in the problem variables */ 372 void SCIPprobStoreRootSol( 373 SCIP_PROB* prob, /**< problem data */ 374 SCIP_SET* set, /**< global SCIP settings */ 375 SCIP_STAT* stat, /**< SCIP statistics */ 376 SCIP_LP* lp, /**< current LP data */ 377 SCIP_Bool roothaslp /**< is the root solution from LP? */ 378 ); 379 380 /** remembers the best solution w.r.t. root reduced cost propagation as root solution in the problem variables */ 381 void SCIPprobUpdateBestRootSol( 382 SCIP_PROB* prob, /**< problem data */ 383 SCIP_SET* set, /**< global SCIP settings */ 384 SCIP_STAT* stat, /**< problem statistics */ 385 SCIP_LP* lp /**< current LP data */ 386 ); 387 388 /** informs problem, that the presolving process was finished, and updates all internal data structures */ 389 SCIP_RETCODE SCIPprobExitPresolve( 390 SCIP_PROB* prob, /**< problem data */ 391 SCIP_SET* set /**< global SCIP settings */ 392 ); 393 394 /** initializes problem for branch and bound process */ 395 SCIP_RETCODE SCIPprobInitSolve( 396 SCIP_PROB* prob, /**< problem data */ 397 SCIP_SET* set /**< global SCIP settings */ 398 ); 399 400 /** deinitializes problem after branch and bound process, and converts all COLUMN variables back into LOOSE variables */ 401 SCIP_RETCODE SCIPprobExitSolve( 402 SCIP_PROB* prob, /**< problem data */ 403 BMS_BLKMEM* blkmem, /**< block memory */ 404 SCIP_SET* set, /**< global SCIP settings */ 405 SCIP_EVENTQUEUE* eventqueue, /**< event queue */ 406 SCIP_LP* lp, /**< current LP data */ 407 SCIP_Bool restart /**< was this exit solve call triggered by a restart? */ 408 ); 409 410 411 412 413 /* 414 * problem information 415 */ 416 417 /** sets problem name */ 418 SCIP_RETCODE SCIPprobSetName( 419 SCIP_PROB* prob, /**< problem data */ 420 const char* name /**< name to be set */ 421 ); 422 423 /** returns the number of implicit binary variables, meaning variable of vartype != SCIP_VARTYPE_BINARY and != 424 * SCIP_VARTYPE_CONTINUOUS but with global bounds [0,1] 425 * 426 * @note this number needs to be computed, because it cannot be update like the othe counters for binary and interger 427 * variables, each time the variable type changes(, we would need to update this counter each time a global bound 428 * changes), even at the end of presolving this cannot be computed, because some variable can change to an 429 * implicit binary status 430 */ 431 int SCIPprobGetNImplBinVars( 432 SCIP_PROB* prob /**< problem data */ 433 ); 434 435 /** returns the number of variables with non-zero objective coefficient */ 436 int SCIPprobGetNObjVars( 437 SCIP_PROB* prob, /**< problem data */ 438 SCIP_SET* set /**< global SCIP settings */ 439 ); 440 441 /** returns the minimal absolute non-zero objective coefficient 442 * 443 * @note currently, this is only used for statistics and printed after the solving process. if this information is 444 * needed during the (pre)solving process this should be implemented more efficiently, e.g., updating the minimal 445 * absolute non-zero coefficient every time an objective coefficient has changed. 446 */ 447 SCIP_Real SCIPprobGetAbsMinObjCoef( 448 SCIP_PROB* prob, /**< problem data */ 449 SCIP_SET* set /**< global SCIP settings */ 450 ); 451 452 /** returns the maximal absolute non-zero objective coefficient 453 * 454 * @note currently, this is only used for statistics and printed after the solving process. if this information is 455 * needed during the (pre)solving process this should be implemented more efficiently, e.g., updating the maximal 456 * absolute non-zero coefficient every time an objective coefficient has changed. 457 */ 458 SCIP_Real SCIPprobGetAbsMaxObjCoef( 459 SCIP_PROB* prob, /**< problem data */ 460 SCIP_SET* set /**< global SCIP settings */ 461 ); 462 463 /** update the number of variables with non-zero objective coefficient */ 464 void SCIPprobUpdateNObjVars( 465 SCIP_PROB* prob, /**< problem data */ 466 SCIP_SET* set, /**< global SCIP settings */ 467 SCIP_Real oldobj, /**< old objective value for variable */ 468 SCIP_Real newobj /**< new objective value for variable */ 469 ); 470 471 /** update the dual bound if its better as the current one */ 472 void SCIPprobUpdateDualbound( 473 SCIP_PROB* prob, /**< problem data */ 474 SCIP_Real newbound /**< new dual bound for the node (if it's tighter than the old one) */ 475 ); 476 477 /** invalidates the dual bound */ 478 void SCIPprobInvalidateDualbound( 479 SCIP_PROB* prob /**< problem data */ 480 ); 481 482 /** returns the external value of the given internal objective value */ 483 SCIP_Real SCIPprobExternObjval( 484 SCIP_PROB* transprob, /**< tranformed problem data */ 485 SCIP_PROB* origprob, /**< original problem data */ 486 SCIP_SET* set, /**< global SCIP settings */ 487 SCIP_Real objval /**< internal objective value */ 488 ); 489 490 /** returns the internal value of the given external objective value */ 491 SCIP_Real SCIPprobInternObjval( 492 SCIP_PROB* transprob, /**< tranformed problem data */ 493 SCIP_PROB* origprob, /**< original problem data */ 494 SCIP_SET* set, /**< global SCIP settings */ 495 SCIP_Real objval /**< external objective value */ 496 ); 497 498 /** returns variable of the problem with given name */ 499 SCIP_VAR* SCIPprobFindVar( 500 SCIP_PROB* prob, /**< problem data */ 501 const char* name /**< name of variable to find */ 502 ); 503 504 /** returns constraint of the problem with given name */ 505 SCIP_CONS* SCIPprobFindCons( 506 SCIP_PROB* prob, /**< problem data */ 507 const char* name /**< name of variable to find */ 508 ); 509 510 /** displays current pseudo solution */ 511 void SCIPprobPrintPseudoSol( 512 SCIP_PROB* prob, /**< problem data */ 513 SCIP_SET* set, /**< global SCIP settings */ 514 SCIP_MESSAGEHDLR* messagehdlr /**< message handler */ 515 ); 516 517 /** outputs problem statistics */ 518 void SCIPprobPrintStatistics( 519 SCIP_PROB* prob, /**< problem data */ 520 SCIP_SET* set, /**< global SCIP settings */ 521 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */ 522 FILE* file /**< output file (or NULL for standard output) */ 523 ); 524 525 526 #ifndef NDEBUG 527 528 /* In debug mode, the following methods are implemented as function calls to ensure 529 * type validity. 530 */ 531 532 /** is the problem permuted */ 533 SCIP_Bool SCIPprobIsPermuted( 534 SCIP_PROB* prob 535 ); 536 537 /** mark the problem as permuted */ 538 void SCIPprobMarkPermuted( 539 SCIP_PROB* prob 540 ); 541 542 /** is the problem data transformed */ 543 SCIP_Bool SCIPprobIsTransformed( 544 SCIP_PROB* prob /**< problem data */ 545 ); 546 547 /** returns whether the objective value is known to be integral in every feasible solution */ 548 SCIP_Bool SCIPprobIsObjIntegral( 549 SCIP_PROB* prob /**< problem data */ 550 ); 551 552 /** returns TRUE iff all columns, i.e. every variable with non-empty column w.r.t. all ever created rows, are present 553 * in the LP, and FALSE, if there are additional already existing columns, that may be added to the LP in pricing 554 */ 555 SCIP_Bool SCIPprobAllColsInLP( 556 SCIP_PROB* prob, /**< problem data */ 557 SCIP_SET* set, /**< global SCIP settings */ 558 SCIP_LP* lp /**< current LP data */ 559 ); 560 561 /** gets limit on objective function in external space */ 562 SCIP_Real SCIPprobGetObjlim( 563 SCIP_PROB* prob, /**< problem data */ 564 SCIP_SET* set /**< global SCIP settings */ 565 ); 566 567 /** gets user problem data */ 568 SCIP_PROBDATA* SCIPprobGetData( 569 SCIP_PROB* prob /**< problem */ 570 ); 571 572 /** gets problem name */ 573 const char* SCIPprobGetName( 574 SCIP_PROB* prob /**< problem data */ 575 ); 576 577 /** gets number of problem variables */ 578 int SCIPprobGetNVars( 579 SCIP_PROB* prob /**< problem data */ 580 ); 581 582 /** gets number of binary problem variables */ 583 int SCIPprobGetNBinVars( 584 SCIP_PROB* prob /**< problem data */ 585 ); 586 587 /** gets number of integer problem variables */ 588 int SCIPprobGetNIntVars( 589 SCIP_PROB* prob /**< problem data */ 590 ); 591 592 /** gets number of implicit integer problem variables */ 593 int SCIPprobGetNImplVars( 594 SCIP_PROB* prob /**< problem data */ 595 ); 596 597 /** gets number of continuous problem variables */ 598 int SCIPprobGetNContVars( 599 SCIP_PROB* prob /**< problem data */ 600 ); 601 602 /** gets problem variables */ 603 SCIP_VAR** SCIPprobGetVars( 604 SCIP_PROB* prob /**< problem data */ 605 ); 606 607 /** gets number of problem constraints */ 608 int SCIPprobGetNConss( 609 SCIP_PROB* prob /**< problem data */ 610 ); 611 612 /** gets the objective offset */ 613 SCIP_Real SCIPprobGetObjoffset( 614 SCIP_PROB* prob /**< problem data */ 615 ); 616 617 /** gets the objective scalar */ 618 SCIP_Real SCIPprobGetObjscale( 619 SCIP_PROB* prob /**< problem data */ 620 ); 621 622 /** is constraint compression enabled for this problem? */ 623 SCIP_Bool SCIPprobIsConsCompressionEnabled( 624 SCIP_PROB* prob /**< problem data */ 625 ); 626 627 /** enable problem compression, i.e., constraints can reduce memory size by removing fixed variables during creation */ 628 void SCIPprobEnableConsCompression( 629 SCIP_PROB* prob /**< problem data */ 630 ); 631 632 #else 633 634 /* In optimized mode, the methods are implemented as defines to reduce the number of function calls and 635 * speed up the algorithms. 636 */ 637 638 #define SCIPprobIsPermuted(prob) ((prob)->permuted) 639 #define SCIPprobMarkPermuted(prob) ((prob)->permuted = TRUE) 640 #define SCIPprobIsTransformed(prob) ((prob)->transformed) 641 #define SCIPprobIsObjIntegral(prob) ((prob)->objisintegral) 642 #define SCIPprobAllColsInLP(prob,set,lp) (SCIPlpGetNCols(lp) == (prob)->ncolvars && (set)->nactivepricers == 0) 643 #define SCIPprobGetObjlim(prob,set) \ 644 ((prob)->objlim >= SCIP_INVALID ? (SCIP_Real)((prob)->objsense) * SCIPsetInfinity(set) : (prob)->objlim) 645 #define SCIPprobGetData(prob) ((prob)->probdata) 646 #define SCIPprobGetName(prob) ((prob)->name) 647 #define SCIPprobGetName(prob) ((prob)->name) 648 #define SCIPprobGetNVars(prob) ((prob)->nvars) 649 #define SCIPprobGetNBinVars(prob) ((prob)->nbinvars) 650 #define SCIPprobGetNIntVars(prob) ((prob)->nintvars) 651 #define SCIPprobGetNImplVars(prob) ((prob)->nimplvars) 652 #define SCIPprobGetNContVars(prob) ((prob)->ncontvars) 653 #define SCIPprobGetVars(prob) ((prob)->vars) 654 #define SCIPprobGetNConss(prob) ((prob)->nconss) 655 #define SCIPprobGetObjoffset(prob) ((prob)->objoffset) 656 #define SCIPprobGetObjscale(prob) ((prob)->objscale) 657 #define SCIPprobIsConsCompressionEnabled(prob) ((prob)->conscompression) 658 #define SCIPprobEnableConsCompression(prob) ((prob)->conscompression = TRUE) 659 #endif 660 661 662 #ifdef __cplusplus 663 } 664 #endif 665 666 #endif 667