SCIP

    Solving Constraint Integer Programs

    prob.c
    Go to the documentation of this file.
    1/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
    2/* */
    3/* This file is part of the program and library */
    4/* SCIP --- Solving Constraint Integer Programs */
    5/* */
    6/* Copyright (c) 2002-2026 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.c
    26 * @ingroup OTHER_CFILES
    27 * @brief Methods and datastructures 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#include "scip/branch.h"
    34#include "scip/conflictstore.h"
    35#include "scip/cons.h"
    36#include "scip/datatree.h"
    37#include "scip/event.h"
    38#include "scip/lp.h"
    39#include "scip/lpexact.h"
    40#include "scip/primal.h"
    41#include "scip/prob.h"
    42#include "scip/pub_cons.h"
    43#include "scip/pub_lp.h"
    44#include "scip/pub_message.h"
    45#include "scip/pub_misc.h"
    46#include "scip/pub_misc_sort.h"
    47#include "scip/pub_var.h"
    48#include "scip/rational.h"
    49#include "scip/set.h"
    50#include "scip/stat.h"
    51#include "scip/struct_cons.h"
    52#include "scip/struct_lp.h"
    53#include "scip/struct_prob.h"
    54#include "scip/struct_set.h"
    55#include "scip/struct_stat.h"
    56#include "scip/struct_var.h"
    57#include "scip/var.h"
    58#include <string.h>
    59
    60#define OBJSCALE_MAXDNOM 1000000LL /**< maximal denominator in objective integral scaling */
    61#define OBJSCALE_MAXSCALE 1000000.0 /**< maximal scalar to reach objective integrality */
    62#define OBJSCALE_MAXFINALSCALE 1000.0 /**< maximal final value to apply as scaling */
    63
    64
    65
    66/*
    67 * dymanic memory arrays
    68 */
    69
    70/** resizes vars array to be able to store at least num entries */
    71static
    73 SCIP_PROB* prob, /**< problem data */
    74 SCIP_SET* set, /**< global SCIP settings */
    75 int num /**< minimal number of slots in array */
    76 )
    77{
    78 assert(prob != NULL);
    79 assert(set != NULL);
    80
    81 if( num > prob->varssize )
    82 {
    83 int newsize;
    84
    85 newsize = SCIPsetCalcMemGrowSize(set, num);
    86 SCIP_ALLOC( BMSreallocMemoryArray(&prob->vars, newsize) );
    87 prob->varssize = newsize;
    88 }
    89 assert(num <= prob->varssize);
    90
    91 return SCIP_OKAY;
    92}
    93
    94/** resizes fixedvars array to be able to store at least num entries */
    95static
    97 SCIP_PROB* prob, /**< problem data */
    98 SCIP_SET* set, /**< global SCIP settings */
    99 int num /**< minimal number of slots in array */
    100 )
    101{
    102 assert(prob != NULL);
    103 assert(set != NULL);
    104
    105 if( num > prob->fixedvarssize )
    106 {
    107 int newsize;
    108
    109 newsize = SCIPsetCalcMemGrowSize(set, num);
    110 SCIP_ALLOC( BMSreallocMemoryArray(&prob->fixedvars, newsize) );
    111 prob->fixedvarssize = newsize;
    112 }
    113 assert(num <= prob->fixedvarssize);
    114
    115 return SCIP_OKAY;
    116}
    117
    118/** resizes deletedvars array to be able to store at least num entries */
    119static
    121 SCIP_PROB* prob, /**< problem data */
    122 SCIP_SET* set, /**< global SCIP settings */
    123 int num /**< minimal number of slots in array */
    124 )
    125{
    126 assert(prob != NULL);
    127 assert(set != NULL);
    128
    129 if( num > prob->deletedvarssize )
    130 {
    131 int newsize;
    132
    133 newsize = SCIPsetCalcMemGrowSize(set, num);
    134 SCIP_ALLOC( BMSreallocMemoryArray(&prob->deletedvars, newsize) );
    135 prob->deletedvarssize = newsize;
    136 }
    137 assert(num <= prob->deletedvarssize);
    138
    139 return SCIP_OKAY;
    140}
    141
    142/** resizes conss array to be able to store at least num entries */
    143static
    145 SCIP_PROB* prob, /**< problem data */
    146 SCIP_SET* set, /**< global SCIP settings */
    147 int num /**< minimal number of slots in array */
    148 )
    149{
    150 assert(prob != NULL);
    151 assert(set != NULL);
    152
    153 if( num > prob->consssize )
    154 {
    155 int newsize;
    156
    157 newsize = SCIPsetCalcMemGrowSize(set, num);
    158 SCIP_ALLOC( BMSreallocMemoryArray(&prob->conss, newsize) );
    159 /* resize sorted original constraints if they exist */
    160 if( prob->origcheckconss != NULL )
    161 {
    163 }
    164 prob->consssize = newsize;
    165 }
    166 assert(num <= prob->consssize);
    167
    168 return SCIP_OKAY;
    169}
    170
    171/** returns whether the constraint has a name */
    172static
    174 SCIP_CONS* cons /**< constraint */
    175 )
    176{
    177 const char* name;
    178
    179 name = SCIPconsGetName(cons);
    180
    181 return (name != NULL && name[0] != '\0');
    182}
    183
    184/** returns whether the variable has a name */
    185static
    187 SCIP_VAR* var /**< variable */
    188 )
    189{
    190 const char* name;
    191
    192 name = SCIPvarGetName(var);
    193
    194 return (name != NULL && name[0] != '\0');
    195}
    196
    197
    198
    199/*
    200 * problem creation
    201 */
    202
    203/** creates problem data structure by copying the source problem
    204 *
    205 * If the problem type requires the use of variable pricers, these pricers should be activated with calls
    206 * to SCIPactivatePricer(). These pricers are automatically deactivated, when the problem is freed.
    207 */
    209 SCIP_PROB** prob, /**< pointer to problem data structure */
    210 BMS_BLKMEM* blkmem, /**< block memory */
    211 SCIP_SET* set, /**< global SCIP settings */
    212 const char* name, /**< problem name */
    213 SCIP* sourcescip, /**< source SCIP data structure */
    214 SCIP_PROB* sourceprob, /**< source problem structure */
    215 SCIP_HASHMAP* varmap, /**< a hashmap to store the mapping of source variables corresponding
    216 * target variables */
    217 SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
    218 * target constraints */
    219 SCIP_Bool original, /**< copy original or transformed problem? */
    220 SCIP_Bool global /**< create a global or a local copy? */
    221 )
    222{
    223 SCIP_PROBDATA* targetdata = NULL;
    225
    226 assert(prob != NULL);
    227 assert(set != NULL);
    228 assert(blkmem != NULL);
    229 assert(sourcescip != NULL);
    230 assert(sourceprob != NULL);
    231 assert(varmap != NULL);
    232 assert(consmap != NULL);
    233
    234 /* create problem and initialize callbacks with NULL */
    235 SCIP_CALL( SCIPprobCreate(prob, blkmem, set, name, NULL, NULL, NULL, NULL, NULL, NULL, NULL, FALSE) );
    236
    237 /* call user copy callback method */
    238 if( sourceprob->probdata != NULL && sourceprob->probcopy != NULL )
    239 {
    240 SCIP_CALL( sourceprob->probcopy(set->scip, sourcescip, sourceprob->probdata, varmap, consmap, &targetdata, original, global, &result) );
    241
    242 /* evaluate result */
    243 if( result != SCIP_DIDNOTRUN && result != SCIP_SUCCESS )
    244 {
    245 SCIPerrorMessage("probdata copying method returned invalid result <%d>\n", result);
    246 return SCIP_INVALIDRESULT;
    247 }
    248
    249 assert(targetdata == NULL || result == SCIP_SUCCESS);
    250
    251 /* if copying was successful, add data and callbacks */
    252 if( result == SCIP_SUCCESS )
    253 {
    254 assert( targetdata != NULL );
    255 (*prob)->probdelorig = sourceprob->probdelorig;
    256 (*prob)->probtrans = sourceprob->probtrans;
    257 (*prob)->probdeltrans = sourceprob->probdeltrans;
    258 (*prob)->probinitsol = sourceprob->probinitsol;
    259 (*prob)->probexitsol = sourceprob->probexitsol;
    260 (*prob)->probcopy = sourceprob->probcopy;
    261 (*prob)->probdata = targetdata;
    262 }
    263 }
    264
    265 return SCIP_OKAY;
    266}
    267
    268/** creates problem data structure
    269 * If the problem type requires the use of variable pricers, these pricers should be activated with calls
    270 * to SCIPactivatePricer(). These pricers are automatically deactivated, when the problem is freed.
    271 */
    273 SCIP_PROB** prob, /**< pointer to problem data structure */
    274 BMS_BLKMEM* blkmem, /**< block memory */
    275 SCIP_SET* set, /**< global SCIP settings */
    276 const char* name, /**< problem name */
    277 SCIP_DECL_PROBDELORIG ((*probdelorig)), /**< frees user data of original problem */
    278 SCIP_DECL_PROBTRANS ((*probtrans)), /**< creates user data of transformed problem by transforming original user data */
    279 SCIP_DECL_PROBDELTRANS((*probdeltrans)), /**< frees user data of transformed problem */
    280 SCIP_DECL_PROBINITSOL ((*probinitsol)), /**< solving process initialization method of transformed data */
    281 SCIP_DECL_PROBEXITSOL ((*probexitsol)), /**< solving process deinitialization method of transformed data */
    282 SCIP_DECL_PROBCOPY ((*probcopy)), /**< copies user data if you want to copy it to a subscip, or NULL */
    283 SCIP_PROBDATA* probdata, /**< user problem data set by the reader */
    284 SCIP_Bool transformed /**< is this the transformed problem? */
    285 )
    286{
    287 assert(prob != NULL);
    288
    289 SCIP_ALLOC( BMSallocMemory(prob) );
    290 SCIP_ALLOC( BMSduplicateMemoryArray(&(*prob)->name, name, strlen(name)+1) );
    291
    292 (*prob)->probdata = probdata;
    293 (*prob)->probcopy = probcopy;
    294 (*prob)->probdelorig = probdelorig;
    295 (*prob)->probtrans = probtrans;
    296 (*prob)->probdeltrans = probdeltrans;
    297 (*prob)->probinitsol = probinitsol;
    298 (*prob)->probexitsol = probexitsol;
    299 if( set->misc_usevartable )
    300 {
    301 SCIP_CALL( SCIPhashtableCreate(&(*prob)->varnames, blkmem,
    302 (set->misc_usesmalltables ? SCIP_HASHSIZE_NAMES_SMALL : SCIP_HASHSIZE_NAMES),
    303 SCIPhashGetKeyVar, SCIPhashKeyEqString, SCIPhashKeyValString, NULL) );
    304 }
    305 else
    306 (*prob)->varnames = NULL;
    307 (*prob)->vars = NULL;
    308 (*prob)->varssize = 0;
    309 (*prob)->nvars = 0;
    310 (*prob)->nbinvars = 0;
    311 (*prob)->nintvars = 0;
    312 (*prob)->nbinimplvars = 0;
    313 (*prob)->nintimplvars = 0;
    314 (*prob)->ncontimplvars = 0;
    315 (*prob)->ncontvars = 0;
    316 (*prob)->ncolvars = 0;
    317 (*prob)->fixedvars = NULL;
    318 (*prob)->fixedvarssize = 0;
    319 (*prob)->nfixedvars = 0;
    320 (*prob)->deletedvars = NULL;
    321 (*prob)->deletedvarssize = 0;
    322 (*prob)->ndeletedvars = 0;
    323 (*prob)->nobjvars = 0;
    324 if( set->misc_useconstable )
    325 {
    326 SCIP_CALL( SCIPhashtableCreate(&(*prob)->consnames, blkmem,
    327 (set->misc_usesmalltables ? SCIP_HASHSIZE_NAMES_SMALL : SCIP_HASHSIZE_NAMES),
    328 SCIPhashGetKeyCons, SCIPhashKeyEqString, SCIPhashKeyValString, NULL) );
    329 }
    330 else
    331 (*prob)->consnames = NULL;
    332 (*prob)->conss = NULL;
    333 (*prob)->origcheckconss = NULL;
    334 (*prob)->consssize = 0;
    335 (*prob)->nconss = 0;
    336 (*prob)->maxnconss = 0;
    337 (*prob)->startnvars = 0;
    338 (*prob)->startnconss = 0;
    339 (*prob)->objlim = SCIP_INVALID;
    340 (*prob)->dualbound = SCIP_INVALID;
    341 (*prob)->objisintegral = FALSE;
    342 (*prob)->transformed = transformed;
    343 (*prob)->nlpenabled = FALSE;
    344 (*prob)->permuted = FALSE;
    345 (*prob)->consschecksorted = FALSE;
    346 (*prob)->conscompression = FALSE;
    347 (*prob)->objsense = SCIP_OBJSENSE_MINIMIZE;
    348 (*prob)->objoffset = 0.0;
    349 (*prob)->objscale = 1.0;
    350 if( set->exact_enable )
    351 {
    352 SCIP_CALL( SCIPrationalCreateBlock(blkmem, &(*prob)->objoffsetexact) );
    353 SCIP_CALL( SCIPrationalCreateBlock(blkmem, &(*prob)->objscaleexact) );
    354
    355 SCIPrationalSetReal((*prob)->objoffsetexact, (*prob)->objoffset);
    356 SCIPrationalSetReal((*prob)->objscaleexact, (*prob)->objscale);
    357 }
    358 else
    359 {
    360 (*prob)->objoffsetexact = NULL;
    361 (*prob)->objscaleexact = NULL;
    362 }
    363
    364 return SCIP_OKAY;
    365}
    366
    367/** sets callback to free user data of original problem */
    369 SCIP_PROB* prob, /**< problem */
    370 SCIP_DECL_PROBDELORIG ((*probdelorig)) /**< frees user data of original problem */
    371 )
    372{
    373 assert(prob != NULL);
    374
    375 prob->probdelorig = probdelorig;
    376}
    377
    378/** sets callback to create user data of transformed problem by transforming original user data */
    380 SCIP_PROB* prob, /**< problem */
    381 SCIP_DECL_PROBTRANS ((*probtrans)) /**< creates user data of transformed problem by transforming original user data */
    382 )
    383{
    384 assert(prob != NULL);
    385
    386 prob->probtrans = probtrans;
    387}
    388
    389/** sets callback to free user data of transformed problem */
    391 SCIP_PROB* prob, /**< problem */
    392 SCIP_DECL_PROBDELTRANS((*probdeltrans)) /**< frees user data of transformed problem */
    393 )
    394{
    395 assert(prob != NULL);
    396
    397 prob->probdeltrans = probdeltrans;
    398}
    399
    400/** sets solving process initialization callback of transformed data */
    402 SCIP_PROB* prob, /**< problem */
    403 SCIP_DECL_PROBINITSOL ((*probinitsol)) /**< solving process initialization callback of transformed data */
    404 )
    405{
    406 assert(prob != NULL);
    407
    408 prob->probinitsol= probinitsol;
    409}
    410
    411/** sets solving process deinitialization callback of transformed data */
    413 SCIP_PROB* prob, /**< problem */
    414 SCIP_DECL_PROBEXITSOL ((*probexitsol)) /**< solving process deinitialization callback of transformed data */
    415 )
    416{
    417 assert(prob != NULL);
    418
    419 prob->probexitsol= probexitsol;
    420}
    421
    422/** sets callback to copy user data to copy it to a subscip, or NULL */
    424 SCIP_PROB* prob, /**< problem */
    425 SCIP_DECL_PROBCOPY ((*probcopy)) /**< copies user data if you want to copy it to a subscip, or NULL */
    426 )
    427{
    428 assert(prob != NULL);
    429
    430 prob->probcopy= probcopy;
    431}
    432
    433/** frees problem data structure */
    435 SCIP_PROB** prob, /**< pointer to problem data structure */
    436 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
    437 BMS_BLKMEM* blkmem, /**< block memory buffer */
    438 SCIP_SET* set, /**< global SCIP settings */
    439 SCIP_STAT* stat, /**< dynamic problem statistics */
    440 SCIP_EVENTQUEUE* eventqueue, /**< event queue */
    441 SCIP_LP* lp /**< current LP data (or NULL, if it's the original problem) */
    442 )
    443{
    444 int v;
    445#ifndef NDEBUG
    446 SCIP_Bool unreleasedvar = FALSE;
    447#endif
    448
    449 assert(prob != NULL);
    450 assert(*prob != NULL);
    451 assert(set != NULL);
    452
    453 /* remove all constraints from the problem */
    454 while( (*prob)->nconss > 0 )
    455 {
    456 /*@todo for debug mode it even might sense, to sort them downwards after their arraypos */
    457 assert((*prob)->conss != NULL);
    458 SCIP_CALL( SCIPprobDelCons(*prob, blkmem, set, stat, (*prob)->conss[(*prob)->nconss - 1]) );
    459 }
    460
    461 if( (*prob)->transformed )
    462 {
    463 int h;
    464
    465 /* unlock variables for all constraint handlers that don't need constraints */
    466 for( h = 0; h < set->nconshdlrs; ++h )
    467 {
    468 if( !SCIPconshdlrNeedsCons(set->conshdlrs[h]) )
    469 {
    470 SCIP_CALL( SCIPconshdlrUnlockVars(set->conshdlrs[h], set) );
    471 }
    472 }
    473 }
    474
    475 /* free constraint array */
    476 BMSfreeMemoryArrayNull(&(*prob)->origcheckconss);
    477 BMSfreeMemoryArrayNull(&(*prob)->conss);
    478
    479 /* free user problem data */
    480 if( (*prob)->transformed )
    481 {
    482 if( (*prob)->probdeltrans != NULL )
    483 {
    484 SCIP_CALL( (*prob)->probdeltrans(set->scip, &(*prob)->probdata) );
    485 }
    486 }
    487 else
    488 {
    489 if( (*prob)->probdelorig != NULL )
    490 {
    491 SCIP_CALL( (*prob)->probdelorig(set->scip, &(*prob)->probdata) );
    492 }
    493 }
    494
    495 /* release problem variables */
    496 for( v = (*prob)->nvars - 1; v >= 0; --v )
    497 {
    498 assert(SCIPvarGetProbindex((*prob)->vars[v]) >= 0);
    499
    500 if( SCIPvarGetNUses((*prob)->vars[v]) > 1 )
    501 {
    502 SCIPmessageFPrintWarning(messagehdlr, "%s variable <%s> not released when freeing SCIP problem <%s>.\n",
    503 (*prob)->transformed ? "Transformed" : "Original", SCIPvarGetName((*prob)->vars[v]), SCIPprobGetName(*prob));
    504#ifndef NDEBUG
    505 unreleasedvar = TRUE;
    506#endif
    507 }
    508
    509 SCIP_CALL( SCIPvarRemove((*prob)->vars[v], blkmem, NULL, set, TRUE, FALSE) );
    510 SCIP_CALL( SCIPvarRelease(&(*prob)->vars[v], blkmem, set, eventqueue, lp) );
    511 }
    512 BMSfreeMemoryArrayNull(&(*prob)->vars);
    513
    514 /* release fixed problem variables */
    515 for( v = (*prob)->nfixedvars - 1; v >= 0; --v )
    516 {
    517 assert(SCIPvarGetProbindex((*prob)->fixedvars[v]) == -1);
    518
    519 if( SCIPvarGetNUses((*prob)->fixedvars[v]) > 1 )
    520 {
    521 SCIPmessageFPrintWarning(messagehdlr, "%s variable <%s> not released when freeing SCIP problem <%s>.\n",
    522 (*prob)->transformed ? "Transformed" : "Original", SCIPvarGetName((*prob)->fixedvars[v]), SCIPprobGetName(*prob));
    523#ifndef NDEBUG
    524 unreleasedvar = TRUE;
    525#endif
    526 }
    527
    528 SCIP_CALL( SCIPvarRelease(&(*prob)->fixedvars[v], blkmem, set, eventqueue, lp) );
    529 }
    530 BMSfreeMemoryArrayNull(&(*prob)->fixedvars);
    531
    532 assert(! unreleasedvar);
    533
    534 /* free deleted problem variables array */
    535 BMSfreeMemoryArrayNull(&(*prob)->deletedvars);
    536
    537 /* free hash tables for names */
    538 if( (*prob)->consnames != NULL )
    539 SCIPhashtableFree(&(*prob)->consnames);
    540 if( (*prob)->varnames != NULL )
    541 SCIPhashtableFree(&(*prob)->varnames);
    542 if( (*prob)->objscaleexact != NULL )
    543 SCIPrationalFreeBlock(blkmem, &(*prob)->objscaleexact);
    544 if( (*prob)->objoffsetexact != NULL )
    545 SCIPrationalFreeBlock(blkmem, &(*prob)->objoffsetexact);
    546 BMSfreeMemoryArray(&(*prob)->name);
    547 BMSfreeMemory(prob);
    548
    549 return SCIP_OKAY;
    550}
    551
    552/** transform problem data into normalized form */
    554 SCIP_PROB* source, /**< problem to transform */
    555 BMS_BLKMEM* blkmem, /**< block memory buffer */
    556 SCIP_SET* set, /**< global SCIP settings */
    557 SCIP_STAT* stat, /**< problem statistics */
    558 SCIP_PRIMAL* primal, /**< primal data */
    559 SCIP_TREE* tree, /**< branch and bound tree */
    560 SCIP_REOPT* reopt, /**< reoptimization data structure */
    561 SCIP_LP* lp, /**< current LP data */
    562 SCIP_BRANCHCAND* branchcand, /**< branching candidate storage */
    563 SCIP_EVENTQUEUE* eventqueue, /**< event queue */
    564 SCIP_EVENTFILTER* eventfilter, /**< global event filter */
    565 SCIP_CONFLICTSTORE* conflictstore, /**< conflict store */
    566 SCIP_PROB** target /**< pointer to target problem data structure */
    567 )
    568{
    569 SCIP_VAR* targetvar;
    570 SCIP_CONS* targetcons;
    571 char transname[SCIP_MAXSTRLEN];
    572 int v;
    573 int c;
    574 int h;
    575
    576 assert(set != NULL);
    577 assert(source != NULL);
    578 assert(blkmem != NULL);
    579 assert(target != NULL);
    580
    581 SCIPsetDebugMsg(set, "transform problem: original has %d variables\n", source->nvars);
    582
    583 /* create target problem data (probdelorig and probtrans are not needed, probdata is set later) */
    584 (void) SCIPsnprintf(transname, SCIP_MAXSTRLEN, "t_%s", source->name);
    585 SCIP_CALL( SCIPprobCreate(target, blkmem, set, transname, source->probdelorig, source->probtrans, source->probdeltrans,
    586 source->probinitsol, source->probexitsol, source->probcopy, NULL, TRUE) );
    587 SCIPprobSetObjsense(*target, source->objsense);
    588
    589 /* transform objective limit */
    590 if( source->objlim < SCIP_INVALID )
    591 SCIPprobSetObjlim(*target, source->objlim);
    592
    593 /* transform dual bound */
    594 if( source->dualbound < SCIP_INVALID )
    595 SCIPprobSetDualbound(*target, source->dualbound);
    596
    597 /* transform and copy all variables to target problem */
    598 SCIP_CALL( probEnsureVarsMem(*target, set, source->nvars) );
    599 for( v = 0; v < source->nvars; ++v )
    600 {
    601 SCIP_CALL( SCIPvarTransform(source->vars[v], blkmem, set, stat, source->objsense, &targetvar) );
    602
    603 /* if in exact mode copy the exact data */
    604 SCIP_CALL( SCIPvarCopyExactData(blkmem, targetvar, source->vars[v], source->objsense == SCIP_OBJSENSE_MAXIMIZE) );
    605
    606 SCIP_CALL( SCIPprobAddVar(*target, blkmem, set, lp, branchcand, eventqueue, eventfilter, targetvar) );
    607 SCIP_CALL( SCIPvarRelease(&targetvar, blkmem, set, eventqueue, NULL) );
    608 }
    609 assert((*target)->nvars == source->nvars);
    610 assert((*target)->nobjvars == SCIPprobGetNObjVars(*target, set));
    611
    612 /* call user data transformation */
    613 if( source->probtrans != NULL )
    614 {
    615 SCIP_CALL( source->probtrans(set->scip, source->probdata, &(*target)->probdata) );
    616 }
    617 else
    618 (*target)->probdata = source->probdata;
    619
    620 /* transform and copy all constraints to target problem */
    621 for( c = 0; c < source->nconss; ++c )
    622 {
    623 SCIP_CALL( SCIPconsTransform(source->conss[c], blkmem, set, &targetcons) );
    624 SCIP_CALL( SCIPprobAddCons(*target, set, stat, targetcons) );
    625 SCIP_CALL( SCIPconsRelease(&targetcons, blkmem, set) );
    626 }
    627
    628 /* lock variables for all constraint handlers that don't need constraints */
    629 for( h = 0; h < set->nconshdlrs; ++h )
    630 {
    631 if( !SCIPconshdlrNeedsCons(set->conshdlrs[h]) )
    632 {
    633 SCIP_CALL( SCIPconshdlrLockVars(set->conshdlrs[h], set) );
    634 }
    635 }
    636
    637 /* objective value is always integral, iff original objective value is always integral and shift is integral */
    638 (*target)->objisintegral = source->objisintegral && SCIPsetIsIntegral(set, (*target)->objoffset);
    639
    640 /* check, whether objective value is always integral by inspecting the problem, if it is the case adjust the
    641 * cutoff bound if primal solution is already known
    642 */
    643 SCIP_CALL( SCIPprobCheckObjIntegral(*target, source, blkmem, set, stat, primal, tree, reopt, lp, eventqueue, eventfilter) );
    644
    645 /* copy the nlpenabled flag */
    646 (*target)->nlpenabled = source->nlpenabled;
    647
    648 /* mark the transformed problem to be permuted iff the source problem is permuted */
    649 (*target)->permuted = source->permuted;
    650
    651 /* transform the conflict pool */
    652 SCIP_CALL( SCIPconflictstoreTransform(conflictstore, blkmem, set, stat, tree, *target, reopt) );
    653
    654 return SCIP_OKAY;
    655}
    656
    657/** resets the global and local bounds of original variables in original problem to their original values */
    659 SCIP_PROB* prob, /**< original problem data */
    660 BMS_BLKMEM* blkmem, /**< block memory */
    661 SCIP_SET* set, /**< global SCIP settings */
    662 SCIP_STAT* stat /**< problem statistics */
    663 )
    664{
    665 int v;
    666
    667 assert(prob != NULL);
    668 assert(prob->nfixedvars == 0);
    669
    670 for( v = 0; v < prob->nvars; ++v )
    671 {
    672 SCIP_CALL( SCIPvarResetBounds(prob->vars[v], blkmem, set, stat) );
    673 }
    674
    675 return SCIP_OKAY;
    676}
    677
    678/** (Re)Sort the variables, which appear in the four categories (binary, integer, implicit, continuous) after presolve
    679 * with respect to their original index (within their categories). Adjust the problem index afterwards which is
    680 * supposed to reflect the position in the variable array. This additional (re)sorting is supposed to get more robust
    681 * against the order presolving fixed variables. (We also reobtain a possible block structure induced by the user
    682 * model)
    683 */
    685 SCIP_PROB* prob /**< problem data */
    686 )
    687{
    688 SCIP_VAR** vars;
    689 int nbinvars;
    690 int nintvars;
    691 int nbinimplvars;
    692 int nintimplvars;
    693 int ncontimplvars;
    694 int ncontvars;
    695 int nvars;
    696 int v;
    697
    698 vars = prob->vars;
    699 nvars = prob->nvars;
    700 nbinvars = prob->nbinvars;
    701 nintvars = prob->nintvars;
    702 nbinimplvars = prob->nbinimplvars;
    703 nintimplvars = prob->nintimplvars;
    704 ncontimplvars = prob->ncontimplvars;
    705 ncontvars = prob->ncontvars;
    706
    707 if( nvars == 0 )
    708 return;
    709
    710 assert(vars != NULL);
    711 assert(nbinvars + nintvars + nbinimplvars + nintimplvars + ncontimplvars + ncontvars == nvars);
    712
    713 SCIPdebugMessage("entering sorting with respect to original block structure! \n");
    714
    715 /* sort binaries */
    716 if( nbinvars > 0 )
    717 SCIPsortPtr((void**)vars, SCIPvarComp, nbinvars);
    718
    719 /* sort integers */
    720 if( nintvars > 0 )
    721 SCIPsortPtr((void**)&vars[nbinvars], SCIPvarComp, nintvars);
    722
    723 /* sort binary implicit variables */
    724 if( nbinimplvars > 0 )
    725 SCIPsortPtr((void**)&vars[nbinvars + nintvars], SCIPvarComp, nbinimplvars);
    726
    727 /* sort integer implicit variables */
    728 if( nintimplvars > 0 )
    729 SCIPsortPtr((void**)&vars[nbinvars + nintvars + nbinimplvars], SCIPvarComp, nintimplvars);
    730
    731 /* sort continuous implicit integer variables */
    732 if( ncontimplvars > 0 )
    733 SCIPsortPtr((void**)&vars[nbinvars + nintvars + nbinimplvars + nintimplvars], SCIPvarComp, ncontimplvars);
    734
    735 /* sort continuous variables */
    736 if( ncontvars > 0 )
    737 SCIPsortPtr((void**)&vars[nbinvars + nintvars + nbinimplvars + nintimplvars + ncontimplvars], SCIPvarComp, ncontvars);
    738
    739 /* after sorting, the problem index of each variable has to be adjusted */
    740 for( v = 0; v < nvars; ++v )
    741 {
    742 vars[v]->probindex = v;
    743 SCIPdebugMessage("Variable: Problem index <%d>, original index <%d> \n", vars[v]->probindex, vars[v]->index);
    744 }
    745}
    746
    747/** possibly create and sort the constraints according to check priorties */
    749 SCIP_PROB* prob /**< problem data */
    750 )
    751{
    752 if( prob->consschecksorted || prob->transformed )
    753 return SCIP_OKAY;
    754
    755 if( prob->nconss > 0 )
    756 {
    757 /* possibly create and copy constraints */
    758 if( prob->origcheckconss == NULL )
    759 {
    761 }
    762 assert( prob->origcheckconss != NULL );
    763
    764 /* sort original constraint according to check priority */
    765 SCIPsortPtr((void**)prob->origcheckconss, SCIPconsCompCheck, prob->nconss);
    766 }
    767 prob->consschecksorted = TRUE;
    768
    769 return SCIP_OKAY;
    770}
    771
    772
    773/*
    774 * problem modification
    775 */
    776
    777/** sets user problem data */
    779 SCIP_PROB* prob, /**< problem */
    780 SCIP_PROBDATA* probdata /**< user problem data to use */
    781 )
    782{
    783 assert(prob != NULL);
    784
    785 prob->probdata = probdata;
    786}
    787
    788/** moves the first behind the last variable for each extended variable type in reverse order until the given one and
    789 * returns the cleared variable position in the given problem
    790 */
    791static
    793 SCIP_PROB* prob, /**< problem data */
    794 SCIP_VARTYPE vartype, /**< type of the variable to be inserted */
    795 SCIP_IMPLINTTYPE impltype /**< implied type of the variable to be inserted */
    796 )
    797{
    798 int insertpos = prob->nvars;
    799 int intstart = prob->nbinvars;
    800 int binimplstart = intstart + prob->nintvars;
    801 int intimplstart = binimplstart + prob->nbinimplvars;
    802 int contimplstart = intimplstart + prob->nintimplvars;
    803 int contstart = contimplstart + prob->ncontimplvars;
    804
    805 /* non-implied continuous variable */
    806 if( vartype == SCIP_VARTYPE_CONTINUOUS && impltype == SCIP_IMPLINTTYPE_NONE )
    807 {
    808 ++prob->ncontvars;
    809 return insertpos;
    810 }
    811 if( insertpos > contstart )
    812 {
    813 prob->vars[insertpos] = prob->vars[contstart];
    814 SCIPvarSetProbindex(prob->vars[insertpos], insertpos);
    815 insertpos = contstart;
    816 }
    817 assert(insertpos == contstart);
    818
    819 /* implied continuous variable */
    820 if( vartype == SCIP_VARTYPE_CONTINUOUS )
    821 {
    822 assert(impltype != SCIP_IMPLINTTYPE_NONE);
    823 ++prob->ncontimplvars;
    824 return insertpos;
    825 }
    826 if( insertpos > contimplstart )
    827 {
    828 prob->vars[insertpos] = prob->vars[contimplstart];
    829 SCIPvarSetProbindex(prob->vars[insertpos], insertpos);
    830 insertpos = contimplstart;
    831 }
    832 assert(insertpos == contimplstart);
    833
    834 /* implied integral variable */
    835 if( vartype == SCIP_VARTYPE_INTEGER && impltype != SCIP_IMPLINTTYPE_NONE )
    836 {
    837 ++prob->nintimplvars;
    838 return insertpos;
    839 }
    840 if( insertpos > intimplstart )
    841 {
    842 prob->vars[insertpos] = prob->vars[intimplstart];
    843 SCIPvarSetProbindex(prob->vars[insertpos], insertpos);
    844 insertpos = intimplstart;
    845 }
    846 assert(insertpos == intimplstart);
    847
    848 /* implied binary variable */
    849 if( vartype == SCIP_VARTYPE_BINARY && impltype != SCIP_IMPLINTTYPE_NONE )
    850 {
    851 ++prob->nbinimplvars;
    852 return insertpos;
    853 }
    854 if( insertpos > binimplstart )
    855 {
    856 prob->vars[insertpos] = prob->vars[binimplstart];
    857 SCIPvarSetProbindex(prob->vars[insertpos], insertpos);
    858 insertpos = binimplstart;
    859 }
    860 assert(insertpos == binimplstart);
    861
    862 /* non-implied integral variable */
    863 if( vartype == SCIP_VARTYPE_INTEGER )
    864 {
    865 assert(impltype == SCIP_IMPLINTTYPE_NONE);
    866 ++prob->nintvars;
    867 return insertpos;
    868 }
    869 if( insertpos > intstart )
    870 {
    871 prob->vars[insertpos] = prob->vars[intstart];
    872 SCIPvarSetProbindex(prob->vars[insertpos], insertpos);
    873 insertpos = intstart;
    874 }
    875 assert(insertpos == intstart);
    876
    877 /* non-implied binary variable */
    878 assert(vartype == SCIP_VARTYPE_BINARY);
    879 assert(impltype == SCIP_IMPLINTTYPE_NONE);
    880 ++prob->nbinvars;
    881
    882 return insertpos;
    883}
    884
    885/** inserts variable at the correct position in vars array, depending on its extended variable type */
    886static
    888 SCIP_PROB* prob, /**< problem data */
    889 SCIP_VAR* var /**< variable to insert */
    890 )
    891{
    892 assert(prob != NULL);
    893 assert(prob->vars != NULL);
    894 assert(prob->nvars < prob->varssize);
    895 assert(var != NULL);
    896 assert(SCIPvarGetProbindex(var) == -1);
    900 /* original variables cannot go into transformed problem and transformed variables cannot go into original problem */
    901 assert((SCIPvarGetStatus(var) != SCIP_VARSTATUS_ORIGINAL) == prob->transformed);
    902
    903 /* get insert position */
    904 SCIP_VARTYPE vartype = SCIPvarGetType(var);
    905 SCIP_IMPLINTTYPE impltype = SCIPvarGetImplType(var);
    906 int insertpos = probProvidePos(prob, vartype, impltype);
    907 assert((vartype == SCIP_VARTYPE_BINARY && impltype == SCIP_IMPLINTTYPE_NONE && insertpos == prob->nbinvars - 1)
    908 || (vartype == SCIP_VARTYPE_INTEGER && impltype == SCIP_IMPLINTTYPE_NONE && insertpos == prob->nbinvars + prob->nintvars - 1)
    909 || (vartype == SCIP_VARTYPE_BINARY && impltype != SCIP_IMPLINTTYPE_NONE && insertpos == prob->nbinvars + prob->nintvars + prob->nbinimplvars - 1)
    910 || (vartype == SCIP_VARTYPE_INTEGER && impltype != SCIP_IMPLINTTYPE_NONE && insertpos == prob->nbinvars + prob->nintvars + prob->nbinimplvars + prob->nintimplvars - 1)
    911 || (vartype == SCIP_VARTYPE_CONTINUOUS && impltype != SCIP_IMPLINTTYPE_NONE && insertpos == prob->nbinvars + prob->nintvars + prob->nbinimplvars + prob->nintimplvars + prob->ncontimplvars - 1)
    912 || (vartype == SCIP_VARTYPE_CONTINUOUS && impltype == SCIP_IMPLINTTYPE_NONE && insertpos == prob->nbinvars + prob->nintvars + prob->nbinimplvars + prob->nintimplvars + prob->ncontimplvars + prob->ncontvars - 1));
    913
    914 /* fill insert position */
    915 prob->vars[insertpos] = var;
    916 SCIPvarSetProbindex(var, insertpos);
    917 ++prob->nvars;
    918 assert(prob->nvars == prob->nbinvars + prob->nintvars + prob->nbinimplvars + prob->nintimplvars + prob->ncontimplvars + prob->ncontvars);
    919
    920 /* update number of column variables in problem */
    922 ++prob->ncolvars;
    923 assert(prob->ncolvars >= 0);
    924 assert(prob->ncolvars <= prob->nvars);
    925}
    926
    927/** removes variable from vars array */
    928static
    930 SCIP_PROB* prob, /**< problem data */
    931 BMS_BLKMEM* blkmem, /**< block memory */
    932 SCIP_CLIQUETABLE* cliquetable, /**< clique table data structure */
    933 SCIP_SET* set, /**< global SCIP settings */
    934 SCIP_VAR* var, /**< variable to remove */
    935 SCIP_Bool isupgraded /**< is the variable removed for the purpose of upgrading its variable type? */
    936 )
    937{
    938 int freepos;
    939 int intstart;
    940 int binimplstart;
    941 int intimplstart;
    942 int contimplstart;
    943 int contstart;
    944 SCIP_VARTYPE vartype;
    945 SCIP_IMPLINTTYPE impltype;
    946
    947 assert(prob != NULL);
    948 assert(var != NULL);
    949 assert(SCIPvarGetProbindex(var) >= 0);
    950 assert(prob->vars != NULL);
    951 assert(prob->vars[SCIPvarGetProbindex(var)] == var);
    952
    953 intstart = prob->nbinvars;
    954 binimplstart = intstart + prob->nintvars;
    955 intimplstart = binimplstart + prob->nbinimplvars;
    956 contimplstart = intimplstart + prob->nintimplvars;
    957 contstart = contimplstart + prob->ncontimplvars;
    958 vartype = SCIPvarGetType(var);
    959 impltype = SCIPvarGetImplType(var);
    960
    961 if( impltype != SCIP_IMPLINTTYPE_NONE )
    962 {
    963 switch( vartype )
    964 {
    966 assert(binimplstart <= SCIPvarGetProbindex(var) && SCIPvarGetProbindex(var) < intimplstart);
    967 --prob->nbinimplvars;
    968 break;
    970 assert(intimplstart <= SCIPvarGetProbindex(var) && SCIPvarGetProbindex(var) < contimplstart);
    971 --prob->nintimplvars;
    972 break;
    974 assert(contimplstart <= SCIPvarGetProbindex(var) && SCIPvarGetProbindex(var) < contstart);
    975 --prob->ncontimplvars;
    976 break;
    977 default:
    978 SCIPerrorMessage("unknown variable type\n");
    979 return SCIP_INVALIDDATA;
    980 } /*lint !e788*/
    981 }
    982 else
    983 {
    984 switch( vartype )
    985 {
    987 assert(0 <= SCIPvarGetProbindex(var) && SCIPvarGetProbindex(var) < intstart);
    988 --prob->nbinvars;
    989 break;
    991 assert(intstart <= SCIPvarGetProbindex(var) && SCIPvarGetProbindex(var) < binimplstart);
    992 --prob->nintvars;
    993 break;
    995 assert(contstart <= SCIPvarGetProbindex(var) && SCIPvarGetProbindex(var) < prob->nvars);
    996 --prob->ncontvars;
    997 break;
    998 default:
    999 SCIPerrorMessage("unknown variable type\n");
    1000 return SCIP_INVALIDDATA;
    1001 } /*lint !e788*/
    1002 }
    1003
    1004 /* move last binary, last integer, last implicit, and last continuous variable forward to fill the free slot */
    1005 freepos = SCIPvarGetProbindex(var);
    1006 if( freepos < intstart-1 )
    1007 {
    1008 /* move last binary variable to free slot */
    1009 prob->vars[freepos] = prob->vars[intstart-1];
    1010 SCIPvarSetProbindex(prob->vars[freepos], freepos);
    1011 freepos = intstart-1;
    1012 }
    1013 if( freepos < binimplstart-1 )
    1014 {
    1015 /* move last integer variable to free slot */
    1016 prob->vars[freepos] = prob->vars[binimplstart-1];
    1017 SCIPvarSetProbindex(prob->vars[freepos], freepos);
    1018 freepos = binimplstart-1;
    1019 }
    1020 if( freepos < intimplstart-1 )
    1021 {
    1022 /* move last binary implied integral variable to free slot */
    1023 prob->vars[freepos] = prob->vars[intimplstart-1];
    1024 SCIPvarSetProbindex(prob->vars[freepos], freepos);
    1025 freepos = intimplstart-1;
    1026 }
    1027 if( freepos < contimplstart-1 )
    1028 {
    1029 /* move last integer implied integral variable to free slot */
    1030 prob->vars[freepos] = prob->vars[contimplstart-1];
    1031 SCIPvarSetProbindex(prob->vars[freepos], freepos);
    1032 freepos = contimplstart-1;
    1033 }
    1034 if( freepos < contstart-1 )
    1035 {
    1036 /* move last continuous implicit integer variable to free slot */
    1037 prob->vars[freepos] = prob->vars[contstart-1];
    1038 SCIPvarSetProbindex(prob->vars[freepos], freepos);
    1039 freepos = contstart-1;
    1040 }
    1041 if( freepos < prob->nvars-1 )
    1042 {
    1043 /* move last continuous variable to free slot */
    1044 prob->vars[freepos] = prob->vars[prob->nvars-1];
    1045 SCIPvarSetProbindex(prob->vars[freepos], freepos);
    1046 freepos = prob->nvars-1;
    1047 }
    1048 assert(freepos == prob->nvars-1);
    1049
    1050 --prob->nvars;
    1051 assert(prob->nvars == prob->nbinvars + prob->nintvars + prob->nbinimplvars + prob->nintimplvars + prob->ncontimplvars + prob->ncontvars);
    1052
    1053 /* update number of column variables in problem */
    1055 prob->ncolvars--;
    1056 assert(0 <= prob->ncolvars && prob->ncolvars <= prob->nvars);
    1057
    1058 /* inform the variable that it is no longer in the problem; if necessary, delete it from the implication graph */
    1059 SCIP_CALL( SCIPvarRemove(var, blkmem, cliquetable, set, FALSE, isupgraded) );
    1060
    1061 return SCIP_OKAY;
    1062}
    1063
    1064/** adds variable's name to the namespace */
    1066 SCIP_PROB* prob, /**< problem data */
    1067 SCIP_VAR* var /**< variable */
    1068 )
    1069{
    1070 assert(SCIPvarGetProbindex(var) != -1);
    1071
    1072 if( varHasName(var) && prob->varnames != NULL )
    1073 {
    1074 SCIP_CALL( SCIPhashtableInsert(prob->varnames, (void*)var) );
    1075 }
    1076
    1077 return SCIP_OKAY;
    1078}
    1079
    1080/** removes variable's name from the namespace */
    1082 SCIP_PROB* prob, /**< problem data */
    1083 SCIP_VAR* var /**< variable */
    1084 )
    1085{
    1086 if( varHasName(var) && prob->varnames != NULL )
    1087 {
    1088 assert(SCIPhashtableExists(prob->varnames, (void*)var));
    1089 SCIP_CALL( SCIPhashtableRemove(prob->varnames, (void*)var) );
    1090 }
    1091
    1092 return SCIP_OKAY;
    1093}
    1094
    1095/** adds variable to the problem and captures it */
    1097 SCIP_PROB* prob, /**< problem data */
    1098 BMS_BLKMEM* blkmem, /**< block memory buffers */
    1099 SCIP_SET* set, /**< global SCIP settings */
    1100 SCIP_LP* lp, /**< current LP data */
    1101 SCIP_BRANCHCAND* branchcand, /**< branching candidate storage */
    1102 SCIP_EVENTQUEUE* eventqueue, /**< event queue */
    1103 SCIP_EVENTFILTER* eventfilter, /**< global event filter */
    1104 SCIP_VAR* var /**< variable to add */
    1105 )
    1106{
    1107 assert(prob != NULL);
    1108 assert(set != NULL);
    1109 assert(var != NULL);
    1110 assert(SCIPvarGetProbindex(var) == -1);
    1114 /* original variables cannot go into transformed problem and transformed variables cannot go into original problem */
    1115 assert((SCIPvarGetStatus(var) != SCIP_VARSTATUS_ORIGINAL) == prob->transformed);
    1116
    1117#ifndef NDEBUG
    1118 /* check if we add this variables to the same scip, where we created it */
    1119 if( var->scip != set->scip )
    1120 {
    1121 SCIPerrorMessage("variable belongs to a different scip instance\n");
    1122 return SCIP_INVALIDDATA;
    1123 }
    1124#endif
    1125
    1126 /* capture variable */
    1127 SCIPvarCapture(var);
    1128
    1129 /* allocate additional memory */
    1130 SCIP_CALL( probEnsureVarsMem(prob, set, prob->nvars+1) );
    1131
    1132 /* insert variable in vars array and mark it to be in problem */
    1133 probInsertVar(prob, var);
    1134
    1135 /* add variable's name to the namespace */
    1136 SCIP_CALL( SCIPprobAddVarName(prob, var) );
    1137
    1138 /* update branching candidates and pseudo and loose objective value in the LP */
    1140 {
    1141 SCIP_CALL( SCIPbranchcandUpdateVar(branchcand, set, var) );
    1142 SCIP_CALL( SCIPlpUpdateAddVar(lp, set, var) );
    1144 }
    1145
    1146 SCIPsetDebugMsg(set, "added variable <%s> to problem (%d variables: %d binary, %d integer, %d continuous; %d implied)\n",
    1147 SCIPvarGetName(var), prob->nvars, prob->nbinvars + prob->nbinimplvars, prob->nintvars + prob->nintimplvars,
    1148 prob->ncontvars+ prob->ncontimplvars, SCIPprobGetNImplVars(prob));
    1149
    1150 if( prob->transformed )
    1151 {
    1152 SCIP_EVENT* event;
    1153
    1154 /* issue VARADDED event */
    1155 SCIP_CALL( SCIPeventCreateVarAdded(&event, blkmem, var) );
    1156 SCIP_CALL( SCIPeventqueueAdd(eventqueue, blkmem, set, NULL, NULL, NULL, eventfilter, &event) );
    1157
    1158 /* update the number of variables with non-zero objective coefficient */
    1159 SCIPprobUpdateNObjVars(prob, set, 0.0, SCIPvarGetObj(var));
    1160
    1161 /* SCIP assumes that the status of objisintegral does not change after transformation. Thus, the objective of all
    1162 * new variables beyond that stage has to be compatible. */
    1165 }
    1166
    1167 return SCIP_OKAY;
    1168}
    1169
    1170/** marks variable to be removed from the problem; however, the variable is NOT removed from the constraints */
    1172 SCIP_PROB* prob, /**< problem data */
    1173 BMS_BLKMEM* blkmem, /**< block memory */
    1174 SCIP_SET* set, /**< global SCIP settings */
    1175 SCIP_EVENTQUEUE* eventqueue, /**< event queue */
    1176 SCIP_VAR* var, /**< problem variable */
    1177 SCIP_Bool* deleted /**< pointer to store whether marking variable to be deleted was successful */
    1178 )
    1179{
    1180 assert(prob != NULL);
    1181 assert(set != NULL);
    1182 assert(var != NULL);
    1183 assert(deleted != NULL);
    1184 assert(SCIPvarGetProbindex(var) != -1);
    1188
    1189 *deleted = FALSE;
    1190
    1191 /* don't remove variables that are not in the problem */
    1192 if( SCIPvarGetProbindex(var) == -1 )
    1193 return SCIP_OKAY;
    1194
    1195 /* don't remove the direct counterpart of an original variable from the transformed problem, because otherwise
    1196 * operations on the original variables would be applied to a NULL pointer
    1197 */
    1199 return SCIP_OKAY;
    1200
    1201 SCIPsetDebugMsg(set, "deleting variable <%s> from problem (%d variables: %d binary, %d integer, %d continuous; %d implied)\n",
    1202 SCIPvarGetName(var), prob->nvars, prob->nbinvars + prob->nbinimplvars, prob->nintvars + prob->nintimplvars,
    1203 prob->ncontvars+ prob->ncontimplvars, SCIPprobGetNImplVars(prob));
    1204
    1205 /* mark variable to be deleted from the problem */
    1206 SCIPvarMarkDeleted(var);
    1207
    1208 if( prob->transformed )
    1209 {
    1210 SCIP_EVENT* event;
    1211
    1212 assert(eventqueue != NULL);
    1213
    1214 /* issue VARDELETED event */
    1215 SCIP_CALL( SCIPeventCreateVarDeleted(&event, blkmem, var) );
    1216 SCIP_CALL( SCIPeventqueueAdd(eventqueue, blkmem, set, NULL, NULL, NULL, NULL, &event) );
    1217 }
    1218
    1219 /* remember that the variable should be deleted from the problem in SCIPprobPerformVarDeletions() */
    1221 prob->deletedvars[prob->ndeletedvars] = var;
    1222 prob->ndeletedvars++;
    1223
    1224 *deleted = TRUE;
    1225
    1226 return SCIP_OKAY;
    1227}
    1228
    1229/** actually removes the deleted variables from the problem and releases them */
    1231 SCIP_PROB* prob, /**< problem data */
    1232 BMS_BLKMEM* blkmem, /**< block memory */
    1233 SCIP_SET* set, /**< global SCIP settings */
    1234 SCIP_STAT* stat, /**< dynamic problem statistics */
    1235 SCIP_EVENTQUEUE* eventqueue, /**< event queue */
    1236 SCIP_CLIQUETABLE* cliquetable, /**< clique table data structure */
    1237 SCIP_LP* lp, /**< current LP data (may be NULL) */
    1238 SCIP_BRANCHCAND* branchcand /**< branching candidate storage */
    1239 )
    1240{
    1241 int i;
    1242
    1243 assert(prob != NULL);
    1244 assert(set != NULL);
    1245
    1246 /* delete variables from the constraints;
    1247 * do this only in solving stage, in presolving, it is already handled by the constraint handlers
    1248 */
    1250 {
    1251 for( i = 0; i < set->nconshdlrs; ++i )
    1252 {
    1253 SCIP_CALL( SCIPconshdlrDelVars(set->conshdlrs[i], blkmem, set, stat) );
    1254 }
    1255 }
    1256
    1257 for( i = 0; i < prob->ndeletedvars; ++i )
    1258 {
    1259 SCIP_VAR* var;
    1260
    1261 var = prob->deletedvars[i];
    1262
    1263 /* don't delete the variable, if it was fixed or aggregated in the meantime */
    1264 if( SCIPvarGetProbindex(var) >= 0 )
    1265 {
    1266 SCIPsetDebugMsg(set, "perform deletion of <%s> [%p]\n", SCIPvarGetName(var), (void*)var);
    1267
    1268 /* convert column variable back into loose variable, free LP column */
    1270 {
    1271 SCIP_CALL( SCIPvarLoose(var, blkmem, set, eventqueue, prob, lp) );
    1272 }
    1273
    1274 /* update branching candidates and pseudo and loose objective value in the LP */
    1276 {
    1277 SCIP_CALL( SCIPlpUpdateDelVar(lp, set, var) );
    1278 SCIP_CALL( SCIPbranchcandRemoveVar(branchcand, var) );
    1279 }
    1280
    1281 /* remove variable's name from the namespace */
    1282 SCIP_CALL( SCIPprobRemoveVarName(prob, var) );
    1283
    1284 /* remove variable from vars array and mark it to be not in problem */
    1285 SCIP_CALL( probRemoveVar(prob, blkmem, cliquetable, set, var, FALSE) );
    1286
    1287 /* update the number of variables with non-zero objective coefficient */
    1288 if( prob->transformed )
    1289 SCIPprobUpdateNObjVars(prob, set, SCIPvarGetObj(var), 0.0);
    1290
    1291 /* release variable */
    1292 SCIP_CALL( SCIPvarRelease(&prob->deletedvars[i], blkmem, set, eventqueue, lp) );
    1293 }
    1294 }
    1295 prob->ndeletedvars = 0;
    1296
    1297 return SCIP_OKAY;
    1298}
    1299
    1300/** changes the type of a variable in the problem */
    1302 SCIP_PROB* prob, /**< problem data */
    1303 BMS_BLKMEM* blkmem, /**< block memory */
    1304 SCIP_SET* set, /**< global SCIP settings */
    1305 SCIP_PRIMAL* primal, /**< primal data */
    1306 SCIP_LP* lp, /**< current LP data */
    1307 SCIP_BRANCHCAND* branchcand, /**< branching candidate storage */
    1308 SCIP_EVENTQUEUE* eventqueue, /**< event queue */
    1309 SCIP_CLIQUETABLE* cliquetable, /**< clique table data structure */
    1310 SCIP_VAR* var, /**< variable to change type of */
    1311 SCIP_VARTYPE vartype /**< new type of variable */
    1312 )
    1313{
    1314 SCIP_Bool upgraded;
    1315
    1316 assert(prob != NULL);
    1317 assert(var != NULL);
    1318 assert(SCIPvarGetProbindex(var) >= 0);
    1322 assert(branchcand != NULL || SCIPvarGetStatus(var) == SCIP_VARSTATUS_ORIGINAL);
    1323
    1324 if( SCIPvarGetType(var) == vartype )
    1325 return SCIP_OKAY;
    1326
    1327 /* temporarily remove variable from branching candidates */
    1328 if( branchcand != NULL )
    1329 {
    1330 SCIP_CALL( SCIPbranchcandRemoveVar(branchcand, var) );
    1331 }
    1332
    1333 /* Do not remove cliques, varbounds and implications if we upgrade the type */
    1334 upgraded = vartype > SCIPvarGetType(var);
    1335
    1336 /* temporarily remove variable from problem */
    1337 SCIP_CALL( probRemoveVar(prob, blkmem, cliquetable, set, var, upgraded) );
    1338
    1339 /* change the type of the variable */
    1340 SCIP_CALL( SCIPvarChgType(var, blkmem, set, primal, lp, eventqueue, vartype) );
    1341
    1342 /* reinsert variable into problem */
    1343 probInsertVar(prob, var);
    1344
    1345 /* update branching candidates */
    1346 if( branchcand != NULL )
    1347 {
    1348 SCIP_CALL( SCIPbranchcandUpdateVar(branchcand, set, var) );
    1349 }
    1350
    1351 return SCIP_OKAY;
    1352}
    1353
    1354/** changes the implied integral type of a variable in the problem */
    1356 SCIP_PROB* prob, /**< problem data */
    1357 BMS_BLKMEM* blkmem, /**< block memory */
    1358 SCIP_SET* set, /**< global SCIP settings */
    1359 SCIP_PRIMAL* primal, /**< primal data */
    1360 SCIP_LP* lp, /**< current LP data */
    1361 SCIP_BRANCHCAND* branchcand, /**< branching candidate storage */
    1362 SCIP_EVENTQUEUE* eventqueue, /**< event queue */
    1363 SCIP_CLIQUETABLE* cliquetable, /**< clique table data structure */
    1364 SCIP_VAR* var, /**< variable to change implied integral type of */
    1365 SCIP_IMPLINTTYPE impltype /**< new implied integral type of variable */
    1366 )
    1367{
    1368 SCIP_Bool upgraded;
    1369
    1370 assert(prob != NULL);
    1371 assert(var != NULL);
    1372 assert(SCIPvarGetProbindex(var) >= 0);
    1376 assert(branchcand != NULL || SCIPvarGetStatus(var) == SCIP_VARSTATUS_ORIGINAL);
    1377
    1378 if( SCIPvarGetImplType(var) == impltype )
    1379 return SCIP_OKAY;
    1380
    1381 /* temporarily remove variable from branching candidates */
    1382 if( branchcand != NULL )
    1383 {
    1384 SCIP_CALL( SCIPbranchcandRemoveVar(branchcand, var) );
    1385 }
    1386
    1387 /* Do not remove cliques, varbounds and implications unless type becomes non-implied */
    1388 upgraded = impltype != SCIP_IMPLINTTYPE_NONE;
    1389
    1390 /* temporarily remove variable from problem */
    1391 SCIP_CALL( probRemoveVar(prob, blkmem, cliquetable, set, var, upgraded) );
    1392
    1393 /* change the type of the variable */
    1394 SCIP_CALL( SCIPvarChgImplType(var, blkmem, set, primal, lp, eventqueue, impltype) );
    1395
    1396 /* reinsert variable into problem */
    1397 probInsertVar(prob, var);
    1398
    1399 /* update branching candidates */
    1400 if( branchcand != NULL )
    1401 {
    1402 SCIP_CALL( SCIPbranchcandUpdateVar(branchcand, set, var) );
    1403 }
    1404
    1405 return SCIP_OKAY;
    1406}
    1407
    1408/** informs problem, that the given loose problem variable changed its status */
    1410 SCIP_PROB* prob, /**< problem data */
    1411 BMS_BLKMEM* blkmem, /**< block memory */
    1412 SCIP_SET* set, /**< global SCIP settings */
    1413 SCIP_BRANCHCAND* branchcand, /**< branching candidate storage */
    1414 SCIP_CLIQUETABLE* cliquetable, /**< clique table data structure */
    1415 SCIP_VAR* var /**< problem variable */
    1416 )
    1417{
    1418 assert(prob != NULL);
    1419 assert(var != NULL);
    1420 assert(SCIPvarGetProbindex(var) != -1);
    1421
    1422 /* get current status of variable */
    1423 switch( SCIPvarGetStatus(var) )
    1424 {
    1426 SCIPerrorMessage("variables cannot switch to ORIGINAL status\n");
    1427 return SCIP_INVALIDDATA;
    1428
    1430 /* variable switched from column to loose */
    1431 prob->ncolvars--;
    1432 break;
    1433
    1435 /* variable switched from non-column to column */
    1436 prob->ncolvars++;
    1437 break;
    1438
    1443 /* variable switched from unfixed to fixed (if it was fixed before, probindex would have been -1) */
    1444
    1445 /* remove variable from problem */
    1446 SCIP_CALL( probRemoveVar(prob, blkmem, cliquetable, set, var, FALSE) );
    1447
    1448 /* insert variable in fixedvars array */
    1450 prob->fixedvars[prob->nfixedvars] = var;
    1451 prob->nfixedvars++;
    1452
    1453 /* update branching candidates */
    1454 SCIP_CALL( SCIPbranchcandUpdateVar(branchcand, set, var) );
    1455 break;
    1456
    1457 default:
    1458 SCIPerrorMessage("invalid variable status <%d>\n", SCIPvarGetStatus(var));
    1459 return SCIP_INVALIDDATA;
    1460 }
    1461 assert(0 <= prob->ncolvars && prob->ncolvars <= prob->nvars);
    1462
    1463 return SCIP_OKAY;
    1464}
    1465
    1466/** adds constraint's name to the namespace */
    1468 SCIP_PROB* prob, /**< problem data */
    1469 SCIP_CONS* cons /**< constraint */
    1470 )
    1471{
    1472 /* add constraint's name to the namespace */
    1473 if( consHasName(cons) && prob->consnames != NULL )
    1474 {
    1475 SCIP_CALL( SCIPhashtableInsert(prob->consnames, (void*)cons) );
    1476 }
    1477
    1478 return SCIP_OKAY;
    1479}
    1480
    1481/** remove constraint's name from the namespace */
    1483 SCIP_PROB* prob, /**< problem data */
    1484 SCIP_CONS* cons /**< constraint */
    1485 )
    1486{
    1487 /* remove constraint's name from the namespace */
    1488 if( consHasName(cons) && prob->consnames != NULL )
    1489 {
    1490 SCIP_CONS* currentcons;
    1491 currentcons = (SCIP_CONS*)SCIPhashtableRetrieve(prob->consnames, (void*)(cons->name));
    1492 if( currentcons == cons )
    1493 {
    1494 SCIP_CALL( SCIPhashtableRemove(prob->consnames, (void*)cons) );
    1495 }
    1496 }
    1497
    1498 return SCIP_OKAY;
    1499}
    1500
    1501/** adds constraint to the problem and captures it;
    1502 * a local constraint is automatically upgraded into a global constraint
    1503 */
    1505 SCIP_PROB* prob, /**< problem data */
    1506 SCIP_SET* set, /**< global SCIP settings */
    1507 SCIP_STAT* stat, /**< dynamic problem statistics */
    1508 SCIP_CONS* cons /**< constraint to add */
    1509 )
    1510{
    1511 assert(prob != NULL);
    1512 assert(cons != NULL);
    1513 assert(cons->addconssetchg == NULL);
    1514 assert(cons->addarraypos == -1);
    1515
    1516#ifndef NDEBUG
    1517 /* check if we add this constraint to the same scip, where we create the constraint */
    1518 if( cons->scip != set->scip )
    1519 {
    1520 SCIPerrorMessage("constraint belongs to different scip instance\n");
    1521 return SCIP_INVALIDDATA;
    1522 }
    1523#endif
    1524 SCIPsetDebugMsg(set, "adding constraint <%s> to global problem -> %d constraints\n",
    1525 SCIPconsGetName(cons), prob->nconss+1);
    1526
    1527 /* mark the constraint as problem constraint, and remember the constraint's position */
    1528 cons->addconssetchg = NULL;
    1529 cons->addarraypos = prob->nconss;
    1530
    1531 /* add the constraint to the problem's constraint array */
    1532 SCIP_CALL( probEnsureConssMem(prob, set, prob->nconss+1) );
    1533 prob->conss[prob->nconss] = cons;
    1534 if( prob->origcheckconss != NULL )
    1535 prob->origcheckconss[prob->nconss] = cons;
    1536 prob->nconss++;
    1537 prob->maxnconss = MAX(prob->maxnconss, prob->nconss);
    1538 prob->consschecksorted = FALSE;
    1539 stat->nactiveconssadded++;
    1540
    1541 /* undelete constraint, if it was globally deleted in the past */
    1542 cons->deleted = FALSE;
    1543
    1544 /* mark constraint to be globally valid */
    1545 SCIPconsSetLocal(cons, FALSE);
    1546
    1547 /* capture constraint */
    1548 SCIPconsCapture(cons);
    1549
    1550 /* add constraint's name to the namespace */
    1551 SCIP_CALL( SCIPprobAddConsName(prob, cons) );
    1552
    1553 /* if the problem is the transformed problem, activate and lock constraint */
    1554 if( prob->transformed )
    1555 {
    1556 /* activate constraint */
    1557 if( !SCIPconsIsActive(cons) )
    1558 {
    1559 SCIP_CALL( SCIPconsActivate(cons, set, stat, -1, (stat->nnodes <= 1)) );
    1560 }
    1561
    1562 /* if constraint is a check-constraint, lock roundings of constraint's variables */
    1563 if( SCIPconsIsChecked(cons) )
    1564 {
    1566 }
    1567 }
    1568
    1569 return SCIP_OKAY;
    1570}
    1571
    1572/** releases and removes constraint from the problem; if the user has not captured the constraint for his own use, the
    1573 * constraint may be invalid after the call
    1574 */
    1576 SCIP_PROB* prob, /**< problem data */
    1577 BMS_BLKMEM* blkmem, /**< block memory */
    1578 SCIP_SET* set, /**< global SCIP settings */
    1579 SCIP_STAT* stat, /**< dynamic problem statistics */
    1580 SCIP_CONS* cons /**< constraint to remove */
    1581 )
    1582{
    1583 int arraypos;
    1584
    1585 assert(prob != NULL);
    1586 assert(blkmem != NULL);
    1587 assert(cons != NULL);
    1588 assert(cons->addconssetchg == NULL);
    1589 assert(0 <= cons->addarraypos && cons->addarraypos < prob->nconss);
    1590 assert(prob->conss != NULL);
    1591 assert(prob->conss[cons->addarraypos] == cons);
    1592
    1593 /* if the problem is the transformed problem, deactivate and unlock constraint */
    1594 if( prob->transformed )
    1595 {
    1596 /* if constraint is a check-constraint, unlock roundings of constraint's variables */
    1597 if( SCIPconsIsChecked(cons) )
    1598 {
    1600 }
    1601
    1602 /* deactivate constraint, if it is currently active */
    1603 if( cons->active && !cons->updatedeactivate )
    1604 {
    1605 SCIP_CALL( SCIPconsDeactivate(cons, set, stat) );
    1606 }
    1607 }
    1608 assert(!cons->active || cons->updatedeactivate);
    1609 assert(!cons->enabled || cons->updatedeactivate);
    1610
    1611 /* remove constraint's name from the namespace */
    1612 SCIP_CALL( SCIPprobRemoveConsName(prob, cons) );
    1613
    1614 /* remove the constraint from the problem's constraint array */
    1615 arraypos = cons->addarraypos;
    1616 prob->conss[arraypos] = prob->conss[prob->nconss-1];
    1617 assert(prob->conss[arraypos] != NULL);
    1618 assert(prob->conss[arraypos]->addconssetchg == NULL);
    1619 prob->conss[arraypos]->addarraypos = arraypos;
    1620 prob->nconss--;
    1621 prob->consschecksorted = FALSE;
    1622
    1623 /* if we delete constraints then delete array origcheckconss to be sure */
    1624 if( prob->origcheckconss != NULL )
    1626
    1627 /* mark the constraint to be no longer in the problem */
    1628 cons->addarraypos = -1;
    1629
    1630 /* release constraint */
    1631 SCIP_CALL( SCIPconsRelease(&cons, blkmem, set) );
    1632
    1633 return SCIP_OKAY;
    1634}
    1635
    1636/** remembers the current number of constraints in the problem's internal data structure
    1637 * - resets maximum number of constraints to current number of constraints
    1638 * - remembers current number of constraints as starting number of constraints
    1639 */
    1641 SCIP_PROB* prob /**< problem data */
    1642 )
    1643{
    1644 assert(prob != NULL);
    1645
    1646 /* remember number of constraints for statistic */
    1647 prob->maxnconss = prob->nconss;
    1648 prob->startnvars = prob->nvars;
    1649 prob->startnconss = prob->nconss;
    1650}
    1651
    1652/** sets objective sense: minimization or maximization */
    1654 SCIP_PROB* prob, /**< problem data */
    1655 SCIP_OBJSENSE objsense /**< new objective sense */
    1656 )
    1657{
    1658 assert(prob != NULL);
    1660 assert(objsense == SCIP_OBJSENSE_MAXIMIZE || objsense == SCIP_OBJSENSE_MINIMIZE);
    1661
    1662 prob->objsense = objsense;
    1663}
    1664
    1665/** adds value to objective offset */
    1667 SCIP_PROB* prob, /**< problem data */
    1668 SCIP_Real addval /**< value to add to objective offset */
    1669 )
    1670{
    1671 assert(prob != NULL);
    1672 assert(prob->objoffsetexact == NULL);
    1673
    1674 SCIPdebugMessage("adding %g to real objective offset %g\n", addval, prob->objoffset);
    1675
    1676 prob->objoffset += addval;
    1677
    1678 SCIPdebugMessage("new objective offset %g\n", prob->objoffset);
    1679}
    1680
    1681/** adds value to objective offset */
    1683 SCIP_PROB* prob, /**< problem data */
    1684 SCIP_RATIONAL* addval /**< value to add to objective offset */
    1685 )
    1686{
    1687 assert(prob != NULL);
    1688 assert(prob->objoffsetexact != NULL);
    1689
    1690 SCIPrationalDebugMessage("adding %q to exact objective offset %q\n", addval, prob->objoffsetexact);
    1691
    1692 SCIPrationalAdd(prob->objoffsetexact, prob->objoffsetexact, addval);
    1694
    1695 SCIPrationalDebugMessage("new objective offset %q\n", prob->objoffsetexact);
    1696}
    1697
    1698/** sets the dual bound on objective function */
    1700 SCIP_PROB* prob, /**< problem data */
    1701 SCIP_Real dualbound /**< external dual bound */
    1702 )
    1703{
    1704 assert(prob != NULL);
    1705
    1706 prob->dualbound = dualbound;
    1707}
    1708
    1709/** sets limit on objective function, such that only solutions better than this limit are accepted */
    1711 SCIP_PROB* prob, /**< problem data */
    1712 SCIP_Real objlim /**< external objective limit */
    1713 )
    1714{
    1715 assert(prob != NULL);
    1716
    1717 prob->objlim = objlim;
    1718}
    1719
    1720/** informs the problem, that its objective value is always integral in every feasible solution */
    1722 SCIP_PROB* prob /**< problem data */
    1723 )
    1724{
    1725 assert(prob != NULL);
    1726
    1727 prob->objisintegral = TRUE;
    1728}
    1729
    1730/** sets integral objective value flag, if all variables with non-zero objective values are integral and have
    1731 * integral objective value and also updates the cutoff bound if primal solution is already known
    1732 */
    1733static
    1735 SCIP_PROB* transprob, /**< tranformed problem data */
    1736 SCIP_PROB* origprob, /**< original problem data */
    1737 BMS_BLKMEM* blkmem, /**< block memory */
    1738 SCIP_SET* set, /**< global SCIP settings */
    1739 SCIP_STAT* stat, /**< problem statistics data */
    1740 SCIP_PRIMAL* primal, /**< primal data */
    1741 SCIP_TREE* tree, /**< branch and bound tree */
    1742 SCIP_REOPT* reopt, /**< reoptimization data structure */
    1743 SCIP_LP* lp, /**< current LP data */
    1744 SCIP_EVENTQUEUE* eventqueue, /**< event queue */
    1745 SCIP_EVENTFILTER* eventfilter /**< global event filter */
    1746 )
    1747{
    1748 SCIP_RATIONAL* obj;
    1749 int v;
    1750
    1751 assert(transprob != NULL);
    1752 assert(origprob != NULL);
    1753 assert(set->exact_enable);
    1754
    1755 /* if we know already, that the objective value is integral, nothing has to be done */
    1756 if( transprob->objisintegral )
    1757 return SCIP_OKAY;
    1758
    1759 /* if there exist unknown variables, we cannot conclude that the objective value is always integral */
    1760 if( set->nactivepricers != 0 || set->nactivebenders != 0 )
    1761 return SCIP_OKAY;
    1762
    1763 /* if the objective value offset is fractional, the value itself is possibly fractional */
    1764 if( !EPSISINT(transprob->objoffset, 0.0) ) /*lint !e835*/
    1765 return SCIP_OKAY;
    1766
    1767 /* scan through the variables */
    1768 for( v = 0; v < transprob->nvars; ++v )
    1769 {
    1770 /* get objective value of variable */
    1771 obj = SCIPvarGetObjExact(transprob->vars[v]);
    1772
    1773 /* check, if objective value is non-zero */
    1774 if( !SCIPrationalIsZero(obj) )
    1775 {
    1776 /* if variable's objective value is fractional, the problem's objective value may also be fractional */
    1777 if( !SCIPrationalIsIntegral(obj) )
    1778 break;
    1779
    1780 /* if variable with non-zero objective value is continuous, the problem's objective value may be fractional */
    1781 if( !SCIPvarIsIntegral(transprob->vars[v]) )
    1782 break;
    1783 }
    1784 }
    1785
    1786 /* objective value is integral, if the variable loop scanned all variables */
    1787 if( v == transprob->nvars )
    1788 {
    1789 transprob->objisintegral = TRUE;
    1790
    1791 /* update upper bound and cutoff bound in primal data structure due to new internality information */
    1792 SCIP_CALL( SCIPprimalUpdateObjoffset(primal, blkmem, set, stat, eventqueue, eventfilter, transprob, origprob, tree, reopt, lp) );
    1793 }
    1794
    1795 return SCIP_OKAY;
    1796}
    1797
    1798/** sets integral objective value flag, if all variables with non-zero objective values are integral and have
    1799 * integral objective value and also updates the cutoff bound if primal solution is already known
    1800 */
    1802 SCIP_PROB* transprob, /**< tranformed problem data */
    1803 SCIP_PROB* origprob, /**< original problem data */
    1804 BMS_BLKMEM* blkmem, /**< block memory */
    1805 SCIP_SET* set, /**< global SCIP settings */
    1806 SCIP_STAT* stat, /**< problem statistics data */
    1807 SCIP_PRIMAL* primal, /**< primal data */
    1808 SCIP_TREE* tree, /**< branch and bound tree */
    1809 SCIP_REOPT* reopt, /**< reoptimization data structure */
    1810 SCIP_LP* lp, /**< current LP data */
    1811 SCIP_EVENTQUEUE* eventqueue, /**< event queue */
    1812 SCIP_EVENTFILTER* eventfilter /**< global event filter */
    1813 )
    1814{
    1815 SCIP_Real obj;
    1816 int v;
    1817
    1818 assert(transprob != NULL);
    1819 assert(origprob != NULL);
    1820
    1821 if( set->exact_enable )
    1822 return probCheckObjIntegralExact(transprob, origprob, blkmem, set, stat, primal, tree, reopt, lp, eventqueue,
    1823 eventfilter);
    1824
    1825 /* if we know already, that the objective value is integral, nothing has to be done */
    1826 if( transprob->objisintegral )
    1827 return SCIP_OKAY;
    1828
    1829 /* if there exist unknown variables, we cannot conclude that the objective value is always integral */
    1830 if( set->nactivepricers != 0 || set->nactivebenders != 0 )
    1831 return SCIP_OKAY;
    1832
    1833 /* if the objective value offset is fractional, the value itself is possibly fractional */
    1834 if( !SCIPsetIsIntegral(set, transprob->objoffset) )
    1835 return SCIP_OKAY;
    1836
    1837 /* scan through the variables */
    1838 for( v = 0; v < transprob->nvars; ++v )
    1839 {
    1840 /* get objective value of variable */
    1841 obj = SCIPvarGetObj(transprob->vars[v]);
    1842
    1843 /* check, if objective value is non-zero */
    1844 if( !SCIPsetIsZero(set, obj) )
    1845 {
    1846 /* if variable's objective value is fractional, the problem's objective value may also be fractional */
    1847 if( !SCIPsetIsIntegral(set, obj) )
    1848 break;
    1849
    1850 /* if variable with non-zero objective value is continuous, the problem's objective value may be fractional */
    1851 if( !SCIPvarIsIntegral(transprob->vars[v]) )
    1852 break;
    1853 }
    1854 }
    1855
    1856 /* objective value is integral, if the variable loop scanned all variables */
    1857 if( v == transprob->nvars )
    1858 {
    1859 transprob->objisintegral = TRUE;
    1860
    1861 /* update upper bound and cutoff bound in primal data structure due to new internality information */
    1862 SCIP_CALL( SCIPprimalUpdateObjoffset(primal, blkmem, set, stat, eventqueue, eventfilter, transprob, origprob, tree, reopt, lp) );
    1863 }
    1864
    1865 return SCIP_OKAY;
    1866}
    1867
    1868
    1869
    1870/** update the number of variables with non-zero objective coefficient */
    1872 SCIP_PROB* prob, /**< problem data */
    1873 SCIP_SET* set, /**< global SCIP settings */
    1874 SCIP_Real oldobj, /**< old objective value for variable */
    1875 SCIP_Real newobj /**< new objective value for variable */
    1876 )
    1877{
    1878 assert(prob->transformed);
    1879
    1880 if( !SCIPsetIsZero(set, oldobj) )
    1881 prob->nobjvars--;
    1882
    1883 if( !SCIPsetIsZero(set, newobj) )
    1884 prob->nobjvars++;
    1885}
    1886
    1887/** update the dual bound if its better as the current one */
    1889 SCIP_PROB* prob, /**< problem data */
    1890 SCIP_Real newbound /**< new dual bound for the node (if it's tighter than the old one) */
    1891 )
    1892{
    1893 if( prob->dualbound == SCIP_INVALID ) /*lint !e777*/
    1894 SCIPprobSetDualbound(prob, newbound);
    1895 else
    1896 {
    1897 switch( prob->objsense )
    1898 {
    1900 prob->dualbound = MAX(newbound, prob->dualbound);
    1901 break;
    1902
    1904 prob->dualbound = MIN(newbound, prob->dualbound);
    1905 break;
    1906
    1907 default:
    1908 SCIPerrorMessage("invalid objective sense <%d>\n", prob->objsense);
    1909 SCIPABORT();
    1910 }
    1911 }
    1912}
    1913
    1914/** invalidates the dual bound */
    1916 SCIP_PROB* prob /**< problem data */
    1917 )
    1918{
    1919 assert(prob != NULL);
    1920
    1921 prob->dualbound = SCIP_INVALID;
    1922}
    1923
    1924/** if possible, scales objective function such that it is integral with gcd = 1 */
    1925static
    1927 SCIP_PROB* transprob, /**< tranformed problem data */
    1928 SCIP_PROB* origprob, /**< original problem data */
    1929 BMS_BLKMEM* blkmem, /**< block memory */
    1930 SCIP_SET* set, /**< global SCIP settings */
    1931 SCIP_STAT* stat, /**< problem statistics data */
    1932 SCIP_PRIMAL* primal, /**< primal data */
    1933 SCIP_TREE* tree, /**< branch and bound tree */
    1934 SCIP_REOPT* reopt, /**< reoptimization data structure */
    1935 SCIP_LP* lp, /**< current LP data */
    1936 SCIP_EVENTQUEUE* eventqueue, /**< event queue */
    1937 SCIP_EVENTFILTER* eventfilter /**< global event filter */
    1938 )
    1939{
    1940 int v;
    1941 int nints;
    1942
    1943 assert(transprob != NULL);
    1944 assert(set != NULL);
    1945
    1946 /* do not change objective if there are pricers involved */
    1947 if( set->nactivepricers != 0 || set->nactivebenders != 0 || !set->misc_scaleobj )
    1948 return SCIP_OKAY;
    1949
    1950 nints = transprob->nvars - transprob->ncontvars;
    1951
    1952 /* scan through the continuous variables */
    1953 for( v = nints; v < transprob->nvars; ++v )
    1954 {
    1955 SCIP_RATIONAL* obj;
    1956
    1957 /* get objective value of variable; it it is non-zero, no scaling can be applied */
    1958 obj = SCIPvarGetObjExact(transprob->vars[v]);
    1959 if( !SCIPrationalIsZero(obj) )
    1960 break;
    1961 }
    1962
    1963 /* only continue if all continuous variables have obj = 0 */
    1964 if( v == transprob->nvars )
    1965 {
    1966 SCIP_RATIONAL** objvals;
    1967 SCIP_RATIONAL* intscalar;
    1968 SCIP_Bool success;
    1969
    1970 /* get temporary memory */
    1971 SCIP_CALL( SCIPrationalCreateBuffer(set->buffer, &intscalar) );
    1972 SCIP_CALL( SCIPrationalCreateBufferArray(set->buffer, &objvals, nints) );
    1973
    1974 /* get objective values of integer variables */
    1975 for( v = 0; v < nints; ++v )
    1976 SCIPrationalSetRational(objvals[v], SCIPvarGetObjExact(transprob->vars[v]));
    1977
    1978 /* calculate integral scalar */
    1980 intscalar, &success) );
    1981
    1982 SCIPrationalDebugMessage("integral objective scalar: success=%u, intscalar=%q\n", success, intscalar);
    1983
    1984 /* apply scaling */
    1985 if( success && !SCIPrationalIsEQReal(intscalar, 1.0) )
    1986 {
    1987 /* calculate scaled objective values */
    1988 for( v = 0; v < nints; ++v )
    1989 {
    1990 SCIPrationalMult(objvals[v], objvals[v], intscalar);
    1991 assert(SCIPrationalIsIntegral(objvals[v]));
    1992 }
    1993
    1994 /* change the variables' objective values and adjust objscale and objoffset */
    1995 if( v == nints )
    1996 {
    1997 for( v = 0; v < nints; ++v )
    1998 {
    1999 SCIPrationalDebugMessage(" -> var <%s>: newobj = %q\n", SCIPvarGetName(transprob->vars[v]), objvals[v]);
    2000 SCIP_CALL( SCIPvarChgObjExact(transprob->vars[v], blkmem, set, transprob, primal, lp->lpexact, eventqueue, objvals[v]) );
    2001 }
    2002 SCIPrationalMult(transprob->objoffsetexact, transprob->objoffsetexact, intscalar);
    2003 SCIPrationalDiv(transprob->objscaleexact, transprob->objscaleexact, intscalar);
    2004 transprob->objoffset = SCIPrationalGetReal(transprob->objoffsetexact);
    2005 transprob->objscale = SCIPrationalGetReal(transprob->objscaleexact);
    2006 transprob->objisintegral = TRUE;
    2007 SCIPrationalDebugMessage("integral objective scalar: objscale=%q\n", transprob->objscaleexact);
    2008
    2009 /* update upperbound and cutoffbound in primal data structure */
    2010 SCIP_CALL( SCIPprimalUpdateObjoffsetExact(primal, blkmem, set, stat, eventqueue, eventfilter, transprob, origprob, tree, reopt, lp) );
    2011 }
    2012 }
    2013
    2014 /* free temporary memory */
    2015 SCIPrationalFreeBuffer(set->buffer, &intscalar);
    2016 SCIPrationalFreeBufferArray(set->buffer, &objvals, nints);
    2017 }
    2018
    2019 return SCIP_OKAY;
    2020}
    2021
    2022/** if possible, scales objective function such that it is integral with gcd = 1 */
    2024 SCIP_PROB* transprob, /**< tranformed problem data */
    2025 SCIP_PROB* origprob, /**< original problem data */
    2026 BMS_BLKMEM* blkmem, /**< block memory */
    2027 SCIP_SET* set, /**< global SCIP settings */
    2028 SCIP_STAT* stat, /**< problem statistics data */
    2029 SCIP_PRIMAL* primal, /**< primal data */
    2030 SCIP_TREE* tree, /**< branch and bound tree */
    2031 SCIP_REOPT* reopt, /**< reoptimization data structure */
    2032 SCIP_LP* lp, /**< current LP data */
    2033 SCIP_EVENTQUEUE* eventqueue, /**< event queue */
    2034 SCIP_EVENTFILTER* eventfilter /**< global event filter */
    2035 )
    2036{
    2037 int v;
    2038 int nints;
    2039
    2040 assert(transprob != NULL);
    2041 assert(set != NULL);
    2042
    2043 /* do not change objective if there are pricers involved */
    2044 if( set->nactivepricers != 0 || set->nactivebenders != 0 || !set->misc_scaleobj )
    2045 return SCIP_OKAY;
    2046
    2047 if( set->exact_enable )
    2048 {
    2049 SCIP_CALL( probScaleObjExact(transprob, origprob, blkmem, set, stat, primal, tree, reopt, lp, eventqueue,
    2050 eventfilter) );
    2051 return SCIP_OKAY;
    2052 }
    2053
    2054 nints = transprob->nvars - transprob->ncontvars;
    2055
    2056 /* scan through the continuous variables */
    2057 for( v = nints; v < transprob->nvars; ++v )
    2058 {
    2059 SCIP_Real obj;
    2060
    2061 /* get objective value of variable; it it is non-zero, no scaling can be applied */
    2062 obj = SCIPvarGetObj(transprob->vars[v]);
    2063 if( !SCIPsetIsZero(set, obj) )
    2064 break;
    2065 }
    2066
    2067 /* only continue if all continuous variables have obj = 0 */
    2068 if( v == transprob->nvars )
    2069 {
    2070 SCIP_Real* objvals;
    2071 SCIP_Real intscalar;
    2072 SCIP_Bool success;
    2073
    2074 /* get temporary memory */
    2075 SCIP_CALL( SCIPsetAllocBufferArray(set, &objvals, nints) );
    2076
    2077 /* get objective values of integer variables */
    2078 for( v = 0; v < nints; ++v )
    2079 objvals[v] = SCIPvarGetObj(transprob->vars[v]);
    2080
    2081 /* calculate integral scalar */
    2083 &intscalar, &success) );
    2084
    2085 SCIPsetDebugMsg(set, "integral objective scalar: success=%u, intscalar=%g\n", success, intscalar);
    2086
    2087 if( success )
    2088 {
    2089 SCIP_Longint gcd;
    2090
    2091 assert(intscalar > 0.0);
    2092
    2093 /* calculate gcd of resulting integral coefficients */
    2094 gcd = 0;
    2095 for( v = 0; v < nints && gcd != 1; ++v )
    2096 {
    2097 SCIP_Longint absobj;
    2098
    2099 /* if absobj exceeds maximum SCIP_Longint value, return */
    2100 if( REALABS(objvals[v]) * intscalar + 0.5 > (SCIP_Real)SCIP_LONGINT_MAX )
    2101 {
    2102 SCIPsetFreeBufferArray(set, &objvals);
    2103 return SCIP_OKAY;
    2104 }
    2105
    2106 absobj = (SCIP_Longint)(REALABS(objvals[v]) * intscalar + 0.5);
    2107 if( gcd == 0 )
    2108 gcd = absobj;
    2109 else if( absobj > 0 )
    2110 gcd = SCIPcalcGreComDiv(gcd, absobj);
    2111 }
    2112 if( gcd != 0 )
    2113 intscalar /= gcd;
    2114 SCIPsetDebugMsg(set, "integral objective scalar: gcd=%" SCIP_LONGINT_FORMAT ", intscalar=%g\n", gcd, intscalar);
    2115
    2116 /* only apply scaling if the final scalar is small enough */
    2117 if( intscalar <= OBJSCALE_MAXFINALSCALE )
    2118 {
    2119 /* apply scaling */
    2120 if( !SCIPsetIsEQ(set, intscalar, 1.0) )
    2121 {
    2122 /* calculate scaled objective values */
    2123 for( v = 0; v < nints; ++v )
    2124 {
    2125 SCIP_Real newobj;
    2126
    2127 /* check if new obj is really integral */
    2128 newobj = intscalar * SCIPvarGetObj(transprob->vars[v]);
    2129 if( !SCIPsetIsFeasIntegral(set, newobj) )
    2130 break;
    2131 objvals[v] = SCIPsetFeasFloor(set, newobj);
    2132 }
    2133
    2134 /* change the variables' objective values and adjust objscale and objoffset */
    2135 if( v == nints )
    2136 {
    2137 for( v = 0; v < nints; ++v )
    2138 {
    2139 SCIPsetDebugMsg(set, " -> var <%s>: newobj = %.6f\n", SCIPvarGetName(transprob->vars[v]), objvals[v]);
    2140 SCIP_CALL( SCIPvarChgObj(transprob->vars[v], blkmem, set, transprob, primal, lp, eventqueue, objvals[v]) );
    2141 }
    2142 transprob->objoffset *= intscalar;
    2143 transprob->objscale /= intscalar;
    2144 transprob->objisintegral = TRUE;
    2145 SCIPsetDebugMsg(set, "integral objective scalar: objscale=%g\n", transprob->objscale);
    2146
    2147 /* update upperbound and cutoffbound in primal data structure */
    2148 SCIP_CALL( SCIPprimalUpdateObjoffset(primal, blkmem, set, stat, eventqueue, eventfilter, transprob, origprob, tree, reopt, lp) );
    2149 }
    2150 }
    2151 }
    2152 }
    2153
    2154 /* free temporary memory */
    2155 SCIPsetFreeBufferArray(set, &objvals);
    2156 }
    2157
    2158 return SCIP_OKAY;
    2159}
    2160
    2161/** remembers the current solution as root solution in the problem variables */
    2163 SCIP_PROB* prob, /**< problem data */
    2164 SCIP_SET* set, /**< global SCIP settings */
    2165 SCIP_STAT* stat, /**< SCIP statistics */
    2166 SCIP_LP* lp, /**< current LP data */
    2167 SCIP_Bool roothaslp /**< is the root solution from LP? */
    2168 )
    2169{
    2170 int v;
    2171
    2172 assert(prob != NULL);
    2173 assert(prob->transformed);
    2174
    2175 if( roothaslp )
    2176 {
    2177 for( v = 0; v < prob->nvars; ++v )
    2178 SCIPvarStoreRootSol(prob->vars[v], roothaslp);
    2179
    2181 SCIPlpStoreRootObjval(lp, set, prob);
    2182
    2183 /* compute root LP best-estimate */
    2185 }
    2186}
    2187
    2188/** remembers the best solution w.r.t. root reduced cost propagation as root solution in the problem variables */
    2190 SCIP_PROB* prob, /**< problem data */
    2191 SCIP_SET* set, /**< global SCIP settings */
    2192 SCIP_STAT* stat, /**< problem statistics */
    2193 SCIP_LP* lp /**< current LP data */
    2194 )
    2195{
    2196 SCIP_Real rootlpobjval;
    2197 int v;
    2198
    2199 assert(prob != NULL);
    2200 assert(lp != NULL);
    2201 assert(prob->transformed);
    2202 assert(lp->lpsolstat == SCIP_LPSOLSTAT_OPTIMAL);
    2203
    2204 /* in case we have a zero objective fucntion, we skip the root reduced cost update */
    2205 if( SCIPprobGetNObjVars(prob, set) == 0 )
    2206 return;
    2207
    2208 if( !SCIPlpIsDualReliable(lp) )
    2209 return;
    2210
    2211 SCIPsetDebugMsg(set, "update root reduced costs\n");
    2212
    2213 /* compute current root LP objective value */
    2214 rootlpobjval = SCIPlpGetObjval(lp, set, prob);
    2215 assert(rootlpobjval != SCIP_INVALID); /*lint !e777*/
    2216
    2217 for( v = 0; v < prob->nvars; ++v )
    2218 {
    2219 SCIP_VAR* var;
    2220 SCIP_COL* col;
    2221 SCIP_Real rootsol = 0.0;
    2222 SCIP_Real rootredcost = 0.0;
    2223
    2224 var = prob->vars[v];
    2225 assert(var != NULL);
    2226
    2227 /* check if the variable is part of the LP */
    2229 continue;
    2230
    2231 col = SCIPvarGetCol(var);
    2232 assert(col != NULL);
    2233
    2235
    2236 if( !SCIPvarIsBinary(var) )
    2237 {
    2238 rootsol = SCIPvarGetSol(var, TRUE);
    2239 rootredcost = SCIPcolGetRedcost(col, stat, lp);
    2240 }
    2241 else
    2242 {
    2243 SCIP_Real primsol;
    2244 SCIP_BASESTAT basestat;
    2245 SCIP_Bool lpissolbasic;
    2246
    2247 basestat = SCIPcolGetBasisStatus(col);
    2248 lpissolbasic = SCIPlpIsSolBasic(lp);
    2249 primsol = SCIPcolGetPrimsol(col);
    2250
    2251 if( (lpissolbasic && (basestat == SCIP_BASESTAT_LOWER || basestat == SCIP_BASESTAT_UPPER)) ||
    2252 (!lpissolbasic && (SCIPsetIsFeasEQ(set, SCIPvarGetLbLocal(var), primsol) ||
    2253 SCIPsetIsFeasEQ(set, SCIPvarGetUbLocal(var), primsol))) )
    2254 {
    2255 SCIP_Real lbrootredcost;
    2256 SCIP_Real ubrootredcost;
    2257
    2258 /* get reduced cost if the variable gets fixed to zero */
    2259 lbrootredcost = SCIPvarGetImplRedcost(var, set, FALSE, stat, prob, lp);
    2260 assert( !SCIPsetIsDualfeasPositive(set, lbrootredcost)
    2262
    2263 /* get reduced cost if the variable gets fixed to one */
    2264 ubrootredcost = SCIPvarGetImplRedcost(var, set, TRUE, stat, prob, lp);
    2265 assert( set->exact_enable || !SCIPsetIsDualfeasNegative(set, ubrootredcost)
    2267
    2268 if( -lbrootredcost > ubrootredcost )
    2269 {
    2270 rootredcost = lbrootredcost;
    2271 rootsol = 1.0;
    2272 }
    2273 else
    2274 {
    2275 rootredcost = ubrootredcost;
    2276 rootsol = 0.0;
    2277 }
    2278 }
    2279 }
    2280
    2281 /* update the current solution as best root solution in the problem variables if it is better */
    2282 SCIPvarUpdateBestRootSol(var, set, rootsol, rootredcost, rootlpobjval);
    2283 }
    2284}
    2285
    2286/** informs problem, that the presolving process was finished, and updates all internal data structures */ /*lint -e715*/
    2288 SCIP_PROB* prob, /**< problem data */
    2289 SCIP_SET* set /**< global SCIP settings */
    2290 )
    2291{ /*lint --e{715}*/
    2292 return SCIP_OKAY;
    2293}
    2294
    2295/** initializes problem for branch and bound process and resets all constraint's ages and histories of current run */
    2297 SCIP_PROB* prob, /**< problem data */
    2298 SCIP_SET* set /**< global SCIP settings */
    2299 )
    2300{
    2301 int c;
    2302 int v;
    2303
    2304 assert(prob != NULL);
    2305 assert(prob->transformed);
    2306 assert(set != NULL);
    2307
    2308 /* reset constraint's ages */
    2309 for( c = 0; c < prob->nconss; ++c )
    2310 {
    2311 SCIP_CALL( SCIPconsResetAge(prob->conss[c], set) );
    2312 }
    2313
    2314 /* initialize variables for solving */
    2315 for( v = 0; v < prob->nvars; ++v )
    2316 SCIPvarInitSolve(prob->vars[v]);
    2317
    2318 /* call user data function */
    2319 if( prob->probinitsol != NULL )
    2320 {
    2321 SCIP_CALL( prob->probinitsol(set->scip, prob->probdata) );
    2322 }
    2323
    2324 /* assert that the counter for variables with nonzero objective is correct */
    2325 assert(prob->nobjvars == SCIPprobGetNObjVars(prob, set));
    2326
    2327 return SCIP_OKAY;
    2328}
    2329
    2330/** deinitializes problem after branch and bound process, and converts all COLUMN variables back into LOOSE variables */
    2332 SCIP_PROB* prob, /**< problem data */
    2333 BMS_BLKMEM* blkmem, /**< block memory */
    2334 SCIP_SET* set, /**< global SCIP settings */
    2335 SCIP_EVENTQUEUE* eventqueue, /**< event queue */
    2336 SCIP_LP* lp, /**< current LP data */
    2337 SCIP_Bool restart /**< was this exit solve call triggered by a restart? */
    2338 )
    2339{
    2340 SCIP_VAR* var;
    2341 int v;
    2342
    2343 assert(prob != NULL);
    2344 assert(prob->transformed);
    2345 assert(set != NULL);
    2346
    2347 /* call user data function */
    2348 if( prob->probexitsol != NULL )
    2349 {
    2350 SCIP_CALL( prob->probexitsol(set->scip, prob->probdata, restart) );
    2351 }
    2352
    2353 /* - convert all COLUMN variables back into LOOSE variables
    2354 * - mark relaxation-only variables for deletion, if possible and restarting
    2355 * - initPresolve will then call SCIPprobPerformVarDeletions
    2356 * - if no restart, then the whole transformed problem will be deleted anyway
    2357 */
    2358 if( prob->ncolvars > 0 || restart )
    2359 {
    2360 for( v = 0; v < prob->nvars; ++v )
    2361 {
    2362 var = prob->vars[v];
    2364 {
    2365 SCIP_CALL( SCIPvarLoose(var, blkmem, set, eventqueue, prob, lp) );
    2366 }
    2367
    2368 /* invalidate root reduced cost, root reduced solution, and root LP objective value for each variable */
    2369 SCIPvarSetBestRootSol(var, 0.0, 0.0, SCIP_INVALID);
    2370
    2371 if( SCIPvarIsRelaxationOnly(var) && restart )
    2372 {
    2373 /* relaxation variables should be unlocked and only captured by prob at this moment */
    2374 assert(SCIPvarGetNLocksDown(var) == 0);
    2375 assert(SCIPvarGetNLocksUp(var) == 0);
    2376 assert(SCIPvarGetNUses(var) == 1);
    2377
    2378 if( SCIPvarIsDeletable(var) )
    2379 {
    2380 SCIP_Bool deleted;
    2381
    2382 SCIPsetDebugMsg(set, "queue relaxation-only variable <%s> for deletion\n", SCIPvarGetName(var));
    2383 SCIP_CALL( SCIPprobDelVar(prob, blkmem, set, eventqueue, var, &deleted) );
    2384 assert(deleted);
    2385 }
    2386 else
    2387 {
    2388 SCIPsetDebugMsg(set, "cannot queue relaxation-only variable <%s> for deletion because it is marked non-deletable\n", SCIPvarGetName(var));
    2389 }
    2390 }
    2391 }
    2392 }
    2393 assert(prob->ncolvars == 0);
    2394
    2395 return SCIP_OKAY;
    2396}
    2397
    2398
    2399
    2400
    2401/*
    2402 * problem information
    2403 */
    2404
    2405/** sets problem name */
    2407 SCIP_PROB* prob, /**< problem data */
    2408 const char* name /**< name to be set */
    2409 )
    2410{
    2411 assert(prob != NULL);
    2412
    2413 BMSfreeMemoryArray(&(prob->name));
    2414 SCIP_ALLOC( BMSduplicateMemoryArray(&(prob->name), name, strlen(name)+1) );
    2415
    2416 return SCIP_OKAY;
    2417}
    2418
    2419/** returns the number of variables with non-zero objective coefficient */
    2421 SCIP_PROB* prob, /**< problem data */
    2422 SCIP_SET* set /**< global SCIP settings */
    2423 )
    2424{
    2425 if( prob->transformed )
    2426 {
    2427 /* this is much too expensive, to check it in each debug run */
    2428#ifdef SCIP_MORE_DEBUG
    2429 int nobjvars;
    2430 int v;
    2431
    2432 nobjvars = 0;
    2433
    2434 for( v = prob->nvars - 1; v >= 0; --v )
    2435 {
    2436 if( !SCIPsetIsZero(set, SCIPvarGetObj(prob->vars[v])) )
    2437 nobjvars++;
    2438 }
    2439
    2440 /* check that the internal count is correct */
    2441 assert(prob->nobjvars == nobjvars);
    2442#endif
    2443 return prob->nobjvars;
    2444 }
    2445 else
    2446 {
    2447 int nobjvars;
    2448 int v;
    2449
    2450 nobjvars = 0;
    2451
    2452 for( v = prob->nvars - 1; v >= 0; --v )
    2453 {
    2454 if( !SCIPsetIsZero(set, SCIPvarGetObj(prob->vars[v])) )
    2455 nobjvars++;
    2456 }
    2457 return nobjvars;
    2458 }
    2459}
    2460
    2461/** returns the minimal absolute non-zero objective coefficient
    2462 *
    2463 * @note currently, this is only used for statistics and printed after the solving process. if this information is
    2464 * needed during the (pre)solving process this should be implemented more efficiently, e.g., updating the minimal
    2465 * absolute non-zero coefficient every time an objective coefficient has changed.
    2466 */
    2468 SCIP_PROB* prob, /**< problem data */
    2469 SCIP_SET* set /**< global SCIP settings */
    2470 )
    2471{
    2472 SCIP_Real absmin;
    2473 int v;
    2474
    2475 absmin = SCIPsetInfinity(set);
    2476
    2477 for( v = 0; v < prob->nvars; v++ )
    2478 {
    2479 SCIP_Real objcoef = SCIPvarGetObj(prob->vars[v]);
    2480
    2481 if( !SCIPsetIsZero(set, objcoef) && SCIPsetIsLT(set, REALABS(objcoef), absmin) )
    2482 absmin = REALABS(objcoef);
    2483 }
    2484
    2485 return absmin;
    2486}
    2487
    2488/** returns the maximal absolute non-zero objective coefficient
    2489 *
    2490 * @note currently, this is only used for statistics and printed after the solving process. if this information is
    2491 * needed during the (pre)solving process this should be implemented more efficiently, e.g., updating the maximal
    2492 * absolute non-zero coefficient every time an objective coefficient has changed.
    2493 */
    2495 SCIP_PROB* prob, /**< problem data */
    2496 SCIP_SET* set /**< global SCIP settings */
    2497 )
    2498{
    2499 SCIP_Real absmax;
    2500 int v;
    2501
    2502 absmax = -SCIPsetInfinity(set);
    2503
    2504 for( v = 0; v < prob->nvars; v++ )
    2505 {
    2506 SCIP_Real objcoef = SCIPvarGetObj(prob->vars[v]);
    2507
    2508 if( !SCIPsetIsZero(set, objcoef) && SCIPsetIsGT(set, REALABS(objcoef), absmax) )
    2509 absmax = REALABS(objcoef);
    2510 }
    2511
    2512 return absmax;
    2513}
    2514
    2515
    2516/** returns the external value of the given internal objective value */
    2518 SCIP_PROB* transprob, /**< tranformed problem data */
    2519 SCIP_PROB* origprob, /**< original problem data */
    2520 SCIP_SET* set, /**< global SCIP settings */
    2521 SCIP_Real objval /**< internal objective value */
    2522 )
    2523{
    2524 assert(set != NULL);
    2525 assert(origprob != NULL);
    2526 assert(transprob != NULL);
    2527 assert(transprob->transformed);
    2528 assert(transprob->objscale > 0.0);
    2529 assert(origprob->objoffsetexact == NULL || origprob->objoffset == SCIPrationalGetReal(origprob->objoffsetexact)); /*lint !e777*/
    2530 assert(origprob->objscaleexact == NULL || origprob->objscale == SCIPrationalGetReal(origprob->objscaleexact)); /*lint !e777*/
    2531 assert(transprob->objoffsetexact == NULL || transprob->objoffset == SCIPrationalGetReal(transprob->objoffsetexact)); /*lint !e777*/
    2532 assert(transprob->objscaleexact == NULL || transprob->objscale == SCIPrationalGetReal(transprob->objscaleexact)); /*lint !e777*/
    2533
    2534 if( SCIPsetIsInfinity(set, objval) )
    2535 return (SCIP_Real)transprob->objsense * SCIPsetInfinity(set);
    2536 else if( SCIPsetIsInfinity(set, -objval) )
    2537 return -(SCIP_Real)transprob->objsense * SCIPsetInfinity(set);
    2538 else
    2539 return (SCIP_Real)transprob->objsense * transprob->objscale * (objval + transprob->objoffset) + origprob->objoffset;
    2540}
    2541
    2542/** returns the external value of the given internal objective value */
    2544 SCIP_PROB* transprob, /**< tranformed problem data */
    2545 SCIP_PROB* origprob, /**< original problem data */
    2546 SCIP_SET* set, /**< global SCIP settings */
    2547 SCIP_RATIONAL* objval, /**< internal objective value */
    2548 SCIP_RATIONAL* objvalext /**< store external objective value */
    2549 )
    2550{
    2551 assert(set != NULL);
    2552 assert(origprob != NULL);
    2553 assert(transprob != NULL);
    2554 assert(transprob->transformed);
    2555 assert(SCIPrationalIsPositive(transprob->objscaleexact));
    2556 assert(set->exact_enable);
    2557
    2558 if( SCIPrationalIsAbsInfinity(objval) )
    2559 SCIPrationalMultReal(objvalext, objval, (SCIP_Real)transprob->objsense);
    2560 else
    2561 {
    2562 SCIPrationalAdd(objvalext, objval, transprob->objoffsetexact);
    2563 SCIPrationalMult(objvalext, objvalext, transprob->objscaleexact);
    2564 SCIPrationalMultReal(objvalext, objvalext, (SCIP_Real)transprob->objsense);
    2565 SCIPrationalAdd(objvalext, objvalext, origprob->objoffsetexact);
    2566 }
    2567}
    2568
    2569/** returns the internal value of the given external objective value */
    2571 SCIP_PROB* transprob, /**< tranformed problem data */
    2572 SCIP_PROB* origprob, /**< original problem data */
    2573 SCIP_SET* set, /**< global SCIP settings */
    2574 SCIP_Real objval /**< external objective value */
    2575 )
    2576{
    2577 assert(set != NULL);
    2578 assert(origprob != NULL);
    2579 assert(transprob != NULL);
    2580 assert(transprob->transformed);
    2581 assert(transprob->objscale > 0.0);
    2582 assert(origprob->objoffsetexact == NULL || origprob->objoffset == SCIPrationalGetReal(origprob->objoffsetexact)); /*lint !e777*/
    2583 assert(origprob->objscaleexact == NULL || origprob->objscale == SCIPrationalGetReal(origprob->objscaleexact)); /*lint !e777*/
    2584 assert(transprob->objoffsetexact == NULL || transprob->objoffset == SCIPrationalGetReal(transprob->objoffsetexact)); /*lint !e777*/
    2585 assert(transprob->objscaleexact == NULL || transprob->objscale == SCIPrationalGetReal(transprob->objscaleexact)); /*lint !e777*/
    2586
    2587 if( SCIPsetIsInfinity(set, objval) )
    2588 return (SCIP_Real)transprob->objsense * SCIPsetInfinity(set);
    2589 else if( SCIPsetIsInfinity(set, -objval) )
    2590 return -(SCIP_Real)transprob->objsense * SCIPsetInfinity(set);
    2591 else
    2592 return (SCIP_Real)transprob->objsense * (objval - origprob->objoffset) / transprob->objscale - transprob->objoffset;
    2593}
    2594
    2595/** returns the internal value of the given external objective value */
    2597 SCIP_PROB* transprob, /**< tranformed problem data */
    2598 SCIP_PROB* origprob, /**< original problem data */
    2599 SCIP_SET* set, /**< global SCIP settings */
    2600 SCIP_RATIONAL* objval, /**< internal objective value */
    2601 SCIP_RATIONAL* objvalint /**< store internal objective value */
    2602 )
    2603{
    2604 assert(set != NULL);
    2605 assert(origprob != NULL);
    2606 assert(transprob != NULL);
    2607 assert(transprob->transformed);
    2608 assert(SCIPrationalIsPositive(transprob->objscaleexact));
    2609 assert(set->exact_enable);
    2610
    2611 if( SCIPrationalIsAbsInfinity(objval) )
    2612 SCIPrationalMultReal(objvalint, objval, (SCIP_Real)transprob->objsense);
    2613 else
    2614 {
    2615 SCIPrationalDiff(objvalint, objval, origprob->objoffsetexact);
    2616 SCIPrationalDiv(objvalint, objvalint, transprob->objscaleexact);
    2617 SCIPrationalMultReal(objvalint, objvalint, (SCIP_Real)transprob->objsense);
    2618 SCIPrationalDiff(objvalint, objvalint, transprob->objoffsetexact);
    2619 }
    2620}
    2621
    2622/** returns variable of the problem with given name */
    2624 SCIP_PROB* prob, /**< problem data */
    2625 const char* name /**< name of variable to find */
    2626 )
    2627{
    2628 assert(prob != NULL);
    2629 assert(name != NULL);
    2630
    2631 if( prob->varnames == NULL )
    2632 {
    2633 SCIPerrorMessage("Cannot find variable if variable-names hashtable was disabled (due to parameter <misc/usevartable>)\n");
    2634 SCIPABORT();/*lint --e{527}*/ /* only in debug mode */
    2635 return NULL;
    2636 }
    2637
    2638 return (SCIP_VAR*)(SCIPhashtableRetrieve(prob->varnames, (char*)name));
    2639}
    2640
    2641/** returns constraint of the problem with given name */
    2643 SCIP_PROB* prob, /**< problem data */
    2644 const char* name /**< name of variable to find */
    2645 )
    2646{
    2647 assert(prob != NULL);
    2648 assert(name != NULL);
    2649
    2650 if( prob->consnames == NULL )
    2651 {
    2652 SCIPerrorMessage("Cannot find constraint if constraint-names hashtable was disabled (due to parameter <misc/useconstable>)\n");
    2653 SCIPABORT();/*lint --e{527}*/ /* only in debug mode */
    2654 return NULL;
    2655 }
    2656
    2657 return (SCIP_CONS*)(SCIPhashtableRetrieve(prob->consnames, (char*)name));
    2658}
    2659
    2660/** displays current pseudo solution */
    2662 SCIP_PROB* prob, /**< problem data */
    2663 SCIP_SET* set, /**< global SCIP settings */
    2664 SCIP_MESSAGEHDLR* messagehdlr /**< message handler */
    2665 )
    2666{
    2667 SCIP_VAR* var;
    2668 SCIP_Real solval;
    2669 int v;
    2670
    2671 for( v = 0; v < prob->nvars; ++v )
    2672 {
    2673 var = prob->vars[v];
    2674 assert(var != NULL);
    2675 solval = SCIPvarGetPseudoSol(var);
    2676 if( !SCIPsetIsZero(set, solval) )
    2677 SCIPmessagePrintInfo(messagehdlr, " <%s>=%.15g", SCIPvarGetName(var), solval);
    2678 }
    2679 SCIPmessagePrintInfo(messagehdlr, "\n");
    2680}
    2681
    2682/** outputs problem statistics */
    2684 SCIP_PROB* prob, /**< problem data */
    2685 SCIP_SET* set, /**< global SCIP settings */
    2686 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
    2687 FILE* file /**< output file (or NULL for standard output) */
    2688 )
    2689{
    2690 assert(prob != NULL);
    2691
    2692 SCIPmessageFPrintInfo(messagehdlr, file, " Problem name : %s\n", prob->name);
    2693 SCIPmessageFPrintInfo(messagehdlr, file, " Variables : %d (%d binary, %d integer, %d continuous)\n",
    2694 prob->nvars, prob->nbinvars + prob->nbinimplvars, prob->nintvars + prob->nintimplvars, prob->ncontvars + prob->ncontimplvars);
    2695 SCIPmessageFPrintInfo(messagehdlr, file, " Implied int vars : %d (%d binary, %d integer, %d continuous)\n",
    2696 SCIPprobGetNImplVars(prob), prob->nbinimplvars, prob->nintimplvars, prob->ncontimplvars);
    2697 SCIPmessageFPrintInfo(messagehdlr, file, " Constraints : %d initial, %d maximal\n", prob->startnconss, prob->maxnconss);
    2698 SCIPmessageFPrintInfo(messagehdlr, file, " Objective : %s, %d non-zeros (abs.min = %g, abs.max = %g)\n",
    2699 !prob->transformed ? (prob->objsense == SCIP_OBJSENSE_MINIMIZE ? "minimize" : "maximize") : "minimize",
    2701}
    2702
    2703
    2704/** collects problem statistics in a SCIP_DATATREE object */
    2706 SCIP_PROB* prob, /**< problem data */
    2707 BMS_BLKMEM* blkmem, /**< block memory */
    2708 SCIP_SET* set, /**< global SCIP settings */
    2709 SCIP_DATATREE* datatree /**< data tree */
    2710 )
    2711{
    2712 assert(prob != NULL);
    2713 assert(datatree != NULL);
    2714
    2715 /* collect problem name */
    2716 SCIP_CALL( SCIPdatatreeInsertString(datatree, set, blkmem, "problem_name", prob->name) );
    2717
    2718 /* collect variables information */
    2719 SCIP_CALL( SCIPdatatreeInsertLong(datatree, set, blkmem, "num_variables", (SCIP_Longint)prob->nvars) );
    2720 SCIP_CALL( SCIPdatatreeInsertLong(datatree, set, blkmem, "num_binary_variables", (SCIP_Longint)prob->nbinvars) );
    2721 SCIP_CALL( SCIPdatatreeInsertLong(datatree, set, blkmem, "num_integer_variables", (SCIP_Longint)prob->nintvars) );
    2722 SCIP_CALL( SCIPdatatreeInsertLong(datatree, set, blkmem, "num_implied_binary_variables", (SCIP_Longint)prob->nbinimplvars) );
    2723 SCIP_CALL( SCIPdatatreeInsertLong(datatree, set, blkmem, "num_implied_integer_variables", (SCIP_Longint)prob->nintimplvars) );
    2724 SCIP_CALL( SCIPdatatreeInsertLong(datatree, set, blkmem, "num_implied_continuous_variables", (SCIP_Longint)prob->ncontimplvars) );
    2725 SCIP_CALL( SCIPdatatreeInsertLong(datatree, set, blkmem, "num_continuous_variables", (SCIP_Longint)prob->ncontvars) );
    2726
    2727 /* collect constraints information */
    2728 SCIP_CALL( SCIPdatatreeInsertLong(datatree, set, blkmem, "num_initial_constraints", (SCIP_Longint)prob->startnconss) );
    2729 SCIP_CALL( SCIPdatatreeInsertLong(datatree, set, blkmem, "num_maximal_constraints", (SCIP_Longint)prob->maxnconss) );
    2730
    2731 /* collect objective information */
    2732 SCIP_CALL( SCIPdatatreeInsertString(datatree, set, blkmem, "objective_sense",
    2733 !prob->transformed ? (prob->objsense == SCIP_OBJSENSE_MINIMIZE ? "minimize" : "maximize") : "minimize") );
    2734 SCIP_CALL( SCIPdatatreeInsertLong(datatree, set, blkmem, "objective_non_zeros", (SCIP_Longint)SCIPprobGetNObjVars(prob, set)) );
    2735 SCIP_CALL( SCIPdatatreeInsertReal(datatree, set, blkmem, "objective_abs_min", SCIPprobGetAbsMinObjCoef(prob, set)) );
    2736 SCIP_CALL( SCIPdatatreeInsertReal(datatree, set, blkmem, "objective_abs_max", SCIPprobGetAbsMaxObjCoef(prob, set)) );
    2737
    2738 return SCIP_OKAY;
    2739}
    2740
    2741
    2742#ifndef NDEBUG
    2743
    2744/* In debug mode, the following methods are implemented as function calls to ensure
    2745 * type validity.
    2746 * In optimized mode, the methods are implemented as defines to improve performance.
    2747 * However, we want to have them in the library anyways, so we have to undef the defines.
    2748 */
    2749
    2750#undef SCIPprobIsPermuted
    2751#undef SCIPprobMarkPermuted
    2752#undef SCIPprobIsTransformed
    2753#undef SCIPprobIsObjIntegral
    2754#undef SCIPprobAllColsInLP
    2755#undef SCIPprobGetObjlim
    2756#undef SCIPprobGetData
    2757#undef SCIPprobGetName
    2758#undef SCIPprobGetNVars
    2759#undef SCIPprobGetNBinVars
    2760#undef SCIPprobGetNIntVars
    2761#undef SCIPprobGetNImplVars
    2762#undef SCIPprobGetNContVars
    2763#undef SCIPprobGetVars
    2764#undef SCIPprobGetNFixedVars
    2765#undef SCIPprobGetFixedVars
    2766#undef SCIPprobGetStartNVars
    2767#undef SCIPprobGetNConss
    2768#undef SCIPprobGetConss
    2769#undef SCIPprobGetMaxNConss
    2770#undef SCIPprobGetStartNConss
    2771#undef SCIPprobGetObjsense
    2772#undef SCIPprobGetObjoffset
    2773#undef SCIPprobGetObjscale
    2774#undef SCIPprobGetObjoffsetExact
    2775#undef SCIPprobGetObjscaleExact
    2776#undef SCIPisConsCompressedEnabled
    2777#undef SCIPprobEnableConsCompression
    2778
    2779/** is the problem permuted */
    2781 SCIP_PROB* prob
    2782 )
    2783{
    2784 assert(prob != NULL);
    2785
    2786 return prob->permuted;
    2787}
    2788
    2789/** mark the problem as permuted */
    2791 SCIP_PROB* prob
    2792 )
    2793{
    2794 assert(prob != NULL);
    2795
    2796 prob->permuted = TRUE;
    2797}
    2798
    2799/** is the problem data transformed */
    2801 SCIP_PROB* prob /**< problem data */
    2802 )
    2803{
    2804 assert(prob != NULL);
    2805
    2806 return prob->transformed;
    2807}
    2808
    2809/** returns whether the objective value is known to be integral in every feasible solution */
    2811 SCIP_PROB* prob /**< problem data */
    2812 )
    2813{
    2814 assert(prob != NULL);
    2815
    2816 return prob->objisintegral;
    2817}
    2818
    2819/** returns TRUE iff all columns, i.e. every variable with non-empty column w.r.t. all ever created rows, are present
    2820 * in the LP, and FALSE, if there are additional already existing columns, that may be added to the LP in pricing
    2821 */
    2823 SCIP_PROB* prob, /**< problem data */
    2824 SCIP_SET* set, /**< global SCIP settings */
    2825 SCIP_LP* lp /**< current LP data */
    2826 )
    2827{
    2828 assert(SCIPlpGetNCols(lp) <= prob->ncolvars && prob->ncolvars <= prob->nvars);
    2829
    2830 return (SCIPlpGetNCols(lp) == prob->ncolvars && set->nactivepricers == 0);
    2831}
    2832
    2833/** gets limit on objective function in external space */
    2835 SCIP_PROB* prob, /**< problem data */
    2836 SCIP_SET* set /**< global SCIP settings */
    2837 )
    2838{
    2839 assert(prob != NULL);
    2840 assert(set != NULL);
    2841
    2842 return prob->objlim >= SCIP_INVALID ? (SCIP_Real)(prob->objsense) * SCIPsetInfinity(set) : prob->objlim;
    2843}
    2844
    2845/** gets user problem data */
    2847 SCIP_PROB* prob /**< problem */
    2848 )
    2849{
    2850 assert(prob != NULL);
    2851
    2852 return prob->probdata;
    2853}
    2854
    2855/** gets problem name */
    2857 SCIP_PROB* prob /**< problem data */
    2858 )
    2859{
    2860 assert(prob != NULL);
    2861 return prob->name;
    2862}
    2863
    2864/** gets number of problem variables */
    2866 SCIP_PROB* prob /**< problem data */
    2867 )
    2868{
    2869 assert(prob != NULL);
    2870 return prob->nvars;
    2871}
    2872
    2873/** gets number of binary problem variables */
    2875 SCIP_PROB* prob /**< problem data */
    2876 )
    2877{
    2878 assert(prob != NULL);
    2879 return prob->nbinvars;
    2880}
    2881
    2882/** gets number of integer problem variables */
    2884 SCIP_PROB* prob /**< problem data */
    2885 )
    2886{
    2887 assert(prob != NULL);
    2888 return prob->nintvars;
    2889}
    2890
    2891/** gets number of implied integral problem variables of any type */
    2893 SCIP_PROB* prob /**< problem data */
    2894 )
    2895{
    2896 assert(prob != NULL);
    2897 return prob->nbinimplvars + prob->nintimplvars + prob->ncontimplvars;
    2898}
    2899
    2900/** gets number of continuous problem variables */
    2902 SCIP_PROB* prob /**< problem data */
    2903 )
    2904{
    2905 assert(prob != NULL);
    2906 return prob->ncontvars;
    2907}
    2908
    2909/** gets problem variables */
    2911 SCIP_PROB* prob /**< problem data */
    2912 )
    2913{
    2914 assert(prob != NULL);
    2915 return prob->vars;
    2916}
    2917
    2918/** gets number of fixed variables */
    2920 SCIP_PROB* prob /**< problem data */
    2921 )
    2922{
    2923 assert(prob != NULL);
    2924 return prob->nfixedvars;
    2925}
    2926
    2927/** gets fixed variables */
    2929 SCIP_PROB* prob /**< problem data */
    2930 )
    2931{
    2932 assert(prob != NULL);
    2933 return prob->fixedvars;
    2934}
    2935
    2936/** gets number of variables existing when problem solving started */
    2938 SCIP_PROB* prob /**< problem data */
    2939 )
    2940{
    2941 assert(prob != NULL);
    2942 return prob->startnvars;
    2943}
    2944
    2945/** gets number of problem constraints */
    2947 SCIP_PROB* prob /**< problem data */
    2948 )
    2949{
    2950 assert(prob != NULL);
    2951 return prob->nconss;
    2952}
    2953
    2954/** gets problem constraints */
    2956 SCIP_PROB* prob /**< problem data */
    2957 )
    2958{
    2959 assert(prob != NULL);
    2960 return prob->conss;
    2961}
    2962
    2963/** gets maximum number of constraints existing at the same time */
    2965 SCIP_PROB* prob /**< problem data */
    2966 )
    2967{
    2968 assert(prob != NULL);
    2969 return prob->maxnconss;
    2970}
    2971
    2972/** gets number of constraints existing when problem solving started */
    2974 SCIP_PROB* prob /**< problem data */
    2975 )
    2976{
    2977 assert(prob != NULL);
    2978 return prob->startnconss;
    2979}
    2980
    2981/** gets the objective sense*/
    2983 SCIP_PROB* prob /**< problem data */
    2984 )
    2985{
    2986 assert(prob != NULL);
    2987 return prob->objsense;
    2988}
    2989
    2990/** gets the objective offset */
    2992 SCIP_PROB* prob /**< problem data */
    2993 )
    2994{
    2995 assert(prob != NULL);
    2996
    2997 return prob->objoffset;
    2998}
    2999
    3000/** gets the objective scalar */
    3002 SCIP_PROB* prob /**< problem data */
    3003 )
    3004{
    3005 assert(prob != NULL);
    3006
    3007 return prob->objscale;
    3008}
    3009
    3010/** gets the exact objective offset */
    3012 SCIP_PROB* prob /**< problem data */
    3013 )
    3014{
    3015 assert(prob != NULL);
    3016 assert(prob->objoffsetexact != NULL);
    3017
    3018 return prob->objoffsetexact;
    3019}
    3020
    3021/** gets the exact objective scalar */
    3023 SCIP_PROB* prob /**< problem data */
    3024 )
    3025{
    3026 assert(prob != NULL);
    3027 assert(prob->objscaleexact != NULL);
    3028
    3029 return prob->objscaleexact;
    3030}
    3031
    3032/** is constraint compression enabled for this problem? */
    3034 SCIP_PROB* prob /**< problem data */
    3035 )
    3036{
    3037 assert(prob != NULL);
    3038
    3039 return prob->conscompression;
    3040}
    3041
    3042/** enable problem compression, i.e., constraints can reduce memory size by removing fixed variables during creation */
    3044 SCIP_PROB* prob /**< problem data */
    3045 )
    3046{
    3047 assert(prob != NULL);
    3048
    3049 prob->conscompression = TRUE;
    3050}
    3051
    3052#endif
    SCIP_RETCODE SCIPbranchcandRemoveVar(SCIP_BRANCHCAND *branchcand, SCIP_VAR *var)
    Definition: branch.c:1152
    SCIP_RETCODE SCIPbranchcandUpdateVar(SCIP_BRANCHCAND *branchcand, SCIP_SET *set, SCIP_VAR *var)
    Definition: branch.c:1169
    internal methods for branching rules and branching candidate storage
    SCIP_VAR * h
    Definition: circlepacking.c:68
    SCIP_RETCODE SCIPconflictstoreTransform(SCIP_CONFLICTSTORE *conflictstore, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_TREE *tree, SCIP_PROB *transprob, SCIP_REOPT *reopt)
    internal methods for storing conflicts
    SCIP_RETCODE SCIPconsAddLocks(SCIP_CONS *cons, SCIP_SET *set, SCIP_LOCKTYPE locktype, int nlockspos, int nlocksneg)
    Definition: cons.c:7557
    void SCIPconsCapture(SCIP_CONS *cons)
    Definition: cons.c:6431
    void SCIPconsSetLocal(SCIP_CONS *cons, SCIP_Bool local)
    Definition: cons.c:6953
    SCIP_RETCODE SCIPconsDeactivate(SCIP_CONS *cons, SCIP_SET *set, SCIP_STAT *stat)
    Definition: cons.c:7077
    SCIP_RETCODE SCIPconshdlrLockVars(SCIP_CONSHDLR *conshdlr, SCIP_SET *set)
    Definition: cons.c:4280
    SCIP_RETCODE SCIPconsResetAge(SCIP_CONS *cons, SCIP_SET *set)
    Definition: cons.c:7456
    SCIP_RETCODE SCIPconsTransform(SCIP_CONS *origcons, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_CONS **transcons)
    Definition: cons.c:6716
    SCIP_RETCODE SCIPconsRelease(SCIP_CONS **cons, BMS_BLKMEM *blkmem, SCIP_SET *set)
    Definition: cons.c:6443
    SCIP_RETCODE SCIPconshdlrUnlockVars(SCIP_CONSHDLR *conshdlr, SCIP_SET *set)
    Definition: cons.c:4300
    SCIP_RETCODE SCIPconsActivate(SCIP_CONS *cons, SCIP_SET *set, SCIP_STAT *stat, int depth, SCIP_Bool focusnode)
    Definition: cons.c:7035
    SCIP_RETCODE SCIPconshdlrDelVars(SCIP_CONSHDLR *conshdlr, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat)
    Definition: cons.c:4244
    internal methods for constraints and constraint handlers
    SCIP_RETCODE SCIPdatatreeInsertLong(SCIP_DATATREE *datatree, SCIP_SET *set, BMS_BLKMEM *blkmem, const char *name, SCIP_Longint value)
    Definition: datatree.c:223
    SCIP_RETCODE SCIPdatatreeInsertString(SCIP_DATATREE *datatree, SCIP_SET *set, BMS_BLKMEM *blkmem, const char *name, const char *value)
    Definition: datatree.c:285
    SCIP_RETCODE SCIPdatatreeInsertReal(SCIP_DATATREE *datatree, SCIP_SET *set, BMS_BLKMEM *blkmem, const char *name, SCIP_Real value)
    Definition: datatree.c:254
    internal methods for handling data trees
    #define NULL
    Definition: def.h:255
    #define SCIP_MAXSTRLEN
    Definition: def.h:276
    #define SCIP_Longint
    Definition: def.h:148
    #define EPSISINT(x, eps)
    Definition: def.h:202
    #define SCIP_INVALID
    Definition: def.h:185
    #define SCIP_Bool
    Definition: def.h:98
    #define SCIP_HASHSIZE_NAMES_SMALL
    Definition: def.h:290
    #define MIN(x, y)
    Definition: def.h:231
    #define SCIP_ALLOC(x)
    Definition: def.h:373
    #define SCIP_Real
    Definition: def.h:163
    #define SCIP_HASHSIZE_NAMES
    Definition: def.h:287
    #define TRUE
    Definition: def.h:100
    #define FALSE
    Definition: def.h:101
    #define MAX(x, y)
    Definition: def.h:227
    #define SCIP_LONGINT_FORMAT
    Definition: def.h:155
    #define SCIPABORT()
    Definition: def.h:334
    #define REALABS(x)
    Definition: def.h:189
    #define SCIP_LONGINT_MAX
    Definition: def.h:149
    #define SCIP_CALL(x)
    Definition: def.h:362
    SCIP_RETCODE SCIPeventCreateVarAdded(SCIP_EVENT **event, BMS_BLKMEM *blkmem, SCIP_VAR *var)
    Definition: event.c:598
    SCIP_RETCODE SCIPeventqueueAdd(SCIP_EVENTQUEUE *eventqueue, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_PRIMAL *primal, SCIP_LP *lp, SCIP_BRANCHCAND *branchcand, SCIP_EVENTFILTER *eventfilter, SCIP_EVENT **event)
    Definition: event.c:2561
    SCIP_RETCODE SCIPeventCreateVarDeleted(SCIP_EVENT **event, BMS_BLKMEM *blkmem, SCIP_VAR *var)
    Definition: event.c:616
    internal methods for managing events
    void SCIPhashtableFree(SCIP_HASHTABLE **hashtable)
    Definition: misc.c:2348
    SCIP_Bool SCIPhashtableExists(SCIP_HASHTABLE *hashtable, void *element)
    Definition: misc.c:2647
    SCIP_RETCODE SCIPhashtableCreate(SCIP_HASHTABLE **hashtable, BMS_BLKMEM *blkmem, int tablesize, SCIP_DECL_HASHGETKEY((*hashgetkey)), SCIP_DECL_HASHKEYEQ((*hashkeyeq)), SCIP_DECL_HASHKEYVAL((*hashkeyval)), void *userptr)
    Definition: misc.c:2298
    void * SCIPhashtableRetrieve(SCIP_HASHTABLE *hashtable, void *key)
    Definition: misc.c:2596
    SCIP_RETCODE SCIPhashtableRemove(SCIP_HASHTABLE *hashtable, void *element)
    Definition: misc.c:2665
    SCIP_RETCODE SCIPhashtableInsert(SCIP_HASHTABLE *hashtable, void *element)
    Definition: misc.c:2535
    SCIP_Longint SCIPcalcGreComDiv(SCIP_Longint val1, SCIP_Longint val2)
    Definition: misc.c:9197
    SCIP_RETCODE SCIPcalcIntegralScalarExact(BMS_BUFMEM *buffer, SCIP_RATIONAL **vals, int nvals, SCIP_Real maxscale, SCIP_RATIONAL *intscalar, SCIP_Bool *success)
    Definition: misc.c:9842
    SCIP_RETCODE SCIPcalcIntegralScalar(SCIP_Real *vals, int nvals, SCIP_Real mindelta, SCIP_Real maxdelta, SCIP_Longint maxdnom, SCIP_Real maxscale, SCIP_Real *intscalar, SCIP_Bool *success)
    Definition: misc.c:9641
    SCIP_Real SCIPcolGetPrimsol(SCIP_COL *col)
    Definition: lp.c:17379
    SCIP_BASESTAT SCIPcolGetBasisStatus(SCIP_COL *col)
    Definition: lp.c:17414
    SCIP_Bool SCIPconshdlrNeedsCons(SCIP_CONSHDLR *conshdlr)
    Definition: cons.c:5306
    SCIP_Bool SCIPconsIsChecked(SCIP_CONS *cons)
    Definition: cons.c:8592
    SCIP_Bool SCIPconsIsActive(SCIP_CONS *cons)
    Definition: cons.c:8454
    const char * SCIPconsGetName(SCIP_CONS *cons)
    Definition: cons.c:8393
    SCIP_RETCODE SCIPrationalCreateBlock(BMS_BLKMEM *blkmem, SCIP_RATIONAL **rational)
    Definition: rational.cpp:109
    void SCIPrationalMult(SCIP_RATIONAL *res, SCIP_RATIONAL *op1, SCIP_RATIONAL *op2)
    Definition: rational.cpp:1067
    void SCIPrationalAdd(SCIP_RATIONAL *res, SCIP_RATIONAL *op1, SCIP_RATIONAL *op2)
    Definition: rational.cpp:936
    SCIP_Real SCIPrationalGetReal(SCIP_RATIONAL *rational)
    Definition: rational.cpp:2084
    void SCIPrationalFreeBlock(BMS_BLKMEM *mem, SCIP_RATIONAL **rational)
    Definition: rational.cpp:462
    #define SCIPrationalDebugMessage
    Definition: rational.h:641
    void SCIPrationalDiv(SCIP_RATIONAL *res, SCIP_RATIONAL *op1, SCIP_RATIONAL *op2)
    Definition: rational.cpp:1133
    SCIP_Bool SCIPrationalIsAbsInfinity(SCIP_RATIONAL *rational)
    Definition: rational.cpp:1681
    void SCIPrationalSetReal(SCIP_RATIONAL *res, SCIP_Real real)
    Definition: rational.cpp:604
    void SCIPrationalFreeBuffer(BMS_BUFMEM *bufmem, SCIP_RATIONAL **rational)
    Definition: rational.cpp:474
    void SCIPrationalDiff(SCIP_RATIONAL *res, SCIP_RATIONAL *op1, SCIP_RATIONAL *op2)
    Definition: rational.cpp:984
    SCIP_Bool SCIPrationalIsPositive(SCIP_RATIONAL *rational)
    Definition: rational.cpp:1641
    SCIP_RETCODE SCIPrationalCreateBuffer(BMS_BUFMEM *bufmem, SCIP_RATIONAL **rational)
    Definition: rational.cpp:124
    SCIP_Bool SCIPrationalIsZero(SCIP_RATIONAL *rational)
    Definition: rational.cpp:1625
    void SCIPrationalSetRational(SCIP_RATIONAL *res, SCIP_RATIONAL *src)
    Definition: rational.cpp:570
    SCIP_Bool SCIPrationalIsIntegral(SCIP_RATIONAL *rational)
    Definition: rational.cpp:1692
    SCIP_Bool SCIPrationalIsEQReal(SCIP_RATIONAL *rat, SCIP_Real real)
    Definition: rational.cpp:1438
    SCIP_RETCODE SCIPrationalCreateBufferArray(BMS_BUFMEM *mem, SCIP_RATIONAL ***rational, int size)
    Definition: rational.cpp:215
    void SCIPrationalMultReal(SCIP_RATIONAL *res, SCIP_RATIONAL *op1, SCIP_Real op2)
    Definition: rational.cpp:1098
    void SCIPrationalFreeBufferArray(BMS_BUFMEM *mem, SCIP_RATIONAL ***ratbufarray, int size)
    Definition: rational.cpp:519
    SCIP_COL * SCIPvarGetCol(SCIP_VAR *var)
    Definition: var.c:23684
    SCIP_Real SCIPvarGetSol(SCIP_VAR *var, SCIP_Bool getlpval)
    Definition: var.c:19008
    SCIP_Bool SCIPvarIsBinary(SCIP_VAR *var)
    Definition: var.c:23479
    SCIP_VARSTATUS SCIPvarGetStatus(SCIP_VAR *var)
    Definition: var.c:23387
    SCIP_Real SCIPvarGetUbLocal(SCIP_VAR *var)
    Definition: var.c:24269
    int SCIPvarGetNLocksDown(SCIP_VAR *var)
    Definition: var.c:4449
    SCIP_Real SCIPvarGetObj(SCIP_VAR *var)
    Definition: var.c:23901
    SCIP_VARTYPE SCIPvarGetType(SCIP_VAR *var)
    Definition: var.c:23454
    void SCIPvarSetBestRootSol(SCIP_VAR *var, SCIP_Real rootsol, SCIP_Real rootredcost, SCIP_Real rootlpobjval)
    Definition: var.c:19613
    int SCIPvarGetNUses(SCIP_VAR *var)
    Definition: var.c:23278
    int SCIPvarGetProbindex(SCIP_VAR *var)
    Definition: var.c:23663
    const char * SCIPvarGetName(SCIP_VAR *var)
    Definition: var.c:23268
    SCIP_Bool SCIPvarIsDeletable(SCIP_VAR *var)
    Definition: var.c:23633
    SCIP_Bool SCIPvarIsIntegral(SCIP_VAR *var)
    Definition: var.c:23491
    SCIP_Bool SCIPvarIsTransformedOrigvar(SCIP_VAR *var)
    Definition: var.c:18498
    SCIP_Real SCIPvarGetPseudoSol(SCIP_VAR *var)
    Definition: var.c:24757
    SCIP_Real SCIPvarGetLbLocal(SCIP_VAR *var)
    Definition: var.c:24235
    SCIP_Bool SCIPvarIsRelaxationOnly(SCIP_VAR *var)
    Definition: var.c:23601
    SCIP_IMPLINTTYPE SCIPvarGetImplType(SCIP_VAR *var)
    Definition: var.c:23464
    int SCIPvarGetNLocksUp(SCIP_VAR *var)
    Definition: var.c:4462
    SCIP_RATIONAL * SCIPvarGetObjExact(SCIP_VAR *var)
    Definition: var.c:23911
    void SCIPsortPtr(void **ptrarray, SCIP_DECL_SORTPTRCOMP((*ptrcomp)), int len)
    int SCIPsnprintf(char *t, int len, const char *s,...)
    Definition: misc.c:10827
    SCIP_Bool SCIPlpIsSolBasic(SCIP_LP *lp)
    Definition: lp.c:18241
    SCIP_LPSOLSTAT SCIPlpGetSolstat(SCIP_LP *lp)
    Definition: lp.c:13420
    void SCIPlpStoreRootObjval(SCIP_LP *lp, SCIP_SET *set, SCIP_PROB *prob)
    Definition: lp.c:13495
    SCIP_Real SCIPlpGetColumnObjval(SCIP_LP *lp)
    Definition: lp.c:13464
    SCIP_RETCODE SCIPlpUpdateAddVar(SCIP_LP *lp, SCIP_SET *set, SCIP_VAR *var)
    Definition: lp.c:14384
    SCIP_Bool SCIPlpIsRelax(SCIP_LP *lp)
    Definition: lp.c:18201
    SCIP_Real SCIPlpGetObjval(SCIP_LP *lp, SCIP_SET *set, SCIP_PROB *prob)
    Definition: lp.c:13436
    SCIP_RETCODE SCIPlpUpdateDelVar(SCIP_LP *lp, SCIP_SET *set, SCIP_VAR *var)
    Definition: lp.c:14405
    SCIP_Real SCIPcolGetRedcost(SCIP_COL *col, SCIP_STAT *stat, SCIP_LP *lp)
    Definition: lp.c:4147
    SCIP_Bool SCIPlpIsDualReliable(SCIP_LP *lp)
    Definition: lp.c:18231
    int SCIPlpGetNCols(SCIP_LP *lp)
    Definition: lp.c:17979
    void SCIPlpSetRootLPIsRelax(SCIP_LP *lp, SCIP_Bool isrelax)
    Definition: lp.c:18123
    internal methods for LP management
    SCIP_RETCODE SCIPlpExactUpdateAddVar(SCIP_LPEXACT *lpexact, SCIP_SET *set, SCIP_VAR *var)
    Definition: lpexact.c:6603
    internal methods for exact LP management
    #define BMSfreeMemory(ptr)
    Definition: memory.h:145
    #define BMSreallocMemoryArray(ptr, num)
    Definition: memory.h:127
    #define BMSduplicateMemoryArray(ptr, source, num)
    Definition: memory.h:143
    #define BMSfreeMemoryArray(ptr)
    Definition: memory.h:147
    struct BMS_BlkMem BMS_BLKMEM
    Definition: memory.h:437
    #define BMSfreeMemoryArrayNull(ptr)
    Definition: memory.h:148
    #define BMSallocMemory(ptr)
    Definition: memory.h:118
    void SCIPmessageFPrintWarning(SCIP_MESSAGEHDLR *messagehdlr, const char *formatstr,...)
    Definition: message.c:451
    void SCIPmessageFPrintInfo(SCIP_MESSAGEHDLR *messagehdlr, FILE *file, const char *formatstr,...)
    Definition: message.c:618
    void SCIPmessagePrintInfo(SCIP_MESSAGEHDLR *messagehdlr, const char *formatstr,...)
    Definition: message.c:594
    SCIP_RETCODE SCIPprimalUpdateObjoffsetExact(SCIP_PRIMAL *primal, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_EVENTQUEUE *eventqueue, SCIP_EVENTFILTER *eventfilter, SCIP_PROB *transprob, SCIP_PROB *origprob, SCIP_TREE *tree, SCIP_REOPT *reopt, SCIP_LP *lp)
    Definition: primal.c:646
    SCIP_RETCODE SCIPprimalUpdateObjoffset(SCIP_PRIMAL *primal, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_EVENTQUEUE *eventqueue, SCIP_EVENTFILTER *eventfilter, SCIP_PROB *transprob, SCIP_PROB *origprob, SCIP_TREE *tree, SCIP_REOPT *reopt, SCIP_LP *lp)
    Definition: primal.c:590
    internal methods for collecting primal CIP solutions and primal informations
    static SCIP_RETCODE probScaleObjExact(SCIP_PROB *transprob, SCIP_PROB *origprob, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PRIMAL *primal, SCIP_TREE *tree, SCIP_REOPT *reopt, SCIP_LP *lp, SCIP_EVENTQUEUE *eventqueue, SCIP_EVENTFILTER *eventfilter)
    Definition: prob.c:1926
    void SCIPprobPrintStatistics(SCIP_PROB *prob, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, FILE *file)
    Definition: prob.c:2683
    SCIP_RETCODE SCIPprobCollectStatistics(SCIP_PROB *prob, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_DATATREE *datatree)
    Definition: prob.c:2705
    static SCIP_RETCODE probRemoveVar(SCIP_PROB *prob, BMS_BLKMEM *blkmem, SCIP_CLIQUETABLE *cliquetable, SCIP_SET *set, SCIP_VAR *var, SCIP_Bool isupgraded)
    Definition: prob.c:929
    static SCIP_RETCODE probEnsureVarsMem(SCIP_PROB *prob, SCIP_SET *set, int num)
    Definition: prob.c:72
    SCIP_Bool SCIPprobIsPermuted(SCIP_PROB *prob)
    Definition: prob.c:2780
    SCIP_RETCODE SCIPprobExitPresolve(SCIP_PROB *prob, SCIP_SET *set)
    Definition: prob.c:2287
    void SCIPprobSetTrans(SCIP_PROB *prob, SCIP_DECL_PROBTRANS((*probtrans)))
    Definition: prob.c:379
    void SCIPprobUpdateNObjVars(SCIP_PROB *prob, SCIP_SET *set, SCIP_Real oldobj, SCIP_Real newobj)
    Definition: prob.c:1871
    int SCIPprobGetNContVars(SCIP_PROB *prob)
    Definition: prob.c:2901
    SCIP_RETCODE SCIPprobAddConsName(SCIP_PROB *prob, SCIP_CONS *cons)
    Definition: prob.c:1467
    SCIP_RETCODE SCIPprobTransform(SCIP_PROB *source, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PRIMAL *primal, SCIP_TREE *tree, SCIP_REOPT *reopt, SCIP_LP *lp, SCIP_BRANCHCAND *branchcand, SCIP_EVENTQUEUE *eventqueue, SCIP_EVENTFILTER *eventfilter, SCIP_CONFLICTSTORE *conflictstore, SCIP_PROB **target)
    Definition: prob.c:553
    void SCIPprobSetInitsol(SCIP_PROB *prob, SCIP_DECL_PROBINITSOL((*probinitsol)))
    Definition: prob.c:401
    SCIP_CONS ** SCIPprobGetConss(SCIP_PROB *prob)
    Definition: prob.c:2955
    int SCIPprobGetNFixedVars(SCIP_PROB *prob)
    Definition: prob.c:2919
    static SCIP_RETCODE probCheckObjIntegralExact(SCIP_PROB *transprob, SCIP_PROB *origprob, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PRIMAL *primal, SCIP_TREE *tree, SCIP_REOPT *reopt, SCIP_LP *lp, SCIP_EVENTQUEUE *eventqueue, SCIP_EVENTFILTER *eventfilter)
    Definition: prob.c:1734
    void SCIPprobInvalidateDualbound(SCIP_PROB *prob)
    Definition: prob.c:1915
    SCIP_RETCODE SCIPprobAddVarName(SCIP_PROB *prob, SCIP_VAR *var)
    Definition: prob.c:1065
    void SCIPprobInternObjvalExact(SCIP_PROB *transprob, SCIP_PROB *origprob, SCIP_SET *set, SCIP_RATIONAL *objval, SCIP_RATIONAL *objvalint)
    Definition: prob.c:2596
    void SCIPprobSetObjIntegral(SCIP_PROB *prob)
    Definition: prob.c:1721
    SCIP_RETCODE SCIPprobVarChangedStatus(SCIP_PROB *prob, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_BRANCHCAND *branchcand, SCIP_CLIQUETABLE *cliquetable, SCIP_VAR *var)
    Definition: prob.c:1409
    const char * SCIPprobGetName(SCIP_PROB *prob)
    Definition: prob.c:2856
    static int probProvidePos(SCIP_PROB *prob, SCIP_VARTYPE vartype, SCIP_IMPLINTTYPE impltype)
    Definition: prob.c:792
    SCIP_Real SCIPprobGetObjoffset(SCIP_PROB *prob)
    Definition: prob.c:2991
    int SCIPprobGetNConss(SCIP_PROB *prob)
    Definition: prob.c:2946
    int SCIPprobGetNObjVars(SCIP_PROB *prob, SCIP_SET *set)
    Definition: prob.c:2420
    SCIP_Real SCIPprobGetAbsMinObjCoef(SCIP_PROB *prob, SCIP_SET *set)
    Definition: prob.c:2467
    static SCIP_RETCODE probEnsureConssMem(SCIP_PROB *prob, SCIP_SET *set, int num)
    Definition: prob.c:144
    static void probInsertVar(SCIP_PROB *prob, SCIP_VAR *var)
    Definition: prob.c:887
    SCIP_RETCODE SCIPprobPerformVarDeletions(SCIP_PROB *prob, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_EVENTQUEUE *eventqueue, SCIP_CLIQUETABLE *cliquetable, SCIP_LP *lp, SCIP_BRANCHCAND *branchcand)
    Definition: prob.c:1230
    void SCIPprobSetExitsol(SCIP_PROB *prob, SCIP_DECL_PROBEXITSOL((*probexitsol)))
    Definition: prob.c:412
    SCIP_Real SCIPprobGetAbsMaxObjCoef(SCIP_PROB *prob, SCIP_SET *set)
    Definition: prob.c:2494
    SCIP_RETCODE SCIPprobRemoveVarName(SCIP_PROB *prob, SCIP_VAR *var)
    Definition: prob.c:1081
    static SCIP_RETCODE probEnsureFixedvarsMem(SCIP_PROB *prob, SCIP_SET *set, int num)
    Definition: prob.c:96
    int SCIPprobGetStartNConss(SCIP_PROB *prob)
    Definition: prob.c:2973
    SCIP_Real SCIPprobGetObjlim(SCIP_PROB *prob, SCIP_SET *set)
    Definition: prob.c:2834
    void SCIPprobUpdateDualbound(SCIP_PROB *prob, SCIP_Real newbound)
    Definition: prob.c:1888
    SCIP_RETCODE SCIPprobInitSolve(SCIP_PROB *prob, SCIP_SET *set)
    Definition: prob.c:2296
    void SCIPprobMarkNConss(SCIP_PROB *prob)
    Definition: prob.c:1640
    SCIP_RATIONAL * SCIPprobGetObjoffsetExact(SCIP_PROB *prob)
    Definition: prob.c:3011
    SCIP_OBJSENSE SCIPprobGetObjsense(SCIP_PROB *prob)
    Definition: prob.c:2982
    void SCIPprobPrintPseudoSol(SCIP_PROB *prob, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr)
    Definition: prob.c:2661
    int SCIPprobGetStartNVars(SCIP_PROB *prob)
    Definition: prob.c:2937
    #define OBJSCALE_MAXSCALE
    Definition: prob.c:61
    SCIP_RETCODE SCIPprobSetName(SCIP_PROB *prob, const char *name)
    Definition: prob.c:2406
    void SCIPprobSetDeltrans(SCIP_PROB *prob, SCIP_DECL_PROBDELTRANS((*probdeltrans)))
    Definition: prob.c:390
    void SCIPprobSetData(SCIP_PROB *prob, SCIP_PROBDATA *probdata)
    Definition: prob.c:778
    #define OBJSCALE_MAXFINALSCALE
    Definition: prob.c:62
    SCIP_Real SCIPprobGetObjscale(SCIP_PROB *prob)
    Definition: prob.c:3001
    void SCIPprobAddObjoffset(SCIP_PROB *prob, SCIP_Real addval)
    Definition: prob.c:1666
    SCIP_RETCODE SCIPprobChgVarImplType(SCIP_PROB *prob, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_PRIMAL *primal, SCIP_LP *lp, SCIP_BRANCHCAND *branchcand, SCIP_EVENTQUEUE *eventqueue, SCIP_CLIQUETABLE *cliquetable, SCIP_VAR *var, SCIP_IMPLINTTYPE impltype)
    Definition: prob.c:1355
    void SCIPprobSetCopy(SCIP_PROB *prob, SCIP_DECL_PROBCOPY((*probcopy)))
    Definition: prob.c:423
    SCIP_VAR * SCIPprobFindVar(SCIP_PROB *prob, const char *name)
    Definition: prob.c:2623
    int SCIPprobGetNImplVars(SCIP_PROB *prob)
    Definition: prob.c:2892
    static SCIP_Bool varHasName(SCIP_VAR *var)
    Definition: prob.c:186
    SCIP_RETCODE SCIPprobExitSolve(SCIP_PROB *prob, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_EVENTQUEUE *eventqueue, SCIP_LP *lp, SCIP_Bool restart)
    Definition: prob.c:2331
    SCIP_RETCODE SCIPprobCreate(SCIP_PROB **prob, BMS_BLKMEM *blkmem, SCIP_SET *set, const char *name, SCIP_DECL_PROBDELORIG((*probdelorig)), SCIP_DECL_PROBTRANS((*probtrans)), SCIP_DECL_PROBDELTRANS((*probdeltrans)), SCIP_DECL_PROBINITSOL((*probinitsol)), SCIP_DECL_PROBEXITSOL((*probexitsol)), SCIP_DECL_PROBCOPY((*probcopy)), SCIP_PROBDATA *probdata, SCIP_Bool transformed)
    Definition: prob.c:272
    void SCIPprobSetObjlim(SCIP_PROB *prob, SCIP_Real objlim)
    Definition: prob.c:1710
    SCIP_VAR ** SCIPprobGetFixedVars(SCIP_PROB *prob)
    Definition: prob.c:2928
    SCIP_RETCODE SCIPprobDelVar(SCIP_PROB *prob, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_EVENTQUEUE *eventqueue, SCIP_VAR *var, SCIP_Bool *deleted)
    Definition: prob.c:1171
    SCIP_Bool SCIPprobIsObjIntegral(SCIP_PROB *prob)
    Definition: prob.c:2810
    SCIP_RETCODE SCIPprobAddVar(SCIP_PROB *prob, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_LP *lp, SCIP_BRANCHCAND *branchcand, SCIP_EVENTQUEUE *eventqueue, SCIP_EVENTFILTER *eventfilter, SCIP_VAR *var)
    Definition: prob.c:1096
    void SCIPprobEnableConsCompression(SCIP_PROB *prob)
    Definition: prob.c:3043
    SCIP_CONS * SCIPprobFindCons(SCIP_PROB *prob, const char *name)
    Definition: prob.c:2642
    #define OBJSCALE_MAXDNOM
    Definition: prob.c:60
    void SCIPprobMarkPermuted(SCIP_PROB *prob)
    Definition: prob.c:2790
    SCIP_RETCODE SCIPprobRemoveConsName(SCIP_PROB *prob, SCIP_CONS *cons)
    Definition: prob.c:1482
    int SCIPprobGetNIntVars(SCIP_PROB *prob)
    Definition: prob.c:2883
    SCIP_RETCODE SCIPprobDelCons(SCIP_PROB *prob, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_CONS *cons)
    Definition: prob.c:1575
    int SCIPprobGetNVars(SCIP_PROB *prob)
    Definition: prob.c:2865
    SCIP_PROBDATA * SCIPprobGetData(SCIP_PROB *prob)
    Definition: prob.c:2846
    SCIP_RETCODE SCIPprobChgVarType(SCIP_PROB *prob, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_PRIMAL *primal, SCIP_LP *lp, SCIP_BRANCHCAND *branchcand, SCIP_EVENTQUEUE *eventqueue, SCIP_CLIQUETABLE *cliquetable, SCIP_VAR *var, SCIP_VARTYPE vartype)
    Definition: prob.c:1301
    static SCIP_RETCODE probEnsureDeletedvarsMem(SCIP_PROB *prob, SCIP_SET *set, int num)
    Definition: prob.c:120
    SCIP_Real SCIPprobExternObjval(SCIP_PROB *transprob, SCIP_PROB *origprob, SCIP_SET *set, SCIP_Real objval)
    Definition: prob.c:2517
    void SCIPprobResortVars(SCIP_PROB *prob)
    Definition: prob.c:684
    SCIP_RETCODE SCIPprobFree(SCIP_PROB **prob, SCIP_MESSAGEHDLR *messagehdlr, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_EVENTQUEUE *eventqueue, SCIP_LP *lp)
    Definition: prob.c:434
    SCIP_RETCODE SCIPprobCopy(SCIP_PROB **prob, BMS_BLKMEM *blkmem, SCIP_SET *set, const char *name, SCIP *sourcescip, SCIP_PROB *sourceprob, SCIP_HASHMAP *varmap, SCIP_HASHMAP *consmap, SCIP_Bool original, SCIP_Bool global)
    Definition: prob.c:208
    SCIP_RETCODE SCIPprobScaleObj(SCIP_PROB *transprob, SCIP_PROB *origprob, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PRIMAL *primal, SCIP_TREE *tree, SCIP_REOPT *reopt, SCIP_LP *lp, SCIP_EVENTQUEUE *eventqueue, SCIP_EVENTFILTER *eventfilter)
    Definition: prob.c:2023
    SCIP_RETCODE SCIPprobAddCons(SCIP_PROB *prob, SCIP_SET *set, SCIP_STAT *stat, SCIP_CONS *cons)
    Definition: prob.c:1504
    SCIP_RETCODE SCIPprobCheckObjIntegral(SCIP_PROB *transprob, SCIP_PROB *origprob, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PRIMAL *primal, SCIP_TREE *tree, SCIP_REOPT *reopt, SCIP_LP *lp, SCIP_EVENTQUEUE *eventqueue, SCIP_EVENTFILTER *eventfilter)
    Definition: prob.c:1801
    int SCIPprobGetMaxNConss(SCIP_PROB *prob)
    Definition: prob.c:2964
    SCIP_RETCODE SCIPprobResetBounds(SCIP_PROB *prob, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat)
    Definition: prob.c:658
    void SCIPprobSetDualbound(SCIP_PROB *prob, SCIP_Real dualbound)
    Definition: prob.c:1699
    void SCIPprobStoreRootSol(SCIP_PROB *prob, SCIP_SET *set, SCIP_STAT *stat, SCIP_LP *lp, SCIP_Bool roothaslp)
    Definition: prob.c:2162
    int SCIPprobGetNBinVars(SCIP_PROB *prob)
    Definition: prob.c:2874
    SCIP_RATIONAL * SCIPprobGetObjscaleExact(SCIP_PROB *prob)
    Definition: prob.c:3022
    SCIP_VAR ** SCIPprobGetVars(SCIP_PROB *prob)
    Definition: prob.c:2910
    void SCIPprobSetDelorig(SCIP_PROB *prob, SCIP_DECL_PROBDELORIG((*probdelorig)))
    Definition: prob.c:368
    SCIP_Bool SCIPprobAllColsInLP(SCIP_PROB *prob, SCIP_SET *set, SCIP_LP *lp)
    Definition: prob.c:2822
    void SCIPprobUpdateBestRootSol(SCIP_PROB *prob, SCIP_SET *set, SCIP_STAT *stat, SCIP_LP *lp)
    Definition: prob.c:2189
    static SCIP_Bool consHasName(SCIP_CONS *cons)
    Definition: prob.c:173
    SCIP_Bool SCIPprobIsTransformed(SCIP_PROB *prob)
    Definition: prob.c:2800
    void SCIPprobExternObjvalExact(SCIP_PROB *transprob, SCIP_PROB *origprob, SCIP_SET *set, SCIP_RATIONAL *objval, SCIP_RATIONAL *objvalext)
    Definition: prob.c:2543
    SCIP_Bool SCIPprobIsConsCompressionEnabled(SCIP_PROB *prob)
    Definition: prob.c:3033
    void SCIPprobAddObjoffsetExact(SCIP_PROB *prob, SCIP_RATIONAL *addval)
    Definition: prob.c:1682
    void SCIPprobSetObjsense(SCIP_PROB *prob, SCIP_OBJSENSE objsense)
    Definition: prob.c:1653
    SCIP_Real SCIPprobInternObjval(SCIP_PROB *transprob, SCIP_PROB *origprob, SCIP_SET *set, SCIP_Real objval)
    Definition: prob.c:2570
    SCIP_RETCODE SCIPprobSortConssCheck(SCIP_PROB *prob)
    Definition: prob.c:748
    internal methods for storing and manipulating the main problem
    public methods for managing constraints
    public methods for LP management
    public methods for message output
    #define SCIPerrorMessage
    Definition: pub_message.h:64
    #define SCIPdebugMessage
    Definition: pub_message.h:96
    public data structures and miscellaneous methods
    methods for sorting joint arrays of various types
    public methods for problem variables
    wrapper for rational number arithmetic
    SCIP_Bool SCIPsetIsFeasEQ(SCIP_SET *set, SCIP_Real val1, SCIP_Real val2)
    Definition: set.c:6945
    SCIP_Real SCIPsetFeasFloor(SCIP_SET *set, SCIP_Real val)
    Definition: set.c:7124
    SCIP_Bool SCIPsetIsDualfeasNegative(SCIP_SET *set, SCIP_Real val)
    Definition: set.c:7314
    SCIP_Real SCIPsetEpsilon(SCIP_SET *set)
    Definition: set.c:6402
    SCIP_Bool SCIPsetIsEQ(SCIP_SET *set, SCIP_Real val1, SCIP_Real val2)
    Definition: set.c:6537
    SCIP_STAGE SCIPsetGetStage(SCIP_SET *set)
    Definition: set.c:3197
    SCIP_Real SCIPsetInfinity(SCIP_SET *set)
    Definition: set.c:6380
    SCIP_Bool SCIPsetIsLT(SCIP_SET *set, SCIP_Real val1, SCIP_Real val2)
    Definition: set.c:6557
    SCIP_Bool SCIPsetIsInfinity(SCIP_SET *set, SCIP_Real val)
    Definition: set.c:6515
    SCIP_Bool SCIPsetIsDualfeasPositive(SCIP_SET *set, SCIP_Real val)
    Definition: set.c:7303
    SCIP_Bool SCIPsetIsGT(SCIP_SET *set, SCIP_Real val1, SCIP_Real val2)
    Definition: set.c:6597
    SCIP_Bool SCIPsetIsIntegral(SCIP_SET *set, SCIP_Real val)
    Definition: set.c:6670
    SCIP_Bool SCIPsetIsZero(SCIP_SET *set, SCIP_Real val)
    Definition: set.c:6637
    int SCIPsetCalcMemGrowSize(SCIP_SET *set, int num)
    Definition: set.c:6080
    SCIP_Bool SCIPsetIsFeasIntegral(SCIP_SET *set, SCIP_Real val)
    Definition: set.c:7098
    internal methods for global SCIP settings
    #define SCIPsetFreeBufferArray(set, ptr)
    Definition: set.h:1782
    #define SCIPsetAllocBufferArray(set, ptr, num)
    Definition: set.h:1775
    #define SCIPsetDebugMsg
    Definition: set.h:1811
    void SCIPstatComputeRootLPBestEstimate(SCIP_STAT *stat, SCIP_SET *set, SCIP_Real rootlpobjval, SCIP_VAR **vars, int nvars)
    Definition: stat.c:840
    internal methods for problem statistics
    unsigned int enabled
    Definition: struct_cons.h:91
    int addarraypos
    Definition: struct_cons.h:56
    SCIP_CONSSETCHG * addconssetchg
    Definition: struct_cons.h:54
    char * name
    Definition: struct_cons.h:49
    unsigned int deleted
    Definition: struct_cons.h:94
    SCIP * scip
    Definition: struct_cons.h:111
    unsigned int updatedeactivate
    Definition: struct_cons.h:98
    unsigned int active
    Definition: struct_cons.h:85
    SCIP_LPEXACT * lpexact
    Definition: struct_lp.h:309
    SCIP_LPSOLSTAT lpsolstat
    Definition: struct_lp.h:359
    int ncontimplvars
    Definition: struct_prob.h:79
    int deletedvarssize
    Definition: struct_prob.h:84
    SCIP_VAR ** fixedvars
    Definition: struct_prob.h:68
    int consssize
    Definition: struct_prob.h:87
    int ncolvars
    Definition: struct_prob.h:81
    SCIP_Real objoffset
    Definition: struct_prob.h:50
    SCIP_Bool consschecksorted
    Definition: struct_prob.h:97
    SCIP_Bool permuted
    Definition: struct_prob.h:96
    SCIP_Bool nlpenabled
    Definition: struct_prob.h:95
    int startnconss
    Definition: struct_prob.h:91
    SCIP_RATIONAL * objoffsetexact
    Definition: struct_prob.h:53
    SCIP_Bool transformed
    Definition: struct_prob.h:94
    int fixedvarssize
    Definition: struct_prob.h:82
    int ncontvars
    Definition: struct_prob.h:80
    int ndeletedvars
    Definition: struct_prob.h:85
    SCIP_CONS ** origcheckconss
    Definition: struct_prob.h:72
    SCIP_RATIONAL * objscaleexact
    Definition: struct_prob.h:54
    SCIP_Real dualbound
    Definition: struct_prob.h:57
    SCIP_PROBDATA * probdata
    Definition: struct_prob.h:65
    int nfixedvars
    Definition: struct_prob.h:83
    int startnvars
    Definition: struct_prob.h:90
    SCIP_OBJSENSE objsense
    Definition: struct_prob.h:92
    SCIP_CONS ** conss
    Definition: struct_prob.h:71
    int nbinimplvars
    Definition: struct_prob.h:77
    int nobjvars
    Definition: struct_prob.h:86
    SCIP_Bool objisintegral
    Definition: struct_prob.h:93
    SCIP_Real objscale
    Definition: struct_prob.h:51
    SCIP_HASHTABLE * consnames
    Definition: struct_prob.h:70
    int nintimplvars
    Definition: struct_prob.h:78
    SCIP_Bool conscompression
    Definition: struct_prob.h:98
    SCIP_VAR ** vars
    Definition: struct_prob.h:67
    int varssize
    Definition: struct_prob.h:73
    SCIP_Real objlim
    Definition: struct_prob.h:56
    char * name
    Definition: struct_prob.h:58
    int nintvars
    Definition: struct_prob.h:76
    int nconss
    Definition: struct_prob.h:88
    SCIP_HASHTABLE * varnames
    Definition: struct_prob.h:66
    int maxnconss
    Definition: struct_prob.h:89
    SCIP_VAR ** deletedvars
    Definition: struct_prob.h:69
    int nbinvars
    Definition: struct_prob.h:75
    SCIP_Longint nactiveconssadded
    Definition: struct_stat.h:126
    SCIP_Longint nnodes
    Definition: struct_stat.h:84
    SCIP * scip
    Definition: struct_var.h:345
    int probindex
    Definition: struct_var.h:311
    datastructures for constraints and constraint handlers
    data structures for LP management
    datastructures for storing and manipulating the main problem
    datastructures for global SCIP settings
    datastructures for problem statistics
    datastructures for problem variables
    Definition: heur_padm.c:135
    @ SCIP_LPSOLSTAT_OPTIMAL
    Definition: type_lp.h:44
    @ SCIP_BASESTAT_UPPER
    Definition: type_lpi.h:93
    @ SCIP_BASESTAT_LOWER
    Definition: type_lpi.h:91
    enum SCIP_BaseStat SCIP_BASESTAT
    Definition: type_lpi.h:96
    #define SCIP_DECL_PROBCOPY(x)
    Definition: type_prob.h:150
    #define SCIP_DECL_PROBDELTRANS(x)
    Definition: type_prob.h:95
    #define SCIP_DECL_PROBEXITSOL(x)
    Definition: type_prob.h:119
    struct SCIP_ProbData SCIP_PROBDATA
    Definition: type_prob.h:53
    @ SCIP_OBJSENSE_MAXIMIZE
    Definition: type_prob.h:47
    @ SCIP_OBJSENSE_MINIMIZE
    Definition: type_prob.h:48
    #define SCIP_DECL_PROBDELORIG(x)
    Definition: type_prob.h:64
    #define SCIP_DECL_PROBTRANS(x)
    Definition: type_prob.h:83
    #define SCIP_DECL_PROBINITSOL(x)
    Definition: type_prob.h:106
    enum SCIP_Objsense SCIP_OBJSENSE
    Definition: type_prob.h:50
    @ SCIP_DIDNOTRUN
    Definition: type_result.h:42
    @ SCIP_SUCCESS
    Definition: type_result.h:58
    enum SCIP_Result SCIP_RESULT
    Definition: type_result.h:61
    @ SCIP_INVALIDRESULT
    Definition: type_retcode.h:53
    @ SCIP_INVALIDDATA
    Definition: type_retcode.h:52
    @ SCIP_OKAY
    Definition: type_retcode.h:42
    enum SCIP_Retcode SCIP_RETCODE
    Definition: type_retcode.h:63
    @ SCIP_STAGE_SOLVING
    Definition: type_set.h:53
    @ SCIP_STAGE_TRANSFORMING
    Definition: type_set.h:46
    enum SCIP_ImplintType SCIP_IMPLINTTYPE
    Definition: type_var.h:117
    @ SCIP_IMPLINTTYPE_NONE
    Definition: type_var.h:90
    @ SCIP_VARTYPE_INTEGER
    Definition: type_var.h:65
    @ SCIP_VARTYPE_CONTINUOUS
    Definition: type_var.h:71
    @ SCIP_VARTYPE_BINARY
    Definition: type_var.h:64
    @ SCIP_VARSTATUS_ORIGINAL
    Definition: type_var.h:51
    @ SCIP_VARSTATUS_FIXED
    Definition: type_var.h:54
    @ SCIP_VARSTATUS_COLUMN
    Definition: type_var.h:53
    @ SCIP_VARSTATUS_MULTAGGR
    Definition: type_var.h:56
    @ SCIP_VARSTATUS_NEGATED
    Definition: type_var.h:57
    @ SCIP_VARSTATUS_AGGREGATED
    Definition: type_var.h:55
    @ SCIP_VARSTATUS_LOOSE
    Definition: type_var.h:52
    @ SCIP_LOCKTYPE_MODEL
    Definition: type_var.h:141
    enum SCIP_Vartype SCIP_VARTYPE
    Definition: type_var.h:73
    SCIP_RETCODE SCIPvarResetBounds(SCIP_VAR *var, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat)
    Definition: var.c:14535
    SCIP_RETCODE SCIPvarChgObj(SCIP_VAR *var, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_PROB *prob, SCIP_PRIMAL *primal, SCIP_LP *lp, SCIP_EVENTQUEUE *eventqueue, SCIP_Real newobj)
    Definition: var.c:9420
    SCIP_Real SCIPvarGetImplRedcost(SCIP_VAR *var, SCIP_SET *set, SCIP_Bool varfixing, SCIP_STAT *stat, SCIP_PROB *prob, SCIP_LP *lp)
    Definition: var.c:19234
    void SCIPvarInitSolve(SCIP_VAR *var)
    Definition: var.c:3846
    SCIP_RETCODE SCIPvarTransform(SCIP_VAR *origvar, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_OBJSENSE objsense, SCIP_VAR **transvar)
    Definition: var.c:4494
    SCIP_RETCODE SCIPvarRelease(SCIP_VAR **var, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_EVENTQUEUE *eventqueue, SCIP_LP *lp)
    Definition: var.c:3787
    SCIP_RETCODE SCIPvarRemove(SCIP_VAR *var, BMS_BLKMEM *blkmem, SCIP_CLIQUETABLE *cliquetable, SCIP_SET *set, SCIP_Bool final, SCIP_Bool keepimplics)
    Definition: var.c:9123
    void SCIPvarCapture(SCIP_VAR *var)
    Definition: var.c:3762
    void SCIPvarStoreRootSol(SCIP_VAR *var, SCIP_Bool roothaslp)
    Definition: var.c:19035
    SCIP_RETCODE SCIPvarChgType(SCIP_VAR *var, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_PRIMAL *primal, SCIP_LP *lp, SCIP_EVENTQUEUE *eventqueue, SCIP_VARTYPE vartype)
    Definition: var.c:9243
    void SCIPvarUpdateBestRootSol(SCIP_VAR *var, SCIP_SET *set, SCIP_Real rootsol, SCIP_Real rootredcost, SCIP_Real rootlpobjval)
    Definition: var.c:19046
    SCIP_RETCODE SCIPvarChgImplType(SCIP_VAR *var, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_PRIMAL *primal, SCIP_LP *lp, SCIP_EVENTQUEUE *eventqueue, SCIP_IMPLINTTYPE impltype)
    Definition: var.c:9302
    void SCIPvarMarkDeleted(SCIP_VAR *var)
    Definition: var.c:9160
    SCIP_RETCODE SCIPvarLoose(SCIP_VAR *var, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_EVENTQUEUE *eventqueue, SCIP_PROB *prob, SCIP_LP *lp)
    Definition: var.c:4680
    SCIP_RETCODE SCIPvarCopyExactData(BMS_BLKMEM *blkmem, SCIP_VAR *targetvar, SCIP_VAR *sourcevar, SCIP_Bool negateobj)
    Definition: var.c:2686
    void SCIPvarSetProbindex(SCIP_VAR *var, int probindex)
    Definition: var.c:9088
    SCIP_RETCODE SCIPvarChgObjExact(SCIP_VAR *var, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_PROB *prob, SCIP_PRIMAL *primal, SCIP_LPEXACT *lp, SCIP_EVENTQUEUE *eventqueue, SCIP_RATIONAL *newobj)
    Definition: var.c:9495
    internal methods for problem variables