Scippy

    SCIP

    Solving Constraint Integer Programs

    debug.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-2025 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 debug.c
    26 * @ingroup OTHER_CFILES
    27 * @brief methods for debugging
    28 * @author Tobias Achterberg
    29 */
    30
    31/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
    32
    33#include <stdio.h>
    34#include <string.h>
    35#include <assert.h>
    36#ifndef _WIN32
    37#include <strings.h> /*lint --e{766}*/
    38#endif
    39
    40#include "scip/def.h"
    42#include "scip/set.h"
    43#include "scip/lp.h"
    44#include "scip/var.h"
    45#include "scip/prob.h"
    46#include "scip/tree.h"
    47#include "scip/scip.h"
    48#include "scip/debug.h"
    49#include "scip/pub_message.h"
    50#include "scip/pub_misc.h"
    51#include "scip/struct_scip.h"
    52
    53#ifdef WITH_DEBUG_SOLUTION
    54
    55#define SCIP_HASHSIZE_DEBUG 500 /**< minimum size of hash map for storing whether a solution is valid for the node */
    56
    57struct SCIP_DebugSolData
    58{
    59 char** solnames; /**< variable names in the solution */
    60 SCIP_Real* solvals; /**< solution value array (only nonzero entries) */
    61 int nsolvals; /**< number of entries in the debug solution */
    62 int solsize; /**< size of the array entries */
    63 SCIP_SOL* debugsol; /**< a debug solution */
    64 SCIP_STAGE debugsolstage; /**< solving stage of debug solution */
    65 SCIP_HASHMAP* solinnode; /**< maps nodes to bools, storing whether the solution is valid for the node */
    66 SCIP_Bool falseptr; /**< pointer to value FALSE used for hashmap */
    67 SCIP_Bool trueptr; /**< pointer to value TRUE used for hashmap */
    68 SCIP_Bool solisachieved; /**< means if current best solution is better than the given debug solution */
    69 SCIP_Real debugsolval; /**< objective value for debug solution */
    70 SCIP_Bool debugsoldisabled; /**< flag indicating if debugging of solution was disabled or not */
    71};
    72
    73
    74/** creates debug solution data */
    76 SCIP_DEBUGSOLDATA** debugsoldata /**< pointer to debug solution data */
    77 )
    78{
    79 assert(debugsoldata != NULL);
    80
    81 SCIP_ALLOC( BMSallocMemory(debugsoldata) );
    82
    83 (*debugsoldata)->solnames = NULL;
    84 (*debugsoldata)->solvals = NULL;
    85 (*debugsoldata)->nsolvals = 0;
    86 (*debugsoldata)->solsize = 0;
    87 (*debugsoldata)->debugsol = NULL;
    88 (*debugsoldata)->debugsolstage = SCIP_STAGE_INIT;
    89 (*debugsoldata)->solinnode = NULL;
    90 (*debugsoldata)->falseptr = FALSE;
    91 (*debugsoldata)->trueptr = TRUE;
    92 (*debugsoldata)->solisachieved = FALSE;
    93 (*debugsoldata)->debugsolval = 0.0;
    94 (*debugsoldata)->debugsoldisabled = TRUE;
    95
    96 return SCIP_OKAY;
    97}
    98
    99#ifdef SCIP_MORE_DEBUG
    100/** comparison method for sorting variables w.r.t. to their name */
    101static
    102SCIP_DECL_SORTPTRCOMP(sortVarsAfterNames)
    103{
    104 return strcmp(SCIPvarGetName((SCIP_VAR*)elem1), SCIPvarGetName((SCIP_VAR*)elem2));
    105}
    106#endif
    107
    108/* checks whether the parameter is specified */
    109static
    110SCIP_Bool debugSolutionAvailable(
    111 SCIP_SET* set /**< global SCIP settings */
    112 )
    113{
    114 assert(set != NULL);
    115
    116 /* check whether a debug solution is specified */
    117 if( strcmp(set->misc_debugsol, "-") == 0 )
    118 {
    119 if( SCIPdebugSolIsEnabled(set->scip) )
    120 {
    123 "SCIP is compiled with 'DEBUGSOL=true' but no debug solution is given:\n");
    125 "*** Please set the parameter 'misc/debugsol' and reload the problem again to use the debugging-mechanism ***\n\n");
    126 }
    127 return FALSE;
    128 }
    129 return TRUE;
    130}
    131
    132/** reads solution from given file into given arrays */
    133static
    134SCIP_RETCODE readSolfile(
    135 SCIP_SET* set, /**< global SCIP settings */
    136 const char* filename, /**< solution filename to read */
    137 SCIP_SOL** debugsolptr,
    138 SCIP_Real* debugsolvalptr,
    139 SCIP_STAGE* debugsolstageptr,
    140 char*** names, /**< pointer to store the array of variable names */
    141 SCIP_Real** vals, /**< pointer to store the array of solution values */
    142 int* nvals, /**< pointer to store the number of non-zero elements */
    143 int* valssize /**< pointer to store the length of the variable names and solution values arrays */
    144 )
    145{
    146 SCIP_FILE* file;
    147 SCIP_VAR** vars;
    148 SCIP_Real* solvalues;
    149 SCIP_SOL* debugsol;
    150 SCIP_Real debugsolval;
    151 SCIP_Bool unknownvariablemessage;
    152 int lineno;
    153 int i;
    154
    155 assert(set != NULL);
    156 assert(filename != NULL);
    157 assert(names != NULL);
    158 assert(*names == NULL);
    159 assert(vals != NULL);
    160 assert(*vals == NULL);
    161 assert(nvals != NULL);
    162 assert(valssize != NULL);
    163
    164 printf("***** debug: reading solution file <%s>\n", filename);
    165
    166 /* open solution file */
    167 file = SCIPfopen(filename, "r");
    168 if( file == NULL )
    169 {
    170 SCIPerrorMessage("cannot open solution file <%s> specified in scip/debug.h\n", filename);
    171 SCIPprintSysError(filename);
    172 return SCIP_NOFILE;
    173 }
    174
    175 /* read data */
    176 *valssize = 0;
    177 unknownvariablemessage = FALSE;
    178 lineno = 0;
    179
    180 while( !SCIPfeof(file) )
    181 {
    182 /**@todo unlimit buffer size */
    183 char buffer[SCIP_MAXSTRLEN];
    184 const char* varname;
    185 const char* valuestring;
    186 char* endptr;
    187 SCIP_VAR* var;
    188
    189 /* get next line */
    190 if( SCIPfgets(buffer, (int)sizeof(buffer), file) == NULL )
    191 {
    192 if( SCIPfeof(file) )
    193 break;
    194 else
    195 {
    196 SCIPfclose(file);
    197 return SCIP_READERROR;
    198 }
    199 }
    200 ++lineno;
    201
    202 /* there are some lines which may precede the solution information */
    203 if( SCIPstrncasecmp(buffer, "solution status:", 16) == 0 || SCIPstrncasecmp(buffer, "objective value:", 16) == 0
    204 || buffer[strspn(buffer, " \t\n\v\f\r")] == '\0' || SCIPstrncasecmp(buffer, "Log started", 11) == 0
    205 || SCIPstrncasecmp(buffer, "Variable Name", 13) == 0 || SCIPstrncasecmp(buffer, "All other variables", 19) == 0
    206 || SCIPstrncasecmp(buffer, "NAME", 4) == 0 || SCIPstrncasecmp(buffer, "ENDATA", 6) == 0 /* allow parsing of SOL-format on the MIPLIB 2003 pages */
    207 || SCIPstrncasecmp(buffer, "=obj=", 5) == 0 ) /* avoid "unknown variable" warning when reading MIPLIB SOL files */
    208 continue;
    209
    210 /* tokenize the line */
    211 varname = SCIPstrtok(buffer, " \t\v", &endptr);
    212 valuestring = SCIPstrtok(NULL, " \t\n\v\f\r", &endptr);
    213 if( valuestring == NULL )
    214 {
    215 SCIPerrorMessage("Invalid input line %d in solution file <%s>: <%s>.\n", lineno, filename, buffer);
    216 SCIPfclose(file);
    217 return SCIP_READERROR;
    218 }
    219
    220 /* find the variable */
    221 var = SCIPfindVar(set->scip, varname);
    222 if( var == NULL )
    223 {
    224 if( !unknownvariablemessage )
    225 {
    226 SCIPverbMessage(set->scip, SCIP_VERBLEVEL_NORMAL, NULL, "unknown variable <%s> in line %d of solution file <%s>\n",
    227 varname, lineno, filename);
    228 SCIPverbMessage(set->scip, SCIP_VERBLEVEL_NORMAL, NULL, " (further unknown variables are ignored)\n");
    229 unknownvariablemessage = TRUE;
    230 }
    231 continue;
    232 }
    233
    234 /* ignore invalid value */
    235 if( SCIPstrncasecmp(valuestring, "inv", 3) == 0 )
    236 {
    237 SCIPdebugMsg(set->scip, "ignored invalid assignment for variable <%s>\n", varname);
    238 continue;
    239 }
    240
    241 /**@todo store exact debugsol */
    242 {
    243 SCIP_Real value;
    244
    245 if( SCIPstrncasecmp(valuestring, "+inf", 4) == 0 || SCIPstrncasecmp(valuestring, "inf", 3) == 0 )
    246 value = SCIPsetInfinity(set);
    247 else if( SCIPstrncasecmp(valuestring, "-inf", 4) == 0 )
    248 value = -SCIPsetInfinity(set);
    249 else if( !SCIPstrToRealValue(valuestring, &value, &endptr) || *endptr != '\0' )
    250 {
    251#ifdef SCIP_WITH_EXACTSOLVE
    252 /* convert exact value */
    253 if( SCIPrationalIsString(valuestring) )
    254 {
    255 SCIP_RATIONAL* valueexact;
    256
    257 SCIP_CALL( SCIPrationalCreateString(SCIPblkmem(set->scip), &valueexact, valuestring) );
    258
    259 value = SCIPrationalGetReal(valueexact);
    260
    261 SCIPrationalFreeBlock(SCIPblkmem(set->scip), &valueexact);
    262 }
    263 else
    264#endif
    265 {
    266 SCIPerrorMessage("Invalid solution value <%s> for variable <%s> in line %d of solution file <%s>.\n",
    267 valuestring, varname, lineno, filename);
    268 SCIPfclose(file);
    269 return SCIP_READERROR;
    270 }
    271 }
    272
    273 /* skip zero entry */
    274 if( value == 0.0 ) /*lint !e777*/
    275 continue;
    276
    277 /* search insertion index in sorted list */
    278 i = *nvals - 1;
    279 while( i >= 0 && strcmp(varname, (*names)[i]) < 0 )
    280 --i;
    281
    282 /* overwrite real solution */
    283 if( i >= 0 && strcmp(varname, (*names)[i]) == 0 )
    284 {
    285 SCIPwarningMessage(set->scip, "Overwriting %lf with %lf for <%s> in line %d of solution file <%s>.\n",
    286 (*vals)[i], value, varname, lineno, filename);
    287 (*vals)[i] = value;
    288 }
    289 /* add real solution */
    290 else
    291 {
    292 int j;
    293
    294 if( *nvals >= *valssize )
    295 {
    296 *valssize = MAX(2 * (*valssize), (*nvals) + 1);
    297 SCIP_ALLOC( BMSreallocMemoryArray(names, *valssize) );
    298 SCIP_ALLOC( BMSreallocMemoryArray(vals, *valssize) );
    299 }
    300 assert(*nvals < *valssize);
    301
    302 ++i;
    303 for( j = *nvals; j > i; --j )
    304 {
    305 (*names)[j] = (*names)[j - 1];
    306 (*vals)[j] = (*vals)[j - 1];
    307 }
    308 SCIP_ALLOC( BMSduplicateMemoryArray(&(*names)[i], varname, strlen(varname)+1) );
    309 (*vals)[i] = value;
    310 ++(*nvals);
    311 }
    312
    313 SCIPdebugMsg(set->scip, "found variable <%s>: value <%g>\n", varname, value);
    314 }
    315 }
    316
    317 /* get memory for SCIP solution */
    318 SCIP_ALLOC( BMSallocMemoryArray(&vars, *valssize) );
    319 SCIP_ALLOC( BMSallocMemoryArray(&solvalues, *valssize) );
    320
    321 debugsolval = 0.0;
    322
    323 /* get solution value */
    324 for( i = 0; i < *nvals; ++i)
    325 {
    326 SCIP_VAR* var = SCIPfindVar(set->scip, (*names)[i]);
    327 assert(var != NULL);
    328 vars[i] = var;
    329 solvalues[i] = (*vals)[i];
    330 debugsolval += solvalues[i] * SCIPvarGetObj(var);
    331 }
    332 SCIPdebugMsg(set->scip, "Debug Solution value is %g.\n", debugsolval);
    333
    334#ifdef SCIP_MORE_DEBUG
    335 SCIPsortPtrReal((void**)vars, solvalues, sortVarsAfterNames, *nvals);
    336
    337 for( i = 0; i < *nvals - 1; ++i)
    338 {
    339 assert(strcmp(SCIPvarGetName(vars[i]), SCIPvarGetName(vars[i + 1])) != 0);
    340 }
    341#endif
    342
    343 if( debugsolptr != NULL )
    344 {
    345 /* create SCIP solution */
    346 SCIP_CALL( SCIPcreateOrigSol(set->scip, &debugsol, NULL) );
    347 *debugsolstageptr = SCIPgetStage(set->scip);
    348
    349 /* set SCIP solution values */
    350 SCIP_CALL( SCIPsetSolVals(set->scip, debugsol, *nvals, vars, solvalues ) );
    351 }
    352
    353 BMSfreeMemoryArray(&vars);
    354 BMSfreeMemoryArray(&solvalues);
    355
    356 if( debugsolptr != NULL )
    357 *debugsolptr = debugsol;
    358
    359 if( debugsolvalptr != NULL )
    360 *debugsolvalptr = debugsolval;
    361
    362 /* close file */
    363 SCIPfclose(file);
    364
    365 printf("***** debug: found %d non-zero entries\n", *nvals);
    366
    367 return SCIP_OKAY;
    368}
    369
    370/** reads feasible solution to check from file */
    371static
    372SCIP_RETCODE readSolution(
    373 SCIP_SET* set /**< global SCIP settings */
    374 )
    375{
    376 SCIP_DEBUGSOLDATA* debugsoldata;
    377
    378 assert(set != NULL);
    379
    380 /* check whether a debug solution is available */
    381 if( !debugSolutionAvailable(set) )
    382 return SCIP_OKAY;
    383
    384 debugsoldata = SCIPsetGetDebugSolData(set);
    385 assert(debugsoldata != NULL);
    386
    387 /* check whether no debug solution is read */
    388 if( debugsoldata->debugsol != NULL )
    389 return SCIP_OKAY;
    390
    391 SCIP_CALL( readSolfile(set, set->misc_debugsol, &debugsoldata->debugsol, &debugsoldata->debugsolval,
    392 &debugsoldata->debugsolstage, &(debugsoldata->solnames), &(debugsoldata->solvals), &(debugsoldata->nsolvals),
    393 &(debugsoldata->solsize)) );
    394
    395 return SCIP_OKAY;
    396}
    397
    398/** gets value of given variable in debugging solution */
    399static
    400SCIP_RETCODE getSolutionValue(
    401 SCIP_SET* set, /**< global SCIP settings */
    402 SCIP_VAR* var, /**< variable to get solution value for */
    403 SCIP_Real* val /**< pointer to store solution value */
    404 )
    405{
    406 SCIP_VAR* solvar;
    407 SCIP_DEBUGSOLDATA* debugsoldata;
    408 SCIP_Real scalar;
    409 SCIP_Real constant;
    410 const char* name;
    411 int left;
    412 int right;
    413 int middle;
    414 int cmp;
    415
    416 assert(set != NULL);
    417 assert(var != NULL);
    418 assert(val != NULL);
    419
    420 /* check whether a debug solution is available */
    421 if( !debugSolutionAvailable(set) )
    422 return SCIP_OKAY;
    423
    424 debugsoldata = SCIPsetGetDebugSolData(set);
    425 assert(debugsoldata != NULL);
    426
    427 /* allow retrieving solution values only if referring to the SCIP instance that is debugged */
    428 if( !SCIPdebugSolIsEnabled(set->scip) )
    429 {
    430 *val = SCIP_UNKNOWN;
    431 return SCIP_OKAY;
    432 }
    433
    434 SCIP_CALL( readSolution(set) );
    435 SCIPsetDebugMsg(set, "Now handling variable <%s>, which has status %d, is of type %d, and was deleted: %d, negated: %d, transformed: %d\n",
    437
    438 /* ignore deleted variables */
    439 if( SCIPvarIsDeleted(var) )
    440 {
    441 SCIPsetDebugMsg(set, "**** unknown solution value for deleted variable <%s>\n", SCIPvarGetName(var));
    442 *val = SCIP_UNKNOWN;
    443 return SCIP_OKAY;
    444 }
    445
    446 /* retransform variable onto original variable space */
    447 solvar = var;
    448 scalar = 1.0;
    449 constant = 0.0;
    450 if( SCIPvarIsNegated(solvar) )
    451 {
    452 scalar = -1.0;
    453 constant = SCIPvarGetNegationConstant(solvar);
    454 solvar = SCIPvarGetNegationVar(solvar);
    455 }
    456
    457 if( SCIPvarIsTransformed(solvar) )
    458 {
    459 SCIP_CALL( SCIPvarGetOrigvarSum(&solvar, &scalar, &constant) );
    460 if( solvar == NULL )
    461 {
    462 /* if no original counterpart, then maybe someone added a value for the transformed variable, so search for var (or its negation) */
    463 SCIPsetDebugMsg(set, "variable <%s> has no original counterpart\n", SCIPvarGetName(var));
    464 solvar = var;
    465 scalar = 1.0;
    466 constant = 0.0;
    467 if( SCIPvarIsNegated(solvar) )
    468 {
    469 scalar = -1.0;
    470 constant = SCIPvarGetNegationConstant(solvar);
    471 solvar = SCIPvarGetNegationVar(solvar);
    472 }
    473 }
    474 }
    475
    476 /* perform a binary search for the variable */
    477 name = SCIPvarGetName(solvar);
    478 left = 0;
    479 right = debugsoldata->nsolvals-1;
    480 while( left <= right )
    481 {
    482 middle = (left+right)/2;
    483 cmp = strcmp(name, debugsoldata->solnames[middle]);
    484 if( cmp < 0 )
    485 right = middle-1;
    486 else if( cmp > 0 )
    487 left = middle+1;
    488 else
    489 {
    490 *val = scalar * debugsoldata->solvals[middle] + constant;
    491
    493 {
    494 SCIPmessagePrintWarning(SCIPgetMessagehdlr(set->scip), "invalid solution value %.15g for variable <%s>[%.15g,%.15g]\n",
    496 }
    497
    498 return SCIP_OKAY;
    499 }
    500 }
    501 *val = constant;
    502
    504 {
    505 SCIPmessagePrintWarning(SCIPgetMessagehdlr(set->scip), "invalid solution value %.15g for variable <%s>[%.15g,%.15g]\n",
    507 }
    508
    509 return SCIP_OKAY;
    510}
    511
    512/** gets pointer to the debug solution */
    513SCIP_RETCODE SCIPdebugGetSol(
    514 SCIP* scip, /**< SCIP data structure */
    515 SCIP_SOL** sol /**< buffer to store pointer to the debug solution */
    516 )
    517{
    518 SCIP_DEBUGSOLDATA* debugsoldata;
    519
    520 debugsoldata = SCIPsetGetDebugSolData(scip->set);
    521 assert(scip != NULL);
    522 assert(sol != NULL);
    523
    524 *sol = NULL;
    525
    526 /* check whether a debug solution is available */
    527 if( !debugSolutionAvailable(scip->set) )
    528 return SCIP_OKAY;
    529
    530 SCIP_CALL( readSolution(scip->set) );
    531
    532 if( debugsoldata->debugsol == NULL )
    533 return SCIP_ERROR;
    534
    535 *sol = debugsoldata->debugsol;
    536
    537 return SCIP_OKAY;
    538}
    539
    540/** gets value for a variable in the debug solution
    541 *
    542 * if no value is stored for the variable, gives 0.0
    543 */
    545 SCIP* scip, /**< SCIP data structure */
    546 SCIP_VAR* var, /**< variable for which to get the value */
    547 SCIP_Real* val /**< buffer to store solution value */
    548 )
    549{
    550 SCIP_CALL( getSolutionValue(scip->set, var, val) );
    551
    552 return SCIP_OKAY;
    553}
    554
    555/** returns whether the debug solution is worse than the best known solution or if the debug solution was found */
    556static
    557SCIP_Bool debugSolIsAchieved(
    558 SCIP_SET* set /**< global SCIP settings */
    559 )
    560{
    561 SCIP_SOL* bestsol;
    562 SCIP* scip;
    563 SCIP_DEBUGSOLDATA* debugsoldata;
    564
    565 /* check whether a debug solution is available */
    566 if( !debugSolutionAvailable(set) )
    567 return SCIP_OKAY;
    568
    569 assert(set != NULL);
    570 debugsoldata = SCIPsetGetDebugSolData(set);
    571
    572 assert(debugsoldata != NULL);
    573
    574 if( debugsoldata->solisachieved )
    575 return TRUE;
    576
    577 assert(set != NULL);
    578
    579 scip = set->scip;
    580 assert(scip != NULL);
    581
    582 bestsol = SCIPgetBestSol(scip);
    583
    584 if( bestsol != NULL )
    585 {
    586 SCIP_Real solvalue;
    587
    588 /* don't check solution while in problem creation stage */
    590 return TRUE;
    591
    592 solvalue = SCIPgetSolOrigObj(scip, bestsol);
    593
    594 /* make sure a debug solution has been read, so we do not compare against the initial debugsolval == 0 */
    595 SCIP_CALL( readSolution(set) );
    596
    597 if( (SCIPgetObjsense(scip) == SCIP_OBJSENSE_MINIMIZE && SCIPsetIsLE(set, solvalue, debugsoldata->debugsolval))
    598 || (SCIPgetObjsense(scip) == SCIP_OBJSENSE_MAXIMIZE && SCIPsetIsGE(set, solvalue, debugsoldata->debugsolval)) )
    599 debugsoldata->solisachieved = TRUE;
    600 }
    601
    602 return debugsoldata->solisachieved;
    603}
    604
    605/** returns whether the solution is contained in node's subproblem */
    606static
    607SCIP_RETCODE isSolutionInNode(
    608 BMS_BLKMEM* blkmem, /**< block memory */
    609 SCIP_SET* set, /**< global SCIP settings */
    610 SCIP_NODE* node, /**< local node where this bound change was applied */
    611 SCIP_Bool* solcontained /**< pointer to store whether the solution is contained in node's subproblem */
    612 )
    613{
    614 SCIP_Bool* boolptr;
    615 SCIP_DEBUGSOLDATA* debugsoldata;
    616
    617 assert(set != NULL);
    618 assert(blkmem != NULL);
    619 assert(node != NULL);
    620 assert(solcontained != NULL);
    621
    622 /* check whether a debug solution is available */
    623 if( !debugSolutionAvailable(set) )
    624 return SCIP_OKAY;
    625
    626 debugsoldata = SCIPsetGetDebugSolData(set);
    627 assert(debugsoldata != NULL);
    628
    629 if( debugsoldata ->debugsoldisabled )
    630 {
    631 *solcontained = FALSE;
    632 return SCIP_OKAY;
    633 }
    634
    635 /* generate the hashmap */
    636 if( debugsoldata->solinnode == NULL )
    637 {
    638 SCIP_CALL( SCIPhashmapCreate(&debugsoldata->solinnode, blkmem, SCIP_HASHSIZE_DEBUG) );
    639 }
    640
    641 /* check, whether we know already whether the solution is contained in the given node */
    642 boolptr = (SCIP_Bool*)SCIPhashmapGetImage(debugsoldata->solinnode, (void*)node);
    643 if( boolptr != NULL )
    644 {
    645 if( boolptr != &debugsoldata->falseptr && boolptr != &debugsoldata->trueptr )
    646 {
    647 SCIPerrorMessage("wrong value in node hashmap\n");
    648 SCIPABORT();
    649 return SCIP_ERROR;
    650 }
    651 *solcontained = *boolptr;
    652 return SCIP_OKAY;
    653 }
    654
    655 /* if the solution is not contained in the parent of the node, it cannot be contained in the current node */
    656 *solcontained = TRUE;
    657 if( node->parent != NULL )
    658 {
    659 SCIP_CALL( isSolutionInNode(blkmem, set, node->parent, solcontained) );
    660 }
    661
    662 if( *solcontained )
    663 {
    664 /* check whether the bound changes at the current node remove the debugging solution from the subproblem */
    665 if( node->domchg != NULL )
    666 {
    667 SCIP_DOMCHGBOUND* domchgbound;
    668 SCIP_BOUNDCHG* boundchgs;
    669 int i;
    670
    671 domchgbound = &node->domchg->domchgbound;
    672 boundchgs = domchgbound->boundchgs;
    673 for( i = 0; i < (int)domchgbound->nboundchgs && *solcontained; ++i )
    674 {
    675 SCIP_Real varsol;
    676
    677 /* get solution value of variable */
    678 SCIP_CALL( getSolutionValue(set, boundchgs[i].var, &varsol) );
    679
    680 if( varsol != SCIP_UNKNOWN ) /*lint !e777*/
    681 {
    682 /* compare the bound change with the solution value */
    683 if( SCIPboundchgGetBoundtype(&boundchgs[i]) == SCIP_BOUNDTYPE_LOWER )
    684 *solcontained = SCIPsetIsFeasGE(set, varsol, boundchgs[i].newbound);
    685 else
    686 *solcontained = SCIPsetIsFeasLE(set, varsol, boundchgs[i].newbound);
    687
    688 if( !(*solcontained) && SCIPboundchgGetBoundchgtype(&boundchgs[i]) != SCIP_BOUNDCHGTYPE_BRANCHING )
    689 {
    690 SCIPerrorMessage("debugging solution was cut off in local node %p at depth %d by inference <%s>[%.15g] %s %.15g\n",
    691 (void*) node, SCIPnodeGetDepth(node), SCIPvarGetName(boundchgs[i].var), varsol,
    692 SCIPboundchgGetBoundtype(&boundchgs[i]) == SCIP_BOUNDTYPE_LOWER ? ">=" : "<=", boundchgs[i].newbound);
    693 SCIPABORT();
    694 }
    695 }
    697 {
    698 /* we branched on a variable were we don't know the solution: no debugging can be applied in this subtree */
    699 *solcontained = FALSE;
    700 }
    701 }
    702 }
    703 if( *solcontained && SCIPnodeGetNAddedConss(node) > 0 )
    704 {
    705 int i;
    706 int naddedcons = 0;
    707 SCIP_CONS** addedcons;
    708
    710
    711 SCIPnodeGetAddedConss(node, addedcons, &naddedcons, SCIPnodeGetNAddedConss(node));
    712
    713 for( i = 0; i < naddedcons && *solcontained; ++i )
    714 {
    715 SCIP_RESULT result = SCIP_FEASIBLE;
    716 SCIP_CALL( SCIPcheckCons(set->scip, addedcons[i], debugsoldata->debugsol , TRUE, TRUE, FALSE, &result) );
    717
    718 if( result != SCIP_FEASIBLE )
    719 *solcontained = FALSE;
    720 }
    721
    722 SCIPsetFreeBufferArray(set, &addedcons);
    723 }
    724 }
    725
    726 /* remember the status of the current node */
    727 SCIP_CALL( SCIPhashmapSetImage(debugsoldata->solinnode, (void*)node, *solcontained ? (void*)(&debugsoldata->trueptr) : (void*)(&debugsoldata->falseptr)) );
    728
    729 return SCIP_OKAY;
    730}
    731
    732/** frees the debug solution */
    735 )
    736{
    737 SCIP_DEBUGSOLDATA* debugsoldata;
    738
    739 debugsoldata = SCIPsetGetDebugSolData(set);
    740 assert(debugsoldata != NULL);
    741
    742 if( debugsoldata->debugsol != NULL && ((SCIPgetStage(set->scip) > SCIP_STAGE_PROBLEM && debugsoldata->debugsolstage > SCIP_STAGE_PROBLEM)
    743 || (SCIPgetStage(set->scip) <= SCIP_STAGE_PROBLEM && debugsoldata->debugsolstage <= SCIP_STAGE_PROBLEM)) )
    744 {
    745 SCIP_CALL( SCIPfreeSol(set->scip, &debugsoldata->debugsol) );
    746 }
    747
    748 return SCIP_OKAY;
    749}
    750
    751/** clears the debug solution */
    752SCIP_RETCODE SCIPdebugClearSol(
    753 SCIP* scip /**< SCIP data structure */
    754 )
    755{
    756 SCIP_DEBUGSOLDATA* debugsoldata;
    757 int s;
    758
    759 assert(scip != NULL);
    760
    761 debugsoldata = SCIPsetGetDebugSolData(scip->set);
    762 assert(debugsoldata != NULL);
    763
    764 if( debugsoldata->debugsol != NULL )
    765 {
    766 SCIP_CALL( SCIPfreeSol(scip, &debugsoldata->debugsol) );
    767 }
    768 SCIP_CALL( SCIPcreateOrigSol(scip, &debugsoldata->debugsol, NULL) );
    769
    770 for( s = debugsoldata->nsolvals - 1; s >= 0; --s )
    771 BMSfreeMemoryArrayNull(&(debugsoldata->solnames[s]));
    772
    773 debugsoldata->nsolvals = 0;
    774 debugsoldata->debugsolval= 0.0;
    775 debugsoldata->solisachieved = FALSE;
    776
    777 return SCIP_OKAY;
    778}
    779
    780/** resets the data structure after restart */
    783 )
    784{
    785 SCIP_DEBUGSOLDATA* debugsoldata;
    786
    787 assert(set != NULL);
    788
    789 debugsoldata = SCIPsetGetDebugSolData(set);
    790 assert(debugsoldata != NULL);
    791
    792 if( debugsoldata->solinnode != NULL )
    793 {
    794 SCIP_CALL( SCIPhashmapRemoveAll(debugsoldata->solinnode) );
    795 }
    796
    797 return SCIP_OKAY;
    798}
    799
    800/** frees debugging data for the particular instance */
    802 SCIP_SET* set /**< global SCIP settings */
    803 )
    804{
    805 int s;
    806
    807 SCIP_DEBUGSOLDATA* debugsoldata;
    808 assert(set != NULL);
    809
    810 debugsoldata = SCIPsetGetDebugSolData(set);
    811 assert(debugsoldata != NULL);
    812
    813 for( s = debugsoldata->nsolvals - 1; s >= 0; --s )
    814 BMSfreeMemoryArrayNull(&(debugsoldata->solnames[s]));
    815
    816 BMSfreeMemoryArrayNull(&debugsoldata->solnames);
    817 BMSfreeMemoryArrayNull(&debugsoldata->solvals);
    818
    819 debugsoldata->nsolvals = 0;
    820 debugsoldata->debugsolval= 0.0;
    821 debugsoldata->solisachieved = FALSE;
    822
    823 if( debugsoldata->solinnode != NULL)
    824 SCIPhashmapFree(&debugsoldata->solinnode);
    825
    826 /* free the debug solution */
    828
    829 return SCIP_OKAY;
    830}
    831
    832/** frees all debugging data */
    834 SCIP_SET* set /**< global SCIP settings */
    835 )
    836{
    837 SCIP_DEBUGSOLDATA* debugsoldata;
    838
    839 assert(set != NULL);
    840
    841 debugsoldata = SCIPsetGetDebugSolData(set);
    842 assert(debugsoldata != NULL);
    843
    845 BMSfreeMemoryNull(&debugsoldata);
    846
    847 set->debugsoldata = NULL;
    848
    849 return SCIP_OKAY;
    850}
    851
    852/** checks for validity of the debugging solution in given active constraints */
    854 SCIP* scip, /**< SCIP data structure */
    855 SCIP_CONS** conss, /**< constraints to check for validity */
    856 int nconss /**< number of given constraints */
    857 )
    858{
    859 SCIP_RESULT result;
    860 int c;
    861
    862 SCIP_DEBUGSOLDATA* debugsoldata;
    863 assert(scip->set != NULL);
    864
    865 /* check if we are in the original problem and not in a sub MIP */
    867 return SCIP_OKAY;
    868
    869 /* check whether a debug solution is available */
    870 if( !debugSolutionAvailable(scip->set) )
    871 return SCIP_OKAY;
    872
    873 debugsoldata = SCIPsetGetDebugSolData(scip->set);
    874
    875 assert(conss != NULL || nconss == 0);
    876 assert(debugsoldata->debugsol != NULL);
    877
    878 /* check if the incumbent solution is at least as good as the debug solution, so we can stop to check the debug
    879 * solution
    880 */
    881 if( debugSolIsAchieved(scip->set) )
    882 return SCIP_OKAY;
    883
    884 result = SCIP_FEASIBLE;
    885
    886 /* checking each given constraint against the debugging solution */
    887 for( c = nconss - 1; c >= 0; --c )
    888 {
    889 assert(conss[c] != NULL);
    890
    891 if( !SCIPconsIsActive(conss[c]) )
    892 continue;
    893
    894 assert(SCIPconsGetActiveDepth(conss[c]) <= SCIPgetDepth(scip));
    895
    896 /* if the cons is only locally valid, check whether the debugging solution is contained in the local subproblem */
    897 if( SCIPconsIsLocal(conss[c]) )
    898 {
    899 SCIP_Bool solcontained;
    900
    901 SCIP_CALL( isSolutionInNode(SCIPblkmem(scip), scip->set, SCIPgetCurrentNode(scip), &solcontained) );
    902 if( !solcontained )
    903 return SCIP_OKAY;
    904 }
    905
    906 SCIP_CALL( SCIPcheckCons(scip, conss[c], debugsoldata->debugsol, TRUE, TRUE, TRUE, &result) );
    907
    908 SCIPdebugMsg(scip, " -> checking of constraint %s returned result <%d>\n", SCIPconsGetName(conss[c]), result);
    909
    910 if( result != SCIP_FEASIBLE )
    911 {
    912 SCIPerrorMessage("constraint %s violates the debugging solution\n", SCIPconsGetName(conss[c]));
    913 SCIPABORT();
    914 }
    915 }
    916
    917 return SCIP_OKAY;
    918}
    919
    920/** checks for validity of the debugging solution for any globally valid constraints. */
    922 SCIP* scip, /**< SCIP data structure */
    923 SCIP_CONS** conss, /**< constraints to check for validity */
    924 int nconss /**< number of given constraints */
    925 )
    926{
    927 SCIP_RESULT result;
    928 int c;
    929
    930 SCIP_DEBUGSOLDATA* debugsoldata;
    931 assert(scip->set != NULL);
    932
    933 /* check if we are in the original problem and not in a sub MIP */
    935 return SCIP_OKAY;
    936
    937 /* check whether a debug solution is available */
    938 if( !debugSolutionAvailable(scip->set) )
    939 return SCIP_OKAY;
    940
    941 debugsoldata = SCIPsetGetDebugSolData(scip->set);
    942
    943 assert(conss != NULL || nconss == 0);
    944 assert(debugsoldata->debugsol != NULL);
    945
    946 /* check if the incumbent solution is at least as good as the debug solution, so we can stop to check the debug
    947 * solution
    948 */
    949 if( debugSolIsAchieved(scip->set) )
    950 return SCIP_OKAY;
    951
    952 result = SCIP_FEASIBLE;
    953
    954 /* checking each given constraint against the debugging solution */
    955 for( c = nconss - 1; c >= 0; --c )
    956 {
    957 assert(conss[c] != NULL);
    958
    959 SCIP_CALL( SCIPcheckCons(scip, conss[c], debugsoldata->debugsol, TRUE, TRUE, TRUE, &result) );
    960
    961 SCIPdebugMsg(scip, " -> checking of constraint %s returned result <%d>\n", SCIPconsGetName(conss[c]), result);
    962
    963 if( result != SCIP_FEASIBLE )
    964 {
    965 SCIPerrorMessage("constraint %s violates the debugging solution\n", SCIPconsGetName(conss[c]));
    966 SCIPABORT();
    967 }
    968 }
    969
    970 return SCIP_OKAY;
    971}
    972
    973/** checks whether given row is valid for the debugging solution */
    975 SCIP_SET* set, /**< global SCIP settings */
    976 SCIP_ROW* row /**< row to check for validity */
    977 )
    978{
    979 SCIP_COL** cols;
    980 SCIP_Real* vals;
    981 SCIP_Real lhs;
    982 SCIP_Real rhs;
    983 int nnonz;
    984 int i;
    985 SCIP_Real minactivity;
    986 SCIP_Real maxactivity;
    987 SCIP_Real solval;
    988
    989 assert(set != NULL);
    990 assert(row != NULL);
    991
    992 /* when debugging was disabled the solution is not defined to be not valid in the current subtree */
    993 if( !SCIPdebugSolIsEnabled(set->scip) )
    994 return SCIP_OKAY;
    995
    996 /* check whether a debug solution is available */
    997 if( !debugSolutionAvailable(set) )
    998 return SCIP_OKAY;
    999
    1000 /* check if the incumbent solution is at least as good as the debug solution, so we can stop to check the debug solution */
    1001 if( debugSolIsAchieved(set) )
    1002 return SCIP_OKAY;
    1003
    1004 /* if the row is only locally valid, check whether the debugging solution is contained in the local subproblem */
    1005 if( SCIProwIsLocal(row) )
    1006 {
    1007 SCIP_Bool solcontained;
    1008
    1009 SCIP_CALL( isSolutionInNode(SCIPblkmem(set->scip), set, SCIPgetCurrentNode(set->scip), &solcontained) );
    1010 if( !solcontained )
    1011 return SCIP_OKAY;
    1012 }
    1013
    1014 cols = SCIProwGetCols(row);
    1015 vals = SCIProwGetVals(row);
    1016 nnonz = SCIProwGetNNonz(row);
    1017 lhs = SCIProwGetLhs(row);
    1018 rhs = SCIProwGetRhs(row);
    1019
    1020 /* calculate row's activity on debugging solution */
    1021 minactivity = SCIProwGetConstant(row);
    1022 maxactivity = minactivity;
    1023 for( i = 0; i < nnonz; ++i )
    1024 {
    1025 SCIP_VAR* var;
    1026
    1027 /* get solution value of variable in debugging solution */
    1028 var = SCIPcolGetVar(cols[i]);
    1029 SCIP_CALL( getSolutionValue(set, var, &solval) );
    1030
    1031 if( solval != SCIP_UNKNOWN ) /*lint !e777*/
    1032 {
    1033 minactivity += vals[i] * solval;
    1034 maxactivity += vals[i] * solval;
    1035 }
    1036 else if( vals[i] > 0.0 )
    1037 {
    1038 minactivity += vals[i] * SCIPvarGetLbGlobal(var);
    1039 maxactivity += vals[i] * SCIPvarGetUbGlobal(var);
    1040 }
    1041 else if( vals[i] < 0.0 )
    1042 {
    1043 minactivity += vals[i] * SCIPvarGetUbGlobal(var);
    1044 maxactivity += vals[i] * SCIPvarGetLbGlobal(var);
    1045 }
    1046 }
    1047 SCIPsetDebugMsg(set, "debugging solution on row <%s>: %g <= [%g,%g] <= %g\n",
    1048 SCIProwGetName(row), lhs, minactivity, maxactivity, rhs);
    1049
    1050 /* check row for violation, using absolute LP feasibility tolerance (as LP solver should do) */
    1051 if( maxactivity + SCIPgetLPFeastol(set->scip) < lhs || minactivity - SCIPgetLPFeastol(set->scip) > rhs )
    1052 {
    1053 printf("***** debug: row <%s> violates debugging solution (lhs=%.15g, rhs=%.15g, activity=[%.15g,%.15g], local=%u, lpfeastol=%g)\n",
    1054 SCIProwGetName(row), lhs, rhs, minactivity, maxactivity, SCIProwIsLocal(row), SCIPgetLPFeastol(set->scip));
    1056
    1057 /* output row with solution values */
    1058 printf("\n\n");
    1059 printf("***** debug: violated row <%s>:\n", SCIProwGetName(row));
    1060 printf(" %.15g <= %.15g", lhs, SCIProwGetConstant(row));
    1061 for( i = 0; i < nnonz; ++i )
    1062 {
    1063 /* get solution value of variable in debugging solution */
    1064 SCIP_CALL( getSolutionValue(set, SCIPcolGetVar(cols[i]), &solval) );
    1065 printf(" %+.15g<%s>[%.15g]", vals[i], SCIPvarGetName(SCIPcolGetVar(cols[i])), solval);
    1066 }
    1067 printf(" <= %.15g\n", rhs);
    1068
    1069 SCIPABORT();
    1070 }
    1071
    1072 return SCIP_OKAY;
    1073}
    1074
    1075/** checks whether given global lower bound is valid for the debugging solution */
    1077 SCIP* scip, /**< SCIP data structure */
    1078 SCIP_VAR* var, /**< problem variable */
    1079 SCIP_Real lb /**< lower bound */
    1080 )
    1081{
    1082 SCIP_Real varsol;
    1083
    1084 assert(scip != NULL);
    1085 assert(var != NULL);
    1086
    1087 /* check if we are in the original problem and not in a sub MIP */
    1089 return SCIP_OKAY;
    1090
    1091 /* check whether a debug solution is available */
    1092 if( !debugSolutionAvailable(scip->set) )
    1093 return SCIP_OKAY;
    1094
    1096 return SCIP_OKAY;
    1097
    1098 /* skip unused relaxation-only variables
    1099 * Relaxation-only variables are not part of any constraints or the original problem and thus there is no need to check their solution value.
    1100 * However, for relaxation-only variables that are still in use for the current solve round and for which a debug solution value has been set,
    1101 * checking against the debug solution value is helpful. If they not in use anymore, they will be captured only by the transformed problem
    1102 * and they may get fixed to some arbitrary value, e.g., in dual fixing.
    1103 * Thus, we skip checking bound changes on unused relaxation-only variables.
    1104 */
    1105 if( SCIPvarIsRelaxationOnly(var) && SCIPvarGetNUses(var) == 1 )
    1106 return SCIP_OKAY;
    1107
    1108 /* check if the incumbent solution is at least as good as the debug solution, so we can stop to check the debug solution */
    1109 if( debugSolIsAchieved(scip->set) )
    1110 return SCIP_OKAY;
    1111
    1112 /* get solution value of variable */
    1113 SCIP_CALL( getSolutionValue(scip->set, var, &varsol) );
    1114 SCIPdebugMsg(scip, "debugging solution on lower bound of <%s>[%g] >= %g\n", SCIPvarGetName(var), varsol, lb);
    1115
    1116 /* check validity of debugging solution */
    1117 if( varsol != SCIP_UNKNOWN && SCIPisFeasLT(scip, varsol, lb) ) /*lint !e777*/
    1118 {
    1119 SCIPerrorMessage("invalid global lower bound: <%s>[%.15g] >= %.15g\n", SCIPvarGetName(var), varsol, lb);
    1120 SCIPABORT();
    1121 }
    1122
    1123 return SCIP_OKAY;
    1124}
    1125
    1126/** checks whether given global upper bound is valid for the debugging solution */
    1128 SCIP* scip, /**< SCIP data structure */
    1129 SCIP_VAR* var, /**< problem variable */
    1130 SCIP_Real ub /**< upper bound */
    1131 )
    1132{
    1133 SCIP_Real varsol;
    1134
    1135 assert(scip != NULL);
    1136 assert(var != NULL);
    1137
    1138 /* when debugging was disabled the solution is not defined to be not valid in the current subtree */
    1140 return SCIP_OKAY;
    1141
    1142 /* check whether a debug solution is available */
    1143 if( !debugSolutionAvailable(scip->set) )
    1144 return SCIP_OKAY;
    1145
    1147 return SCIP_OKAY;
    1148
    1149 /* skip unused relaxation-only variables, see also comment in SCIPdebugCheckLbGlobal() */
    1150 if( SCIPvarIsRelaxationOnly(var) && SCIPvarGetNUses(var) == 1 )
    1151 return SCIP_OKAY;
    1152
    1153 /* check if the incumbent solution is at least as good as the debug solution, so we can stop to check the debug solution */
    1154 if( debugSolIsAchieved(scip->set) )
    1155 return SCIP_OKAY;
    1156
    1157 /* get solution value of variable */
    1158 SCIP_CALL( getSolutionValue(scip->set, var, &varsol) );
    1159 SCIPdebugMsg(scip, "debugging solution on upper bound of <%s>[%g] <= %g\n", SCIPvarGetName(var), varsol, ub);
    1160
    1161 /* check validity of debugging solution */
    1162 if( varsol != SCIP_UNKNOWN && SCIPisFeasGT(scip, varsol, ub) ) /*lint !e777*/
    1163 {
    1164 SCIPerrorMessage("invalid global upper bound: <%s>[%.15g] <= %.15g\n", SCIPvarGetName(var), varsol, ub);
    1165 SCIPABORT();
    1166 }
    1167
    1168 return SCIP_OKAY;
    1169}
    1170
    1171/** checks whether given local bound implication is valid for the debugging solution */
    1173 BMS_BLKMEM* blkmem, /**< block memory */
    1174 SCIP_SET* set, /**< global SCIP settings */
    1175 SCIP_NODE* node, /**< local node where this bound change was applied */
    1176 SCIP_VAR* var, /**< problem variable */
    1177 SCIP_Real newbound, /**< new value for bound */
    1178 SCIP_BOUNDTYPE boundtype /**< type of bound: lower or upper bound */
    1179 )
    1180{
    1181 SCIP_Real varsol;
    1182 SCIP_Bool solcontained;
    1183
    1184 assert(set != NULL);
    1185 assert(blkmem != NULL);
    1186 assert(node != NULL);
    1187 assert(var != NULL);
    1188
    1189 /* in case we are in probing or diving we have to avoid checking the solution */
    1190 if( SCIPlpDiving(set->scip->lp) || SCIPtreeProbing(set->scip->tree) )
    1191 return SCIP_OKAY;
    1192
    1193 /* when debugging was disabled the solution is not defined to be not valid in the current subtree */
    1194 if( !SCIPdebugSolIsEnabled(set->scip) )
    1195 return SCIP_OKAY;
    1196
    1197 /* check whether a debug solution is available */
    1198 if( !debugSolutionAvailable(set) )
    1199 return SCIP_OKAY;
    1200
    1201 /* check if the incumbent solution is at least as good as the debug solution, so we can stop to check the debug solution */
    1202 if( debugSolIsAchieved(set) )
    1203 return SCIP_OKAY;
    1204
    1205 /* check whether the debugging solution is contained in the local subproblem */
    1206 SCIP_CALL( isSolutionInNode(blkmem, set, node, &solcontained) );
    1207 if( !solcontained )
    1208 return SCIP_OKAY;
    1209
    1210 /* get solution value of variable */
    1211 SCIP_CALL( getSolutionValue(set, var, &varsol) );
    1212
    1213 /* check validity of debugging solution */
    1214 if( varsol != SCIP_UNKNOWN ) /*lint !e777*/
    1215 {
    1216 if( boundtype == SCIP_BOUNDTYPE_LOWER && SCIPsetIsFeasLT(set, varsol, newbound) )
    1217 {
    1218 SCIPerrorMessage("invalid local lower bound implication: <%s>[%.15g] >= %.15g\n", SCIPvarGetName(var), varsol, newbound);
    1219 SCIPABORT();
    1220 }
    1221 if( boundtype == SCIP_BOUNDTYPE_UPPER && SCIPsetIsFeasGT(set, varsol, newbound) )
    1222 {
    1223 SCIPerrorMessage("invalid local upper bound implication: <%s>[%.15g] <= %.15g\n", SCIPvarGetName(var), varsol, newbound);
    1224 SCIPABORT();
    1225 }
    1226 }
    1227
    1228 return SCIP_OKAY;
    1229}
    1230
    1231/** informs solution debugger, that the given node will be freed */
    1233 BMS_BLKMEM* blkmem, /**< block memory */
    1234 SCIP_SET* set, /**< global SCIP settings */
    1235 SCIP_NODE* node /**< node that will be freed */
    1236 )
    1237{
    1238 SCIP_DEBUGSOLDATA* debugsoldata;
    1239
    1240 assert(set != NULL);
    1241 assert(blkmem != NULL);
    1242 assert(node != NULL);
    1243
    1244 debugsoldata = SCIPsetGetDebugSolData(set);
    1245 assert(debugsoldata != NULL);
    1246
    1247 /* when debugging was disabled the solution is not defined to be not valid in the current subtree */
    1248 if( !SCIPdebugSolIsEnabled(set->scip) )
    1249 return SCIP_OKAY;
    1250
    1251 /* check whether a debug solution is available */
    1252 if( !debugSolutionAvailable(set) )
    1253 return SCIP_OKAY;
    1254
    1255 /* check if the incumbent solution is at least as good as the debug solution, so we can stop to check the debug solution */
    1256 if( debugSolIsAchieved(set) )
    1257 return SCIP_OKAY;
    1258
    1259 /* check if a solution will be cutoff in tree */
    1262 {
    1263 SCIP_Bool solisinnode;
    1264
    1265 solisinnode = FALSE;
    1266
    1267 SCIP_CALL( isSolutionInNode(blkmem, set, node, &solisinnode) );
    1268 /* wrong node will be cutoff */
    1269 if( solisinnode )
    1270 {
    1271 SCIPerrorMessage("debugging solution was cut off in local node #%" SCIP_LONGINT_FORMAT " (%p) at depth %d\n",
    1272 node->number, (void*) node, SCIPnodeGetDepth(node));
    1273 SCIPABORT();
    1274 }
    1275 }
    1276
    1277 /* remove node from the hash map */
    1278 if( debugsoldata->solinnode != NULL )
    1279 {
    1280 SCIP_CALL( SCIPhashmapRemove(debugsoldata->solinnode, (void*)node) );
    1281 }
    1282
    1283 return SCIP_OKAY;
    1284}
    1285
    1286/** checks whether global lower bound does not exceed debuging solution value */
    1288 BMS_BLKMEM* blkmem, /**< block memory */
    1289 SCIP_SET* set /**< global SCIP settings */
    1290 )
    1291{
    1292 SCIP_DEBUGSOLDATA* debugsoldata;
    1293 SCIP_Real treelowerbound;
    1294
    1295 assert(set != NULL);
    1296 assert(blkmem != NULL);
    1297
    1298 /* when debugging was disabled the solution is not defined to be not valid in the current subtree */
    1299 if( !SCIPdebugSolIsEnabled(set->scip) )
    1300 return SCIP_OKAY;
    1301
    1302 /* check whether a debug solution is available */
    1303 if( !debugSolutionAvailable(set) )
    1304 return SCIP_OKAY;
    1305
    1307 return SCIP_OKAY;
    1308
    1310 return SCIP_OKAY;
    1311
    1312 /* if there are no leaves then SCIPtreeGetLowerbound() will return infintiy */
    1313 if( SCIPgetNLeaves(set->scip) <= 0 )
    1314 return SCIP_OKAY;
    1315
    1316 debugsoldata = SCIPsetGetDebugSolData(set);
    1317 assert(debugsoldata != NULL);
    1318
    1319 /* make sure a debug solution has been read */
    1320 if( debugsoldata->debugsol == NULL )
    1321 {
    1322 SCIP_CALL( readSolution(set) );
    1323 }
    1324
    1325 /* get global lower bound of tree (do not use SCIPgetLowerbound() since this adjusts the value using the primal bound) */
    1326 treelowerbound = SCIPtreeGetLowerbound(set->scip->tree, set);
    1327 treelowerbound = SCIPprobExternObjval(set->scip->transprob, set->scip->origprob, set, treelowerbound);
    1328
    1329 if( SCIPgetObjsense(set->scip) == SCIP_OBJSENSE_MINIMIZE && SCIPsetIsGT(set, treelowerbound, SCIPsolGetOrigObj(debugsoldata->debugsol)) )
    1330 {
    1331 SCIPerrorMessage("global lower bound %g is larger than the value of the debugging solution %g.\n", treelowerbound, SCIPsolGetOrigObj(debugsoldata->debugsol));
    1332 SCIPABORT();
    1333 }
    1334 else if( SCIPgetObjsense(set->scip) == SCIP_OBJSENSE_MAXIMIZE && SCIPsetIsLT(set, treelowerbound, SCIPsolGetOrigObj(debugsoldata->debugsol)) )
    1335 {
    1336 SCIPerrorMessage("global upper bound %g is smaller than the value of the debugging solution %g.\n", treelowerbound, SCIPsolGetOrigObj(debugsoldata->debugsol));
    1337 SCIPABORT();
    1338 }
    1339
    1340 return SCIP_OKAY;
    1341}
    1342
    1343/** checks whether local lower bound does not exceed debuging solution value */
    1345 BMS_BLKMEM* blkmem, /**< block memory */
    1346 SCIP_SET* set, /**< global SCIP settings */
    1347 SCIP_NODE* node /**< node that will be freed */
    1348 )
    1349{
    1350 SCIP_DEBUGSOLDATA* debugsoldata;
    1351 SCIP_Bool solisinnode;
    1352
    1353 assert(set != NULL);
    1354 assert(blkmem != NULL);
    1355
    1356 /* exit if we do not have a node to check */
    1357 if( node == NULL )
    1358 return SCIP_OKAY;
    1359
    1360 /* when debugging was disabled the solution is not defined to be not valid in the current subtree */
    1361 if( !SCIPdebugSolIsEnabled(set->scip) )
    1362 return SCIP_OKAY;
    1363
    1364 /* check whether a debug solution is available */
    1365 if( !debugSolutionAvailable(set) )
    1366 return SCIP_OKAY;
    1367
    1368 if( SCIPgetStage(set->scip) <= SCIP_STAGE_INITSOLVE )
    1369 return SCIP_OKAY;
    1370
    1372 return SCIP_OKAY;
    1373
    1374 debugsoldata = SCIPsetGetDebugSolData(set);
    1375 assert(debugsoldata != NULL);
    1376
    1377 /* make sure a debug solution has been read */
    1378 if( debugsoldata->debugsol == NULL )
    1379 {
    1380 SCIP_CALL( readSolution(set) );
    1381 }
    1382
    1383 /* check local lower bound */
    1384 SCIP_CALL( isSolutionInNode(blkmem, set, node, &solisinnode) );
    1385
    1386 /* if we are in a node that contains the given debug solution, the lower bound should not exceed the solution's objective */
    1387 if( solisinnode )
    1388 {
    1389 SCIP_Real localbound;
    1390
    1391 localbound = SCIPnodeGetLowerbound(node);
    1392 localbound = SCIPprobExternObjval(set->scip->transprob, set->scip->origprob, set, localbound);
    1393
    1394 if( SCIPgetObjsense(set->scip) == SCIP_OBJSENSE_MINIMIZE && SCIPsetIsGT(set, localbound, SCIPsolGetOrigObj(debugsoldata->debugsol)) )
    1395 {
    1396 SCIPerrorMessage("local lower bound %g of node #%" SCIP_LONGINT_FORMAT " at depth %d is larger than the value of the debugging solution %g contained in this node.\n",
    1397 localbound, node->number, SCIPnodeGetDepth(node), SCIPsolGetOrigObj(debugsoldata->debugsol));
    1398 SCIPABORT();
    1399 }
    1400 else if( SCIPgetObjsense(set->scip) == SCIP_OBJSENSE_MAXIMIZE && SCIPsetIsLT(set, localbound, SCIPsolGetOrigObj(debugsoldata->debugsol)) )
    1401 {
    1402 SCIPerrorMessage("local upper bound %g of node #%" SCIP_LONGINT_FORMAT " at depth %d is smaller than the value of the debugging solution %g contained in this node.\n",
    1403 localbound, node->number, SCIPnodeGetDepth(node), SCIPsolGetOrigObj(debugsoldata->debugsol));
    1404 SCIPABORT();
    1405 }
    1406 }
    1407
    1408 return SCIP_OKAY;
    1409}
    1410
    1411/** checks whether given variable bound is valid for the debugging solution */
    1413 SCIP_SET* set, /**< global SCIP settings */
    1414 SCIP_VAR* var, /**< problem variable x in x <= b*z + d or x >= b*z + d */
    1415 SCIP_BOUNDTYPE vbtype, /**< type of variable bound (LOWER or UPPER) */
    1416 SCIP_VAR* vbvar, /**< variable z in x <= b*z + d or x >= b*z + d */
    1417 SCIP_Real vbcoef, /**< coefficient b in x <= b*z + d or x >= b*z + d */
    1418 SCIP_Real vbconstant /**< constant d in x <= b*z + d or x >= b*z + d */
    1419 )
    1420{
    1421 SCIP_Real varsol;
    1422 SCIP_Real vbvarsol;
    1423 SCIP_Real vb;
    1424
    1425 assert(set != NULL);
    1426 assert(var != NULL);
    1427
    1428 /* when debugging was disabled the solution is not defined to be not valid in the current subtree */
    1429 if( !SCIPdebugSolIsEnabled(set->scip) )
    1430 return SCIP_OKAY;
    1431
    1432 /* check whether a debug solution is available */
    1433 if( !debugSolutionAvailable(set) )
    1434 return SCIP_OKAY;
    1435
    1436 /* check if the incumbent solution is at least as good as the debug solution, so we can stop to check the debug solution */
    1437 if( debugSolIsAchieved(set) )
    1438 return SCIP_OKAY;
    1439
    1440 /* get solution value of variables */
    1441 SCIP_CALL( getSolutionValue(set, var, &varsol) );
    1442 SCIP_CALL( getSolutionValue(set, vbvar, &vbvarsol) );
    1443
    1444 /* check validity of debugging solution */
    1445 if( varsol != SCIP_UNKNOWN && vbvarsol != SCIP_UNKNOWN ) /*lint !e777*/
    1446 {
    1447 vb = vbcoef * vbvarsol + vbconstant;
    1448 if( (vbtype == SCIP_BOUNDTYPE_LOWER && SCIPsetIsFeasLT(set, varsol, vb))
    1449 || (vbtype == SCIP_BOUNDTYPE_UPPER && SCIPsetIsFeasGT(set, varsol, vb)) )
    1450 {
    1451 SCIPerrorMessage("invalid variable bound: <%s>[%.15g] %s %.15g<%s>[%.15g] %+.15g\n",
    1452 SCIPvarGetName(var), varsol, vbtype == SCIP_BOUNDTYPE_LOWER ? ">=" : "<=", vbcoef,
    1453 SCIPvarGetName(vbvar), vbvarsol, vbconstant);
    1454 SCIPABORT();
    1455 }
    1456 }
    1457
    1458 return SCIP_OKAY;
    1459}
    1460
    1461/** checks whether given implication is valid for the debugging solution */
    1463 SCIP_SET* set, /**< global SCIP settings */
    1464 SCIP_VAR* var, /**< problem variable */
    1465 SCIP_Bool varfixing, /**< FALSE if y should be added in implications for x == 0, TRUE for x == 1 */
    1466 SCIP_VAR* implvar, /**< variable y in implication y <= b or y >= b */
    1467 SCIP_BOUNDTYPE impltype, /**< type of implication y <= b (SCIP_BOUNDTYPE_UPPER) or y >= b (SCIP_BOUNDTYPE_LOWER) */
    1468 SCIP_Real implbound /**< bound b in implication y <= b or y >= b */
    1469 )
    1470{
    1471 SCIP_Real solval;
    1472
    1473 assert(set != NULL);
    1474 assert(var != NULL);
    1475 assert(SCIPvarGetType(var) == SCIP_VARTYPE_BINARY);
    1476
    1477 /* when debugging was disabled the solution is not defined to be not valid in the current subtree */
    1478 if( !SCIPdebugSolIsEnabled(set->scip) )
    1479 return SCIP_OKAY;
    1480
    1481 /* check whether a debug solution is available */
    1482 if( !debugSolutionAvailable(set) )
    1483 return SCIP_OKAY;
    1484
    1485 /* check if the incumbent solution is at least as good as the debug solution, so we can stop to check the debug solution */
    1486 if( debugSolIsAchieved(set) )
    1487 return SCIP_OKAY;
    1488
    1489 /* get solution value of variable */
    1490 SCIP_CALL( getSolutionValue(set, var, &solval) );
    1491 if( solval == SCIP_UNKNOWN ) /*lint !e777*/
    1492 return SCIP_OKAY;
    1493 assert(SCIPsetIsFeasZero(set, solval) || SCIPsetIsFeasEQ(set, solval, 1.0));
    1494
    1495 /* check, whether the implication applies for the debugging solution */
    1496 if( (solval > 0.5) != varfixing )
    1497 return SCIP_OKAY;
    1498
    1499 /* get solution value of implied variable */
    1500 SCIP_CALL( getSolutionValue(set, implvar, &solval) );
    1501 if( solval == SCIP_UNKNOWN ) /*lint !e777*/
    1502 return SCIP_OKAY;
    1503
    1504 if( impltype == SCIP_BOUNDTYPE_LOWER )
    1505 {
    1506 if( SCIPsetIsFeasLT(set, solval, implbound) )
    1507 {
    1508 SCIPerrorMessage("invalid implication <%s> == %d -> <%s> >= %.15g (variable has value %.15g in solution)\n",
    1509 SCIPvarGetName(var), varfixing, SCIPvarGetName(implvar), implbound, solval);
    1510 SCIPABORT();
    1511 }
    1512 }
    1513 else
    1514 {
    1515 if( SCIPsetIsFeasGT(set, solval, implbound) )
    1516 {
    1517 SCIPerrorMessage("invalid implication <%s> == %d -> <%s> <= %.15g (variable has value %.15g in solution)\n",
    1518 SCIPvarGetName(var), varfixing, SCIPvarGetName(implvar), implbound, solval);
    1519 SCIPABORT();
    1520 }
    1521 }
    1522
    1523 return SCIP_OKAY;
    1524}
    1525
    1526/** checks whether given (multi)-aggregation is valid for the debugging solution */
    1528 SCIP_SET* set, /**< global SCIP settings */
    1529 SCIP_VAR* var, /**< problem variable */
    1530 SCIP_VAR** aggrvars, /**< variables y_i in aggregation x = a_1*y_1 + ... + a_n*y_n + c */
    1531 SCIP_Real* scalars, /**< multipliers a_i in aggregation x = a_1*y_1 + ... + a_n*y_n + c */
    1532 SCIP_Real constant, /**< constant shift c in aggregation x = a_1*y_1 + ... + a_n*y_n + c */
    1533 int naggrvars /**< number n of variables in aggregation x = a_1*y_1 + ... + a_n*y_n + c */
    1534 )
    1535{
    1536 SCIP_Real solval;
    1537 SCIP_Real val;
    1538 int i;
    1539
    1540 assert(set != NULL);
    1541 assert(var != NULL);
    1542 assert(aggrvars != NULL);
    1543 assert(scalars != NULL);
    1544 assert(naggrvars >= 0);
    1545
    1546 /* when debugging was disabled the solution is not defined to be not valid in the current subtree */
    1547 if( !SCIPdebugSolIsEnabled(set->scip) )
    1548 return SCIP_OKAY;
    1549
    1550 /* check whether a debug solution is available */
    1551 if( !debugSolutionAvailable(set) )
    1552 return SCIP_OKAY;
    1553
    1554 /* check if the incumbent solution is at least as good as the debug solution, so we can stop to check the debug solution */
    1555 if( debugSolIsAchieved(set) )
    1556 return SCIP_OKAY;
    1557
    1558 /* get solution value of x variable */
    1559 SCIP_CALL( getSolutionValue(set, var, &solval) );
    1560
    1561 if( solval == SCIP_UNKNOWN ) /*lint !e777*/
    1562 return SCIP_OKAY;
    1563
    1564 val = constant;
    1565
    1566 for( i = 0; i < naggrvars; i++ )
    1567 {
    1568 SCIP_Real aggrsolval;
    1569
    1570 /* get solution value of y variable */
    1571 SCIP_CALL( getSolutionValue(set, aggrvars[i], &aggrsolval) );
    1572
    1573 if( aggrsolval == SCIP_UNKNOWN ) /*lint !e777*/
    1574 return SCIP_OKAY;
    1575
    1576 val += scalars[i] * aggrsolval;
    1577 }
    1578
    1579 /* print debug message if the aggregation violates the debugging solution */
    1580 if( !SCIPsetIsRelEQ(set, solval, val) )
    1581 {
    1582 if( naggrvars == 1 )
    1583 {
    1584 SCIP_Real aggrsolval;
    1585
    1586 /* get solution value of y variable */
    1587 SCIP_CALL( getSolutionValue(set, aggrvars[0], &aggrsolval) );
    1588
    1589 SCIPerrorMessage("aggregation <%s>[%g] = %g<%s>[%g] + %g violates debugging solution (expected %g)\n",
    1590 SCIPvarGetName(var), solval, scalars[0], SCIPvarGetName(aggrvars[0]), aggrsolval, constant, val);
    1591 }
    1592 else
    1593 {
    1594 SCIPerrorMessage("multi-aggregation <%s>[%g] = ... %d vars ... + %g violates debugging solution (expected %g)\n",
    1595 SCIPvarGetName(var), solval, naggrvars, constant, val);
    1596 }
    1597 SCIPABORT();
    1598 }
    1599
    1600 return SCIP_OKAY;
    1601}
    1602
    1603/** check whether given clique is valid for the debugging solution */
    1605 SCIP_SET* set, /**< global SCIP settings */
    1606 SCIP_VAR** vars, /**< binary variables in the clique: at most one can be set to the given value */
    1607 SCIP_Bool* values, /**< values of the variables in the clique; NULL to use TRUE for all vars */
    1608 int nvars /**< number of variables in the clique */
    1609 )
    1610{
    1611 SCIP_Real solval;
    1612 int pos1;
    1613 int pos2;
    1614 int v;
    1615
    1616 assert(set != NULL);
    1617 assert(vars != NULL);
    1618
    1619 /* when debugging was disabled the solution is not defined to be not valid in the current subtree */
    1620 if( !SCIPdebugSolIsEnabled(set->scip) )
    1621 return SCIP_OKAY;
    1622
    1623 /* check whether a debug solution is available */
    1624 if( !debugSolutionAvailable(set) )
    1625 return SCIP_OKAY;
    1626
    1627 /* check if the incumbent solution is at least as good as the debug solution, so we can stop to check the debug solution */
    1628 if( debugSolIsAchieved(set) )
    1629 return SCIP_OKAY;
    1630
    1631 pos1 = -1;
    1632 pos2 = -1;
    1633
    1634 for( v = 0; v < nvars; ++v )
    1635 {
    1636 assert(vars[v] != NULL);
    1637 assert(SCIPvarIsBinary(vars[v]));
    1638
    1639 /* get solution value of variable */
    1640 SCIP_CALL( getSolutionValue(set, vars[v], &solval) );
    1641
    1642 if( solval == SCIP_UNKNOWN ) /*lint !e777*/
    1643 continue;
    1644
    1645 assert(SCIPsetIsFeasZero(set, solval) || SCIPsetIsFeasEQ(set, solval, 1.0));
    1646
    1647 /* negated solution value if negated variable is in clique */
    1648 if( values != NULL && values[v] == 0 )
    1649 solval = 1.0 - solval;
    1650
    1651 if( SCIPsetIsFeasEQ(set, solval, 1.0) )
    1652 {
    1653 if( pos1 == -1 )
    1654 pos1 = v;
    1655 else
    1656 {
    1657 assert(pos2 == -1);
    1658 pos2 = v;
    1659 break;
    1660 }
    1661 }
    1662 }
    1663
    1664 /* print debug message if the clique violates the debugging solution */
    1665 if( pos2 != -1 )
    1666 {
    1667 assert(pos1 != -1);
    1668 SCIPerrorMessage("clique violates debugging solution, (at least) variable <%s%s> and variable <%s%s> are both one in the debugging solution\n",
    1669 (values == NULL || values[pos1]) ? "" : "~", SCIPvarGetName(vars[pos1]), (values == NULL || values[pos2]) ? "" : "~", SCIPvarGetName(vars[pos2]));
    1670 SCIPABORT();
    1671 }
    1672
    1673 return SCIP_OKAY;
    1674}
    1675
    1676/** check, whether at least one literals is TRUE in the debugging solution */
    1677static
    1678SCIP_Bool debugCheckBdchginfos(
    1679 SCIP_SET* set, /**< global SCIP settings */
    1680 SCIP_BDCHGINFO** bdchginfos, /**< bound change informations of the conflict set */
    1681 SCIP_Real* relaxedbds, /**< array with relaxed bounds which are efficient to create a valid conflict, or NULL */
    1682 int nbdchginfos /**< number of bound changes in the conflict set */
    1683 )
    1684{
    1685 SCIP_Real solval;
    1686 int i;
    1687
    1688 /* check whether a debug solution is available */
    1689 if( !debugSolutionAvailable(set) )
    1690 return SCIP_OKAY;
    1691
    1692 assert(SCIPdebugSolIsEnabled(set->scip));
    1693
    1694 solval = 0.0;
    1695 /* check, whether at least one literals is TRUE in the debugging solution */
    1696 for( i = 0; i < nbdchginfos; ++i )
    1697 {
    1698 SCIP_BDCHGINFO* bdchginfo;
    1699 SCIP_VAR* var;
    1700 SCIP_Real newbound;
    1701
    1702 bdchginfo = bdchginfos[i];
    1703 assert(bdchginfo != NULL);
    1704
    1705 var = SCIPbdchginfoGetVar(bdchginfo);
    1706 assert(var != NULL);
    1707
    1708 if( relaxedbds != NULL )
    1709 newbound = relaxedbds[i];
    1710 else
    1711 newbound = SCIPbdchginfoGetNewbound(bdchginfo);
    1712
    1713 SCIP_CALL( getSolutionValue(set, var, &solval) );
    1714
    1715 if( solval == SCIP_UNKNOWN ) /*lint !e777*/
    1716 return TRUE;
    1717
    1719 {
    1720 assert(SCIPsetIsLE(set, newbound, SCIPbdchginfoGetNewbound(bdchginfo)));
    1721
    1723 {
    1724 if( SCIPsetIsLE(set, solval, newbound) )
    1725 return TRUE;
    1726 }
    1727 else
    1728 {
    1729 if( SCIPsetIsLT(set, solval, newbound) )
    1730 return TRUE;
    1731 }
    1732 }
    1733 else
    1734 {
    1735 assert(SCIPsetIsGE(set, newbound, SCIPbdchginfoGetNewbound(bdchginfo)));
    1736
    1738 {
    1739 if( SCIPsetIsGE(set, solval, newbound) )
    1740 return TRUE;
    1741 }
    1742 else
    1743 {
    1744 if( SCIPsetIsGT(set, solval, newbound) )
    1745 return TRUE;
    1746 }
    1747 }
    1748 }
    1749
    1750 return FALSE;
    1751}
    1752
    1753/** print bound change information */
    1754static
    1755SCIP_RETCODE printBdchginfo(
    1756 SCIP_SET* set, /**< global SCIP settings */
    1757 SCIP_BDCHGINFO * bdchginfo, /**< bound change information */
    1758 SCIP_Real relaxedbd /**< array with relaxed bounds which are efficient to create a valid conflict, or NULL */
    1759 )
    1760{
    1761 SCIP_Real solval;
    1762
    1763 /* check whether a debug solution is available */
    1764 if( !debugSolutionAvailable(set) )
    1765 return SCIP_OKAY;
    1766
    1767 /* get solution value within the debug solution */
    1768 SCIP_CALL( getSolutionValue(set, SCIPbdchginfoGetVar(bdchginfo), &solval) );
    1769
    1770 printf(" <%s>[%.15g] %s %g(%g)", SCIPvarGetName(SCIPbdchginfoGetVar(bdchginfo)), solval,
    1771 SCIPbdchginfoGetBoundtype(bdchginfo) == SCIP_BOUNDTYPE_LOWER ? ">=" : "<=",
    1772 SCIPbdchginfoGetNewbound(bdchginfo), relaxedbd);
    1773
    1774 return SCIP_OKAY;
    1775}
    1776
    1777
    1778/** print bound change information */
    1779static
    1780SCIP_RETCODE printBdchginfos(
    1781 SCIP_SET* set, /**< global SCIP settings */
    1782 SCIP_BDCHGINFO** bdchginfos, /**< bound change information array */
    1783 SCIP_Real* relaxedbds, /**< array with relaxed bounds which are efficient to create a valid conflict, or NULL */
    1784 int nbdchginfos /**< number of bound changes in the conflict set */
    1785 )
    1786{
    1787 int i;
    1788
    1789 /* check whether a debug solution is available */
    1790 if( !debugSolutionAvailable(set) )
    1791 return SCIP_OKAY;
    1792
    1793 for( i = 0; i < nbdchginfos; ++i )
    1794 {
    1795 SCIP_BDCHGINFO* bdchginfo;
    1796
    1797 bdchginfo = bdchginfos[i];
    1798 assert(bdchginfo != NULL);
    1799
    1800 printBdchginfo(set, bdchginfo, relaxedbds != NULL ? relaxedbds[i] : SCIPbdchginfoGetNewbound(bdchginfo));
    1801 }
    1802
    1803 return SCIP_OKAY;
    1804}
    1805
    1806/** checks whether given conflict is valid for the debugging solution */
    1808 BMS_BLKMEM* blkmem, /**< block memory */
    1809 SCIP_SET* set, /**< global SCIP settings */
    1810 SCIP_NODE* node, /**< node where the conflict clause is added */
    1811 SCIP_BDCHGINFO** bdchginfos, /**< bound change informations of the conflict set */
    1812 SCIP_Real* relaxedbds, /**< array with relaxed bounds which are efficient to create a valid conflict */
    1813 int nbdchginfos /**< number of bound changes in the conflict set */
    1814 )
    1815{
    1816 SCIP_Bool solcontained;
    1817
    1818 assert(set != NULL);
    1819 assert(blkmem != NULL);
    1820 assert(node != NULL);
    1821 assert(nbdchginfos == 0 || bdchginfos != NULL);
    1822
    1823 /* when debugging was disabled the solution is not defined to be not valid in the current subtree */
    1824 if( !SCIPdebugSolIsEnabled(set->scip) )
    1825 return SCIP_OKAY;
    1826
    1827 /* check whether a debug solution is available */
    1828 if( !debugSolutionAvailable(set) )
    1829 return SCIP_OKAY;
    1830
    1831 /* check if the incumbent solution is at least as good as the debug solution, so we can stop to check the debug solution */
    1832 if( debugSolIsAchieved(set) )
    1833 return SCIP_OKAY;
    1834
    1835 /* check whether the debugging solution is contained in the local subproblem */
    1836 SCIP_CALL( isSolutionInNode(blkmem, set, node, &solcontained) );
    1837 if( !solcontained )
    1838 return SCIP_OKAY;
    1839
    1840 /* check, whether at least one literals is TRUE in the debugging solution */
    1841 if( debugCheckBdchginfos(set, bdchginfos, relaxedbds, nbdchginfos) )
    1842 return SCIP_OKAY;
    1843
    1844 SCIPerrorMessage("invalid conflict set:");
    1845
    1846 /* print bound changes which are already part of the conflict set */
    1847 SCIP_CALL( printBdchginfos(set, bdchginfos, relaxedbds, nbdchginfos) );
    1848
    1849 printf("\n");
    1850 SCIPABORT();
    1851
    1852 return SCIP_OKAY; /*lint !e527*/
    1853}
    1854
    1855/** checks whether given conflict graph frontier is valid for the debugging solution */
    1857 BMS_BLKMEM* blkmem, /**< block memory */
    1858 SCIP_SET* set, /**< global SCIP settings */
    1859 SCIP_NODE* node, /**< node where the conflict clause is added */
    1860 SCIP_BDCHGINFO* bdchginfo, /**< bound change info which got resolved, or NULL */
    1861 SCIP_BDCHGINFO** bdchginfos, /**< bound change informations of the conflict set */
    1862 SCIP_Real* relaxedbds, /**< array with relaxed bounds which are efficient to create a valid conflict */
    1863 int nbdchginfos, /**< number of bound changes in the conflict set */
    1864 SCIP_PQUEUE* bdchgqueue, /**< unprocessed conflict bound changes */
    1865 SCIP_PQUEUE* forcedbdchgqueue /**< unprocessed conflict bound changes that must be resolved */
    1866 )
    1867{
    1868 SCIP_BDCHGINFO** bdchgqueued;
    1869 SCIP_BDCHGINFO** forcedbdchgqueued;
    1870 SCIP_Bool solcontained;
    1871 int nbdchgqueued;
    1872 int nforcedbdchgqueued;
    1873
    1874 assert(set != NULL);
    1875 assert(blkmem != NULL);
    1876 assert(node != NULL);
    1877 assert(nbdchginfos == 0 || bdchginfos != NULL);
    1878
    1879 /* when debugging was disabled the solution is not defined to be not valid in the current subtree */
    1880 if( !SCIPdebugSolIsEnabled(set->scip) )
    1881 return SCIP_OKAY;
    1882
    1883 /* check whether a debug solution is available */
    1884 if( !debugSolutionAvailable(set) )
    1885 return SCIP_OKAY;
    1886
    1887 /* check if the incumbent solution is at least as good as the debug solution, so we can stop to check the debug solution */
    1888 if( debugSolIsAchieved(set) )
    1889 return SCIP_OKAY;
    1890
    1891 /* check whether the debugging solution is contained in the local subproblem */
    1892 SCIP_CALL( isSolutionInNode(blkmem, set, node, &solcontained) );
    1893 if( !solcontained )
    1894 return SCIP_OKAY;
    1895
    1896 /* check, whether one literals is TRUE in the debugging solution */
    1897 if( debugCheckBdchginfos(set, bdchginfos, relaxedbds, nbdchginfos) )
    1898 return SCIP_OKAY;
    1899
    1900 /* get the elements of the bound change queue */
    1901 bdchgqueued = (SCIP_BDCHGINFO**)SCIPpqueueElems(bdchgqueue);
    1902 nbdchgqueued = SCIPpqueueNElems(bdchgqueue);
    1903
    1904 /* check, whether one literals is TRUE in the debugging solution */
    1905 if( debugCheckBdchginfos(set, bdchgqueued, NULL, nbdchgqueued) )
    1906 return SCIP_OKAY;
    1907
    1908 /* get the elements of the bound change queue */
    1909 forcedbdchgqueued = (SCIP_BDCHGINFO**)SCIPpqueueElems(forcedbdchgqueue);
    1910 nforcedbdchgqueued = SCIPpqueueNElems(forcedbdchgqueue);
    1911
    1912 /* check, whether one literals is TRUE in the debugging solution */
    1913 if( debugCheckBdchginfos(set, forcedbdchgqueued, NULL, nforcedbdchgqueued) )
    1914 return SCIP_OKAY;
    1915
    1916 SCIPerrorMessage("invalid conflict frontier");
    1917
    1918 if( bdchginfo != NULL )
    1919 {
    1920 printf(" (after resolving bound change ");
    1921 printBdchginfo(set, bdchginfo, SCIPbdchginfoGetNewbound(bdchginfo));
    1922 printf(")");
    1923 }
    1924 printf(":");
    1925
    1926 /* print bound changes which are already part of the conflict set */
    1927 SCIP_CALL( printBdchginfos(set, bdchginfos, relaxedbds, nbdchginfos) );
    1928
    1929 /* print bound changes which are queued */
    1930 SCIP_CALL( printBdchginfos(set, bdchgqueued, NULL, nbdchgqueued) );
    1931
    1932 /* print bound changes which are queued in the force queue */
    1933 SCIP_CALL( printBdchginfos(set, forcedbdchgqueued, NULL, nforcedbdchgqueued) );
    1934
    1935 printf("\n");
    1936 SCIPABORT();
    1937
    1938 return SCIP_OKAY; /*lint !e527*/
    1939}
    1940
    1941/** check whether the debugging solution is valid in the current node */
    1943 SCIP* scip, /**< SCIP data structure */
    1944 SCIP_Bool* isvalidinsubtree /**< pointer to store whether the solution is valid in the current
    1945 * subtree */
    1946 )
    1947{
    1948 SCIP_Bool solcontained;
    1949
    1950 *isvalidinsubtree = FALSE;
    1951
    1952 assert(scip->set != NULL);
    1953
    1954 /* when debugging was disabled the solution is not defined to be not valid in the current subtree */
    1956 return SCIP_OKAY;
    1957
    1958 /* check whether a debug solution is available */
    1959 if( !debugSolutionAvailable(scip->set) )
    1960 return SCIP_OKAY;
    1961
    1962 /* check if the incumbent solution is at least as good as the debug solution, so we can stop to check the debug solution */
    1963 if( debugSolIsAchieved(scip->set) )
    1964 return SCIP_OKAY;
    1965
    1966 /* check whether the debugging solution is contained in the local subproblem */
    1967 SCIP_CALL( isSolutionInNode(SCIPblkmem(scip), scip->set, SCIPgetCurrentNode(scip), &solcontained) );
    1968
    1969 if( solcontained )
    1970 *isvalidinsubtree = TRUE;
    1971
    1972 return SCIP_OKAY;
    1973}
    1974
    1975/** checks whether SCIP data structure is the main SCIP (the one for which debugging is enabled) */
    1976SCIP_Bool SCIPdebugIsMainscip(
    1977 SCIP* scip /**< SCIP data structure */
    1978 )
    1979{
    1980 assert(scip != NULL);
    1981
    1983}
    1984
    1985/** enabling solution debugging mechanism */
    1987 SCIP* scip /**< SCIP data structure */
    1988 )
    1989{
    1990 SCIP_DEBUGSOLDATA* debugsoldata;
    1991 assert(scip != NULL);
    1992 assert(scip->set != NULL);
    1993
    1994 debugsoldata = SCIPsetGetDebugSolData(scip->set);
    1995 assert(debugsoldata != NULL);
    1996
    1997 debugsoldata->debugsoldisabled = FALSE;
    1998}
    1999
    2000/** disabling solution debugging mechanism */
    2002 SCIP* scip /**< SCIP data structure */
    2003 )
    2004{
    2005 SCIP_DEBUGSOLDATA* debugsoldata;
    2006 assert(scip != NULL);
    2007 assert(scip->set != NULL);
    2008
    2009 debugsoldata = SCIPsetGetDebugSolData(scip->set);
    2010 assert(debugsoldata != NULL);
    2011
    2012 debugsoldata->debugsoldisabled = TRUE;
    2013}
    2014
    2015/** check if solution debugging mechanism is enabled */
    2017 SCIP* scip /**< SCIP data structure */
    2018 )
    2019{
    2020 SCIP_DEBUGSOLDATA* debugsoldata;
    2021 assert(scip != NULL);
    2022 assert(scip->set != NULL);
    2023
    2024 debugsoldata = SCIPsetGetDebugSolData(scip->set);
    2025 assert(debugsoldata != NULL);
    2026
    2027 return (!debugsoldata->debugsoldisabled);
    2028}
    2029
    2030/** check if SCIP is compiled with WITH_DEBUG_SOLUTION */
    2032{
    2033#ifdef WITH_DEBUG_SOLUTION
    2034 return TRUE;
    2035#else
    2036 return FALSE;
    2037#endif
    2038}
    2039
    2040
    2041/** propagator to force finding the debugging solution */
    2042static
    2043SCIP_DECL_PROPEXEC(propExecDebug)
    2044{ /*lint --e{715}*/
    2045 SCIP_VAR** vars;
    2046 int nvars;
    2047 int i;
    2048
    2049 assert(scip != NULL);
    2050 assert(result != NULL);
    2051
    2052 *result = SCIP_DIDNOTFIND;
    2053
    2054 /* check if we are in the original problem and not in a sub MIP */
    2055 if( !SCIPdebugIsMainscip(scip) )
    2056 return SCIP_OKAY;
    2057
    2059 return SCIP_OKAY;
    2060
    2061 /* check whether a debug solution is available */
    2062 if( !debugSolutionAvailable(scip->set) )
    2063 return SCIP_OKAY;
    2064
    2065 /* check if the incumbent solution is at least as good as the debug solution, so we can stop to check the debug solution */
    2066 if( debugSolIsAchieved(scip->set) )
    2067 return SCIP_OKAY;
    2068
    2069#if 1
    2070 /* solve at least one LP */
    2071 if( SCIPgetNLPIterations(scip) == 0 )
    2072 return SCIP_OKAY;
    2073#endif
    2074
    2075 vars = SCIPgetOrigVars(scip);
    2076 nvars = SCIPgetNOrigVars(scip);
    2077 for( i = 0; i < nvars; ++i )
    2078 {
    2079 SCIP_Real solval;
    2080 SCIP_Real lb;
    2081 SCIP_Real ub;
    2082 SCIP_Bool infeasible;
    2083 SCIP_Bool fixed;
    2084
    2085 SCIP_CALL( getSolutionValue(scip->set, vars[i], &solval) );
    2086 if( solval == SCIP_UNKNOWN ) /*lint !e777*/
    2087 {
    2088 SCIPerrorMessage("original variable without debugging solution value\n");
    2089 SCIPABORT();
    2090 }
    2091
    2092 lb = SCIPvarGetLbGlobal(vars[i]);
    2093 ub = SCIPvarGetUbGlobal(vars[i]);
    2094 if( SCIPisLT(scip, solval, lb) || SCIPisGT(scip, solval, ub) )
    2095 {
    2096 SCIPerrorMessage("solution value %.15g of <%s> outside bounds loc=[%.15g,%.15g], glb=[%.15g,%.15g]\n",
    2097 solval, SCIPvarGetName(vars[i]), lb, ub, SCIPvarGetLbGlobal(vars[i]), SCIPvarGetUbGlobal(vars[i]));
    2098 SCIPABORT();
    2099 }
    2100
    2101 SCIP_CALL( SCIPfixVar(scip, vars[i], solval, &infeasible, &fixed) );
    2102 if( infeasible )
    2103 *result = SCIP_CUTOFF;
    2104 else if( fixed )
    2105 *result = SCIP_REDUCEDDOM;
    2106 }
    2107
    2108 return SCIP_OKAY;
    2109}
    2110
    2111/** creates the debugging propagator and includes it in SCIP */
    2113 SCIP* scip /**< SCIP data structure */
    2114 )
    2115{
    2116 assert(scip != NULL);
    2117
    2118 /* include propagator */
    2119 SCIP_CALL( SCIPincludeProp(scip, "debug", "debugging propagator", 99999999, -1, FALSE,
    2121 NULL, propExecDebug, NULL, NULL) );
    2122
    2123 return SCIP_OKAY;
    2124}
    2125
    2126/** adds a solution value for a new variable in the transformed problem that has no original counterpart
    2127 * a value can only be set if no value has been set for this variable before
    2128 */
    2130 SCIP* scip, /**< SCIP data structure */
    2131 SCIP_VAR* var, /**< variable for which to add a value */
    2132 SCIP_Real val /**< solution value for variable */
    2133 )
    2134{
    2135 SCIP_DEBUGSOLDATA* debugsoldata;
    2136 SCIP_Real testval;
    2137 const char* varname;
    2138 int i;
    2139
    2140 assert(scip != NULL);
    2141 assert(var != NULL);
    2142 assert(scip->set != NULL);
    2143
    2144 debugsoldata = SCIPsetGetDebugSolData(scip->set);
    2145 assert(debugsoldata != NULL);
    2146
    2147 /* assert that we are in the SCIP instance that we are debugging and not some different (subSCIP,
    2148 * auxiliary CIP, ...)
    2149 */
    2151 return SCIP_OKAY;
    2152
    2153 /* check whether a debug solution is available */
    2154 if( !debugSolutionAvailable(scip->set) )
    2155 return SCIP_OKAY;
    2156
    2157 if( debugsoldata->debugsol == NULL )
    2158 {
    2159 /* make sure a debug solution has been read, so we do not compare against the initial debugsolval == 0 */
    2160 SCIP_CALL( readSolution(scip->set) );
    2161 }
    2162
    2163 /* allocate memory */
    2164 if( debugsoldata->nsolvals >= debugsoldata->solsize )
    2165 {
    2166 debugsoldata->solsize = MAX(2*debugsoldata->solsize, debugsoldata->nsolvals+1);
    2167 SCIP_ALLOC( BMSreallocMemoryArray(&debugsoldata->solnames, debugsoldata->solsize) );
    2168 SCIP_ALLOC( BMSreallocMemoryArray(&debugsoldata->solvals, debugsoldata->solsize) );
    2169 }
    2170 assert(debugsoldata->nsolvals < debugsoldata->solsize);
    2171
    2172 /* store solution value in sorted list */
    2173 varname = SCIPvarGetName(var);
    2174 for( i = debugsoldata->nsolvals; i > 0 && strcmp(varname, debugsoldata->solnames[i-1]) < 0; --i )
    2175 {
    2176 debugsoldata->solnames[i] = debugsoldata->solnames[i-1];
    2177 debugsoldata->solvals[i] = debugsoldata->solvals[i-1];
    2178 }
    2179 if( i > 0 && strcmp(varname, debugsoldata->solnames[i-1]) == 0 )
    2180 {
    2181 if( REALABS(debugsoldata->solvals[i-1] - val) > 1e-9 )
    2182 {
    2183 SCIPerrorMessage("already have stored different debugging solution value (%g) for variable <%s>, cannot store %g\n", debugsoldata->solvals[i-1], varname, val);
    2184 return SCIP_ERROR;
    2185 }
    2186 else
    2187 {
    2188 SCIPdebugMsg(scip, "already have stored debugging solution value %g for variable <%s>, do not store same value again\n", val, varname);
    2189 for( ; i < debugsoldata->nsolvals; ++i )
    2190 {
    2191 debugsoldata->solnames[i] = debugsoldata->solnames[i+1];
    2192 debugsoldata->solvals[i] = debugsoldata->solvals[i+1];
    2193 }
    2194 return SCIP_OKAY;
    2195 }
    2196 }
    2197
    2198 /* insert new solution value */
    2199 SCIP_ALLOC( BMSduplicateMemoryArray(&(debugsoldata->solnames[i]), varname, strlen(varname)+1) );
    2200 SCIPdebugMsg(scip, "add variable <%s>: value <%g>\n", debugsoldata->solnames[i], val);
    2201 debugsoldata->solvals[i] = val;
    2202 debugsoldata->nsolvals++;
    2203
    2204 /* update objective function value of debug solution */
    2205 debugsoldata->debugsolval += debugsoldata->solvals[i] * SCIPvarGetObj(var);
    2206 SCIPdebugMsg(scip, "Debug Solution value is now %g.\n", debugsoldata->debugsolval);
    2207
    2209 {
    2210 /* add values to SCIP debug solution */
    2211 SCIP_CALL( SCIPsetSolVal(scip, debugsoldata->debugsol, var, debugsoldata->solvals[i] ) );
    2212 }
    2213
    2214 /* get solution value once to produce warning if solution was cut off */
    2215 SCIPdebugGetSolVal(scip, var, &testval);
    2216
    2217 return SCIP_OKAY;
    2218}
    2219
    2220#else
    2221
    2222/** this is a dummy method to make the SunOS gcc linker happy */
    2223extern void SCIPdummyDebugMethodForSun(void);
    2225{
    2226 return;
    2227}
    2228
    2229#endif
    2230
    2231
    2232/*
    2233 * debug method for LP interface, to check if the LP interface works correct
    2234 */
    2235#ifdef SCIP_DEBUG_LP_INTERFACE
    2236
    2237/* check whether coef is the r-th row of the inverse basis matrix B^-1; this is
    2238 * the case if( coef * B ) is the r-th unit vector */
    2240 SCIP* scip, /**< SCIP data structure */
    2241 int r, /**< row number */
    2242 SCIP_Real* coef /**< r-th row of the inverse basis matrix */
    2243 )
    2244{
    2245 SCIP_Real vecval;
    2246 SCIP_Real matrixval;
    2247 int* basisind;
    2248 int nrows;
    2249 int idx;
    2250 int i;
    2251 int k;
    2252
    2253 assert(scip != NULL);
    2254
    2255 nrows = SCIPgetNLPRows(scip);
    2256
    2257 /* get basic indices for the basic matrix B */
    2258 SCIP_CALL( SCIPallocBufferArray(scip, &basisind, nrows) );
    2259 SCIP_CALL( SCIPgetLPBasisInd(scip, basisind) );
    2260
    2261 /* loop over the columns of B */
    2262 for( k = 0; k < nrows; ++k )
    2263 {
    2264 vecval = 0.0;
    2265
    2266 /* indices of basic columns and rows:
    2267 * - index i >= 0 corresponds to column i,
    2268 * - index i < 0 to row -i-1
    2269 */
    2270 idx = basisind[k];
    2271
    2272 /* check if we have a slack variable; this is the case if idx < 0 */
    2273 if( idx >= 0 )
    2274 {
    2275 /* loop over the rows to compute the corresponding value in the unit vector */
    2276 for( i = 0; i < nrows; ++i )
    2277 {
    2278 SCIP_CALL( SCIPlpiGetCoef(scip->lp->lpi, i, idx, &matrixval) );
    2279 vecval += coef[i] * matrixval;
    2280 }
    2281 }
    2282 else
    2283 {
    2284 assert( idx < 0 );
    2285
    2286 /* retransform idx
    2287 * - index i >= 0 corresponds to column i,
    2288 * - index i < 0 to row -i-1
    2289 */
    2290 idx = -idx - 1;
    2291 assert( idx >= 0 && idx < nrows );
    2292
    2293 /* since idx < 0 we are in the case of a slack variable, i.e., the corresponding column
    2294 is the idx-unit vector; note that some LP solver return a -idx-unit vector */
    2295 /* vecval = REALABS(coef[idx]);*/
    2296 vecval = coef[idx];
    2297 }
    2298
    2299 /* check if vecval fits to the r-th unit vector */
    2300 if( k == r && !SCIPisFeasEQ(scip, vecval, 1.0) )
    2301 {
    2302 /* we expected a 1.0 and found something different */
    2303 SCIPmessagePrintWarning(SCIPgetMessagehdlr(scip), "checked SCIPgetLPBInvRow() found value <%g> expected 1.0\n", vecval);
    2304 }
    2305 else if( k != r && !SCIPisFeasZero(scip, vecval) )
    2306 {
    2307 /* we expected a 0.0 and found something different */
    2308 SCIPmessagePrintWarning(SCIPgetMessagehdlr(scip), "checked SCIPgetLPBInvRow() found value <%g> expected 0.0\n", vecval);
    2309 }
    2310 }
    2311
    2312 SCIPfreeBufferArray(scip, &basisind);
    2313
    2314 return SCIP_OKAY;
    2315}
    2316
    2317#endif
    2318
    2319/** checks if SCIP is in one of the feasible stages */
    2320#ifdef SCIP_CHECK_STAGE
    2322 SCIP* scip, /**< SCIP data structure */
    2323 const char* method, /**< method that was called */
    2324 SCIP_Bool init, /**< may method be called in the INIT stage? */
    2325 SCIP_Bool problem, /**< may method be called in the PROBLEM stage? */
    2326 SCIP_Bool transforming, /**< may method be called in the TRANSFORMING stage? */
    2327 SCIP_Bool transformed, /**< may method be called in the TRANSFORMED stage? */
    2328 SCIP_Bool initpresolve, /**< may method be called in the INITPRESOLVE stage? */
    2329 SCIP_Bool presolving, /**< may method be called in the PRESOLVING stage? */
    2330 SCIP_Bool exitpresolve, /**< may method be called in the EXITPRESOLE stage? */
    2331 SCIP_Bool presolved, /**< may method be called in the PRESOLVED stage? */
    2332 SCIP_Bool initsolve, /**< may method be called in the INITSOLVE stage? */
    2333 SCIP_Bool solving, /**< may method be called in the SOLVING stage? */
    2334 SCIP_Bool solved, /**< may method be called in the SOLVED stage? */
    2335 SCIP_Bool exitsolve, /**< may method be called in the EXITSOLVE stage? */
    2336 SCIP_Bool freetrans, /**< may method be called in the FREETRANS stage? */
    2337 SCIP_Bool freescip /**< may method be called in the FREE stage? */
    2338 )
    2339{
    2340 assert(scip != NULL);
    2341 assert(method != NULL);
    2342
    2343 /*SCIPdebugMsg(scip, "called method <%s> at stage %d ------------------------------------------------\n",
    2344 method, scip->set->stage);*/
    2345
    2346 assert(scip->mem != NULL);
    2347 assert(scip->set != NULL);
    2348 assert(scip->interrupt != NULL);
    2349 assert(scip->dialoghdlr != NULL);
    2350 assert(scip->totaltime != NULL);
    2351
    2352 switch( scip->set->stage )
    2353 {
    2354 case SCIP_STAGE_INIT:
    2355 assert(scip->stat == NULL);
    2356 assert(scip->origprob == NULL);
    2357 assert(scip->eventfilter == NULL);
    2358 assert(scip->eventqueue == NULL);
    2359 assert(scip->branchcand == NULL);
    2360 assert(scip->lp == NULL);
    2361 assert(scip->nlp == NULL);
    2362 assert(scip->primal == NULL);
    2363 assert(scip->tree == NULL);
    2364 assert(scip->conflict == NULL);
    2365 assert(scip->transprob == NULL);
    2366 assert(scip->pricestore == NULL);
    2367 assert(scip->sepastore == NULL);
    2368 assert(scip->cutpool == NULL);
    2369 assert(scip->delayedcutpool == NULL);
    2370
    2371 if( !init )
    2372 {
    2373 SCIPerrorMessage("cannot call method <%s> in initialization stage\n", method);
    2374 return SCIP_INVALIDCALL;
    2375 }
    2376 return SCIP_OKAY;
    2377
    2378 case SCIP_STAGE_PROBLEM:
    2379 assert(scip->stat != NULL);
    2380 assert(scip->origprob != NULL);
    2381 assert(scip->eventfilter == NULL);
    2382 assert(scip->eventqueue == NULL);
    2383 assert(scip->branchcand == NULL);
    2384 assert(scip->lp == NULL);
    2385 assert(scip->nlp == NULL);
    2386 assert(scip->primal == NULL);
    2387 assert(scip->tree == NULL);
    2388 assert(scip->conflict == NULL);
    2389 assert(scip->transprob == NULL);
    2390 assert(scip->pricestore == NULL);
    2391 assert(scip->sepastore == NULL);
    2392 assert(scip->cutpool == NULL);
    2393 assert(scip->delayedcutpool == NULL);
    2394
    2395 if( !problem )
    2396 {
    2397 SCIPerrorMessage("cannot call method <%s> in problem creation stage\n", method);
    2398 return SCIP_INVALIDCALL;
    2399 }
    2400 return SCIP_OKAY;
    2401
    2403 assert(scip->stat != NULL);
    2404 assert(scip->origprob != NULL);
    2405 assert(scip->eventfilter != NULL);
    2406 assert(scip->eventqueue != NULL);
    2407 assert(scip->branchcand != NULL);
    2408 assert(scip->lp != NULL);
    2409 assert(scip->primal != NULL);
    2410 assert(scip->tree != NULL);
    2411 assert(scip->conflict != NULL);
    2412 assert(scip->transprob != NULL);
    2413 assert(scip->pricestore == NULL);
    2414 assert(scip->sepastore == NULL);
    2415 assert(scip->cutpool == NULL);
    2416 assert(scip->delayedcutpool == NULL);
    2417
    2418 if( !transforming )
    2419 {
    2420 SCIPerrorMessage("cannot call method <%s> in problem transformation stage\n", method);
    2421 return SCIP_INVALIDCALL;
    2422 }
    2423 return SCIP_OKAY;
    2424
    2426 assert(scip->stat != NULL);
    2427 assert(scip->origprob != NULL);
    2428 assert(scip->eventfilter != NULL);
    2429 assert(scip->eventqueue != NULL);
    2430 assert(scip->branchcand != NULL);
    2431 assert(scip->lp != NULL);
    2432 assert(scip->primal != NULL);
    2433 assert(scip->tree != NULL);
    2434 assert(scip->conflict != NULL);
    2435 assert(scip->transprob != NULL);
    2436 assert(scip->pricestore == NULL);
    2437 assert(scip->sepastore == NULL);
    2438 assert(scip->cutpool == NULL);
    2439 assert(scip->delayedcutpool == NULL);
    2440
    2441 if( !transformed )
    2442 {
    2443 SCIPerrorMessage("cannot call method <%s> in problem transformed stage\n", method);
    2444 return SCIP_INVALIDCALL;
    2445 }
    2446 return SCIP_OKAY;
    2447
    2449 assert(scip->stat != NULL);
    2450 assert(scip->origprob != NULL);
    2451 assert(scip->eventfilter != NULL);
    2452 assert(scip->eventqueue != NULL);
    2453 assert(scip->branchcand != NULL);
    2454 assert(scip->lp != NULL);
    2455 assert(scip->primal != NULL);
    2456 assert(scip->tree != NULL);
    2457 assert(scip->conflict != NULL);
    2458 assert(scip->transprob != NULL);
    2459 assert(scip->pricestore == NULL);
    2460 assert(scip->sepastore == NULL);
    2461 assert(scip->cutpool == NULL);
    2462 assert(scip->delayedcutpool == NULL);
    2463
    2464 if( !initpresolve )
    2465 {
    2466 SCIPerrorMessage("cannot call method <%s> in init presolving stage\n", method);
    2467 return SCIP_INVALIDCALL;
    2468 }
    2469 return SCIP_OKAY;
    2470
    2472 assert(scip->stat != NULL);
    2473 assert(scip->origprob != NULL);
    2474 assert(scip->eventfilter != NULL);
    2475 assert(scip->eventqueue != NULL);
    2476 assert(scip->branchcand != NULL);
    2477 assert(scip->lp != NULL);
    2478 assert(scip->primal != NULL);
    2479 assert(scip->tree != NULL);
    2480 assert(scip->conflict != NULL);
    2481 assert(scip->transprob != NULL);
    2482 assert(scip->pricestore == NULL);
    2483 assert(scip->sepastore == NULL);
    2484 assert(scip->cutpool == NULL);
    2485 assert(scip->delayedcutpool == NULL);
    2486
    2487 if( !presolving )
    2488 {
    2489 SCIPerrorMessage("cannot call method <%s> in presolving stage\n", method);
    2490 return SCIP_INVALIDCALL;
    2491 }
    2492 return SCIP_OKAY;
    2493
    2495 assert(scip->stat != NULL);
    2496 assert(scip->origprob != NULL);
    2497 assert(scip->eventfilter != NULL);
    2498 assert(scip->eventqueue != NULL);
    2499 assert(scip->branchcand != NULL);
    2500 assert(scip->lp != NULL);
    2501 assert(scip->primal != NULL);
    2502 assert(scip->tree != NULL);
    2503 assert(scip->conflict != NULL);
    2504 assert(scip->transprob != NULL);
    2505 assert(scip->pricestore == NULL);
    2506 assert(scip->sepastore == NULL);
    2507 assert(scip->cutpool == NULL);
    2508 assert(scip->delayedcutpool == NULL);
    2509
    2510 if( !exitpresolve )
    2511 {
    2512 SCIPerrorMessage("cannot call method <%s> in exit presolving stage\n", method);
    2513 return SCIP_INVALIDCALL;
    2514 }
    2515 return SCIP_OKAY;
    2516
    2518 assert(scip->stat != NULL);
    2519 assert(scip->origprob != NULL);
    2520 assert(scip->eventfilter != NULL);
    2521 assert(scip->eventqueue != NULL);
    2522 assert(scip->branchcand != NULL);
    2523 assert(scip->lp != NULL);
    2524 assert(scip->primal != NULL);
    2525 assert(scip->tree != NULL);
    2526 assert(scip->conflict != NULL);
    2527 assert(scip->transprob != NULL);
    2528 assert(scip->pricestore == NULL);
    2529 assert(scip->sepastore == NULL);
    2530 assert(scip->cutpool == NULL);
    2531 assert(scip->delayedcutpool == NULL);
    2532
    2533 if( !presolved )
    2534 {
    2535 SCIPerrorMessage("cannot call method <%s> in problem presolved stage\n", method);
    2536 return SCIP_INVALIDCALL;
    2537 }
    2538 return SCIP_OKAY;
    2539
    2541 assert(scip->stat != NULL);
    2542 assert(scip->origprob != NULL);
    2543 assert(scip->eventfilter != NULL);
    2544 assert(scip->eventqueue != NULL);
    2545 assert(scip->branchcand != NULL);
    2546 assert(scip->lp != NULL);
    2547 assert(scip->primal != NULL);
    2548 assert(scip->tree != NULL);
    2549 assert(scip->transprob != NULL);
    2550
    2551 if( !initsolve )
    2552 {
    2553 SCIPerrorMessage("cannot call method <%s> in init solve stage\n", method);
    2554 return SCIP_INVALIDCALL;
    2555 }
    2556 return SCIP_OKAY;
    2557
    2558 case SCIP_STAGE_SOLVING:
    2559 assert(scip->stat != NULL);
    2560 assert(scip->origprob != NULL);
    2561 assert(scip->eventfilter != NULL);
    2562 assert(scip->eventqueue != NULL);
    2563 assert(scip->branchcand != NULL);
    2564 assert(scip->lp != NULL);
    2565 assert(scip->primal != NULL);
    2566 assert(scip->tree != NULL);
    2567 assert(scip->conflict != NULL);
    2568 assert(scip->transprob != NULL);
    2569 assert(scip->pricestore != NULL);
    2570 assert(scip->sepastore != NULL);
    2571 assert(scip->cutpool != NULL);
    2572 assert(scip->delayedcutpool != NULL);
    2573
    2574 if( !solving )
    2575 {
    2576 SCIPerrorMessage("cannot call method <%s> in solving stage\n", method);
    2577 return SCIP_INVALIDCALL;
    2578 }
    2579 return SCIP_OKAY;
    2580
    2581 case SCIP_STAGE_SOLVED:
    2582 assert(scip->stat != NULL);
    2583 assert(scip->origprob != NULL);
    2584 assert(scip->eventfilter != NULL);
    2585 assert(scip->eventqueue != NULL);
    2586 assert(scip->branchcand != NULL);
    2587 assert(scip->lp != NULL);
    2588 assert(scip->primal != NULL);
    2589 assert(scip->tree != NULL);
    2590 assert(scip->conflict != NULL);
    2591 assert(scip->transprob != NULL);
    2592 assert(scip->pricestore != NULL);
    2593 assert(scip->sepastore != NULL);
    2594 assert(scip->cutpool != NULL);
    2595 assert(scip->delayedcutpool != NULL);
    2596
    2597 if( !solved )
    2598 {
    2599 SCIPerrorMessage("cannot call method <%s> in problem solved stage\n", method);
    2600 return SCIP_INVALIDCALL;
    2601 }
    2602 return SCIP_OKAY;
    2603
    2605 assert(scip->stat != NULL);
    2606 assert(scip->origprob != NULL);
    2607 assert(scip->eventfilter != NULL);
    2608 assert(scip->eventqueue != NULL);
    2609 assert(scip->branchcand != NULL);
    2610 assert(scip->lp != NULL);
    2611 assert(scip->primal != NULL);
    2612 assert(scip->tree != NULL);
    2613 assert(scip->transprob != NULL);
    2614
    2615 if( !exitsolve )
    2616 {
    2617 SCIPerrorMessage("cannot call method <%s> in solve deinitialization stage\n", method);
    2618 return SCIP_INVALIDCALL;
    2619 }
    2620 return SCIP_OKAY;
    2621
    2623 assert(scip->stat != NULL);
    2624 assert(scip->origprob != NULL);
    2625 assert(scip->pricestore == NULL);
    2626 assert(scip->sepastore == NULL);
    2627 assert(scip->cutpool == NULL);
    2628 assert(scip->delayedcutpool == NULL);
    2629
    2630 if( !freetrans )
    2631 {
    2632 SCIPerrorMessage("cannot call method <%s> in free transformed problem stage\n", method);
    2633 return SCIP_INVALIDCALL;
    2634 }
    2635 return SCIP_OKAY;
    2636
    2637 case SCIP_STAGE_FREE:
    2638 if( !freescip )
    2639 {
    2640 SCIPerrorMessage("cannot call method <%s> in free stage\n", method);
    2641 return SCIP_INVALIDCALL;
    2642 }
    2643 return SCIP_OKAY;
    2644
    2645 default:
    2646 /* note that this is in an internal SCIP error since all SCIP stages are covert in the switch above */
    2647 SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
    2648 return SCIP_ERROR;
    2649 }
    2650}
    2651#endif
    SCIP_Real * r
    Definition: circlepacking.c:59
    void SCIPdummyDebugMethodForSun(void)
    Definition: debug.c:2224
    methods for debugging
    #define SCIPdebugCheckLbGlobal(scip, var, lb)
    Definition: debug.h:298
    #define SCIPdebugCheckClique(set, vars, values, nvars)
    Definition: debug.h:307
    #define SCIPdebugFree(set)
    Definition: debug.h:294
    struct SCIP_DebugSolData SCIP_DEBUGSOLDATA
    Definition: debug.h:59
    #define SCIPdebugCheckRow(set, row)
    Definition: debug.h:297
    #define SCIPdebugSolDisable(scip)
    Definition: debug.h:315
    #define SCIPdebugCheckConflict(blkmem, set, node, bdchginfos, relaxedbds, nliterals)
    Definition: debug.h:308
    #define SCIPdebugCheckActiveConss(scip, conss, nconss)
    Definition: debug.h:295
    #define SCIPdebugCheckImplic(set, var, varfixing, implvar, impltype, implbound)
    Definition: debug.h:305
    #define SCIPdebugGetSolVal(scip, var, val)
    Definition: debug.h:312
    #define SCIPdebugFreeSol(set)
    Definition: debug.h:291
    #define SCIPdebugCheckUbGlobal(scip, var, ub)
    Definition: debug.h:299
    #define SCIPdebugSolEnable(scip)
    Definition: debug.h:314
    #define SCIPdebugCheckGlobalLowerbound(blkmem, set)
    Definition: debug.h:302
    #define SCIPcheckStage(scip, method, init, problem, transforming, transformed, initpresolve, presolving, exitpresolve, presolved, initsolve, solving, solved, exitsolve, freetrans, freescip)
    Definition: debug.h:364
    #define SCIPdebugCheckLocalLowerbound(blkmem, set, node)
    Definition: debug.h:303
    #define SCIPdebugAddSolVal(scip, var, val)
    Definition: debug.h:311
    #define SCIPdebugCheckVbound(set, var, vbtype, vbvar, vbcoef, vbconstant)
    Definition: debug.h:304
    #define SCIPdebugCheckConss(scip, conss, nconss)
    Definition: debug.h:296
    #define SCIPdebugFreeDebugData(set)
    Definition: debug.h:293
    #define SCIPdebugSolIsEnabled(scip)
    Definition: debug.h:316
    #define SCIPdebugCheckAggregation(set, var, aggrvars, scalars, constant, naggrvars)
    Definition: debug.h:306
    #define SCIPdebugCheckBInvRow(scip, r, coef)
    Definition: debug.h:337
    #define SCIPdebugRemoveNode(blkmem, set, node)
    Definition: debug.h:301
    #define SCIPdebugSolIsValidInSubtree(scip, isvalidinsubtree)
    Definition: debug.h:313
    #define SCIPdebugReset(set)
    Definition: debug.h:292
    #define SCIPdebugCheckConflictFrontier(blkmem, set, node, bdchginfo, bdchginfos, relaxedbds, nliterals, bdchgqueue, forcedbdchgqueue)
    Definition: debug.h:309
    #define SCIPdebugIncludeProp(scip)
    Definition: debug.h:310
    #define SCIPdebugCheckInference(blkmem, set, node, var, newbound, boundtype)
    Definition: debug.h:300
    #define SCIPwithDebugSol(void)
    Definition: debug.h:317
    #define SCIPdebugSolDataCreate(debugsoldata)
    Definition: debug.h:290
    common defines and data types used in all packages of SCIP
    #define NULL
    Definition: def.h:248
    #define SCIP_MAXSTRLEN
    Definition: def.h:269
    #define SCIP_Bool
    Definition: def.h:91
    #define SCIP_ALLOC(x)
    Definition: def.h:366
    #define SCIP_Real
    Definition: def.h:156
    #define SCIP_UNKNOWN
    Definition: def.h:179
    #define TRUE
    Definition: def.h:93
    #define FALSE
    Definition: def.h:94
    #define MAX(x, y)
    Definition: def.h:220
    #define SCIP_LONGINT_FORMAT
    Definition: def.h:148
    #define SCIPABORT()
    Definition: def.h:327
    #define REALABS(x)
    Definition: def.h:182
    #define SCIP_CALL(x)
    Definition: def.h:355
    SCIP_FILE * SCIPfopen(const char *path, const char *mode)
    Definition: fileio.c:153
    int SCIPfeof(SCIP_FILE *stream)
    Definition: fileio.c:227
    int SCIPfclose(SCIP_FILE *fp)
    Definition: fileio.c:232
    char * SCIPfgets(char *s, int size, SCIP_FILE *stream)
    Definition: fileio.c:200
    SCIP_STATUS SCIPgetStatus(SCIP *scip)
    Definition: scip_general.c:562
    SCIP_STAGE SCIPgetStage(SCIP *scip)
    Definition: scip_general.c:444
    SCIP_VAR ** SCIPgetOrigVars(SCIP *scip)
    Definition: scip_prob.c:2811
    int SCIPgetNOrigVars(SCIP *scip)
    Definition: scip_prob.c:2838
    SCIP_OBJSENSE SCIPgetObjsense(SCIP *scip)
    Definition: scip_prob.c:1400
    SCIP_VAR * SCIPfindVar(SCIP *scip, const char *name)
    Definition: scip_prob.c:3189
    void SCIPhashmapFree(SCIP_HASHMAP **hashmap)
    Definition: misc.c:3095
    void * SCIPhashmapGetImage(SCIP_HASHMAP *hashmap, void *origin)
    Definition: misc.c:3284
    SCIP_RETCODE SCIPhashmapSetImage(SCIP_HASHMAP *hashmap, void *origin, void *image)
    Definition: misc.c:3366
    SCIP_RETCODE SCIPhashmapCreate(SCIP_HASHMAP **hashmap, BMS_BLKMEM *blkmem, int mapsize)
    Definition: misc.c:3061
    SCIP_RETCODE SCIPhashmapRemoveAll(SCIP_HASHMAP *hashmap)
    Definition: misc.c:3676
    SCIP_RETCODE SCIPhashmapRemove(SCIP_HASHMAP *hashmap, void *origin)
    Definition: misc.c:3482
    SCIP_RETCODE SCIPlpiGetCoef(SCIP_LPI *lpi, int row, int col, SCIP_Real *val)
    Definition: lpi_clp.cpp:1799
    void SCIPverbMessage(SCIP *scip, SCIP_VERBLEVEL msgverblevel, FILE *file, const char *formatstr,...)
    Definition: scip_message.c:225
    SCIP_MESSAGEHDLR * SCIPgetMessagehdlr(SCIP *scip)
    Definition: scip_message.c:88
    #define SCIPdebugMsg
    Definition: scip_message.h:78
    void SCIPwarningMessage(SCIP *scip, const char *formatstr,...)
    Definition: scip_message.c:120
    void ** SCIPpqueueElems(SCIP_PQUEUE *pqueue)
    Definition: misc.c:1540
    int SCIPpqueueNElems(SCIP_PQUEUE *pqueue)
    Definition: misc.c:1529
    SCIP_VAR * SCIPcolGetVar(SCIP_COL *col)
    Definition: lp.c:17425
    SCIP_RETCODE SCIPcheckCons(SCIP *scip, SCIP_CONS *cons, SCIP_SOL *sol, SCIP_Bool checkintegrality, SCIP_Bool checklprows, SCIP_Bool printreason, SCIP_RESULT *result)
    Definition: scip_cons.c:2135
    int SCIPconsGetActiveDepth(SCIP_CONS *cons)
    Definition: cons.c:8439
    SCIP_Bool SCIPconsIsActive(SCIP_CONS *cons)
    Definition: cons.c:8450
    SCIP_Bool SCIPconsIsLocal(SCIP_CONS *cons)
    Definition: cons.c:8628
    const char * SCIPconsGetName(SCIP_CONS *cons)
    Definition: cons.c:8389
    SCIP_RETCODE SCIPgetLPBasisInd(SCIP *scip, int *basisind)
    Definition: scip_lp.c:692
    int SCIPgetNLPRows(SCIP *scip)
    Definition: scip_lp.c:632
    SCIP_Real SCIPgetLPFeastol(SCIP *scip)
    Definition: scip_lp.c:434
    BMS_BLKMEM * SCIPblkmem(SCIP *scip)
    Definition: scip_mem.c:57
    #define SCIPallocBufferArray(scip, ptr, num)
    Definition: scip_mem.h:124
    #define SCIPfreeBufferArray(scip, ptr)
    Definition: scip_mem.h:136
    SCIP_NODETYPE SCIPnodeGetType(SCIP_NODE *node)
    Definition: tree.c:8473
    SCIP_Real SCIPnodeGetLowerbound(SCIP_NODE *node)
    Definition: tree.c:8503
    int SCIPnodeGetNAddedConss(SCIP_NODE *node)
    Definition: tree.c:1799
    void SCIPnodeGetAddedConss(SCIP_NODE *node, SCIP_CONS **addedconss, int *naddedconss, int addedconsssize)
    Definition: tree.c:1769
    int SCIPnodeGetDepth(SCIP_NODE *node)
    Definition: tree.c:8493
    SCIP_RETCODE SCIPincludeProp(SCIP *scip, const char *name, const char *desc, int priority, int freq, SCIP_Bool delay, SCIP_PROPTIMING timingmask, int presolpriority, int presolmaxrounds, SCIP_PRESOLTIMING presoltiming, SCIP_DECL_PROPCOPY((*propcopy)), SCIP_DECL_PROPFREE((*propfree)), SCIP_DECL_PROPINIT((*propinit)), SCIP_DECL_PROPEXIT((*propexit)), SCIP_DECL_PROPINITPRE((*propinitpre)), SCIP_DECL_PROPEXITPRE((*propexitpre)), SCIP_DECL_PROPINITSOL((*propinitsol)), SCIP_DECL_PROPEXITSOL((*propexitsol)), SCIP_DECL_PROPPRESOL((*proppresol)), SCIP_DECL_PROPEXEC((*propexec)), SCIP_DECL_PROPRESPROP((*propresprop)), SCIP_PROPDATA *propdata)
    Definition: scip_prop.c:66
    SCIP_Real SCIPrationalGetReal(SCIP_RATIONAL *rational)
    Definition: rational.cpp:2085
    SCIP_RETCODE SCIPrationalCreateString(BMS_BLKMEM *mem, SCIP_RATIONAL **rational, const char *desc)
    Definition: rational.cpp:796
    SCIP_Bool SCIPrationalIsString(const char *desc)
    Definition: rational.cpp:652
    void SCIPrationalFreeBlock(BMS_BLKMEM *mem, SCIP_RATIONAL **rational)
    Definition: rational.cpp:461
    SCIP_Real SCIProwGetLhs(SCIP_ROW *row)
    Definition: lp.c:17686
    int SCIProwGetNNonz(SCIP_ROW *row)
    Definition: lp.c:17607
    SCIP_COL ** SCIProwGetCols(SCIP_ROW *row)
    Definition: lp.c:17632
    SCIP_Real SCIProwGetRhs(SCIP_ROW *row)
    Definition: lp.c:17696
    SCIP_Bool SCIProwIsLocal(SCIP_ROW *row)
    Definition: lp.c:17795
    const char * SCIProwGetName(SCIP_ROW *row)
    Definition: lp.c:17745
    SCIP_Real SCIProwGetConstant(SCIP_ROW *row)
    Definition: lp.c:17652
    SCIP_Real * SCIProwGetVals(SCIP_ROW *row)
    Definition: lp.c:17642
    SCIP_SOL * SCIPgetBestSol(SCIP *scip)
    Definition: scip_sol.c:2981
    SCIP_Real SCIPsolGetOrigObj(SCIP_SOL *sol)
    Definition: sol.c:4170
    SCIP_RETCODE SCIPfreeSol(SCIP *scip, SCIP_SOL **sol)
    Definition: scip_sol.c:1252
    SCIP_RETCODE SCIPcreateOrigSol(SCIP *scip, SCIP_SOL **sol, SCIP_HEUR *heur)
    Definition: scip_sol.c:831
    SCIP_RETCODE SCIPsetSolVals(SCIP *scip, SCIP_SOL *sol, int nvars, SCIP_VAR **vars, SCIP_Real *vals)
    Definition: scip_sol.c:1662
    SCIP_Real SCIPgetSolOrigObj(SCIP *scip, SCIP_SOL *sol)
    Definition: scip_sol.c:1892
    SCIP_RETCODE SCIPsetSolVal(SCIP *scip, SCIP_SOL *sol, SCIP_VAR *var, SCIP_Real val)
    Definition: scip_sol.c:1571
    SCIP_Bool SCIPisInRestart(SCIP *scip)
    Definition: scip_solve.c:3709
    SCIP_Longint SCIPgetNLPIterations(SCIP *scip)
    SCIP_Bool SCIPisFeasEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
    SCIP_Bool SCIPisFeasZero(SCIP *scip, SCIP_Real val)
    SCIP_Bool SCIPisFeasLT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
    SCIP_Bool SCIPisGT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
    SCIP_Bool SCIPisFeasGT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
    SCIP_Bool SCIPisLT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
    int SCIPgetDepth(SCIP *scip)
    Definition: scip_tree.c:672
    int SCIPgetNLeaves(SCIP *scip)
    Definition: scip_tree.c:272
    SCIP_NODE * SCIPgetCurrentNode(SCIP *scip)
    Definition: scip_tree.c:91
    SCIP_RETCODE SCIPvarGetOrigvarSum(SCIP_VAR **var, SCIP_Real *scalar, SCIP_Real *constant)
    Definition: var.c:18320
    SCIP_Bool SCIPvarIsDeleted(SCIP_VAR *var)
    Definition: var.c:23534
    SCIP_Real SCIPvarGetNegationConstant(SCIP_VAR *var)
    Definition: var.c:23889
    SCIP_Bool SCIPvarIsBinary(SCIP_VAR *var)
    Definition: var.c:23478
    SCIP_BOUNDTYPE SCIPboundchgGetBoundtype(SCIP_BOUNDCHG *boundchg)
    Definition: var.c:23194
    SCIP_VARSTATUS SCIPvarGetStatus(SCIP_VAR *var)
    Definition: var.c:23386
    SCIP_BOUNDCHGTYPE SCIPboundchgGetBoundchgtype(SCIP_BOUNDCHG *boundchg)
    Definition: var.c:23184
    SCIP_Bool SCIPvarIsTransformed(SCIP_VAR *var)
    Definition: var.c:23430
    SCIP_Real SCIPvarGetObj(SCIP_VAR *var)
    Definition: var.c:23900
    SCIP_VARTYPE SCIPvarGetType(SCIP_VAR *var)
    Definition: var.c:23453
    SCIP_Real SCIPvarGetUbGlobal(SCIP_VAR *var)
    Definition: var.c:24142
    int SCIPvarGetNUses(SCIP_VAR *var)
    Definition: var.c:23277
    const char * SCIPvarGetName(SCIP_VAR *var)
    Definition: var.c:23267
    SCIP_VAR * SCIPbdchginfoGetVar(SCIP_BDCHGINFO *bdchginfo)
    Definition: var.c:24929
    SCIP_Bool SCIPvarIsTransformedOrigvar(SCIP_VAR *var)
    Definition: var.c:18497
    SCIP_Bool SCIPvarIsNegated(SCIP_VAR *var)
    Definition: var.c:23443
    SCIP_Bool SCIPvarIsRelaxationOnly(SCIP_VAR *var)
    Definition: var.c:23600
    SCIP_VAR * SCIPvarGetNegationVar(SCIP_VAR *var)
    Definition: var.c:23878
    SCIP_Real SCIPvarGetLbGlobal(SCIP_VAR *var)
    Definition: var.c:24120
    SCIP_RETCODE SCIPfixVar(SCIP *scip, SCIP_VAR *var, SCIP_Real fixedval, SCIP_Bool *infeasible, SCIP_Bool *fixed)
    Definition: scip_var.c:10318
    SCIP_BOUNDTYPE SCIPbdchginfoGetBoundtype(SCIP_BDCHGINFO *bdchginfo)
    Definition: var.c:24949
    SCIP_Real SCIPbdchginfoGetNewbound(SCIP_BDCHGINFO *bdchginfo)
    Definition: var.c:24919
    void SCIPsortPtrReal(void **ptrarray, SCIP_Real *realarray, SCIP_DECL_SORTPTRCOMP((*ptrcomp)), int len)
    SCIP_Bool SCIPstrToRealValue(const char *str, SCIP_Real *value, char **endptr)
    Definition: misc.c:10955
    void SCIPprintSysError(const char *message)
    Definition: misc.c:10719
    int SCIPstrncasecmp(const char *s1, const char *s2, int length)
    Definition: misc.c:10876
    char * SCIPstrtok(char *s, const char *delim, char **ptrptr)
    Definition: misc.c:10768
    SCIP_Bool SCIPlpDiving(SCIP_LP *lp)
    Definition: lp.c:18251
    void SCIProwPrint(SCIP_ROW *row, SCIP_MESSAGEHDLR *messagehdlr, FILE *file)
    Definition: lp.c:5514
    static const SCIP_Real scalars[]
    Definition: lp.c:5959
    internal methods for LP management
    memory allocation routines
    #define BMSreallocMemoryArray(ptr, num)
    Definition: memory.h:127
    #define BMSduplicateMemoryArray(ptr, source, num)
    Definition: memory.h:143
    #define BMSfreeMemoryNull(ptr)
    Definition: memory.h:146
    #define BMSallocMemoryArray(ptr, num)
    Definition: memory.h:123
    #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 SCIPmessagePrintWarning(SCIP_MESSAGEHDLR *messagehdlr, const char *formatstr,...)
    Definition: message.c:427
    SCIP_Real SCIPprobExternObjval(SCIP_PROB *transprob, SCIP_PROB *origprob, SCIP_SET *set, SCIP_Real objval)
    Definition: prob.c:2520
    internal methods for storing and manipulating the main problem
    struct SCIP_File SCIP_FILE
    Definition: pub_fileio.h:43
    public methods for message output
    #define SCIPerrorMessage
    Definition: pub_message.h:64
    public data structures and miscellaneous methods
    SCIP callable library.
    SCIP_Bool SCIPsetIsGE(SCIP_SET *set, SCIP_Real val1, SCIP_Real val2)
    Definition: set.c:6617
    SCIP_Bool SCIPsetIsRelEQ(SCIP_SET *set, SCIP_Real val1, SCIP_Real val2)
    Definition: set.c:7463
    SCIP_Bool SCIPsetIsFeasGT(SCIP_SET *set, SCIP_Real val1, SCIP_Real val2)
    Definition: set.c:7017
    SCIP_Bool SCIPsetIsFeasLE(SCIP_SET *set, SCIP_Real val1, SCIP_Real val2)
    Definition: set.c:6993
    SCIP_Bool SCIPsetIsFeasEQ(SCIP_SET *set, SCIP_Real val1, SCIP_Real val2)
    Definition: set.c:6945
    SCIP_Bool SCIPsetIsLE(SCIP_SET *set, SCIP_Real val1, SCIP_Real val2)
    Definition: set.c:6577
    SCIP_Bool SCIPsetIsFeasZero(SCIP_SET *set, SCIP_Real val)
    Definition: set.c:7065
    SCIP_STAGE SCIPsetGetStage(SCIP_SET *set)
    Definition: set.c:3197
    SCIP_Bool SCIPsetIsFeasLT(SCIP_SET *set, SCIP_Real val1, SCIP_Real val2)
    Definition: set.c:6969
    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 SCIPsetIsGT(SCIP_SET *set, SCIP_Real val1, SCIP_Real val2)
    Definition: set.c:6597
    SCIP_DEBUGSOLDATA * SCIPsetGetDebugSolData(SCIP_SET *set)
    Definition: set.c:6272
    SCIP_Bool SCIPsetIsFeasGE(SCIP_SET *set, SCIP_Real val1, SCIP_Real val2)
    Definition: set.c:7041
    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
    SCIP_BOUNDCHG * boundchgs
    Definition: struct_var.h:140
    unsigned int nboundchgs
    Definition: struct_var.h:138
    SCIP_DOMCHG * domchg
    Definition: struct_tree.h:160
    SCIP_Longint number
    Definition: struct_tree.h:143
    SCIP_NODE * parent
    Definition: struct_tree.h:158
    SCIP main data structure.
    Definition: heur_padm.c:135
    SCIP_Bool SCIPtreeProbing(SCIP_TREE *tree)
    Definition: tree.c:9361
    SCIP_Real SCIPtreeGetLowerbound(SCIP_TREE *tree, SCIP_SET *set)
    Definition: tree.c:8224
    internal methods for branch and bound tree
    @ SCIP_BOUNDTYPE_UPPER
    Definition: type_lp.h:58
    @ SCIP_BOUNDTYPE_LOWER
    Definition: type_lp.h:57
    enum SCIP_BoundType SCIP_BOUNDTYPE
    Definition: type_lp.h:60
    @ SCIP_VERBLEVEL_NORMAL
    Definition: type_message.h:60
    #define SCIP_DECL_SORTPTRCOMP(x)
    Definition: type_misc.h:189
    @ SCIP_OBJSENSE_MAXIMIZE
    Definition: type_prob.h:47
    @ SCIP_OBJSENSE_MINIMIZE
    Definition: type_prob.h:48
    #define SCIP_DECL_PROPEXEC(x)
    Definition: type_prop.h:217
    @ SCIP_CUTOFF
    Definition: type_result.h:48
    @ SCIP_FEASIBLE
    Definition: type_result.h:45
    @ SCIP_REDUCEDDOM
    Definition: type_result.h:51
    @ SCIP_DIDNOTFIND
    Definition: type_result.h:44
    enum SCIP_Result SCIP_RESULT
    Definition: type_result.h:61
    @ SCIP_NOFILE
    Definition: type_retcode.h:47
    @ SCIP_READERROR
    Definition: type_retcode.h:45
    @ SCIP_OKAY
    Definition: type_retcode.h:42
    @ SCIP_INVALIDCALL
    Definition: type_retcode.h:51
    @ SCIP_ERROR
    Definition: type_retcode.h:43
    enum SCIP_Retcode SCIP_RETCODE
    Definition: type_retcode.h:63
    @ SCIP_STAGE_PROBLEM
    Definition: type_set.h:45
    @ SCIP_STAGE_INITPRESOLVE
    Definition: type_set.h:48
    @ SCIP_STAGE_SOLVED
    Definition: type_set.h:54
    @ SCIP_STAGE_PRESOLVING
    Definition: type_set.h:49
    @ SCIP_STAGE_TRANSFORMED
    Definition: type_set.h:47
    @ SCIP_STAGE_INITSOLVE
    Definition: type_set.h:52
    @ SCIP_STAGE_EXITPRESOLVE
    Definition: type_set.h:50
    @ SCIP_STAGE_EXITSOLVE
    Definition: type_set.h:55
    @ SCIP_STAGE_INIT
    Definition: type_set.h:44
    @ SCIP_STAGE_FREE
    Definition: type_set.h:57
    @ SCIP_STAGE_FREETRANS
    Definition: type_set.h:56
    @ SCIP_STAGE_SOLVING
    Definition: type_set.h:53
    @ SCIP_STAGE_TRANSFORMING
    Definition: type_set.h:46
    @ SCIP_STAGE_PRESOLVED
    Definition: type_set.h:51
    enum SCIP_Stage SCIP_STAGE
    Definition: type_set.h:59
    @ SCIP_STATUS_UNBOUNDED
    Definition: type_stat.h:45
    @ SCIP_STATUS_INFORUNBD
    Definition: type_stat.h:46
    #define SCIP_PRESOLTIMING_FAST
    Definition: type_timing.h:52
    #define SCIP_PROPTIMING_ALWAYS
    Definition: type_timing.h:73
    @ SCIP_NODETYPE_PROBINGNODE
    Definition: type_tree.h:42
    @ SCIP_VARTYPE_CONTINUOUS
    Definition: type_var.h:71
    @ SCIP_VARTYPE_BINARY
    Definition: type_var.h:64
    @ SCIP_BOUNDCHGTYPE_BRANCHING
    Definition: type_var.h:131
    @ SCIP_VARSTATUS_ORIGINAL
    Definition: type_var.h:51
    SCIP_DOMCHGBOUND domchgbound
    Definition: struct_var.h:168
    internal methods for problem variables