Scippy

    SCIP

    Solving Constraint Integer Programs

    sol.c
    Go to the documentation of this file.
    1/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
    2/* */
    3/* This file is part of the program and library */
    4/* SCIP --- Solving Constraint Integer Programs */
    5/* */
    6/* Copyright (c) 2002-2026 Zuse Institute Berlin (ZIB) */
    7/* */
    8/* Licensed under the Apache License, Version 2.0 (the "License"); */
    9/* you may not use this file except in compliance with the License. */
    10/* You may obtain a copy of the License at */
    11/* */
    12/* http://www.apache.org/licenses/LICENSE-2.0 */
    13/* */
    14/* Unless required by applicable law or agreed to in writing, software */
    15/* distributed under the License is distributed on an "AS IS" BASIS, */
    16/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
    17/* See the License for the specific language governing permissions and */
    18/* limitations under the License. */
    19/* */
    20/* You should have received a copy of the Apache-2.0 license */
    21/* along with SCIP; see the file LICENSE. If not visit scipopt.org. */
    22/* */
    23/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
    24
    25/**@file sol.c
    26 * @ingroup OTHER_CFILES
    27 * @brief methods for storing primal CIP solutions
    28 * @author Tobias Achterberg
    29 */
    30
    31/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
    32#include "scip/clock.h"
    33#include "scip/cons.h"
    34#include "scip/lp.h"
    35#include "scip/lpexact.h"
    36#include "scip/misc.h"
    37#include "scip/nlp.h"
    38#include "scip/primal.h"
    39#include "scip/prob.h"
    40#include "scip/pub_lp.h"
    41#include "scip/pub_message.h"
    42#include "scip/pub_sol.h"
    43#include "scip/pub_var.h"
    44#include "scip/relax.h"
    45#include "scip/set.h"
    46#include "scip/sol.h"
    47#include "scip/stat.h"
    48#include "scip/struct_lp.h"
    49#include "scip/struct_lpexact.h"
    50#include "scip/struct_prob.h"
    51#include "scip/struct_set.h"
    52#include "scip/struct_sol.h"
    53#include "scip/struct_stat.h"
    54#include "scip/struct_var.h"
    55#include "scip/tree.h"
    56#include "scip/var.h"
    57
    58
    59/** clears solution arrays of primal CIP solution */
    60static
    62 SCIP_SOL* sol /**< primal CIP solution */
    63 )
    64{
    65 assert(sol != NULL);
    66
    68 sol->hasinfval = FALSE;
    69
    70 if( SCIPsolIsExact(sol) )
    71 {
    73 }
    74
    75 return SCIP_OKAY;
    76}
    77
    78/** sets value of variable in the solution's array */
    79static
    81 SCIP_SOL* sol, /**< primal CIP solution */
    82 SCIP_SET* set, /**< global SCIP settings */
    83 SCIP_VAR* var, /**< problem variable */
    84 SCIP_Real val /**< value to set variable to */
    85 )
    86{
    87 int idx;
    88
    89 assert(sol != NULL);
    90
    91 idx = SCIPvarGetIndex(var);
    92
    93 /* from now on, variable must not be deleted */
    95
    96 /* mark the variable valid */
    97 SCIP_CALL( SCIPboolarraySetVal(sol->valid, set->mem_arraygrowinit, set->mem_arraygrowfac, idx, TRUE) );
    98
    99 /* set the value in the solution array */
    100 SCIP_CALL( SCIPrealarraySetVal(sol->vals, set->mem_arraygrowinit, set->mem_arraygrowfac, idx, val) );
    101
    102 /* store whether the solution has infinite values assigned to variables */
    103 if( val != SCIP_UNKNOWN ) /*lint !e777*/
    104 sol->hasinfval = (sol->hasinfval || SCIPsetIsInfinity(set, val) || SCIPsetIsInfinity(set, -val));
    105
    106 return SCIP_OKAY;
    107}
    108
    109/** sets value of variable in the exact solution's array */
    110static
    112 SCIP_SOL* sol, /**< primal CIP solution */
    113 SCIP_SET* set, /**< global SCIP settings */
    114 SCIP_VAR* var, /**< problem variable */
    115 SCIP_RATIONAL* val /**< value to set variable to */
    116 )
    117{
    118 int idx;
    119
    120 assert(sol != NULL);
    121 assert(SCIPsolIsExact(sol));
    122
    123 idx = SCIPvarGetIndex(var);
    124
    125 /* from now on, variable must not be deleted */
    127
    128 /* mark the variable valid */
    129 SCIP_CALL( SCIPboolarraySetVal(sol->valsexact->valid, set->mem_arraygrowinit, set->mem_arraygrowfac, idx, TRUE) );
    130
    131 /* set the value in the solution array */
    133
    134 /* store whether the solution has infinite values assigned to variables */
    135 if( SCIPrationalIsAbsInfinity(val) ) /*lint !e777*/
    136 sol->hasinfval = TRUE;
    137
    138 return SCIP_OKAY;
    139}
    140
    141/** increases value of variable in the solution's array */
    142static
    144 SCIP_SOL* sol, /**< primal CIP solution */
    145 SCIP_SET* set, /**< global SCIP settings */
    146 SCIP_VAR* var, /**< problem variable */
    147 SCIP_Real incval /**< increase of variable's solution value */
    148 )
    149{
    150 int idx;
    151
    152 assert(sol != NULL);
    153
    154 idx = SCIPvarGetIndex(var);
    155
    156 /* from now on, variable must not be deleted */
    158
    159 /* if the variable was not valid, mark it to be valid and set the value to the incval (it is 0.0 if not valid) */
    160 if( !SCIPboolarrayGetVal(sol->valid, idx) )
    161 {
    162 /* mark the variable valid */
    163 SCIP_CALL( SCIPboolarraySetVal(sol->valid, set->mem_arraygrowinit, set->mem_arraygrowfac, idx, TRUE) );
    164
    165 /* set the value in the solution array */
    166 SCIP_CALL( SCIPrealarraySetVal(sol->vals, set->mem_arraygrowinit, set->mem_arraygrowfac, idx, incval) );
    167 }
    168 else
    169 {
    170 /* increase the value in the solution array */
    171 SCIP_CALL( SCIPrealarrayIncVal(sol->vals, set->mem_arraygrowinit, set->mem_arraygrowfac, idx, incval) );
    172 }
    173
    174 /* store whether the solution has infinite values assigned to variables */
    175 incval = SCIPrealarrayGetVal(sol->vals, idx);
    176 if( incval != SCIP_UNKNOWN ) /*lint !e777*/
    177 sol->hasinfval = (sol->hasinfval || SCIPsetIsInfinity(set, incval) || SCIPsetIsInfinity(set, -incval));
    178
    179 return SCIP_OKAY;
    180}
    181
    182/** returns the value of the variable in the given solution */
    183static
    185 SCIP_SOL* sol, /**< primal CIP solution */
    186 SCIP_VAR* var /**< problem variable */
    187 )
    188{
    189 int idx;
    190
    191 assert(sol != NULL);
    192
    193 idx = SCIPvarGetIndex(var);
    194
    195 /* check, if the variable's value is valid */
    196 if( SCIPboolarrayGetVal(sol->valid, idx) )
    197 {
    198 return SCIPrealarrayGetVal(sol->vals, idx);
    199 }
    200 else
    201 {
    202 /* return the variable's value corresponding to the origin */
    203 switch( sol->solorigin )
    204 {
    207 return 0.0;
    208
    210 return SCIPvarGetLPSol(var);
    211
    213 return SCIPvarGetNLPSol(var);
    214
    216 return SCIPvarGetRelaxSolTransVar(var);
    217
    219 return SCIPvarGetPseudoSol(var);
    220
    223 return SCIP_UNKNOWN;
    224
    225 default:
    226 SCIPerrorMessage("unknown solution origin <%d>\n", sol->solorigin);
    227 SCIPABORT();
    228 return 0.0; /*lint !e527*/
    229 }
    230 }
    231}
    232
    233/** returns the value of the variable in the given exact solution */
    234static
    236 SCIP_RATIONAL* res, /**< buffer to store result */
    237 SCIP_SOL* sol, /**< primal CIP solution */
    238 SCIP_VAR* var /**< problem variable */
    239 )
    240{
    241 int idx;
    242
    243 assert(sol != NULL);
    244 assert(SCIPsolIsExact(sol));
    245
    246 idx = SCIPvarGetIndex(var);
    247
    248 /* check, if the variable's value is valid */
    249 if( SCIPboolarrayGetVal(sol->valsexact->valid, idx) )
    250 {
    251 SCIPrationalarrayGetVal(sol->valsexact->vals, idx, res);
    252 }
    253 else
    254 {
    255 /* return the variable's value corresponding to the origin */
    256 switch( sol->solorigin )
    257 {
    260 SCIPrationalSetReal(res, 0.0);
    261 break;
    262
    264 SCIPvarGetLPSolExact(var, res);
    265 break;
    266
    269 break;
    270
    275 default:
    276 SCIPerrorMessage("unknown solution origin <%d>\n", sol->solorigin);
    277 SCIPABORT();
    278 return; /*lint !e527*/
    279 }
    280 }
    281}
    282
    283/** stores solution value of variable in solution's own array */
    284static
    286 SCIP_SOL* sol, /**< primal CIP solution */
    287 SCIP_SET* set, /**< global SCIP settings */
    288 SCIP_VAR* var /**< problem variable */
    289 )
    290{
    291 SCIP_Real solval;
    292
    293 assert(sol != NULL);
    294 assert(var != NULL);
    295 assert(SCIPvarIsTransformed(var));
    297
    298 /* if variable is already valid, nothing has to be done */
    300 return SCIP_OKAY;
    301
    302 SCIPsetDebugMsg(set, "unlinking solution value of variable <%s>\n", SCIPvarGetName(var));
    303
    304 /* store the correct solution value into the solution array */
    305 switch( sol->solorigin )
    306 {
    308 SCIPerrorMessage("cannot unlink solutions of original problem space\n");
    309 return SCIP_INVALIDDATA;
    310
    312 return SCIP_OKAY;
    313
    315 solval = SCIPvarGetLPSol(var);
    316 SCIP_CALL( solSetArrayVal(sol, set, var, solval) );
    317 return SCIP_OKAY;
    318
    320 solval = SCIPvarGetNLPSol(var);
    321 SCIP_CALL( solSetArrayVal(sol, set, var, solval) );
    322 return SCIP_OKAY;
    323
    325 solval = SCIPvarGetRelaxSolTransVar(var);
    326 SCIP_CALL( solSetArrayVal(sol, set, var, solval) );
    327 return SCIP_OKAY;
    328
    330 solval = SCIPvarGetPseudoSol(var);
    331 SCIP_CALL( solSetArrayVal(sol, set, var, solval) );
    332 return SCIP_OKAY;
    333
    337 return SCIP_OKAY;
    338
    339 default:
    340 SCIPerrorMessage("unknown solution origin <%d>\n", sol->solorigin);
    341 return SCIP_INVALIDDATA;
    342 }
    343}
    344
    345/** stores solution value of variable in exact solution's own array */
    346static
    348 SCIP_SOL* sol, /**< primal CIP solution */
    349 SCIP_SET* set, /**< global SCIP settings */
    350 SCIP_VAR* var /**< problem variable */
    351 )
    352{
    353 SCIP_RATIONAL* solval;
    354
    355 assert(sol != NULL);
    356 assert(var != NULL);
    357 assert(SCIPsolIsExact(sol));
    358 assert(SCIPvarIsTransformed(var));
    360
    361 /* if variable is already valid, nothing has to be done */
    363 return SCIP_OKAY;
    364
    365 SCIPsetDebugMsg(set, "unlinking solution value of variable <%s>\n", SCIPvarGetName(var));
    366
    367 /* store the correct solution value into the solution array */
    368 switch( sol->solorigin )
    369 {
    371 SCIPerrorMessage("cannot unlink solutions of original problem space\n");
    372 return SCIP_INVALIDDATA;
    373
    375 return SCIP_OKAY;
    376
    378 SCIP_CALL( SCIPrationalCreateBuffer(set->buffer, &solval) );
    379 SCIPvarGetLPSolExact(var, solval);
    380 SCIP_CALL( solSetArrayValExact(sol, set, var, solval) );
    381 SCIPrationalFreeBuffer(set->buffer, &solval);
    382 return SCIP_OKAY;
    383
    386 return SCIP_OKAY;
    387
    392 default:
    393 SCIPerrorMessage("unknown solution origin <%d>\n", sol->solorigin);
    394 return SCIP_INVALIDDATA;
    395 }
    396}
    397
    398/** sets the solution time, nodenum, runnum, and depth stamp to the current values */
    399static
    401 SCIP_SOL* sol, /**< primal CIP solution */
    402 SCIP_STAT* stat, /**< problem statistics data */
    403 SCIP_TREE* tree, /**< branch and bound tree, or NULL */
    404 SCIP_Bool checktime /**< should the time be updated? */
    405 )
    406{
    407 assert(sol != NULL);
    408 assert(stat != NULL);
    409
    410 if( checktime )
    411 {
    412 sol->time = SCIPclockGetTime(stat->solvingtime);
    413#ifndef NDEBUG
    414 sol->lpcount = stat->lpcount;
    415#endif
    416 }
    417 else
    419 sol->nodenum = stat->nnodes;
    420 sol->runnum = stat->nruns;
    421 if( tree == NULL )
    422 sol->depth = -1;
    423 else
    424 sol->depth = SCIPtreeGetCurrentDepth(tree);
    425}
    426
    427/** creates primal CIP solution, initialized to zero */
    429 SCIP_SOL** sol, /**< pointer to primal CIP solution */
    430 BMS_BLKMEM* blkmem, /**< block memory */
    431 SCIP_SET* set, /**< global SCIP settings */
    432 SCIP_STAT* stat, /**< problem statistics data */
    433 SCIP_PRIMAL* primal, /**< primal data */
    434 SCIP_TREE* tree, /**< branch and bound tree */
    435 SCIP_HEUR* heur /**< heuristic that found the solution (or NULL if it's from the tree) */
    436 )
    437{
    438 assert(sol != NULL);
    439 assert(blkmem != NULL);
    440 assert(stat != NULL);
    441
    442 SCIP_ALLOC( BMSallocBlockMemory(blkmem, sol) );
    443 SCIP_CALL( SCIPrealarrayCreate(&(*sol)->vals, blkmem) );
    444 SCIP_CALL( SCIPboolarrayCreate(&(*sol)->valid, blkmem) );
    445
    446 (*sol)->solorigin = SCIP_SOLORIGIN_ZERO;
    447 (*sol)->obj = 0.0;
    448 (*sol)->primalindex = -1;
    449 (*sol)->index = stat->solindex;
    450 (*sol)->hasinfval = FALSE;
    451 (*sol)->valsexact = NULL;
    452#ifndef NDEBUG
    453 (*sol)->scip = set->scip;
    454#endif
    455
    457 stat->solindex++;
    458 solStamp(*sol, stat, tree, TRUE);
    460
    461 /* set solution type and creator depending on whether a heuristic or NULL is passed */
    462 SCIPsolSetHeur(*sol, heur);
    463
    464 SCIP_CALL( SCIPprimalSolCreated(primal, set, *sol) );
    465
    466 return SCIP_OKAY;
    467}
    468
    469/** creates primal CIP solution with exact rational values, initialized to zero */
    471 SCIP_SOL** sol, /**< pointer to primal CIP solution */
    472 BMS_BLKMEM* blkmem, /**< block memory */
    473 SCIP_SET* set, /**< global SCIP settings */
    474 SCIP_STAT* stat, /**< problem statistics data */
    475 SCIP_PRIMAL* primal, /**< primal data */
    476 SCIP_TREE* tree, /**< branch and bound tree */
    477 SCIP_HEUR* heur /**< heuristic that found the solution (or NULL if it's from the tree) */
    478 )
    479{
    480 assert(sol != NULL);
    481 assert(blkmem != NULL);
    482 assert(stat != NULL);
    483
    484 SCIP_CALL( SCIPsolCreate(sol, blkmem, set, stat, primal, tree, heur) );
    485
    486 SCIP_ALLOC( BMSallocBlockMemory(blkmem, &(*sol)->valsexact) );
    487 SCIP_CALL( SCIPrationalarrayCreate(&(*sol)->valsexact->vals, blkmem) );
    488 SCIP_CALL( SCIPboolarrayCreate(&(*sol)->valsexact->valid, blkmem) );
    489 SCIP_CALL( SCIPrationalCreateBlock(blkmem, &(*sol)->valsexact->obj) );
    490
    491 assert(SCIPsolIsExact(*sol));
    492
    493 return SCIP_OKAY;
    494}
    495
    496/** creates a copy of exact solution data */
    498 SCIP_VALSEXACT** valsexact, /**< pointer to store the copy of the primal CIP solution */
    499 BMS_BLKMEM* blkmem, /**< block memory */
    500 SCIP_VALSEXACT* sourcevals /**< primal CIP solution to copy */
    501 )
    502{
    503 assert(valsexact != NULL);
    504
    505 SCIP_ALLOC( BMSallocBlockMemory(blkmem, valsexact) );
    506 SCIP_CALL( SCIPrationalarrayCopy(&(*valsexact)->vals, blkmem, sourcevals->vals) );
    507 SCIP_CALL( SCIPboolarrayCopy(&(*valsexact)->valid, blkmem, sourcevals->valid) );
    508 SCIP_CALL( SCIPrationalCopyBlock(blkmem, &(*valsexact)->obj, sourcevals->obj) );
    509
    510 return SCIP_OKAY;
    511}
    512
    513/** creates primal CIP solution in original problem space, initialized to the offset in the original problem */
    515 SCIP_SOL** sol, /**< pointer to primal CIP solution */
    516 BMS_BLKMEM* blkmem, /**< block memory */
    517 SCIP_SET* set, /**< global SCIP settings */
    518 SCIP_STAT* stat, /**< problem statistics data */
    519 SCIP_PROB* origprob, /**< original problem data */
    520 SCIP_PRIMAL* primal, /**< primal data */
    521 SCIP_TREE* tree, /**< branch and bound tree */
    522 SCIP_HEUR* heur /**< heuristic that found the solution (or NULL if it's from the tree) */
    523 )
    524{
    525 assert(sol != NULL);
    526 assert(blkmem != NULL);
    527 assert(stat != NULL);
    528
    529 SCIP_ALLOC( BMSallocBlockMemory(blkmem, sol) );
    530 SCIP_CALL( SCIPrealarrayCreate(&(*sol)->vals, blkmem) );
    531 SCIP_CALL( SCIPboolarrayCreate(&(*sol)->valid, blkmem) );
    532 (*sol)->solorigin = SCIP_SOLORIGIN_ORIGINAL;
    533 (*sol)->obj = origprob->objoffset;
    534 (*sol)->primalindex = -1;
    535 (*sol)->index = stat->solindex;
    536 (*sol)->hasinfval = FALSE;
    537 (*sol)->valsexact = NULL;
    538#ifndef NDEBUG
    539 (*sol)->scip = set->scip;
    540#endif
    541 stat->solindex++;
    542 solStamp(*sol, stat, tree, TRUE);
    543
    544 /* set solution type and creator depending on whether a heuristic or NULL is passed */
    545 SCIPsolSetHeur(*sol, heur);
    546
    548
    549 SCIP_CALL( SCIPprimalSolCreated(primal, set, *sol) );
    550
    551 return SCIP_OKAY;
    552}
    553
    554/** creates exact primal CIP solution in original problem space, initialized to the offset in the original problem */
    556 SCIP_SOL** sol, /**< pointer to primal CIP solution */
    557 BMS_BLKMEM* blkmem, /**< block memory */
    558 SCIP_SET* set, /**< global SCIP settings */
    559 SCIP_STAT* stat, /**< problem statistics data */
    560 SCIP_PROB* origprob, /**< original problem data */
    561 SCIP_PRIMAL* primal, /**< primal data */
    562 SCIP_TREE* tree, /**< branch and bound tree */
    563 SCIP_HEUR* heur /**< heuristic that found the solution (or NULL if it's from the tree) */
    564 )
    565{
    566 assert(sol != NULL);
    567 assert(blkmem != NULL);
    568 assert(stat != NULL);
    569
    570 SCIP_CALL( SCIPsolCreateOriginal(sol, blkmem, set, stat, origprob, primal, tree, heur) );
    571
    572 SCIP_ALLOC( BMSallocBlockMemory(blkmem, &(*sol)->valsexact ) );
    573 SCIP_CALL( SCIPrationalarrayCreate(&(*sol)->valsexact->vals, blkmem) );
    574 SCIP_CALL( SCIPboolarrayCreate(&(*sol)->valsexact->valid, blkmem) );
    575 SCIP_CALL( SCIPrationalCreateBlock(blkmem, &(*sol)->valsexact->obj) );
    576
    577 assert(SCIPsolIsExact(*sol));
    578
    579 return SCIP_OKAY;
    580}
    581
    582/** creates a copy of a primal CIP solution */
    584 SCIP_SOL** sol, /**< pointer to store the copy of the primal CIP solution */
    585 BMS_BLKMEM* blkmem, /**< block memory */
    586 SCIP_SET* set, /**< global SCIP settings */
    587 SCIP_STAT* stat, /**< problem statistics data */
    588 SCIP_PRIMAL* primal, /**< primal data */
    589 SCIP_SOL* sourcesol /**< primal CIP solution to copy */
    590 )
    591{
    592 assert(sol != NULL);
    593 assert(sourcesol != NULL);
    594
    595 SCIP_ALLOC( BMSallocBlockMemory(blkmem, sol) );
    596 SCIP_CALL( SCIPrealarrayCopy(&(*sol)->vals, blkmem, sourcesol->vals) );
    597 SCIP_CALL( SCIPboolarrayCopy(&(*sol)->valid, blkmem, sourcesol->valid) );
    598
    599 /* copy solution type and creator information */
    600 switch( sourcesol->type )
    601 {
    606 (*sol)->type = sourcesol->type;
    607 break;
    609 SCIPsolSetHeur((*sol), SCIPsolGetHeur(sourcesol));
    610 break;
    612 SCIPsolSetRelax((*sol), SCIPsolGetRelax(sourcesol));
    613 break;
    614 default:
    615 SCIPerrorMessage("Unknown source solution type %d!\n", sourcesol->type);
    616 return SCIP_INVALIDDATA;
    617 }
    618 (*sol)->obj = sourcesol->obj;
    619 (*sol)->primalindex = -1;
    620 (*sol)->time = sourcesol->time;
    621#ifndef NDEBUG
    622 (*sol)->lpcount = sourcesol->lpcount;
    623#endif
    624 (*sol)->nodenum = sourcesol->nodenum;
    625 (*sol)->solorigin = sourcesol->solorigin;
    626 (*sol)->runnum = sourcesol->runnum;
    627 (*sol)->depth = sourcesol->depth;
    628 (*sol)->index = stat->solindex;
    629 (*sol)->hasinfval = sourcesol->hasinfval;
    630 stat->solindex++;
    631 (*sol)->viol.absviolbounds = sourcesol->viol.absviolbounds;
    632 (*sol)->viol.absviolcons = sourcesol->viol.absviolcons;
    633 (*sol)->viol.absviolintegrality = sourcesol->viol.absviolintegrality;
    634 (*sol)->viol.absviollprows = sourcesol->viol.absviollprows;
    635 (*sol)->viol.relviolbounds = sourcesol->viol.relviolbounds;
    636 (*sol)->viol.relviolcons = sourcesol->viol.relviolcons;
    637 (*sol)->viol.relviollprows = sourcesol->viol.relviollprows;
    638#ifndef NDEBUG
    639 (*sol)->scip = set->scip;
    640#endif
    641
    642 /* copy rational values if solution is exact */
    643 if( SCIPsolIsExact(sourcesol) )
    644 {
    645 SCIP_CALL( SCIPvalsExactCopy( &(*sol)->valsexact, blkmem, sourcesol->valsexact) );
    646 }
    647 else
    648 (*sol)->valsexact = NULL;
    649
    650 SCIP_CALL( SCIPprimalSolCreated(primal, set, *sol) );
    651
    652 return SCIP_OKAY;
    653}
    654
    655/** transformes given original solution to the transformed space; a corresponding transformed solution has to be given
    656 * which is copied into the existing solution and freed afterwards
    657 */
    659 SCIP_SOL* sol, /**< primal CIP solution to change, living in original space */
    660 SCIP_SOL** transsol, /**< pointer to corresponding transformed primal CIP solution */
    661 BMS_BLKMEM* blkmem, /**< block memory */
    662 SCIP_SET* set, /**< global SCIP settings */
    663 SCIP_PRIMAL* primal /**< primal data */
    664 )
    665{ /*lint --e{715}*/
    666 SCIP_REALARRAY* tmpvals;
    667 SCIP_BOOLARRAY* tmpvalid;
    668 SCIP_SOL* tsol;
    669
    670 assert(sol != NULL);
    671 assert(transsol != NULL);
    672 assert(set != NULL);
    673 assert(SCIPsolIsOriginal(sol));
    674 assert(sol->primalindex > -1);
    675
    676 tsol = *transsol;
    677 assert(tsol != NULL);
    678 assert(!SCIPsolIsOriginal(tsol));
    679
    680 /* switch vals and valid arrays; the exisiting solution gets the arrays of the transformed solution;
    681 * the transformed one gets the original arrays, because they have to be freed anyway and freeing the transsol
    682 * automatically frees its arrays
    683 */
    684 tmpvals = sol->vals;
    685 tmpvalid = sol->valid;
    686 sol->vals = tsol->vals;
    687 sol->valid = tsol->valid;
    688 tsol->vals = tmpvals;
    689 tsol->valid = tmpvalid;
    690 if( SCIPsolIsExact(sol) )
    691 {
    692 SCIP_VALSEXACT* tmpvalsexact;
    693 tmpvalsexact = sol->valsexact;
    694 sol->valsexact = tsol->valsexact;
    695 tsol->valsexact = tmpvalsexact;
    696 }
    697
    698 /* copy solorigin and objective (should be the same, only to avoid numerical issues);
    699 * we keep the other statistics of the original solution, since that was the first time that this solution as found
    700 */
    701 sol->solorigin = tsol->solorigin;
    702 sol->obj = tsol->obj;
    703
    704 SCIP_CALL( SCIPsolFree(transsol, blkmem, primal) );
    705
    706 return SCIP_OKAY;
    707}
    708
    709/** adjusts solution values of implied integral variables in handed solution, solution objective value is not
    710 * deteriorated by this method
    711 */
    713 SCIP_SOL* sol, /**< primal CIP solution */
    714 SCIP_SET* set, /**< global SCIP settings */
    715 SCIP_STAT* stat, /**< problem statistics data */
    716 SCIP_PROB* prob, /**< either original or transformed problem, depending on sol origin */
    717 SCIP_TREE* tree, /**< branch and bound tree */
    718 SCIP_Bool uselprows /**< should LP row information be considered for none-objective variables */
    719 )
    720{
    721 SCIP_VAR** vars;
    722 int nimplvarsbegin;
    723 int nimplvarsend;
    724 int v;
    725
    726 assert(sol != NULL);
    727 assert(prob != NULL);
    728
    729 /* get number of implied integral variables */
    730 nimplvarsend = SCIPprobGetNImplVars(prob);
    731
    732 if( nimplvarsend == 0 )
    733 return SCIP_OKAY;
    734
    735 /* get range of implied integral variables */
    736 vars = SCIPprobGetVars(prob);
    737 nimplvarsbegin = SCIPprobGetNBinVars(prob) + SCIPprobGetNIntVars(prob);
    738 nimplvarsend += nimplvarsbegin;
    739
    740 /* loop over implied integral variables and round them up or down */
    741 for( v = nimplvarsbegin; v < nimplvarsend; ++v )
    742 {
    743 SCIP_VAR* var;
    744 SCIP_Real solval;
    745 SCIP_Real obj;
    746 SCIP_Real newsolval;
    747 SCIP_Bool roundup;
    748 SCIP_Bool rounddown;
    749 int nuplocks;
    750 int ndownlocks;
    751
    752 var = vars[v];
    753
    754 assert( SCIPvarIsImpliedIntegral(var) );
    755 solval = SCIPsolGetVal(sol, set, stat, var);
    756
    757 /* we do not need to round integral solution values or those of variables which are not column variables */
    759 continue;
    760
    763 obj = SCIPvarGetUnchangedObj(var);
    764
    765 roundup = FALSE;
    766 rounddown = FALSE;
    767
    768 /* in case of a non-zero objective coefficient, there is only one possible rounding direction */
    769 if( SCIPsetIsFeasNegative(set, obj) )
    770 roundup = TRUE;
    771 else if( SCIPsetIsFeasPositive(set, obj) )
    772 rounddown = TRUE;
    773 else if( uselprows )
    774 {
    775 /* determine rounding direction based on row violations */
    776 SCIP_COL* col;
    777 SCIP_ROW** rows;
    778 SCIP_Real* vals;
    779 int nrows;
    780 int r;
    781
    782 col = SCIPvarGetCol(var);
    783 vals = SCIPcolGetVals(col);
    784 rows = SCIPcolGetRows(col);
    785 nrows = SCIPcolGetNNonz(col);
    786
    787 /* loop over rows and search for equations whose violation can be decreased by rounding */
    788 for( r = 0; r < nrows && !(roundup && rounddown); ++r )
    789 {
    790 SCIP_ROW* row;
    791 SCIP_Real activity;
    792 SCIP_Real rhs;
    793 SCIP_Real lhs;
    794
    795 row = rows[r];
    796
    797 if( SCIProwIsLocal(row) || !SCIProwIsInLP(row) )
    798 continue;
    799
    800 rhs = SCIProwGetRhs(row);
    801 lhs = SCIProwGetLhs(row);
    802
    803 if( SCIPsetIsInfinity(set, rhs) || SCIPsetIsInfinity(set, -lhs) )
    804 continue;
    805
    806 activity = SCIProwGetSolActivity(row, set, stat, sol);
    807 if( SCIPsetIsFeasLE(set, activity, rhs) && SCIPsetIsFeasLE(set, lhs, activity) )
    808 continue;
    809
    810 assert(! SCIPsetIsZero(set, vals[r]));
    811 if( (SCIPsetIsFeasGT(set, activity, rhs) && SCIPsetIsPositive(set, vals[r]))
    812 || (SCIPsetIsFeasLT(set, activity, lhs) && SCIPsetIsNegative(set, vals[r])) )
    813 rounddown = TRUE;
    814 else
    815 roundup = TRUE;
    816 }
    817 }
    818
    819 /* in case of a tie, we select the rounding step based on the number of variable locks */
    820 if( roundup == rounddown )
    821 {
    822 rounddown = ndownlocks <= nuplocks;
    823 roundup = !rounddown;
    824 }
    825
    826 /* round the variable up or down */
    827 if( roundup )
    828 {
    829 newsolval = SCIPsetCeil(set, solval);
    830 assert(SCIPsetIsFeasLE(set, newsolval, SCIPvarGetUbGlobal(var)));
    831 }
    832 else
    833 {
    834 assert( rounddown ); /* should be true because of the code above */
    835 newsolval = SCIPsetFloor(set, solval);
    836 assert(SCIPsetIsFeasGE(set, newsolval, SCIPvarGetLbGlobal(var)));
    837 }
    838
    839 SCIP_CALL( SCIPsolSetVal(sol, set, stat, tree, var, newsolval) );
    840 }
    841
    842 return SCIP_OKAY;
    843}
    844
    845/** creates primal CIP solution, initialized to the current LP solution */
    847 SCIP_SOL** sol, /**< pointer to primal CIP solution */
    848 BMS_BLKMEM* blkmem, /**< block memory */
    849 SCIP_SET* set, /**< global SCIP settings */
    850 SCIP_STAT* stat, /**< problem statistics data */
    851 SCIP_PROB* prob, /**< transformed problem data */
    852 SCIP_PRIMAL* primal, /**< primal data */
    853 SCIP_TREE* tree, /**< branch and bound tree */
    854 SCIP_LP* lp, /**< current LP data */
    855 SCIP_HEUR* heur /**< heuristic that found the solution (or NULL if it's from the tree) */
    856 )
    857{
    858 assert(sol != NULL);
    859 assert(lp != NULL);
    860 assert(SCIPlpIsSolved(lp));
    861
    862 SCIP_CALL( SCIPsolCreate(sol, blkmem, set, stat, primal, tree, heur) );
    863 SCIP_CALL( SCIPsolLinkLPSol(*sol, set, stat, prob, tree, lp) );
    864
    865 return SCIP_OKAY;
    866}
    867
    868/** creates primal CIP solution with exact rational values, initialized to the current exact LP solution
    869 * (will use exact safe dual solution if lp was not solved exactly)
    870 */
    872 SCIP_SOL** sol, /**< pointer to primal CIP solution */
    873 BMS_BLKMEM* blkmem, /**< block memory */
    874 SCIP_SET* set, /**< global SCIP settings */
    875 SCIP_STAT* stat, /**< problem statistics data */
    876 SCIP_PRIMAL* primal, /**< primal data */
    877 SCIP_TREE* tree, /**< branch and bound tree */
    878 SCIP_LPEXACT* lp, /**< current LP data */
    879 SCIP_HEUR* heur /**< heuristic that found the solution (or NULL if it's from the tree) */
    880 )
    881{
    882 assert(sol != NULL);
    883 assert(lp != NULL);
    884 assert(lp->solved);
    885
    886 SCIP_CALL( SCIPsolCreateExact(sol, blkmem, set, stat, primal, tree, heur) );
    887 SCIP_CALL( SCIPsolLinkLPSolExact(*sol, set, lp) );
    888
    889 return SCIP_OKAY;
    890}
    891
    892/** creates primal CIP solution, initialized to the current NLP solution */
    894 SCIP_SOL** sol, /**< pointer to primal CIP solution */
    895 BMS_BLKMEM* blkmem, /**< block memory */
    896 SCIP_SET* set, /**< global SCIP settings */
    897 SCIP_STAT* stat, /**< problem statistics data */
    898 SCIP_PRIMAL* primal, /**< primal data */
    899 SCIP_TREE* tree, /**< branch and bound tree */
    900 SCIP_NLP* nlp, /**< current NLP data */
    901 SCIP_HEUR* heur /**< heuristic that found the solution (or NULL if it's from the tree) */
    902 )
    903{
    904 assert(sol != NULL);
    905 assert(nlp != NULL);
    906
    907 SCIP_CALL( SCIPsolCreate(sol, blkmem, set, stat, primal, tree, heur) );
    908 SCIP_CALL( SCIPsolLinkNLPSol(*sol, stat, tree, nlp) );
    909
    910 return SCIP_OKAY;
    911}
    912
    913/** creates primal CIP solution, initialized to the current relaxation solution */
    915 SCIP_SOL** sol, /**< pointer to primal CIP solution */
    916 BMS_BLKMEM* blkmem, /**< block memory */
    917 SCIP_SET* set, /**< global SCIP settings */
    918 SCIP_STAT* stat, /**< problem statistics data */
    919 SCIP_PRIMAL* primal, /**< primal data */
    920 SCIP_TREE* tree, /**< branch and bound tree */
    921 SCIP_RELAXATION* relaxation, /**< global relaxation data */
    922 SCIP_HEUR* heur /**< heuristic that found the solution (or NULL if it's from the tree) */
    923 )
    924{
    925 assert(sol != NULL);
    926 assert(relaxation != NULL);
    927 assert(SCIPrelaxationIsSolValid(relaxation));
    928
    929 SCIP_CALL( SCIPsolCreate(sol, blkmem, set, stat, primal, tree, heur) );
    930 SCIP_CALL( SCIPsolLinkRelaxSol(*sol, set, stat, tree, relaxation) );
    931
    932 /* update solution type and store relaxator as creator only if no heuristic is specified as creator */
    933 if( heur == NULL )
    935
    936 return SCIP_OKAY;
    937}
    938
    939/** creates primal CIP solution, initialized to the current pseudo solution */
    941 SCIP_SOL** sol, /**< pointer to primal CIP solution */
    942 BMS_BLKMEM* blkmem, /**< block memory */
    943 SCIP_SET* set, /**< global SCIP settings */
    944 SCIP_STAT* stat, /**< problem statistics data */
    945 SCIP_PROB* prob, /**< transformed problem data */
    946 SCIP_PRIMAL* primal, /**< primal data */
    947 SCIP_TREE* tree, /**< branch and bound tree, or NULL */
    948 SCIP_LP* lp, /**< current LP data */
    949 SCIP_HEUR* heur /**< heuristic that found the solution (or NULL if it's from the tree) */
    950 )
    951{
    952 assert(sol != NULL);
    953
    954 SCIP_CALL( SCIPsolCreate(sol, blkmem, set, stat, primal, tree, heur) );
    955 SCIP_CALL( SCIPsolLinkPseudoSol(*sol, set, stat, prob, tree, lp) );
    956
    957 /* update solution type to pseudo solution */
    958 if( heur == NULL )
    959 SCIPsolSetPseudo(*sol);
    960
    961 return SCIP_OKAY;
    962}
    963
    964/** creates primal CIP solution, initialized to the current exact pseudo solution */
    966 SCIP_SOL** sol, /**< pointer to primal CIP solution */
    967 BMS_BLKMEM* blkmem, /**< block memory */
    968 SCIP_SET* set, /**< global SCIP settings */
    969 SCIP_STAT* stat, /**< problem statistics data */
    970 SCIP_PRIMAL* primal, /**< primal data */
    971 SCIP_TREE* tree, /**< branch and bound tree, or NULL */
    972 SCIP_LPEXACT* lp, /**< current LP data */
    973 SCIP_HEUR* heur /**< heuristic that found the solution (or NULL if it's from the tree) */
    974 )
    975{
    976 assert(sol != NULL);
    977
    978 SCIP_CALL( SCIPsolCreateExact(sol, blkmem, set, stat, primal, tree, heur) );
    980
    981 return SCIP_OKAY;
    982}
    983
    984/** creates primal CIP solution, initialized to the current solution */
    986 SCIP_SOL** sol, /**< pointer to primal CIP solution */
    987 BMS_BLKMEM* blkmem, /**< block memory */
    988 SCIP_SET* set, /**< global SCIP settings */
    989 SCIP_STAT* stat, /**< problem statistics data */
    990 SCIP_PROB* prob, /**< transformed problem data */
    991 SCIP_PRIMAL* primal, /**< primal data */
    992 SCIP_TREE* tree, /**< branch and bound tree */
    993 SCIP_LP* lp, /**< current LP data */
    994 SCIP_HEUR* heur /**< heuristic that found the solution (or NULL if it's from the tree) */
    995 )
    996{
    997 assert(tree != NULL);
    998
    999 if( SCIPtreeHasCurrentNodeLP(tree) )
    1000 {
    1001 SCIP_CALL( SCIPsolCreateLPSol(sol, blkmem, set, stat, prob, primal, tree, lp, heur) );
    1002 }
    1003 else
    1004 {
    1005 SCIP_CALL( SCIPsolCreatePseudoSol(sol, blkmem, set, stat, prob, primal, tree, lp, heur) );
    1006 }
    1007
    1008 return SCIP_OKAY;
    1009}
    1010
    1011/** creates primal CIP solution with exact rational values, initialized to the current solution */
    1013 SCIP_SOL** sol, /**< pointer to primal CIP solution */
    1014 BMS_BLKMEM* blkmem, /**< block memory */
    1015 SCIP_SET* set, /**< global SCIP settings */
    1016 SCIP_STAT* stat, /**< problem statistics data */
    1017 SCIP_PRIMAL* primal, /**< primal data */
    1018 SCIP_TREE* tree, /**< branch and bound tree */
    1019 SCIP_LPEXACT* lp, /**< current LP data */
    1020 SCIP_HEUR* heur /**< heuristic that found the solution (or NULL if it's from the tree) */
    1021 )
    1022{
    1023 assert(tree != NULL);
    1024
    1025 if( SCIPtreeHasCurrentNodeLP(tree) )
    1026 {
    1027 assert(lp->solved);
    1028 SCIP_CALL( SCIPsolCreateLPSolExact(sol, blkmem, set, stat, primal, tree, lp, heur) );
    1029 }
    1030 else
    1031 {
    1032 SCIP_CALL( SCIPsolCreatePseudoSolExact(sol, blkmem, set, stat, primal, tree, lp, heur) );
    1033 }
    1034
    1035 return SCIP_OKAY;
    1036}
    1037
    1038/** creates partial primal CIP solution, initialized to unknown values */
    1040 SCIP_SOL** sol, /**< pointer to primal CIP solution */
    1041 BMS_BLKMEM* blkmem, /**< block memory */
    1042 SCIP_SET* set, /**< global SCIP settings */
    1043 SCIP_STAT* stat, /**< problem statistics data */
    1044 SCIP_PRIMAL* primal, /**< primal data */
    1045 SCIP_HEUR* heur /**< heuristic that found the solution (or NULL if it's from the tree) */
    1046 )
    1047{
    1048 assert(sol != NULL);
    1049 assert(blkmem != NULL);
    1050 assert(set != NULL);
    1051 assert(stat != NULL);
    1052 assert(primal != NULL);
    1053
    1054 SCIP_ALLOC( BMSallocBlockMemory(blkmem, sol) );
    1055 SCIP_CALL( SCIPrealarrayCreate(&(*sol)->vals, blkmem) );
    1056 SCIP_CALL( SCIPboolarrayCreate(&(*sol)->valid, blkmem) );
    1057 (*sol)->solorigin = SCIP_SOLORIGIN_PARTIAL;
    1058 (*sol)->obj = SCIP_UNKNOWN;
    1059 (*sol)->primalindex = -1;
    1060 (*sol)->index = stat->solindex;
    1061 (*sol)->hasinfval = FALSE;
    1062 (*sol)->valsexact = NULL;
    1063#ifndef NDEBUG
    1064 (*sol)->scip = set->scip;
    1065#endif
    1066 stat->solindex++;
    1067 solStamp(*sol, stat, NULL, TRUE);
    1069
    1070 /* set solution type and creator depending on whether a heuristic or NULL is passed */
    1071 SCIPsolSetHeur(*sol, heur);
    1072
    1073 SCIP_CALL( SCIPprimalSolCreated(primal, set, *sol) );
    1074
    1075 return SCIP_OKAY;
    1076}
    1077
    1078/** creates primal CIP solution, initialized to unknown values */
    1080 SCIP_SOL** sol, /**< pointer to primal CIP solution */
    1081 BMS_BLKMEM* blkmem, /**< block memory */
    1082 SCIP_SET* set, /**< global SCIP settings */
    1083 SCIP_STAT* stat, /**< problem statistics data */
    1084 SCIP_PRIMAL* primal, /**< primal data */
    1085 SCIP_TREE* tree, /**< branch and bound tree */
    1086 SCIP_HEUR* heur /**< heuristic that found the solution (or NULL if it's from the tree) */
    1087 )
    1088{
    1089 assert(sol != NULL);
    1090 assert(blkmem != NULL);
    1091 assert(stat != NULL);
    1092
    1093 SCIP_ALLOC( BMSallocBlockMemory(blkmem, sol) );
    1094 SCIP_CALL( SCIPrealarrayCreate(&(*sol)->vals, blkmem) );
    1095 SCIP_CALL( SCIPboolarrayCreate(&(*sol)->valid, blkmem) );
    1096 (*sol)->solorigin = SCIP_SOLORIGIN_UNKNOWN;
    1097 (*sol)->obj = 0.0;
    1098 (*sol)->primalindex = -1;
    1099 (*sol)->index = stat->solindex;
    1100 (*sol)->hasinfval = FALSE;
    1101 (*sol)->valsexact = NULL;
    1102 stat->solindex++;
    1103 solStamp(*sol, stat, tree, TRUE);
    1105
    1106 /* set solution type and creator depending on whether a heuristic or NULL is passed */
    1107 SCIPsolSetHeur(*sol, heur);
    1108
    1109 SCIP_CALL( SCIPprimalSolCreated(primal, set, *sol) );
    1110
    1111 return SCIP_OKAY;
    1112}
    1113
    1114/** frees exact solution values */
    1115static
    1117 SCIP_VALSEXACT** valsexact, /**< pointer to primal CIP solution */
    1118 BMS_BLKMEM* blkmem /**< block memory */
    1119 )
    1120{
    1121 assert(valsexact != NULL);
    1122 assert(*valsexact != NULL);
    1123
    1124 SCIPrationalFreeBlock(blkmem, &(*valsexact)->obj);
    1125 SCIP_CALL( SCIPrationalarrayFree(&(*valsexact)->vals, blkmem) );
    1126 SCIP_CALL( SCIPboolarrayFree(&(*valsexact)->valid) );
    1127 BMSfreeBlockMemory(blkmem, valsexact);
    1128
    1129 return SCIP_OKAY;
    1130}
    1131
    1132/** frees primal CIP solution */
    1134 SCIP_SOL** sol, /**< pointer to primal CIP solution */
    1135 BMS_BLKMEM* blkmem, /**< block memory */
    1136 SCIP_PRIMAL* primal /**< primal data */
    1137 )
    1138{
    1139 assert(sol != NULL);
    1140 assert(*sol != NULL);
    1141
    1142 SCIPprimalSolFreed(primal, *sol);
    1143
    1144 SCIP_CALL( SCIPrealarrayFree(&(*sol)->vals) );
    1145 SCIP_CALL( SCIPboolarrayFree(&(*sol)->valid) );
    1146 if( SCIPsolIsExact(*sol) )
    1147 {
    1148 SCIP_CALL( valsExactFree(&((*sol)->valsexact), blkmem) );
    1149 }
    1150 BMSfreeBlockMemory(blkmem, sol);
    1151
    1152 return SCIP_OKAY;
    1153}
    1154
    1155/** copies current LP solution into CIP solution by linking */
    1157 SCIP_SOL* sol, /**< primal CIP solution */
    1158 SCIP_SET* set, /**< global SCIP settings */
    1159 SCIP_STAT* stat, /**< problem statistics data */
    1160 SCIP_PROB* prob, /**< transformed problem data */
    1161 SCIP_TREE* tree, /**< branch and bound tree */
    1162 SCIP_LP* lp /**< current LP data */
    1163 )
    1164{
    1165 assert(sol != NULL);
    1166 assert(stat != NULL);
    1167 assert(tree != NULL);
    1168 assert(lp != NULL);
    1169 assert(lp->solved);
    1170 assert(SCIPlpDiving(lp) || SCIPtreeProbing(tree) || !SCIPlpDivingObjChanged(lp));
    1171
    1172 SCIPsetDebugMsg(set, "linking solution to LP\n");
    1173
    1174 /* clear the old solution arrays */
    1175 SCIP_CALL( solClearArrays(sol) );
    1176
    1177 /* link solution to LP solution */
    1178 if( SCIPlpDivingObjChanged(lp) )
    1179 {
    1180 /* the objective value has to be calculated manually, because the LP's value is invalid;
    1181 * use objective values of variables, because columns objective values are changed to dive values
    1182 */
    1183 sol->obj = SCIPlpGetLooseObjval(lp, set, prob);
    1184 if( !SCIPsetIsInfinity(set, -sol->obj) )
    1185 {
    1186 SCIP_VAR* var;
    1187 SCIP_COL** cols;
    1188 int ncols;
    1189 int c;
    1190
    1191 cols = SCIPlpGetCols(lp);
    1192 ncols = SCIPlpGetNCols(lp);
    1193 for( c = 0; c < ncols; ++c )
    1194 {
    1195 var = SCIPcolGetVar(cols[c]);
    1196 sol->obj += SCIPvarGetUnchangedObj(var) * cols[c]->primsol;
    1197 }
    1198 }
    1199 }
    1200 else
    1201 {
    1202 /* the objective value in the columns is correct, s.t. the LP's objective value is also correct */
    1203 sol->obj = SCIPlpGetObjval(lp, set, prob);
    1204 }
    1206 solStamp(sol, stat, tree, TRUE);
    1207
    1208 SCIPsetDebugMsg(set, " -> objective value: %g\n", sol->obj);
    1209
    1210 return SCIP_OKAY;
    1211}
    1212
    1213/** copies current exact LP solution into exact CIP solution by linking */
    1215 SCIP_SOL* sol, /**< primal CIP solution */
    1216 SCIP_SET* set, /**< global SCIP settings */
    1217 SCIP_LPEXACT* lp /**< current LP data */
    1218 )
    1219{
    1220 assert(sol != NULL);
    1221 assert(lp != NULL);
    1222 assert(lp->solved);
    1223 assert(SCIPsolIsExact(sol));
    1224
    1225 /* clear the old solution arrays */
    1226 SCIP_CALL( solClearArrays(sol) );
    1227
    1228 /* the objective value in the columns is correct, s.t. the LP's objective value is also correct */
    1232
    1233 return SCIP_OKAY;
    1234}
    1235
    1236/** copies current NLP solution into CIP solution by linking */
    1238 SCIP_SOL* sol, /**< primal CIP solution */
    1239 SCIP_STAT* stat, /**< problem statistics data */
    1240 SCIP_TREE* tree, /**< branch and bound tree */
    1241 SCIP_NLP* nlp /**< current NLP data */
    1242 )
    1243{
    1244 assert(sol != NULL);
    1245 assert(stat != NULL);
    1246 assert(tree != NULL);
    1247 assert(nlp != NULL);
    1248 assert(SCIPnlpHasSolution(nlp));
    1249
    1250 SCIPstatDebugMsg(stat, "linking solution to NLP\n");
    1251
    1252 /* clear the old solution arrays */
    1253 SCIP_CALL( solClearArrays(sol) );
    1254
    1255 /* get objective value of NLP solution */
    1256 if( SCIPnlpIsDivingObjChanged(nlp) )
    1257 {
    1258 /* the objective value has to be calculated manually, because the NLP's value is invalid */
    1259
    1260 SCIP_VAR** vars;
    1261 int nvars;
    1262 int v;
    1263
    1264 sol->obj = 0.0;
    1265
    1266 vars = SCIPnlpGetVars(nlp);
    1267 nvars = SCIPnlpGetNVars(nlp);
    1268 for( v = 0; v < nvars; ++v )
    1269 {
    1270 assert(SCIPvarIsActive(vars[v]));
    1271 sol->obj += SCIPvarGetUnchangedObj(vars[v]) * SCIPvarGetNLPSol(vars[v]);
    1272 }
    1273 }
    1274 else
    1275 {
    1276 sol->obj = SCIPnlpGetObjval(nlp);
    1277 }
    1278
    1280 solStamp(sol, stat, tree, TRUE);
    1281
    1282 SCIPstatDebugMsg(stat, " -> objective value: %g\n", sol->obj);
    1283
    1284 return SCIP_OKAY;
    1285}
    1286
    1287/** copies current relaxation solution into CIP solution by linking */
    1289 SCIP_SOL* sol, /**< primal CIP solution */
    1290 SCIP_SET* set, /**< global SCIP settings */
    1291 SCIP_STAT* stat, /**< problem statistics data */
    1292 SCIP_TREE* tree, /**< branch and bound tree */
    1293 SCIP_RELAXATION* relaxation /**< global relaxation data */
    1294 )
    1295{ /*lint --e{715}*/
    1296 assert(sol != NULL);
    1297 assert(stat != NULL);
    1298 assert(tree != NULL);
    1299 assert(relaxation != NULL);
    1300 assert(SCIPrelaxationIsSolValid(relaxation));
    1301
    1302 SCIPsetDebugMsg(set, "linking solution to relaxation\n");
    1303
    1304 /* clear the old solution arrays */
    1305 SCIP_CALL( solClearArrays(sol) );
    1306
    1307 /* the objective value in the columns is correct, s.t. the LP's objective value is also correct */
    1308 sol->obj = SCIPrelaxationGetSolObj(relaxation);
    1310 solStamp(sol, stat, tree, TRUE);
    1311
    1312 SCIPsetDebugMsg(set, " -> objective value: %g\n", sol->obj);
    1313
    1314 return SCIP_OKAY;
    1315}
    1316
    1317/** copies current pseudo solution into CIP solution by linking */
    1319 SCIP_SOL* sol, /**< primal CIP solution */
    1320 SCIP_SET* set, /**< global SCIP settings */
    1321 SCIP_STAT* stat, /**< problem statistics data */
    1322 SCIP_PROB* prob, /**< transformed problem data */
    1323 SCIP_TREE* tree, /**< branch and bound tree, or NULL */
    1324 SCIP_LP* lp /**< current LP data */
    1325 )
    1326{
    1327 assert(sol != NULL);
    1328 assert(stat != NULL);
    1329 assert(tree != NULL);
    1330
    1331 SCIPsetDebugMsg(set, "linking solution to pseudo solution\n");
    1332
    1333 /* clear the old solution arrays */
    1334 SCIP_CALL( solClearArrays(sol) );
    1335
    1336 /* link solution to pseudo solution */
    1337 sol->obj = SCIPlpGetPseudoObjval(lp, set, prob);
    1339 solStamp(sol, stat, tree, TRUE);
    1340
    1341 SCIPsetDebugMsg(set, " -> objective value: %g\n", sol->obj);
    1342
    1343 return SCIP_OKAY;
    1344}
    1345
    1346/** copies current exact pseudo solution into exact CIP solution by linking */
    1348 SCIP_SOL* sol, /**< primal CIP solution */
    1349 SCIP_SET* set, /**< global SCIP settings */
    1350 SCIP_LPEXACT* lp /**< current LP data */
    1351 )
    1352{
    1353 assert(sol != NULL);
    1354 assert(SCIPsolIsExact(sol));
    1355
    1356 /* clear the old solution arrays */
    1357 SCIP_CALL( solClearArrays(sol) );
    1358
    1359 /* link solution to pseudo solution */
    1361
    1362 SCIPsetDebugMsg(set, " -> objective value: %g\n", sol->obj);
    1363
    1364 return SCIP_OKAY;
    1365}
    1366
    1367/** copies current solution (LP or pseudo solution) into CIP solution by linking */
    1369 SCIP_SOL* sol, /**< primal CIP solution */
    1370 SCIP_SET* set, /**< global SCIP settings */
    1371 SCIP_STAT* stat, /**< problem statistics data */
    1372 SCIP_PROB* prob, /**< transformed problem data */
    1373 SCIP_TREE* tree, /**< branch and bound tree */
    1374 SCIP_LP* lp /**< current LP data */
    1375 )
    1376{
    1377 assert(tree != NULL);
    1378
    1379 SCIPsetDebugMsg(set, "linking solution to current solution\n");
    1380
    1381 if( SCIPtreeHasCurrentNodeLP(tree) && SCIPlpIsSolved(lp) )
    1382 {
    1383 SCIP_CALL( SCIPsolLinkLPSol(sol, set, stat, prob, tree, lp) );
    1384 }
    1385 else
    1386 {
    1387 SCIP_CALL( SCIPsolLinkPseudoSol(sol, set, stat, prob, tree, lp) );
    1388 }
    1389
    1390 return SCIP_OKAY;
    1391}
    1392
    1393/** clears primal CIP solution */
    1395 SCIP_SOL* sol, /**< primal CIP solution */
    1396 SCIP_STAT* stat, /**< problem statistics data */
    1397 SCIP_TREE* tree /**< branch and bound tree */
    1398 )
    1399{
    1400 assert(sol != NULL);
    1401
    1402 SCIP_CALL( solClearArrays(sol) );
    1404 sol->obj = 0.0;
    1405 solStamp(sol, stat, tree, TRUE);
    1406
    1407 if( SCIPsolIsExact(sol) )
    1408 SCIPrationalSetReal(sol->valsexact->obj, 0.0);
    1409
    1410 return SCIP_OKAY;
    1411}
    1412
    1413/** declares all entries in the primal CIP solution to be unknown */
    1415 SCIP_SOL* sol, /**< primal CIP solution */
    1416 SCIP_STAT* stat, /**< problem statistics data */
    1417 SCIP_TREE* tree /**< branch and bound tree */
    1418 )
    1419{
    1420 assert(sol != NULL);
    1421
    1422 SCIP_CALL( solClearArrays(sol) );
    1424 sol->obj = 0.0;
    1425 solStamp(sol, stat, tree, TRUE);
    1426
    1427 return SCIP_OKAY;
    1428}
    1429
    1430/** stores solution values of variables in solution's own array */
    1432 SCIP_SOL* sol, /**< primal CIP solution */
    1433 SCIP_SET* set, /**< global SCIP settings */
    1434 SCIP_PROB* prob /**< transformed problem data */
    1435 )
    1436{
    1437 int v;
    1438
    1439 assert(sol != NULL);
    1440 assert(prob != NULL);
    1441 assert(prob->nvars == 0 || prob->vars != NULL);
    1442
    1445 {
    1446 SCIPsetDebugMsg(set, "completing solution %p\n", (void*)sol);
    1447
    1448 for( v = 0; v < prob->nvars; ++v )
    1449 {
    1450 SCIP_CALL( solUnlinkVar(sol, set, prob->vars[v]) );
    1451 }
    1452
    1453 sol->solorigin = SCIP_SOLORIGIN_ZERO;
    1454 }
    1455
    1456 return SCIP_OKAY;
    1457}
    1458
    1459/** stores solution values of variables in exact solution's own array */
    1461 SCIP_SOL* sol, /**< primal CIP solution */
    1462 SCIP_SET* set, /**< global SCIP settings */
    1463 SCIP_PROB* prob /**< transformed problem data */
    1464 )
    1465{
    1466 int v;
    1467
    1468 assert(sol != NULL);
    1469 assert(prob != NULL);
    1470 assert(prob->nvars == 0 || prob->vars != NULL);
    1471 assert(SCIPsolIsExact(sol));
    1472
    1475 {
    1476 SCIPsetDebugMsg(set, "completing solution %p\n", (void*)sol);
    1477
    1478 for( v = 0; v < prob->nvars; ++v )
    1479 {
    1480 SCIP_CALL( solUnlinkVarExact(sol, set, prob->vars[v]) );
    1481 }
    1482 }
    1483
    1484 SCIP_CALL( SCIPsolUnlink(sol, set, prob) );
    1485
    1486 return SCIP_OKAY;
    1487}
    1488
    1489/** sets value of variable in primal CIP solution */
    1491 SCIP_SOL* sol, /**< primal CIP solution */
    1492 SCIP_SET* set, /**< global SCIP settings */
    1493 SCIP_STAT* stat, /**< problem statistics data */
    1494 SCIP_TREE* tree, /**< branch and bound tree, or NULL */
    1495 SCIP_VAR* var, /**< variable to add to solution */
    1496 SCIP_Real val /**< solution value of variable */
    1497 )
    1498{
    1499 SCIP_Real oldval;
    1500
    1501 assert(sol != NULL);
    1502 assert(stat != NULL);
    1503 assert(sol->solorigin == SCIP_SOLORIGIN_ORIGINAL
    1507 || (sol->nodenum == stat->nnodes && sol->runnum == stat->nruns));
    1508 assert(var != NULL);
    1509 assert(var->scip == sol->scip);
    1510 assert(SCIPisFinite(val));
    1511
    1512 SCIPsetDebugMsg(set, "setting value of <%s> in solution %p to %g\n", SCIPvarGetName(var), (void*)sol, val);
    1513
    1514 /* we want to store only values for non fixed variables (LOOSE or COLUMN); others have to be transformed */
    1515 switch( SCIPvarGetStatus(var) )
    1516 {
    1518 if( SCIPsolIsOriginal(sol) )
    1519 {
    1520 oldval = solGetArrayVal(sol, var);
    1521
    1522 if( val != oldval ) /*lint !e777*/
    1523 {
    1524 SCIP_CALL( solSetArrayVal(sol, set, var, val) );
    1525
    1526 /* update the objective value; we do not need to do this for invalid objectives or partial solutions */
    1527 if( sol->obj != SCIP_INVALID && !SCIPsolIsPartial(sol) ) /*lint !e777*/
    1528 {
    1529 SCIP_Real obj;
    1530 SCIP_Real oldobjcont;
    1531 SCIP_Real newobjcont;
    1532
    1533 /* an unknown solution value does not count towards the objective */
    1534 obj = SCIPvarGetUnchangedObj(var);
    1535 oldobjcont = (oldval == SCIP_UNKNOWN ? 0.0 : obj * oldval); /*lint !e777*/
    1536 newobjcont = (val == SCIP_UNKNOWN ? 0.0 : obj * val); /*lint !e777*/
    1537
    1538 /* we want to use a safe invalid if the contribution exchange contradicts the infinity status of the objective value */
    1539 if( SCIPsetIsInfinity(set, sol->obj) )
    1540 {
    1541 if( ( SCIPsetIsInfinity(set, oldobjcont) && !SCIPsetIsInfinity(set, newobjcont) )
    1542 || ( !SCIPsetIsInfinity(set, -oldobjcont) && SCIPsetIsInfinity(set, -newobjcont) ) )
    1543 sol->obj = SCIP_INVALID;
    1544 }
    1545 else if( SCIPsetIsInfinity(set, -sol->obj) )
    1546 {
    1547 if( ( SCIPsetIsInfinity(set, -oldobjcont) && !SCIPsetIsInfinity(set, -newobjcont) )
    1548 || ( !SCIPsetIsInfinity(set, oldobjcont) && SCIPsetIsInfinity(set, newobjcont) ) )
    1549 sol->obj = SCIP_INVALID;
    1550 }
    1551 /* we want to use a clean infinity if the contribution exchange or the resulting objective hits the infinity bound */
    1552 else
    1553 {
    1554 if( !SCIPsetIsInfinity(set, MAX(ABS(oldobjcont), ABS(newobjcont))) )
    1555 {
    1556 sol->obj -= oldobjcont;
    1557 sol->obj += newobjcont;
    1558
    1559 if( SCIPsetIsInfinity(set, sol->obj) )
    1560 sol->obj = SCIPsetInfinity(set);
    1561 else if( SCIPsetIsInfinity(set, -sol->obj) )
    1562 sol->obj = -SCIPsetInfinity(set);
    1563 }
    1564 else if( !SCIPsetIsInfinity(set, MAX(oldobjcont, -newobjcont)) )
    1565 sol->obj = SCIPsetInfinity(set);
    1566 else if( !SCIPsetIsInfinity(set, MAX(-oldobjcont, newobjcont)) )
    1567 sol->obj = -SCIPsetInfinity(set);
    1568 }
    1569 }
    1570
    1571 solStamp(sol, stat, tree, FALSE);
    1572 }
    1573 return SCIP_OKAY;
    1574 }
    1575 else
    1576 return SCIPsolSetVal(sol, set, stat, tree, SCIPvarGetTransVar(var), val);
    1577
    1580 assert(!SCIPsolIsOriginal(sol));
    1582 || sol->lpcount == stat->lpcount);
    1583 oldval = solGetArrayVal(sol, var);
    1584
    1585 if( val != oldval ) /*lint !e777*/
    1586 {
    1587 SCIP_CALL( solSetArrayVal(sol, set, var, val) );
    1588
    1589 /* update the objective value; we do not need to do this for invalid objectives */
    1590 if( sol->obj != SCIP_INVALID ) /*lint !e777*/
    1591 {
    1592 SCIP_Real obj;
    1593 SCIP_Real oldobjcont;
    1594 SCIP_Real newobjcont;
    1595
    1596 /* an unknown solution value does not count towards the objective */
    1597 obj = SCIPvarGetUnchangedObj(var);
    1598 oldobjcont = (oldval == SCIP_UNKNOWN ? 0.0 : obj * oldval); /*lint !e777*/
    1599 newobjcont = (val == SCIP_UNKNOWN ? 0.0 : obj * val); /*lint !e777*/
    1600
    1601 /* we want to use a safe invalid if the contribution exchange contradicts the infinity status of the objective value */
    1602 if( SCIPsetIsInfinity(set, sol->obj) )
    1603 {
    1604 if( ( SCIPsetIsInfinity(set, oldobjcont) && !SCIPsetIsInfinity(set, newobjcont) )
    1605 || ( !SCIPsetIsInfinity(set, -oldobjcont) && SCIPsetIsInfinity(set, -newobjcont) ) )
    1606 sol->obj = SCIP_INVALID;
    1607 }
    1608 else if( SCIPsetIsInfinity(set, -sol->obj) )
    1609 {
    1610 if( ( SCIPsetIsInfinity(set, -oldobjcont) && !SCIPsetIsInfinity(set, -newobjcont) )
    1611 || ( !SCIPsetIsInfinity(set, oldobjcont) && SCIPsetIsInfinity(set, newobjcont) ) )
    1612 sol->obj = SCIP_INVALID;
    1613 }
    1614 /* we want to use a clean infinity if the contribution exchange or the resulting objective hits the infinity bound */
    1615 else
    1616 {
    1617 if( !SCIPsetIsInfinity(set, MAX(ABS(oldobjcont), ABS(newobjcont))) )
    1618 {
    1619 sol->obj -= oldobjcont;
    1620 sol->obj += newobjcont;
    1621
    1622 if( SCIPsetIsInfinity(set, sol->obj) )
    1623 sol->obj = SCIPsetInfinity(set);
    1624 else if( SCIPsetIsInfinity(set, -sol->obj) )
    1625 sol->obj = -SCIPsetInfinity(set);
    1626 }
    1627 else if( !SCIPsetIsInfinity(set, MAX(oldobjcont, -newobjcont)) )
    1628 sol->obj = SCIPsetInfinity(set);
    1629 else if( !SCIPsetIsInfinity(set, MAX(-oldobjcont, newobjcont)) )
    1630 sol->obj = -SCIPsetInfinity(set);
    1631 }
    1632 }
    1633
    1634 solStamp(sol, stat, tree, FALSE);
    1635 }
    1636 return SCIP_OKAY;
    1637
    1639 assert(!SCIPsolIsOriginal(sol));
    1640 oldval = SCIPvarGetLbGlobal(var);
    1641 if( val != oldval ) /*lint !e777*/
    1642 {
    1643 SCIPerrorMessage("cannot set solution value for variable <%s> fixed to %.15g to different value %.15g\n",
    1644 SCIPvarGetName(var), oldval, val);
    1645 return SCIP_INVALIDDATA;
    1646 }
    1647 return SCIP_OKAY;
    1648
    1649 case SCIP_VARSTATUS_AGGREGATED: /* x = a*y + c => y = (x-c)/a */
    1650 assert(!SCIPsetIsZero(set, SCIPvarGetAggrScalar(var)));
    1653
    1654 if( val == SCIP_UNKNOWN )/*lint !e777*/
    1655 return SCIPsolSetVal(sol, set, stat, tree, SCIPvarGetAggrVar(var), val);
    1656 if( SCIPsetIsInfinity(set, val) || SCIPsetIsInfinity(set, -val) )
    1657 return SCIPsolSetVal(sol, set, stat, tree, SCIPvarGetAggrVar(var), SCIPvarGetAggrScalar(var) > 0 ? val : -val);
    1658 else
    1659 return SCIPsolSetVal(sol, set, stat, tree, SCIPvarGetAggrVar(var), (val - SCIPvarGetAggrConstant(var))/SCIPvarGetAggrScalar(var));
    1660
    1662 if ( SCIPvarGetMultaggrNVars(var) == 1 )
    1663 {
    1664 SCIP_VAR** multaggrvars;
    1665 SCIP_Real* multaggrscalars;
    1666 SCIP_Real multaggrconstant;
    1667
    1668 multaggrvars = SCIPvarGetMultaggrVars(var);
    1669 multaggrscalars = SCIPvarGetMultaggrScalars(var);
    1670 multaggrconstant = SCIPvarGetMultaggrConstant(var);
    1671
    1672 if( SCIPsetIsInfinity(set, multaggrconstant) || SCIPsetIsInfinity(set, -multaggrconstant) )
    1673 {
    1674 if( (SCIPsetIsInfinity(set, multaggrconstant) && !SCIPsetIsInfinity(set, val))
    1675 || (SCIPsetIsInfinity(set, -multaggrconstant) && !SCIPsetIsInfinity(set, -val)) )
    1676 {
    1677 SCIPerrorMessage("cannot set solution value for variable <%s> fixed to %.15g to different value %.15g\n",
    1678 SCIPvarGetName(var), multaggrconstant, val);
    1679 return SCIP_INVALIDDATA;
    1680 }
    1681 return SCIP_OKAY;
    1682 }
    1683 else
    1684 {
    1685 if( SCIPsetIsInfinity(set, val) || SCIPsetIsInfinity(set, -val) )
    1686 return SCIPsolSetVal(sol, set, stat, tree, multaggrvars[0], multaggrscalars[0] > 0 ? val : -val);
    1687 else
    1688 return SCIPsolSetVal(sol, set, stat, tree, multaggrvars[0], (val - multaggrconstant)/multaggrscalars[0]);
    1689 }
    1690 }
    1691 SCIPerrorMessage("cannot set solution value for multiple aggregated variable\n");
    1692 return SCIP_INVALIDDATA;
    1693
    1696
    1697 if( val == SCIP_UNKNOWN )/*lint !e777*/
    1698 return SCIPsolSetVal(sol, set, stat, tree, SCIPvarGetNegationVar(var), val);
    1699 else if( SCIPsetIsInfinity(set, val) || SCIPsetIsInfinity(set, -val) )
    1700 return SCIPsolSetVal(sol, set, stat, tree, SCIPvarGetNegationVar(var), -val);
    1701 else
    1702 return SCIPsolSetVal(sol, set, stat, tree, SCIPvarGetNegationVar(var), SCIPvarGetNegationConstant(var) - val);
    1703
    1704 default:
    1705 SCIPerrorMessage("unknown variable status\n");
    1706 return SCIP_INVALIDDATA;
    1707 }
    1708}
    1709
    1710/** sets value of variable in exact primal CIP solution */
    1712 SCIP_SOL* sol, /**< primal CIP solution */
    1713 SCIP_SET* set, /**< global SCIP settings */
    1714 SCIP_STAT* stat, /**< problem statistics data */
    1715 SCIP_TREE* tree, /**< branch and bound tree, or NULL */
    1716 SCIP_VAR* var, /**< variable to add to solution */
    1717 SCIP_RATIONAL* val /**< solution value of variable */
    1718 )
    1719{
    1720 SCIP_RATIONAL* oldval;
    1721 SCIP_RATIONAL* tmp;
    1722 SCIP_RETCODE retcode;
    1723
    1724 assert(sol != NULL);
    1725 assert(stat != NULL);
    1726 assert(sol->solorigin == SCIP_SOLORIGIN_ORIGINAL
    1730 assert(var != NULL);
    1731 assert(!SCIPrationalIsAbsInfinity(val));
    1732 assert(SCIPsolIsExact(sol));
    1733
    1734 SCIPsetDebugMsg(set, "setting value of <%s> in exact solution %p to %g\n", SCIPvarGetName(var), (void*)sol, SCIPrationalGetReal(val));
    1735
    1736 /* we want to store only values for non fixed variables (LOOSE or COLUMN); others have to be transformed */
    1737 switch( SCIPvarGetStatusExact(var) )
    1738 {
    1741 {
    1742 SCIP_CALL( SCIPrationalCreateBuffer(set->buffer, &oldval) );
    1743
    1744 solGetArrayValExact(oldval, sol, var);
    1745
    1746 if( !SCIPrationalIsEQ(val, oldval) )
    1747 {
    1748 SCIP_RATIONAL* obj;
    1749
    1750 SCIP_CALL( solSetArrayValExact(sol, set, var, val) );
    1751 obj = SCIPvarGetObjExact(var);
    1752 SCIPrationalDiffProd(sol->valsexact->obj, obj, oldval);
    1753
    1754 SCIPrationalAddProd(sol->valsexact->obj, obj, val);
    1755 }
    1756
    1757 SCIPrationalFreeBuffer(set->buffer, &oldval);
    1758 break;
    1759 }
    1760 else
    1761 return SCIPsolSetValExact(sol, set, stat, tree, SCIPvarGetTransVar(var), val);
    1762
    1765 assert(sol->solorigin != SCIP_SOLORIGIN_ORIGINAL);
    1766 SCIP_CALL( SCIPrationalCreateBuffer(set->buffer, &oldval) );
    1767
    1768 solGetArrayValExact(oldval, sol, var);
    1769
    1770 if( !SCIPrationalIsEQ(val, oldval) )
    1771 {
    1772 SCIP_RATIONAL* obj;
    1773 SCIP_CALL( solSetArrayValExact(sol, set, var, val) );
    1774 obj = SCIPvarGetObjExact(var);
    1775 SCIPrationalDiffProd(sol->valsexact->obj, obj, oldval);
    1776 SCIPrationalAddProd(sol->valsexact->obj, obj, val);
    1777 }
    1778
    1779 SCIPrationalFreeBuffer(set->buffer, &oldval);
    1780 break;
    1781
    1783 assert(sol->solorigin != SCIP_SOLORIGIN_ORIGINAL);
    1785 {
    1786 SCIPerrorMessage("cannot set solution value for variable <%s> fixed to %.15g to different value %.15g\n",
    1788 return SCIP_INVALIDDATA;
    1789 }
    1790 break;
    1791
    1792 case SCIP_VARSTATUS_AGGREGATED: /* x = a*y + c => y = (x-c)/a */
    1796
    1797 SCIP_CALL( SCIPrationalCreateBuffer(set->buffer, &tmp) );
    1798
    1799 if( SCIPrationalIsAbsInfinity(val) )
    1800 {
    1802 SCIPrationalNegate(tmp, val);
    1803 retcode = SCIPsolSetValExact(sol, set, stat, tree, SCIPvarGetAggrVar(var), tmp);
    1804 }
    1805 else
    1806 {
    1809 retcode = SCIPsolSetValExact(sol, set, stat, tree, SCIPvarGetAggrVar(var), tmp);
    1810 }
    1811
    1812 SCIPrationalFreeBuffer(set->buffer, &tmp);
    1813 return retcode;
    1814
    1816 SCIPerrorMessage("cannot set solution value for multiple aggregated variable\n");
    1817 SCIPABORT();
    1818 return SCIP_INVALIDDATA;
    1819
    1822 return SCIPsolSetValExact(sol, set, stat, tree, SCIPvarGetNegationVar(var), val);
    1823
    1824 default:
    1825 SCIPerrorMessage("unknown variable status\n");
    1826 return SCIP_INVALIDDATA;
    1827 }
    1828
    1829 /* set real approximation */
    1830 SCIP_CALL( SCIPsolSetVal(sol, set, stat, tree, var, SCIPrationalGetReal(val)) );
    1831
    1832 return SCIP_OKAY;
    1833}
    1834
    1835/** increases value of variable in primal CIP solution */
    1837 SCIP_SOL* sol, /**< primal CIP solution */
    1838 SCIP_SET* set, /**< global SCIP settings */
    1839 SCIP_STAT* stat, /**< problem statistics data */
    1840 SCIP_TREE* tree, /**< branch and bound tree */
    1841 SCIP_VAR* var, /**< variable to increase solution value for */
    1842 SCIP_Real incval /**< increment for solution value of variable */
    1843 )
    1844{
    1845 SCIP_Real oldval;
    1846
    1847 assert(sol != NULL);
    1848 assert(stat != NULL);
    1849 assert(sol->solorigin == SCIP_SOLORIGIN_ORIGINAL
    1851 || (sol->nodenum == stat->nnodes && sol->runnum == stat->nruns));
    1852 assert(var != NULL);
    1853 assert(!SCIPsetIsInfinity(set, incval) && !SCIPsetIsInfinity(set, -incval));
    1854
    1855 SCIPsetDebugMsg(set, "increasing value of <%s> in solution %p by %g\n", SCIPvarGetName(var), (void*)sol, incval);
    1856
    1857 if( incval == 0.0 )
    1858 return SCIP_OKAY;
    1859
    1861 || sol->lpcount == stat->lpcount);
    1862
    1863 oldval = solGetArrayVal(sol, var);
    1864 if( SCIPsetIsInfinity(set, oldval) || SCIPsetIsInfinity(set, -oldval) )
    1865 return SCIP_OKAY;
    1866
    1867 /* we want to store only values for non fixed variables (LOOSE or COLUMN); others have to be transformed */
    1868 /* @todo: handle strange cases, such as sums that yield infinite values */
    1869 switch( SCIPvarGetStatus(var) )
    1870 {
    1872 if( SCIPsolIsOriginal(sol) )
    1873 {
    1874 SCIP_CALL( solIncArrayVal(sol, set, var, incval) );
    1875 sol->obj += SCIPvarGetUnchangedObj(var) * incval;
    1876 solStamp(sol, stat, tree, FALSE);
    1877 return SCIP_OKAY;
    1878 }
    1879 else
    1880 return SCIPsolIncVal(sol, set, stat, tree, SCIPvarGetTransVar(var), incval);
    1881
    1884 assert(!SCIPsolIsOriginal(sol));
    1885 SCIP_CALL( solIncArrayVal(sol, set, var, incval) );
    1886 sol->obj += SCIPvarGetUnchangedObj(var) * incval;
    1887 solStamp(sol, stat, tree, FALSE);
    1888 return SCIP_OKAY;
    1889
    1891 SCIPerrorMessage("cannot increase solution value for fixed variable\n");
    1892 return SCIP_INVALIDDATA;
    1893
    1894 case SCIP_VARSTATUS_AGGREGATED: /* x = a*y + c => y = (x-c)/a */
    1895 assert(!SCIPsetIsZero(set, SCIPvarGetAggrScalar(var)));
    1896 return SCIPsolIncVal(sol, set, stat, tree, SCIPvarGetAggrVar(var), incval/SCIPvarGetAggrScalar(var));
    1897
    1899 SCIPerrorMessage("cannot increase solution value for multiple aggregated variable\n");
    1900 return SCIP_INVALIDDATA;
    1901
    1903 return SCIPsolIncVal(sol, set, stat, tree, SCIPvarGetNegationVar(var), -incval);
    1904
    1905 default:
    1906 SCIPerrorMessage("unknown variable status\n");
    1907 return SCIP_INVALIDDATA;
    1908 }
    1909}
    1910
    1911/** returns value of variable in primal CIP solution */
    1913 SCIP_SOL* sol, /**< primal CIP solution */
    1914 SCIP_SET* set, /**< global SCIP settings */
    1915 SCIP_STAT* stat, /**< problem statistics data */
    1916 SCIP_VAR* var /**< variable to get value for */
    1917 )
    1918{
    1919 SCIP_VAR** vars;
    1921 SCIP_Real solval;
    1922 SCIP_Real solvalsum;
    1923 int nvars;
    1924 int i;
    1925
    1926 assert(sol != NULL);
    1927 assert(sol->solorigin == SCIP_SOLORIGIN_ORIGINAL
    1931 || (sol->nodenum == stat->nnodes && sol->runnum == stat->nruns));
    1932 assert(var != NULL);
    1933 assert(var->scip == sol->scip);
    1934
    1935 /* if the value of a transformed variable in an original solution is requested, we need to project the variable back
    1936 * to the original space, the opposite case is handled below
    1937 */
    1938 if( SCIPsolIsOriginal(sol) && SCIPvarIsTransformed(var) )
    1939 {
    1940 SCIP_RETCODE retcode;
    1941 SCIP_VAR* origvar;
    1942 SCIP_Real scalar;
    1943 SCIP_Real constant;
    1944
    1945 /* we cannot get the value of a transformed variable for a solution that lives in the original problem space
    1946 * -> get the corresponding original variable first
    1947 */
    1948 origvar = var;
    1949 scalar = 1.0;
    1950 constant = 0.0;
    1951 retcode = SCIPvarGetOrigvarSum(&origvar, &scalar, &constant);
    1952 if ( retcode != SCIP_OKAY )
    1953 return SCIP_INVALID;
    1954 if( origvar == NULL )
    1955 {
    1956 /* the variable has no original counterpart: in the original solution, it has a value of zero */
    1957 return 0.0;
    1958 }
    1959 assert(!SCIPvarIsTransformed(origvar));
    1960
    1961 solval = SCIPsolGetVal(sol, set, stat, origvar);
    1962 if( solval == SCIP_UNKNOWN ) /*lint !e777*/
    1963 return SCIP_UNKNOWN;
    1964 else
    1965 return scalar * solval + constant;
    1966 }
    1967
    1968 /* only values for non fixed variables (LOOSE or COLUMN) are stored; others have to be transformed */
    1969 switch( SCIPvarGetStatus(var) )
    1970 {
    1972 if( SCIPsolIsOriginal(sol) )
    1973 return solGetArrayVal(sol, var);
    1974 else
    1975 return SCIPsolGetVal(sol, set, stat, SCIPvarGetTransVar(var));
    1976
    1979 assert(!SCIPsolIsOriginal(sol));
    1981 || sol->lpcount == stat->lpcount);
    1982 return solGetArrayVal(sol, var);
    1983
    1985 assert(!SCIPsolIsOriginal(sol));
    1986 assert(SCIPvarGetLbGlobal(var) == SCIPvarGetUbGlobal(var) || (set->exact_enable && SCIPrationalIsEQ(SCIPvarGetLbGlobalExact(var), SCIPvarGetUbGlobalExact(var)))) ; /*lint !e777*/
    1987 assert(SCIPvarGetLbLocal(var) == SCIPvarGetUbLocal(var) || (set->exact_enable && SCIPrationalIsEQ(SCIPvarGetLbLocalExact(var), SCIPvarGetUbLocalExact(var)))); /*lint !e777*/
    1988 assert(SCIPvarGetLbGlobal(var) == SCIPvarGetLbLocal(var) || (set->exact_enable && SCIPrationalIsEQ(SCIPvarGetLbGlobalExact(var), SCIPvarGetLbLocalExact(var)))); /*lint !e777*/
    1989 return SCIPvarGetLbGlobal(var);
    1990
    1991 case SCIP_VARSTATUS_AGGREGATED: /* x = a*y + c => y = (x-c)/a */
    1992 solval = SCIPsolGetVal(sol, set, stat, SCIPvarGetAggrVar(var));
    1993 if( solval == SCIP_UNKNOWN ) /*lint !e777*/
    1994 return SCIP_UNKNOWN;
    1995 if( SCIPsetIsInfinity(set, solval) || SCIPsetIsInfinity(set, -solval) )
    1996 {
    1997 if( SCIPvarGetAggrScalar(var) * solval > 0.0 )
    1998 return SCIPsetInfinity(set);
    1999 if( SCIPvarGetAggrScalar(var) * solval < 0.0 )
    2000 return -SCIPsetInfinity(set);
    2001 }
    2002 return SCIPvarGetAggrScalar(var) * solval + SCIPvarGetAggrConstant(var);
    2003
    2005 nvars = SCIPvarGetMultaggrNVars(var);
    2006 vars = SCIPvarGetMultaggrVars(var);
    2008 solvalsum = SCIPvarGetMultaggrConstant(var);
    2009 for( i = 0; i < nvars; ++i )
    2010 {
    2011 solval = SCIPsolGetVal(sol, set, stat, vars[i]);
    2012 if( solval == SCIP_UNKNOWN ) /*lint !e777*/
    2013 return SCIP_UNKNOWN;
    2014 if( SCIPsetIsInfinity(set, solval) || SCIPsetIsInfinity(set, -solval) )
    2015 {
    2016 if( scalars[i] * solval > 0.0 )
    2017 return SCIPsetInfinity(set);
    2018 if( scalars[i] * solval < 0.0 )
    2019 return -SCIPsetInfinity(set);
    2020 }
    2021 solvalsum += scalars[i] * solval;
    2022 }
    2023 return solvalsum;
    2024
    2026 solval = SCIPsolGetVal(sol, set, stat, SCIPvarGetNegationVar(var));
    2027 if( solval == SCIP_UNKNOWN ) /*lint !e777*/
    2028 return SCIP_UNKNOWN;
    2029 if( SCIPsetIsInfinity(set, solval) )
    2030 return -SCIPsetInfinity(set);
    2031 if( SCIPsetIsInfinity(set, -solval) )
    2032 return SCIPsetInfinity(set);
    2033 return SCIPvarGetNegationConstant(var) - solval;
    2034
    2035 default:
    2036 SCIPerrorMessage("unknown variable status\n");
    2037 SCIPABORT();
    2038 return 0.0; /*lint !e527*/
    2039 }
    2040}
    2041
    2042/** returns value of variable in exact primal CIP solution */
    2044 SCIP_RATIONAL* res, /**< resulting rational */
    2045 SCIP_SOL* sol, /**< primal CIP solution */
    2046 SCIP_SET* set, /**< global SCIP settings */
    2047 SCIP_STAT* stat, /**< problem statistics data */
    2048 SCIP_VAR* var /**< variable to get value for */
    2049 )
    2050{
    2051 SCIP_VAR** vars;
    2053 SCIP_RATIONAL* solval;
    2054 int nvars;
    2055 int i;
    2056
    2057 assert(sol != NULL);
    2058 assert(sol->solorigin == SCIP_SOLORIGIN_ORIGINAL
    2063 assert(var != NULL);
    2064 assert(SCIPsolIsExact(sol));
    2065
    2066 /* if the value of a transformed variable in an original solution is requested, we need to project the variable back
    2067 * to the original space, the opposite case is handled below
    2068 */
    2070 {
    2071 SCIP_RETCODE retcode;
    2072 SCIP_VAR* origvar;
    2073 SCIP_RATIONAL* scalar;
    2074 SCIP_RATIONAL* constant;
    2075
    2076 (void) SCIPrationalCreateBuffer(set->buffer, &scalar);
    2077 (void) SCIPrationalCreateBuffer(set->buffer, &constant);
    2078
    2079 /* we cannot get the value of a transformed variable for a solution that lives in the original problem space
    2080 * -> get the corresponding original variable first
    2081 */
    2082 origvar = var;
    2083 SCIPrationalSetFraction(scalar, 1LL, 1LL);
    2084 SCIPrationalSetReal(constant, 0.0);
    2085 retcode = SCIPvarGetOrigvarSumExact(&origvar, scalar, constant);
    2086 if ( retcode != SCIP_OKAY )
    2087 {
    2088 SCIPABORT();
    2089 return;
    2090 }
    2091 if( origvar == NULL )
    2092 {
    2093 /* the variable has no original counterpart: in the original solution, it has a value of zero */
    2094 SCIPrationalSetReal(res, 0.0);
    2095 return;
    2096 }
    2097
    2098 assert(!SCIPvarIsTransformed(origvar));
    2099
    2100 SCIPsolGetValExact(res, sol, set, stat, origvar);
    2101 SCIPrationalMult(res, res, scalar);
    2102 SCIPrationalAdd(res, res, constant);
    2103
    2104 SCIPrationalFreeBuffer(set->buffer, &constant);
    2105 SCIPrationalFreeBuffer(set->buffer, &scalar);
    2106
    2107 return;
    2108 }
    2109
    2110 /* only values for non fixed variables (LOOSE or COLUMN) are stored; others have to be transformed */
    2111 switch( SCIPvarGetStatusExact(var) )
    2112 {
    2115 solGetArrayValExact(res, sol, var);
    2116 else
    2117 SCIPsolGetValExact(res, sol, set, stat, SCIPvarGetTransVar(var));
    2118 break;
    2119
    2122 assert(sol->solorigin != SCIP_SOLORIGIN_ORIGINAL);
    2124 || sol->lpcount == stat->lpcount );
    2125 solGetArrayValExact(res, sol, var);
    2126 break;
    2127
    2129 assert(sol->solorigin != SCIP_SOLORIGIN_ORIGINAL);
    2130 assert(SCIPrationalIsEQ(SCIPvarGetLbGlobalExact(var), SCIPvarGetUbGlobalExact(var))); /*lint !e777*/
    2131 assert(SCIPrationalIsEQ(SCIPvarGetLbLocalExact(var), SCIPvarGetUbLocalExact(var))); /*lint !e777*/
    2132 assert(SCIPrationalIsEQ(SCIPvarGetLbGlobalExact(var), SCIPvarGetLbLocalExact(var))); /*lint !e777*/
    2134 break;
    2135
    2136 case SCIP_VARSTATUS_AGGREGATED: /* x = a*y + c => y = (x-c)/a */
    2137 SCIPsolGetValExact(res, sol, set, stat, SCIPvarGetAggrVar(var));
    2138 if( SCIPrationalIsAbsInfinity(res) )
    2139 {
    2141 {
    2143 return;
    2144 }
    2146 {
    2148 return;
    2149 }
    2150 }
    2153 break;
    2154
    2156 (void) SCIPrationalCreateBuffer(set->buffer, &solval);
    2157
    2158 nvars = SCIPvarGetMultaggrNVars(var);
    2159 vars = SCIPvarGetMultaggrVars(var);
    2162 for( i = 0; i < nvars; ++i )
    2163 {
    2164 SCIPsolGetValExact(solval, sol, set, stat, vars[i]);
    2165 if( SCIPrationalIsAbsInfinity(solval) )
    2166 {
    2171 break;
    2172 }
    2173 SCIPrationalAddProd(res, scalars[i], solval);
    2174 }
    2175 SCIPrationalFreeBuffer(set->buffer, &solval);
    2176 break;
    2177
    2179 SCIPsolGetValExact(res, sol, set, stat, SCIPvarGetNegationVar(var));
    2181 SCIPrationalNegate(res, res);
    2182 break;
    2183
    2184 default:
    2185 SCIPerrorMessage("unknown variable status\n");
    2186 SCIPABORT();
    2187 SCIPrationalSetReal(res, 0.0); /*lint !e527*/
    2188 }
    2189}
    2190
    2191/** returns value of variable in primal ray represented by primal CIP solution */
    2193 SCIP_SOL* sol, /**< primal CIP solution, representing a primal ray */
    2194 SCIP_SET* set, /**< global SCIP settings */
    2195 SCIP_STAT* stat, /**< problem statistics data */
    2196 SCIP_VAR* var /**< variable to get value for */
    2197 )
    2198{
    2199 SCIP_VAR** vars;
    2201 SCIP_Real solval;
    2202 SCIP_Real solvalsum;
    2203 int nvars;
    2204 int i;
    2205
    2206 assert(sol != NULL);
    2207 assert(sol->solorigin == SCIP_SOLORIGIN_ZERO);
    2208 assert(var != NULL);
    2209
    2210 /* only values for non fixed variables (LOOSE or COLUMN) are stored; others have to be transformed */
    2211 switch( SCIPvarGetStatus(var) )
    2212 {
    2214 return SCIPsolGetRayVal(sol, set, stat, SCIPvarGetTransVar(var));
    2215
    2218 return solGetArrayVal(sol, var);
    2219
    2221 assert(!SCIPsolIsOriginal(sol));
    2222 assert(SCIPvarGetLbGlobal(var) == SCIPvarGetUbGlobal(var)); /*lint !e777*/
    2223 assert(SCIPvarGetLbLocal(var) == SCIPvarGetUbLocal(var)); /*lint !e777*/
    2224 assert(SCIPvarGetLbGlobal(var) == SCIPvarGetLbLocal(var)); /*lint !e777*/
    2225 return 0.0; /* constants are ignored for computing the ray direction */
    2226
    2227 case SCIP_VARSTATUS_AGGREGATED: /* x = a*y + c => y = (x-c)/a */
    2228 solval = SCIPsolGetRayVal(sol, set, stat, SCIPvarGetAggrVar(var));
    2229 assert(solval != SCIP_UNKNOWN); /*lint !e777*/
    2230 assert(!SCIPsetIsInfinity(set, REALABS(solval)));
    2231 return SCIPvarGetAggrScalar(var) * solval; /* constants are ignored for computing the ray direction */
    2232
    2234 nvars = SCIPvarGetMultaggrNVars(var);
    2235 vars = SCIPvarGetMultaggrVars(var);
    2237 solvalsum = 0.0; /* constants are ignored for computing the ray direction */
    2238 for( i = 0; i < nvars; ++i )
    2239 {
    2240 solval = SCIPsolGetRayVal(sol, set, stat, vars[i]);
    2241 assert(solval != SCIP_UNKNOWN ); /*lint !e777*/
    2242 assert(!SCIPsetIsInfinity(set, REALABS(solval)));
    2243 solvalsum += scalars[i] * solval;
    2244 }
    2245 return solvalsum;
    2246
    2248 solval = SCIPsolGetRayVal(sol, set, stat, SCIPvarGetNegationVar(var));
    2249 assert(solval != SCIP_UNKNOWN); /*lint !e777*/
    2250 assert(!SCIPsetIsInfinity(set, REALABS(solval)));
    2251 return -solval; /* constants are ignored for computing the ray direction */
    2252
    2253 default:
    2254 SCIPerrorMessage("unknown variable status\n");
    2255 SCIPABORT();
    2256 return 0.0; /*lint !e527*/
    2257 }
    2258}
    2259
    2260/** gets objective value of primal CIP solution in transformed problem */
    2262 SCIP_SOL* sol, /**< primal CIP solution */
    2263 SCIP_SET* set, /**< global SCIP settings */
    2264 SCIP_PROB* transprob, /**< tranformed problem data */
    2265 SCIP_PROB* origprob /**< original problem data */
    2266 )
    2267{
    2268 assert(sol != NULL);
    2269
    2270 /* for original solutions, sol->obj contains the external objective value */
    2271 if( SCIPsolIsOriginal(sol) )
    2272 return SCIPprobInternObjval(transprob, origprob, set, sol->obj);
    2273 else
    2274 return sol->obj;
    2275}
    2276
    2277/** gets objective value of exact primal CIP solution in transformed problem */
    2279 SCIP_SOL* sol, /**< primal CIP solution */
    2280 SCIP_SET* set, /**< global SCIP settings */
    2281 SCIP_PROB* transprob, /**< tranformed problem data */
    2282 SCIP_PROB* origprob, /**< original problem data */
    2283 SCIP_RATIONAL* objval /**< store the result here */
    2284 )
    2285{
    2286 assert(sol != NULL);
    2287 assert(SCIPsolIsExact(sol));
    2288
    2289 /* for original solutions, sol->obj contains the external objective value */
    2290 if( SCIPsolIsOriginal(sol) )
    2291 SCIPprobInternObjvalExact(transprob, origprob, set, sol->valsexact->obj, objval);
    2292 else
    2293 SCIPrationalSetRational(objval, sol->valsexact->obj);
    2294}
    2295
    2296/** updates primal solutions after a change in a variable's objective value */
    2298 SCIP_SOL* sol, /**< primal CIP solution */
    2299 SCIP_VAR* var, /**< problem variable */
    2300 SCIP_Real oldobj, /**< old objective value */
    2301 SCIP_Real newobj /**< new objective value */
    2302 )
    2303{
    2304 SCIP_Real solval;
    2305
    2306 assert(sol != NULL);
    2307 assert(!SCIPsolIsOriginal(sol));
    2309
    2310 solval = solGetArrayVal(sol, var);
    2311 if( solval != SCIP_UNKNOWN ) /*lint !e777*/
    2312 sol->obj += (newobj - oldobj) * solval;
    2313}
    2314
    2315/* mark the given solution as partial solution */
    2317 SCIP_SOL* sol, /**< primal CIP solution */
    2318 SCIP_SET* set, /**< global SCIP settings */
    2319 SCIP_STAT* stat, /**< problem statistics */
    2320 SCIP_VAR** vars, /**< problem variables */
    2321 int nvars /**< number of problem variables */
    2322 )
    2323{
    2324 SCIP_Real* vals;
    2325 int v;
    2326
    2327 assert(sol != NULL);
    2328 assert(sol->solorigin == SCIP_SOLORIGIN_ORIGINAL);
    2329 assert(nvars == 0 || vars != NULL);
    2330
    2331 if( nvars == 0 )
    2332 return SCIP_OKAY;;
    2333
    2334 SCIP_CALL( SCIPsetAllocBufferArray(set, &vals, nvars) );
    2335
    2336 /* get values */
    2337 for( v = 0; v < nvars; v++ )
    2338 {
    2339 assert(!SCIPvarIsTransformed(vars[v]));
    2340 vals[v] = SCIPsolGetVal(sol, set, stat, vars[v]);
    2341 }
    2342
    2343 /* change origin to partial */
    2345
    2346 /* set values */
    2347 for( v = 0; v < nvars; v++ )
    2348 {
    2349 int idx = SCIPvarGetIndex(vars[v]);
    2350
    2351 if( vals[v] != SCIP_UNKNOWN ) /*lint !e777*/
    2352 {
    2353 /* from now on, variable must not be deleted */
    2354 SCIPvarMarkNotDeletable(vars[v]);
    2355
    2356 /* mark the variable valid */
    2357 SCIP_CALL( SCIPboolarraySetVal(sol->valid, set->mem_arraygrowinit, set->mem_arraygrowfac, idx, TRUE) );
    2358
    2359 /* set the value in the solution array */
    2360 SCIP_CALL( SCIPrealarraySetVal(sol->vals, set->mem_arraygrowinit, set->mem_arraygrowfac, idx, vals[v]) );
    2361 }
    2362 else
    2363 {
    2364 /* mark the variable invalid */
    2365 SCIP_CALL( SCIPboolarraySetVal(sol->valid, set->mem_arraygrowinit, set->mem_arraygrowfac, idx, FALSE) );
    2366 }
    2367 }
    2368
    2369 /* free buffer */
    2371
    2372 return SCIP_OKAY;
    2373}
    2374
    2375/** checks primal CIP solution for exact feasibility
    2376 * (either checks fp values exactly or rational values if it is a rational solution)
    2377 */
    2378static
    2380 SCIP_SOL* sol, /**< primal CIP solution */
    2381 SCIP_SET* set, /**< global SCIP settings */
    2382 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
    2383 BMS_BLKMEM* blkmem, /**< block memory */
    2384 SCIP_STAT* stat, /**< problem statistics */
    2385 SCIP_PROB* prob, /**< transformed problem data */
    2386 SCIP_Bool printreason, /**< Should all reasons of violations be printed? */
    2387 SCIP_Bool completely, /**< Should all violations be checked? */
    2388 SCIP_Bool checklprows, /**< Do constraints represented by rows in the current LP have to be checked? */
    2389 SCIP_Bool* feasible /**< stores whether solution is feasible */
    2390 )
    2391{
    2392 SCIP_RESULT result;
    2393 SCIP_RATIONAL* solval;
    2394 int h;
    2395
    2396 assert(sol != NULL);
    2397 assert(set != NULL);
    2398 assert(prob != NULL);
    2399 assert(feasible != NULL);
    2400
    2401 SCIPsetDebugMsg(set, "checking solution with objective value %g (nodenum=%" SCIP_LONGINT_FORMAT ", origin=%u)\n",
    2402 sol->obj, sol->nodenum, sol->solorigin);
    2403
    2404 *feasible = TRUE;
    2405
    2406 if( !printreason )
    2407 completely = FALSE;
    2408
    2409 SCIP_CALL( SCIPrationalCreateBuffer(set->buffer, &solval) );
    2410
    2411 /* check whether the solution respects the global bounds of the variables */
    2412 {
    2413 int v;
    2414
    2415 for( v = 0; v < prob->nvars && (*feasible || completely); ++v )
    2416 {
    2417 SCIP_VAR* var;
    2418
    2419 var = prob->vars[v];
    2420 if( SCIPsolIsExact(sol) )
    2421 SCIPsolGetValExact(solval, sol, set, stat, var);
    2422 else
    2423 SCIPrationalSetReal(solval, SCIPsolGetVal(sol, set, stat, var));
    2424
    2425 if( !SCIPrationalIsAbsInfinity(solval) ) /*lint !e777*/
    2426 {
    2427 SCIP_RATIONAL* lb;
    2428 SCIP_RATIONAL* ub;
    2429
    2430 lb = SCIPvarGetLbGlobalExact(var);
    2431 ub = SCIPvarGetUbGlobalExact(var);
    2432
    2433 /* if we have to check bound and one of the current bounds is violated */
    2434 if( (!SCIPrationalIsNegInfinity(lb) && SCIPrationalIsLT(solval, lb)) || (!SCIPrationalIsInfinity(ub) && SCIPrationalIsGT(solval, ub)) )
    2435 {
    2436 *feasible = FALSE;
    2437
    2438 if( printreason )
    2439 {
    2440 SCIPmessagePrintInfo(messagehdlr, "solution value %g violates bounds of <%s>[%g,%g] by %g\n", SCIPrationalGetReal(solval), SCIPvarGetName(var),
    2442 }
    2443#ifdef SCIP_DEBUG
    2444 else
    2445 {
    2446 SCIPrationalDebugMessage(" -> solution value %q violates bounds of <%s>[%g,%g]\n", solval, SCIPvarGetName(var),
    2448 }
    2449#endif
    2450 }
    2451
    2452 /* check whether there are infinite variable values that lead to an objective value of +infinity */
    2453 if( *feasible && sol->hasinfval )
    2454 {
    2455 *feasible = *feasible && (!SCIPrationalIsInfinity(solval) || !SCIPrationalIsPositive(SCIPvarGetObjExact(var)) );
    2456 *feasible = *feasible && (!SCIPrationalIsNegInfinity(solval) || !SCIPrationalIsNegative(SCIPvarGetObjExact(var)) );
    2457
    2460 {
    2461 if( printreason )
    2462 {
    2463 SCIPrationalDebugMessage("infinite solution value %q for variable <%s> with obj %q implies objective value +infinity\n",
    2465 }
    2466#ifdef SCIP_DEBUG
    2467 else
    2468 {
    2469 SCIPrationalDebugMessage("infinite solution value %q for variable <%s> with obj %g implies objective value +infinity\n",
    2470 solval, SCIPvarGetName(var), SCIPvarGetUnchangedObj(var));
    2471 }
    2472#endif
    2473 }
    2474 }
    2475 }
    2476 }
    2477 }
    2478
    2479 /* check whether the solution fulfills all constraints */
    2480 for( h = 0; h < set->nconshdlrs && (*feasible || completely); ++h )
    2481 {
    2482 SCIP_CALL( SCIPconshdlrCheck(set->conshdlrs[h], blkmem, set, stat, sol,
    2483 TRUE, checklprows, printreason, completely, &result) );
    2484 *feasible = *feasible && (result == SCIP_FEASIBLE);
    2485
    2486#ifdef SCIP_DEBUG
    2487 if( !(*feasible) )
    2488 {
    2489 SCIPdebugPrintf(" -> infeasibility detected in constraint handler <%s>\n",
    2490 SCIPconshdlrGetName(set->conshdlrs[h]));
    2491 }
    2492#endif
    2493 }
    2494
    2495 SCIPrationalFreeBuffer(set->buffer, &solval);
    2496
    2497 return SCIP_OKAY;
    2498}
    2499
    2500/** checks solution for feasibility in original problem without adding it to the solution store
    2501 *
    2502 * We first check the variable bounds. Then we loop over all constraint handlers and constraints, checking each in the
    2503 * order of their check priority.
    2504 */
    2506 SCIP_SOL* sol, /**< primal CIP solution */
    2507 SCIP_SET* set, /**< global SCIP settings */
    2508 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
    2509 BMS_BLKMEM* blkmem, /**< block memory */
    2510 SCIP_STAT* stat, /**< problem statistics */
    2511 SCIP_PROB* prob, /**< transformed problem data */
    2512 SCIP_PRIMAL* primal, /**< primal data */
    2513 SCIP_Bool printreason, /**< Should the reason for the violation be printed? */
    2514 SCIP_Bool completely, /**< Should all violations be checked if printreason is true? */
    2515 SCIP_Bool checkbounds, /**< Should the bounds of the variables be checked? */
    2516 SCIP_Bool checkintegrality, /**< Has integrality to be checked? */
    2517 SCIP_Bool checklprows, /**< Do constraints represented by rows in the current LP have to be checked? */
    2518 SCIP_Bool checkmodifiable, /**< have modifiable constraint to be checked? */
    2519 SCIP_Bool* feasible /**< stores whether given solution is feasible */
    2520 )
    2521{
    2522 SCIP_RESULT result;
    2523#ifndef NDEBUG
    2524 int oldpriority;
    2525#endif
    2526 int v;
    2527 int c;
    2528 int h;
    2529
    2530 assert(sol != NULL);
    2531 assert(set != NULL);
    2532 assert(prob != NULL);
    2533 assert(!prob->transformed);
    2534 assert(feasible != NULL);
    2535
    2536 /* have to check bounds without tolerances in exact solving mode */
    2537 if( set->exact_enable )
    2538 {
    2539 SCIP_CALL( solCheckExact(sol, set, messagehdlr, blkmem, stat, prob, printreason,
    2540 completely, checklprows, feasible) );
    2541
    2542 return SCIP_OKAY;
    2543 }
    2544
    2545 *feasible = TRUE;
    2546
    2548
    2549 if( !printreason )
    2550 completely = FALSE;
    2551
    2552 /* check bounds */
    2553 if( checkbounds )
    2554 {
    2555 for( v = 0; v < prob->nvars; ++v )
    2556 {
    2557 SCIP_VAR* var;
    2558 SCIP_Real solval;
    2559 SCIP_Real lb;
    2560 SCIP_Real ub;
    2561
    2562 var = prob->vars[v];
    2563 solval = SCIPsolGetVal(sol, set, stat, var);
    2564
    2565 lb = SCIPvarGetLbOriginal(var);
    2566 ub = SCIPvarGetUbOriginal(var);
    2567
    2568 if( SCIPprimalUpdateViolations(primal) )
    2569 {
    2570 SCIPsolUpdateBoundViolation(sol, lb - solval, SCIPrelDiff(lb, solval));
    2571 SCIPsolUpdateBoundViolation(sol, solval - ub, SCIPrelDiff(solval, ub));
    2572 }
    2573
    2574 if( SCIPsetIsFeasLT(set, solval, lb) || SCIPsetIsFeasGT(set, solval, ub) )
    2575 {
    2576 *feasible = FALSE;
    2577
    2578 if( printreason )
    2579 {
    2580 SCIPmessagePrintInfo(messagehdlr, "solution violates original bounds of variable <%s> [%g,%g] solution value <%g>\n",
    2581 SCIPvarGetName(var), lb, ub, solval);
    2582 }
    2583
    2584 if( !completely )
    2585 return SCIP_OKAY;
    2586 }
    2587 }
    2588 }
    2589
    2590 /* sort original constraint according to check priority */
    2592
    2593 /* check original constraints
    2594 *
    2595 * in general modifiable constraints can not be checked, because the variables to fulfill them might be missing in
    2596 * the original problem; however, if the solution comes from a heuristic during presolving, modifiable constraints
    2597 * have to be checked;
    2598 */
    2599#ifndef NDEBUG
    2600 oldpriority = INT_MAX;
    2601#endif
    2602 h = 0;
    2603 for( c = 0; c < prob->nconss; ++c )
    2604 {
    2605 SCIP_CONS* cons;
    2606 int priority;
    2607
    2608 cons = prob->origcheckconss[c];
    2609 assert( SCIPconsGetHdlr(cons) != NULL );
    2611
    2612#ifndef NDEBUG
    2613 assert( priority <= oldpriority );
    2614 oldpriority = priority;
    2615#endif
    2616
    2617 /* check constraints handlers without constraints that have a check priority at least as high as current
    2618 * constraint */
    2619 while( h < set->nconshdlrs && SCIPconshdlrGetCheckPriority(set->conshdlrs[h]) >= priority )
    2620 {
    2621 if( !SCIPconshdlrNeedsCons(set->conshdlrs[h]) )
    2622 {
    2623 SCIP_CALL( SCIPconshdlrCheck(set->conshdlrs[h], blkmem, set, stat, sol,
    2624 checkintegrality, checklprows, printreason, completely, &result) );
    2625
    2626 if( result != SCIP_FEASIBLE )
    2627 {
    2628 *feasible = FALSE;
    2629
    2630 if( !completely )
    2631 return SCIP_OKAY;
    2632 }
    2633 }
    2634 ++h;
    2635 }
    2636
    2637 /* now check constraint */
    2638 if( SCIPconsIsChecked(cons) && (checkmodifiable || !SCIPconsIsModifiable(cons)) )
    2639 {
    2640 /* check solution */
    2641 SCIP_CALL( SCIPconsCheck(cons, set, sol, checkintegrality, checklprows, printreason, &result) );
    2642
    2643 if( result != SCIP_FEASIBLE )
    2644 {
    2645 *feasible = FALSE;
    2646
    2647 if( !completely )
    2648 return SCIP_OKAY;
    2649 }
    2650 }
    2651 }
    2652
    2653 /* one final loop over the remaining constraints handlers without constraints */
    2654 while( h < set->nconshdlrs )
    2655 {
    2656 if( !SCIPconshdlrNeedsCons(set->conshdlrs[h]) )
    2657 {
    2658 SCIP_CALL( SCIPconshdlrCheck(set->conshdlrs[h], blkmem, set, stat, sol,
    2659 checkintegrality, checklprows, printreason, completely, &result) );
    2660
    2661 if( result != SCIP_FEASIBLE )
    2662 {
    2663 *feasible = FALSE;
    2664
    2665 if( !completely )
    2666 return SCIP_OKAY;
    2667 }
    2668 }
    2669 ++h;
    2670 }
    2671
    2672 return SCIP_OKAY;
    2673}
    2674
    2675/** checks primal CIP solution for feasibility
    2676 *
    2677 * @note The difference between SCIPsolCheck() and SCIPcheckSolOrig() is that modifiable constraints are handled
    2678 * differently. There might be some variables which do not have an original counter part (e.g. in
    2679 * branch-and-price). Therefore, modifiable constraints can not be double-checked in the original space.
    2680 */
    2682 SCIP_SOL* sol, /**< primal CIP solution */
    2683 SCIP_SET* set, /**< global SCIP settings */
    2684 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
    2685 BMS_BLKMEM* blkmem, /**< block memory */
    2686 SCIP_STAT* stat, /**< problem statistics */
    2687 SCIP_PROB* prob, /**< transformed problem data */
    2688 SCIP_Bool printreason, /**< Should all reasons of violations be printed? */
    2689 SCIP_Bool completely, /**< Should all violations be checked? */
    2690 SCIP_Bool checkbounds, /**< Should the bounds of the variables be checked? */
    2691 SCIP_Bool checkintegrality, /**< Has integrality to be checked? */
    2692 SCIP_Bool checklprows, /**< Do constraints represented by rows in the current LP have to be checked? */
    2693 SCIP_Bool* feasible /**< stores whether solution is feasible */
    2694 )
    2695{
    2696 SCIP_RESULT result;
    2697 int h;
    2698
    2699 assert(sol != NULL);
    2700 assert(!SCIPsolIsOriginal(sol));
    2701 assert(set != NULL);
    2702 assert(prob != NULL);
    2703 assert(feasible != NULL);
    2704
    2705 SCIPsetDebugMsg(set, "checking solution with objective value %g (nodenum=%" SCIP_LONGINT_FORMAT ", origin=%d)\n",
    2706 sol->obj, sol->nodenum, sol->solorigin);
    2707
    2708 /* have to check bounds without tolerances in exact solving mode */
    2709 if( set->exact_enable )
    2710 {
    2711 SCIP_CALL( solCheckExact(sol, set, messagehdlr, blkmem, stat, prob, printreason,
    2712 completely, checklprows, feasible) );
    2713
    2714 return SCIP_OKAY;
    2715 }
    2716
    2717 *feasible = TRUE;
    2718
    2720
    2721 if( !printreason )
    2722 completely = FALSE;
    2723
    2724 /* check whether the solution respects the global bounds of the variables */
    2725 if( checkbounds || sol->hasinfval )
    2726 {
    2727 int v;
    2728
    2729 for( v = 0; v < prob->nvars && (*feasible || completely); ++v )
    2730 {
    2731 SCIP_VAR* var;
    2732 SCIP_Real solval;
    2733
    2734 var = prob->vars[v];
    2735 solval = SCIPsolGetVal(sol, set, stat, var);
    2736
    2737 if( solval != SCIP_UNKNOWN ) /*lint !e777*/
    2738 {
    2739 SCIP_Real lb;
    2740 SCIP_Real ub;
    2741
    2742 lb = SCIPvarGetLbGlobal(var);
    2743 ub = SCIPvarGetUbGlobal(var);
    2744
    2745 /* if we have to check bound and one of the current bounds is violated */
    2746 if( checkbounds && ((!SCIPsetIsInfinity(set, -lb) && SCIPsetIsFeasLT(set, solval, lb))
    2747 || (!SCIPsetIsInfinity(set, ub) && SCIPsetIsFeasGT(set, solval, ub))) )
    2748 {
    2749 *feasible = FALSE;
    2750
    2751 if( printreason )
    2752 {
    2753 SCIPmessagePrintInfo(messagehdlr, "solution value %g violates bounds of <%s>[%g,%g] by %g\n", solval, SCIPvarGetName(var),
    2754 SCIPvarGetLbGlobal(var), SCIPvarGetUbGlobal(var), MAX(lb - solval, 0.0) + MAX(solval - ub, 0.0));
    2755 }
    2756#ifdef SCIP_DEBUG
    2757 else
    2758 {
    2759 SCIPsetDebugMsgPrint(set, " -> solution value %g violates bounds of <%s>[%g,%g]\n", solval, SCIPvarGetName(var),
    2761 }
    2762#endif
    2763 }
    2764
    2765 /* check whether there are infinite variable values that lead to an objective value of +infinity */
    2766 if( *feasible && sol->hasinfval )
    2767 {
    2768 *feasible = *feasible && (!SCIPsetIsInfinity(set, solval) || SCIPsetIsLE(set, SCIPvarGetUnchangedObj(var), 0.0) );
    2769 *feasible = *feasible && (!SCIPsetIsInfinity(set, -solval) || SCIPsetIsGE(set, SCIPvarGetUnchangedObj(var), 0.0) );
    2770
    2771 if( ((SCIPsetIsInfinity(set, solval) && SCIPsetIsGT(set, SCIPvarGetUnchangedObj(var), 0.0)) || (SCIPsetIsInfinity(set, -solval) && SCIPsetIsLT(set, SCIPvarGetUnchangedObj(var), 0.0))) )
    2772 {
    2773 if( printreason )
    2774 {
    2775 SCIPmessagePrintInfo(messagehdlr, "infinite solution value %g for variable <%s> with obj %g implies objective value +infinity\n",
    2776 solval, SCIPvarGetName(var), SCIPvarGetUnchangedObj(var));
    2777 }
    2778#ifdef SCIP_DEBUG
    2779 else
    2780 {
    2781 SCIPsetDebugMsgPrint(set, "infinite solution value %g for variable <%s> with obj %g implies objective value +infinity\n",
    2782 solval, SCIPvarGetName(var), SCIPvarGetUnchangedObj(var));
    2783 }
    2784#endif
    2785 }
    2786 }
    2787 }
    2788 }
    2789 }
    2790
    2791 /* check whether the solution fulfills all constraints */
    2792 for( h = 0; h < set->nconshdlrs && (*feasible || completely); ++h )
    2793 {
    2794 SCIP_CALL( SCIPconshdlrCheck(set->conshdlrs[h], blkmem, set, stat, sol,
    2795 checkintegrality, checklprows, printreason, completely, &result) );
    2796 *feasible = *feasible && (result == SCIP_FEASIBLE);
    2797
    2798#ifdef SCIP_DEBUG
    2799 if( !(*feasible) )
    2800 {
    2801 SCIPdebugPrintf(" -> infeasibility detected in constraint handler <%s>\n",
    2802 SCIPconshdlrGetName(set->conshdlrs[h]));
    2803 }
    2804#endif
    2805 }
    2806
    2807 return SCIP_OKAY;
    2808}
    2809
    2810/** try to round given solution */
    2812 SCIP_SOL* sol, /**< primal solution */
    2813 SCIP_SET* set, /**< global SCIP settings */
    2814 SCIP_STAT* stat, /**< problem statistics data */
    2815 SCIP_PROB* prob, /**< transformed problem data */
    2816 SCIP_TREE* tree, /**< branch and bound tree */
    2817 SCIP_Bool* success /**< pointer to store whether rounding was successful */
    2818 )
    2819{
    2820 int nvars;
    2821 int v;
    2822
    2823 assert(sol != NULL);
    2824 assert(!SCIPsolIsOriginal(sol));
    2825 assert(prob != NULL);
    2826 assert(prob->transformed);
    2827 assert(success != NULL);
    2828
    2829 /* round all roundable fractional enforced integral variables as long as no unroundable var was found */
    2830 nvars = prob->nvars - prob->ncontvars - prob->ncontimplvars;
    2831 assert(nvars >= 0);
    2832 for( v = 0; v < nvars; ++v )
    2833 {
    2834 SCIP_VAR* var;
    2835 SCIP_Real solval;
    2836 SCIP_Bool mayrounddown;
    2837 SCIP_Bool mayroundup;
    2838
    2839 var = prob->vars[v];
    2842 || sol->lpcount == stat->lpcount);
    2843 solval = solGetArrayVal(sol, var);
    2844
    2845 /* solutions with unknown entries cannot be rounded */
    2846 if( solval == SCIP_UNKNOWN ) /*lint !e777*/
    2847 break;
    2848
    2849 /* if solution value is already integral with feastol, continue */
    2850 if( SCIPsetIsFeasIntegral(set, solval) )
    2851 continue;
    2852
    2853 /* get rounding possibilities */
    2854 mayrounddown = SCIPvarMayRoundDown(var);
    2855 mayroundup = SCIPvarMayRoundUp(var);
    2856
    2857 /* choose rounding direction */
    2858 if( mayrounddown && mayroundup )
    2859 {
    2860 /* we can round in both directions: round in objective function direction */
    2861 if( SCIPvarGetUnchangedObj(var) >= 0.0 )
    2862 solval = SCIPsetFeasFloor(set, solval);
    2863 else
    2864 solval = SCIPsetFeasCeil(set, solval);
    2865 }
    2866 else if( mayrounddown )
    2867 solval = SCIPsetFeasFloor(set, solval);
    2868 else if( mayroundup )
    2869 solval = SCIPsetFeasCeil(set, solval);
    2870 else
    2871 break;
    2872
    2873 /* store new solution value */
    2874 SCIP_CALL( SCIPsolSetVal(sol, set, stat, tree, var, solval) );
    2875 }
    2876
    2877 /* check, if rounding was successful */
    2878 *success = (v == nvars);
    2879
    2880 return SCIP_OKAY;
    2881}
    2882
    2883/** copies the real values to the exact arrays of the solution */
    2885 SCIP_SOL* sol, /**< primal solution */
    2886 BMS_BLKMEM* blkmem, /**< block memory */
    2887 SCIP_SET* set, /**< global SCIP settings */
    2888 SCIP_STAT* stat, /**< problem statistics data */
    2889 SCIP_PROB* prob /**< transformed problem data */
    2890 )
    2891{
    2892 SCIP_RATIONAL* tmp;
    2893 int v;
    2894
    2895 if( SCIPsolIsExact(sol) )
    2896 return SCIP_OKAY;
    2897
    2898 SCIP_ALLOC( BMSallocBlockMemory(blkmem, &sol->valsexact) );
    2900 SCIP_CALL( SCIPboolarrayCreate(&sol->valsexact->valid, blkmem) );
    2902 SCIP_CALL( SCIPrationalCreateBuffer(set->buffer, &tmp) );
    2903
    2904 SCIP_CALL( SCIPsolUnlink(sol, set, prob) );
    2905
    2906 for( v = 0; v < prob->nvars; ++v )
    2907 {
    2908 SCIPrationalSetReal(tmp, solGetArrayVal(sol, prob->vars[v]));
    2909 SCIP_CALL( solSetArrayValExact(sol, set, prob->vars[v], tmp) );
    2910 }
    2911
    2912 SCIPsolRecomputeInternObjExact(sol, set, stat, prob);
    2913
    2914 SCIPrationalFreeBuffer(set->buffer, &tmp);
    2915
    2916 return SCIP_OKAY;
    2917}
    2918
    2919/** approximates and copies the exact values to the real arrays of the solution and frees the exact data */
    2921 SCIP_SOL* sol, /**< primal solution */
    2922 BMS_BLKMEM* blkmem, /**< block memory */
    2923 SCIP_SET* set, /**< global SCIP settings */
    2924 SCIP_STAT* stat, /**< problem statistics data */
    2925 SCIP_PROB* prob /**< transformed problem data */
    2926 )
    2927{
    2928 SCIP_RATIONAL* tmp;
    2929 int v;
    2930
    2931 if( !SCIPsolIsExact(sol) )
    2932 return SCIP_OKAY;
    2933
    2934 SCIP_CALL( SCIPrationalCreateBuffer(set->buffer, &tmp) );
    2935
    2936 SCIP_CALL( SCIPsolUnlinkExact(sol, set, prob) );
    2937
    2938 for( v = 0; v < prob->nvars; ++v )
    2939 {
    2940 solGetArrayValExact(tmp, sol, prob->vars[v]);
    2941 SCIP_CALL( solSetArrayVal(sol, set, prob->vars[v], SCIPrationalGetReal(tmp)) );
    2942 }
    2943
    2944 SCIPsolRecomputeObj(sol, set, stat, prob);
    2945
    2946 SCIPrationalFreeBuffer(set->buffer, &tmp);
    2947 SCIPrationalFreeBlock(blkmem, &sol->valsexact->obj);
    2949 SCIP_CALL( SCIPrationalarrayFree(&sol->valsexact->vals, blkmem) );
    2950 BMSfreeBlockMemory(blkmem, &sol->valsexact);
    2951
    2952 return SCIP_OKAY;
    2953}
    2954
    2955/** updates the solution value sums in variables by adding the value in the given solution */
    2957 SCIP_SOL* sol, /**< primal CIP solution */
    2958 SCIP_SET* set, /**< global SCIP settings */
    2959 SCIP_STAT* stat, /**< problem statistics data */
    2960 SCIP_PROB* prob, /**< transformed problem data */
    2961 SCIP_Real weight /**< weight of solution in weighted average */
    2962 )
    2963{
    2964 SCIP_Real solval;
    2965 int v;
    2966
    2967 assert(sol != NULL);
    2968 assert(!SCIPsolIsOriginal(sol));
    2969 assert(0.0 <= weight && weight <= 1.0);
    2970
    2971 for( v = 0; v < prob->nvars; ++v )
    2972 {
    2973 assert(prob->vars[v] != NULL);
    2974 solval = SCIPsolGetVal(sol, set, stat, prob->vars[v]);
    2975 if( solval != SCIP_UNKNOWN ) /*lint !e777*/
    2976 {
    2977 prob->vars[v]->primsolavg *= (1.0-weight);
    2978 prob->vars[v]->primsolavg += weight*solval;
    2979 }
    2980 }
    2981}
    2982
    2983/** retransforms solution to original problem space */
    2985 SCIP_SOL* sol, /**< primal CIP solution */
    2986 SCIP_SET* set, /**< global SCIP settings */
    2987 SCIP_STAT* stat, /**< problem statistics data */
    2988 SCIP_PROB* origprob, /**< original problem */
    2989 SCIP_PROB* transprob, /**< transformed problem */
    2990 SCIP_Bool* hasinfval /**< pointer to store whether the solution has infinite values */
    2991 )
    2992{
    2993 SCIP_VAR** transvars;
    2994 SCIP_VAR** vars;
    2995 SCIP_VAR** activevars;
    2996 SCIP_Real* solvals;
    2997 SCIP_Real* activevals;
    2998 SCIP_Real* transsolvals;
    2999 SCIP_Real constant;
    3000 int requiredsize;
    3001 int ntransvars;
    3002 int nactivevars;
    3003 int nvars;
    3004 int v;
    3005 int i;
    3006
    3007 assert(sol != NULL);
    3008 assert(sol->solorigin == SCIP_SOLORIGIN_ZERO);
    3009 assert(origprob != NULL);
    3010 assert(transprob != NULL);
    3011 assert(hasinfval != NULL);
    3012 assert(!origprob->transformed);
    3013 assert(transprob->transformed);
    3014
    3015 *hasinfval = FALSE;
    3016
    3017 /* transform exact values first (needs unchanged solorigin) */
    3018 if( SCIPsolIsExact(sol) )
    3019 {
    3020 SCIP_CALL( SCIPsolRetransformExact(sol, set, stat, origprob, transprob, hasinfval) );
    3021 SCIP_CALL( SCIPsolOverwriteFPSolWithExact(sol, set, stat, origprob, transprob, NULL) );
    3022 return SCIP_OKAY;
    3023 }
    3024
    3025 /* This method was a performance bottleneck when retransforming a solution during presolving, before flattening the
    3026 * aggregation graph. In that case, calling SCIPsolGetVal() on the original variable consumed too much
    3027 * time. Therefore, we now first compute the active representation of each original variable using
    3028 * SCIPvarGetActiveRepresentatives(), which is much faster, and sum up the solution values of the active variables by
    3029 * hand for each original variable.
    3030 */
    3031 vars = origprob->vars;
    3032 nvars = origprob->nvars;
    3033 transvars = transprob->vars;
    3034 ntransvars = transprob->nvars;
    3035
    3036 /* allocate temporary memory for getting the active representation of the original variables, buffering the solution
    3037 * values of all active variables and storing the original solution values
    3038 */
    3039 SCIP_CALL( SCIPsetAllocBufferArray(set, &transsolvals, ntransvars + 1) );
    3040 SCIP_CALL( SCIPsetAllocBufferArray(set, &activevars, ntransvars + 1) );
    3041 SCIP_CALL( SCIPsetAllocBufferArray(set, &activevals, ntransvars + 1) );
    3042 SCIP_CALL( SCIPsetAllocBufferArray(set, &solvals, nvars) );
    3043 assert(transsolvals != NULL); /* for flexelint */
    3044 assert(solvals != NULL); /* for flexelint */
    3045
    3046 /* get the solution values of all active variables */
    3047 for( v = 0; v < ntransvars; ++v )
    3048 {
    3049 transsolvals[v] = SCIPsolGetVal(sol, set, stat, transvars[v]);
    3050 }
    3051
    3052 /* get the solution in original problem variables */
    3053 for( v = 0; v < nvars; ++v )
    3054 {
    3055 activevars[0] = vars[v];
    3056 activevals[0] = 1.0;
    3057 nactivevars = 1;
    3058 constant = 0.0;
    3059
    3060 /* get active representation of the original variable */
    3061 SCIP_CALL( SCIPvarGetActiveRepresentatives(set, activevars, activevals, &nactivevars, ntransvars + 1, &constant,
    3062 &requiredsize) );
    3063 assert(requiredsize <= ntransvars);
    3064
    3065 /* compute solution value of the original variable */
    3066 solvals[v] = constant;
    3067 for( i = 0; i < nactivevars; ++i )
    3068 {
    3069 assert(0 <= SCIPvarGetProbindex(activevars[i]) && SCIPvarGetProbindex(activevars[i]) < ntransvars);
    3070 assert(!SCIPsetIsInfinity(set, -solvals[v]) || !SCIPsetIsInfinity(set, activevals[i] * transsolvals[SCIPvarGetProbindex(activevars[i])]));
    3071 assert(!SCIPsetIsInfinity(set, solvals[v]) || !SCIPsetIsInfinity(set, -activevals[i] * transsolvals[SCIPvarGetProbindex(activevars[i])]));
    3072 solvals[v] += activevals[i] * transsolvals[SCIPvarGetProbindex(activevars[i])];
    3073 }
    3074
    3075 if( SCIPsetIsInfinity(set, solvals[v]) )
    3076 {
    3077 solvals[v] = SCIPsetInfinity(set);
    3078 *hasinfval = TRUE;
    3079 }
    3080 else if( SCIPsetIsInfinity(set, -solvals[v]) )
    3081 {
    3082 solvals[v] = -SCIPsetInfinity(set);
    3083 *hasinfval = TRUE;
    3084 }
    3085 }
    3086
    3087 /* clear the solution and convert it into original space */
    3088 SCIP_CALL( solClearArrays(sol) );
    3090 sol->obj = origprob->objoffset;
    3091
    3092 /* reinsert the values of the original variables */
    3093 for( v = 0; v < nvars; ++v )
    3094 {
    3095 assert(SCIPvarGetUnchangedObj(vars[v]) == SCIPvarGetObj(vars[v])); /*lint !e777*/
    3096
    3097 if( solvals[v] != 0.0 )
    3098 {
    3099 SCIP_CALL( solSetArrayVal(sol, set, vars[v], solvals[v]) );
    3100 if( solvals[v] != SCIP_UNKNOWN ) /*lint !e777*/
    3101 sol->obj += SCIPvarGetUnchangedObj(vars[v]) * solvals[v];
    3102 }
    3103 }
    3104
    3105 /**@todo remember the variables without original counterpart (priced variables) in the solution */
    3106
    3107 /* free temporary memory */
    3108 SCIPsetFreeBufferArray(set, &solvals);
    3109 SCIPsetFreeBufferArray(set, &activevals);
    3110 SCIPsetFreeBufferArray(set, &activevars);
    3111 SCIPsetFreeBufferArray(set, &transsolvals);
    3112
    3113 return SCIP_OKAY;
    3114}
    3115
    3116/** retransforms exact solution to original problem space */
    3118 SCIP_SOL* sol, /**< primal CIP solution */
    3119 SCIP_SET* set, /**< global SCIP settings */
    3120 SCIP_STAT* stat, /**< problem statistics data */
    3121 SCIP_PROB* origprob, /**< original problem */
    3122 SCIP_PROB* transprob, /**< transformed problem */
    3123 SCIP_Bool* hasinfval /**< pointer to store whether the solution has infinite values */
    3124 )
    3125{
    3126 SCIP_VAR** transvars;
    3127 SCIP_VAR** vars;
    3128 SCIP_VAR** activevars;
    3129 SCIP_RATIONAL** solvals;
    3130 SCIP_RATIONAL** activevals;
    3131 SCIP_RATIONAL** transsolvals;
    3132 SCIP_RATIONAL* constant;
    3133 int requiredsize;
    3134 int ntransvars;
    3135 int nactivevars;
    3136 int nvars;
    3137 int v;
    3138 int i;
    3139
    3140 assert(sol != NULL);
    3141 assert(sol->solorigin == SCIP_SOLORIGIN_ZERO);
    3142 assert(origprob != NULL);
    3143 assert(transprob != NULL);
    3144 assert(hasinfval != NULL);
    3145 assert(!origprob->transformed);
    3146 assert(transprob->transformed);
    3147 assert(SCIPsolIsExact(sol));
    3148
    3149 *hasinfval = FALSE;
    3150
    3151 /* This method was a performance bottleneck when retransforming a solution during presolving, before flattening the
    3152 * aggregation graph. In that case, calling SCIPsolGetVal() on the original variable consumed too much
    3153 * time. Therefore, we now first compute the active representation of each original variable using
    3154 * SCIPvarGetActiveRepresentatives(), which is much faster, and sum up the solution values of the active variables by
    3155 * hand for each original variable.
    3156 */
    3157 vars = origprob->vars;
    3158 nvars = origprob->nvars;
    3159 transvars = transprob->vars;
    3160 ntransvars = transprob->nvars;
    3161
    3162 /* allocate temporary memory for getting the active representation of the original variables, buffering the solution
    3163 * values of all active variables and storing the original solution values
    3164 */
    3165 SCIP_CALL( SCIPrationalCreateBufferArray(set->buffer, &transsolvals, ntransvars + 1) );
    3166 SCIP_CALL( SCIPsetAllocBufferArray(set, &activevars, ntransvars + 1) );
    3167 SCIP_CALL( SCIPrationalCreateBufferArray(set->buffer, &activevals, ntransvars + 1) );
    3168 SCIP_CALL( SCIPrationalCreateBufferArray(set->buffer, &solvals, nvars) );
    3169 SCIP_CALL( SCIPrationalCreateBuffer(set->buffer, &constant) );
    3170
    3171 assert(transsolvals != NULL); /* for flexelint */
    3172
    3173 /* get the solution values of all active variables */
    3174 for( v = 0; v < ntransvars; ++v )
    3175 {
    3176 SCIPsolGetValExact(transsolvals[v], sol, set, stat, transvars[v]);
    3177 }
    3178
    3179 /* get the solution in original problem variables */
    3180 for( v = 0; v < nvars; ++v )
    3181 {
    3182 activevars[0] = vars[v];
    3183 SCIPrationalSetReal(activevals[0], 1.0);
    3184 nactivevars = 1;
    3185 SCIPrationalSetReal(constant, 0.0);
    3186
    3187 /* get active representation of the original variable */
    3188 SCIP_CALL( SCIPvarGetActiveRepresentativesExact(set, activevars, activevals, &nactivevars, ntransvars + 1, constant,
    3189 &requiredsize, TRUE) );
    3190 assert(requiredsize <= ntransvars);
    3191
    3192 /* compute solution value of the original variable */
    3193 SCIPrationalSetRational(solvals[v], constant);
    3194 for( i = 0; i < nactivevars; ++i )
    3195 {
    3196 assert(0 <= SCIPvarGetProbindex(activevars[i]) && SCIPvarGetProbindex(activevars[i]) < ntransvars);
    3197 SCIPrationalAddProd(solvals[v], activevals[i], transsolvals[SCIPvarGetProbindex(activevars[i])]);
    3198 }
    3199
    3200 if( SCIPrationalIsAbsInfinity(solvals[v]) )
    3201 *hasinfval = TRUE;
    3202 }
    3203
    3204 /* clear the solution and convert it into original space */
    3205 SCIP_CALL( solClearArrays(sol) );
    3206 SCIPrationalSetReal(sol->valsexact->obj, origprob->objoffset);
    3208
    3209 /* reinsert the values of the original variables */
    3210 for( v = 0; v < nvars; ++v )
    3211 {
    3212 /* we might require unchangedObjexact for this assert if exact probing mode is implemented */
    3213 assert(SCIPvarGetUnchangedObj(vars[v]) == SCIPvarGetObj(vars[v])); /*lint !e777*/
    3214
    3215 if( !SCIPrationalIsZero(solvals[v]) )
    3216 {
    3217 SCIP_CALL( solSetArrayValExact(sol, set, vars[v], solvals[v]) );
    3218 SCIPrationalAddProd(sol->valsexact->obj, SCIPvarGetObjExact(vars[v]), solvals[v]);
    3219 }
    3220 }
    3221
    3222 /* free temporary memory */
    3223 SCIPrationalFreeBuffer(set->buffer, &constant);
    3224 SCIPrationalFreeBufferArray(set->buffer, &solvals, nvars);
    3225 SCIPrationalFreeBufferArray(set->buffer, &activevals, ntransvars + 1);
    3226 SCIPsetFreeBufferArray(set, &activevars);
    3227 SCIPrationalFreeBufferArray(set->buffer, &transsolvals, ntransvars + 1);
    3228
    3229 return SCIP_OKAY;
    3230}
    3231
    3232/** recomputes the objective value of an original solution, e.g., when transferring solutions
    3233 * from the solution pool (objective coefficients might have changed in the meantime)
    3234 */
    3236 SCIP_SOL* sol, /**< primal CIP solution */
    3237 SCIP_SET* set, /**< global SCIP settings */
    3238 SCIP_STAT* stat, /**< problem statistics data */
    3239 SCIP_PROB* origprob /**< original problem */
    3240 )
    3241{
    3242 SCIP_VAR** vars;
    3243 SCIP_Real solval;
    3244 int nvars;
    3245 int v;
    3246
    3247 assert(sol != NULL);
    3248 assert(SCIPsolIsOriginal(sol));
    3249 assert(!SCIPsolIsExact(sol));
    3250 assert(origprob != NULL);
    3251
    3252 vars = origprob->vars;
    3253 nvars = origprob->nvars;
    3254
    3255 /* recompute the objective value */
    3256 sol->obj = SCIPprobGetObjoffset(origprob);
    3257 for( v = 0; v < nvars; ++v )
    3258 {
    3259 solval = SCIPsolGetVal(sol, set, stat, vars[v]);
    3260 if( solval != 0.0 && solval != SCIP_UNKNOWN ) /*lint !e777*/
    3261 {
    3262 sol->obj += SCIPvarGetUnchangedObj(vars[v]) * solval;
    3263 }
    3264 }
    3265
    3266 if( SCIPsetIsInfinity(set, -sol->obj) )
    3267 sol->obj = -SCIPsetInfinity(set);
    3268}
    3269
    3270/** recomputes the objective value of an exact solution, e.g., when initialized from a real solution */
    3272 SCIP_SOL* sol, /**< primal CIP solution */
    3273 SCIP_SET* set, /**< global SCIP settings */
    3274 SCIP_STAT* stat, /**< problem statistics data */
    3275 SCIP_PROB* prob /**< scip problem */
    3276 )
    3277{
    3278 SCIP_VAR** vars;
    3279 SCIP_RATIONAL* solval;
    3280 int nvars;
    3281 int v;
    3282
    3283 assert(sol != NULL);
    3284 assert(SCIPsolIsExact(sol));
    3285 assert(prob != NULL);
    3286
    3287 vars = prob->vars;
    3288 nvars = prob->nvars;
    3289 (void) SCIPrationalCreateBuffer(set->buffer, &solval);
    3290
    3291 SCIPrationalSetFraction(sol->valsexact->obj, 0LL, 1LL);
    3292
    3293 /* recompute the objective value */
    3294 for( v = 0; v < nvars; ++v )
    3295 {
    3296 SCIPsolGetValExact(solval, sol, set, stat, vars[v]);
    3297 if( !SCIPrationalIsZero(solval) ) /*lint !e777*/
    3298 {
    3299 SCIPrationalAddProd(sol->valsexact->obj, SCIPvarGetObjExact(vars[v]), solval);
    3300 }
    3301 }
    3302
    3303 SCIPrationalFreeBuffer(set->buffer, &solval);
    3304}
    3305
    3306/** returns whether the given solutions (exact or floating point) are exactly equal */
    3307static
    3309 SCIP_SOL* sol1, /**< first primal CIP solution */
    3310 SCIP_SOL* sol2, /**< second primal CIP solution */
    3311 SCIP_SET* set, /**< global SCIP settings */
    3312 SCIP_STAT* stat, /**< problem statistics data */
    3313 SCIP_PROB* origprob, /**< original problem */
    3314 SCIP_PROB* transprob /**< transformed problem after presolve, or NULL if both solution are
    3315 * defined in the original problem space */
    3316 )
    3317{
    3318 SCIP_PROB* prob;
    3319 SCIP_RATIONAL* tmp1;
    3320 SCIP_RATIONAL* tmp2;
    3321 int v;
    3322 SCIP_Bool result = TRUE;
    3323
    3324 assert(sol1 != NULL);
    3325 assert(sol2 != NULL);
    3326 assert(((SCIPsolGetOrigin(sol1) == SCIP_SOLORIGIN_ORIGINAL) && (SCIPsolGetOrigin(sol2) == SCIP_SOLORIGIN_ORIGINAL)) || transprob != NULL);
    3327
    3328 (void) SCIPrationalCreateBuffer(set->buffer, &tmp1);
    3329 (void) SCIPrationalCreateBuffer(set->buffer, &tmp2);
    3330
    3331 /* if both solutions are original or both are transformed, take the objective values stored in the solutions */
    3333 {
    3334 SCIPsolIsExact(sol1) ? SCIPrationalSetRational(tmp1, sol1->valsexact->obj) : SCIPrationalSetReal(tmp1, sol1->obj);
    3335 SCIPsolIsExact(sol2) ? SCIPrationalSetRational(tmp2, sol2->valsexact->obj) : SCIPrationalSetReal(tmp2, sol2->obj);
    3336 }
    3337 /* one solution is original and the other not, so we have to get for both the objective in the transformed problem */
    3338 else
    3339 {
    3340 if( SCIPsolIsExact(sol1) )
    3341 SCIPsolGetObjExact(sol1, set, transprob, origprob, tmp1);
    3342 else
    3343 SCIPrationalSetReal(tmp1, SCIPsolGetObj(sol1, set, transprob, origprob));
    3344 if( SCIPsolIsExact(sol2) )
    3345 SCIPsolGetObjExact(sol2, set, transprob, origprob, tmp2);
    3346 else
    3347 SCIPrationalSetReal(tmp2, SCIPsolGetObj(sol2, set, transprob, origprob));
    3348 }
    3349
    3350 /* solutions with different objective values cannot be the same */
    3351 if( !SCIPrationalIsEQ(tmp1, tmp2) )
    3352 result = FALSE;
    3353
    3354 /* if one of the solutions is defined in the original space, the comparison has to be performed in the original
    3355 * space
    3356 */
    3357 prob = transprob;
    3359 prob = origprob;
    3360 assert(prob != NULL);
    3361
    3362 /* compare each variable value */
    3363 for( v = 0; v < prob->nvars; ++v )
    3364 {
    3365 if( SCIPsolIsExact(sol1) )
    3366 SCIPsolGetValExact(tmp1, sol1, set, stat, prob->vars[v]);
    3367 else
    3368 SCIPrationalSetReal(tmp1, SCIPsolGetVal(sol1, set, stat, prob->vars[v]));
    3369 if( SCIPsolIsExact(sol2) )
    3370 SCIPsolGetValExact(tmp2, sol2, set, stat, prob->vars[v]);
    3371 else
    3372 SCIPrationalSetReal(tmp2, SCIPsolGetVal(sol2, set, stat, prob->vars[v]));
    3373
    3374 if( !SCIPrationalIsEQ(tmp1, tmp2) )
    3375 result = FALSE;
    3376 }
    3377
    3378 SCIPrationalFreeBuffer(set->buffer, &tmp2);
    3379 SCIPrationalFreeBuffer(set->buffer, &tmp1);
    3380
    3381 return result;
    3382}
    3383
    3384/** returns whether the given solutions are equal */
    3386 SCIP_SOL* sol1, /**< first primal CIP solution */
    3387 SCIP_SOL* sol2, /**< second primal CIP solution */
    3388 SCIP_SET* set, /**< global SCIP settings */
    3389 SCIP_STAT* stat, /**< problem statistics data */
    3390 SCIP_PROB* origprob, /**< original problem */
    3391 SCIP_PROB* transprob /**< transformed problem after presolve, or NULL if both solution are
    3392 * defined in the original problem space */
    3393 )
    3394{
    3395 SCIP_PROB* prob;
    3396 SCIP_Bool infobjs;
    3397 SCIP_Real obj1;
    3398 SCIP_Real obj2;
    3399 int v;
    3400
    3401 assert(sol1 != NULL);
    3402 assert(sol2 != NULL);
    3403 assert((SCIPsolIsOriginal(sol1) && SCIPsolIsOriginal(sol2)) || transprob != NULL);
    3404
    3405 /* exact solutions should be checked exactly */
    3406 if( set->exact_enable )
    3407 {
    3408 return solsAreEqualExact(sol1, sol2, set, stat, origprob, transprob);
    3409 }
    3410
    3411 /* if both solutions are original or both are transformed, take the objective values stored in the solutions */
    3412 if( SCIPsolIsOriginal(sol1) == SCIPsolIsOriginal(sol2) )
    3413 {
    3414 obj1 = sol1->obj;
    3415 obj2 = sol2->obj;
    3416 }
    3417 /* one solution is original and the other not, so we have to get for both the objective in the transformed problem */
    3418 else
    3419 {
    3420 obj1 = SCIPsolGetObj(sol1, set, transprob, origprob);
    3421 obj2 = SCIPsolGetObj(sol2, set, transprob, origprob);
    3422 }
    3423
    3424 /* solutions with different objective values cannot be the same; we consider two infinite objective values with the
    3425 * same sign always to be different
    3426 */
    3427 infobjs = (SCIPsetIsInfinity(set, obj1) && SCIPsetIsInfinity(set, obj2))
    3428 || (SCIPsetIsInfinity(set, -obj1) && SCIPsetIsInfinity(set, -obj2));
    3429 if( !infobjs && !SCIPsetIsEQ(set, obj1, obj2) )
    3430 return FALSE;
    3431
    3432 /* if one of the solutions is defined in the original space, the comparison has to be performed in the original
    3433 * space
    3434 */
    3435 prob = transprob;
    3436 if( SCIPsolIsOriginal(sol1) || SCIPsolIsOriginal(sol2) )
    3437 prob = origprob;
    3438 assert(prob != NULL);
    3439
    3440 /* compare each variable value */
    3441 for( v = 0; v < prob->nvars; ++v )
    3442 {
    3443 SCIP_Real val1;
    3444 SCIP_Real val2;
    3445
    3446 val1 = SCIPsolGetVal(sol1, set, stat, prob->vars[v]);
    3447 val2 = SCIPsolGetVal(sol2, set, stat, prob->vars[v]);
    3448 if( !SCIPsetIsEQ(set, val1, val2) )
    3449 return FALSE;
    3450 }
    3451
    3452 return TRUE;
    3453}
    3454
    3455/** outputs non-zero elements of solution to file stream */
    3457 SCIP_SOL* sol, /**< primal CIP solution */
    3458 SCIP_SET* set, /**< global SCIP settings */
    3459 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
    3460 SCIP_STAT* stat, /**< problem statistics data */
    3461 SCIP_PROB* prob, /**< problem data (original or transformed) */
    3462 SCIP_PROB* transprob, /**< transformed problem data or NULL (to display priced variables) */
    3463 FILE* file, /**< output file (or NULL for standard output) */
    3464 SCIP_Bool mipstart, /**< should only discrete variables be printed? */
    3465 SCIP_Bool printzeros /**< should variables set to zero be printed? */
    3466 )
    3467{
    3468 SCIP_Real solval;
    3469 int v;
    3470
    3471 assert(sol != NULL);
    3472 assert(prob != NULL);
    3473 assert(SCIPsolIsOriginal(sol) || prob->transformed || transprob != NULL);
    3474 assert(!mipstart || !SCIPsolIsPartial(sol));
    3475
    3476 /* display variables of problem data */
    3477 for( v = 0; v < prob->nfixedvars; ++v )
    3478 {
    3479 assert(prob->fixedvars[v] != NULL);
    3480
    3481 /* skip non-discrete variables in a mip start */
    3482 if( mipstart && !SCIPvarIsIntegral(prob->fixedvars[v]) )
    3483 continue;
    3484
    3485 solval = SCIPsolGetVal(sol, set, stat, prob->fixedvars[v]);
    3486 if( printzeros || mipstart
    3487 || (sol->solorigin != SCIP_SOLORIGIN_PARTIAL && !SCIPsetIsZero(set, solval))
    3488 || (sol->solorigin == SCIP_SOLORIGIN_PARTIAL && solval != SCIP_UNKNOWN) ) /*lint !e777*/
    3489 {
    3490 SCIPmessageFPrintInfo(messagehdlr, file, "%-32s", SCIPvarGetName(prob->fixedvars[v]));
    3491 if( solval == SCIP_UNKNOWN ) /*lint !e777*/
    3492 SCIPmessageFPrintInfo(messagehdlr, file, " unknown");
    3493 else if( SCIPsetIsInfinity(set, solval) )
    3494 SCIPmessageFPrintInfo(messagehdlr, file, " +infinity");
    3495 else if( SCIPsetIsInfinity(set, -solval) )
    3496 SCIPmessageFPrintInfo(messagehdlr, file, " -infinity");
    3497 else
    3498 SCIPmessageFPrintInfo(messagehdlr, file, " %20.15g", solval);
    3499 SCIPmessageFPrintInfo(messagehdlr, file, " \t(obj:%.15g)\n", SCIPvarGetUnchangedObj(prob->fixedvars[v]));
    3500 }
    3501 }
    3502
    3503 for( v = 0; v < prob->nvars; ++v )
    3504 {
    3505 assert(prob->vars[v] != NULL);
    3506
    3507 /* skip non-discrete variables in a mip start */
    3508 if( mipstart && !SCIPvarIsIntegral(prob->vars[v]) )
    3509 continue;
    3510
    3511 solval = SCIPsolGetVal(sol, set, stat, prob->vars[v]);
    3512 if( printzeros || mipstart
    3513 || (sol->solorigin != SCIP_SOLORIGIN_PARTIAL && !SCIPsetIsZero(set, solval))
    3514 || (sol->solorigin == SCIP_SOLORIGIN_PARTIAL && solval != SCIP_UNKNOWN) ) /*lint !e777*/
    3515 {
    3516 SCIPmessageFPrintInfo(messagehdlr, file, "%-32s", SCIPvarGetName(prob->vars[v]));
    3517 if( solval == SCIP_UNKNOWN ) /*lint !e777*/
    3518 SCIPmessageFPrintInfo(messagehdlr, file, " unknown");
    3519 else if( SCIPsetIsInfinity(set, solval) )
    3520 SCIPmessageFPrintInfo(messagehdlr, file, " +infinity");
    3521 else if( SCIPsetIsInfinity(set, -solval) )
    3522 SCIPmessageFPrintInfo(messagehdlr, file, " -infinity");
    3523 else
    3524 SCIPmessageFPrintInfo(messagehdlr, file, " %20.15g", solval);
    3525 SCIPmessageFPrintInfo(messagehdlr, file, " \t(obj:%.15g)\n", SCIPvarGetUnchangedObj(prob->vars[v]));
    3526 }
    3527 }
    3528
    3529 /* display additional priced variables (if given problem data is original problem); consider these variables only
    3530 * if there is at least one active pricer, otherwise we might print variables that have been added by, e.g., the
    3531 * dual sparsify presolver (see #2946)
    3532 */
    3533 if( !prob->transformed && !SCIPsolIsOriginal(sol) && set->nactivepricers > 0 )
    3534 {
    3535 assert(transprob != NULL);
    3536 for( v = 0; v < transprob->nfixedvars; ++v )
    3537 {
    3538 assert(transprob->fixedvars[v] != NULL);
    3539 if( SCIPvarIsTransformedOrigvar(transprob->fixedvars[v]) )
    3540 continue;
    3541
    3542 /* skip non-discrete variables in a mip start */
    3543 if( mipstart && !SCIPvarIsIntegral(transprob->fixedvars[v]) )
    3544 continue;
    3545
    3546 solval = SCIPsolGetVal(sol, set, stat, transprob->fixedvars[v]);
    3547 if( printzeros || mipstart || !SCIPsetIsZero(set, solval) )
    3548 {
    3549 SCIPmessageFPrintInfo(messagehdlr, file, "%-32s", SCIPvarGetName(transprob->fixedvars[v]));
    3550 if( solval == SCIP_UNKNOWN ) /*lint !e777*/
    3551 SCIPmessageFPrintInfo(messagehdlr, file, " unknown");
    3552 else if( SCIPsetIsInfinity(set, solval) )
    3553 SCIPmessageFPrintInfo(messagehdlr, file, " +infinity");
    3554 else if( SCIPsetIsInfinity(set, -solval) )
    3555 SCIPmessageFPrintInfo(messagehdlr, file, " -infinity");
    3556 else
    3557 SCIPmessageFPrintInfo(messagehdlr, file, " %20.15g", solval);
    3558 SCIPmessageFPrintInfo(messagehdlr, file, " \t(obj:%.15g)\n", SCIPvarGetUnchangedObj(transprob->fixedvars[v]));
    3559 }
    3560 }
    3561 for( v = 0; v < transprob->nvars; ++v )
    3562 {
    3563 assert(transprob->vars[v] != NULL);
    3564 if( SCIPvarIsTransformedOrigvar(transprob->vars[v]) )
    3565 continue;
    3566
    3567 /* skip non-discrete variables in a mip start */
    3568 if( mipstart && !SCIPvarIsIntegral(transprob->vars[v]) )
    3569 continue;
    3570
    3571 solval = SCIPsolGetVal(sol, set, stat, transprob->vars[v]);
    3572 if( printzeros || !SCIPsetIsZero(set, solval) )
    3573 {
    3574 SCIPmessageFPrintInfo(messagehdlr, file, "%-32s", SCIPvarGetName(transprob->vars[v]));
    3575 if( solval == SCIP_UNKNOWN ) /*lint !e777*/
    3576 SCIPmessageFPrintInfo(messagehdlr, file, " unknown");
    3577 else if( SCIPsetIsInfinity(set, solval) )
    3578 SCIPmessageFPrintInfo(messagehdlr, file, " +infinity");
    3579 else if( SCIPsetIsInfinity(set, -solval) )
    3580 SCIPmessageFPrintInfo(messagehdlr, file, " -infinity");
    3581 else
    3582 SCIPmessageFPrintInfo(messagehdlr, file, " %20.15g", solval);
    3583 SCIPmessageFPrintInfo(messagehdlr, file, " \t(obj:%.15g)\n", SCIPvarGetUnchangedObj(transprob->vars[v]));
    3584 }
    3585 }
    3586 }
    3587
    3588 return SCIP_OKAY;
    3589}
    3590
    3591/** outputs non-zero elements of exact solution to file stream */
    3593 SCIP_SOL* sol, /**< primal CIP solution */
    3594 SCIP_SET* set, /**< global SCIP settings */
    3595 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
    3596 SCIP_STAT* stat, /**< problem statistics data */
    3597 SCIP_PROB* prob, /**< problem data (original or transformed) */
    3598 SCIP_PROB* transprob, /**< transformed problem data or NULL (to display priced variables) */
    3599 FILE* file, /**< output file (or NULL for standard output) */
    3600 SCIP_Bool mipstart, /**< should only discrete variables be printed? */
    3601 SCIP_Bool printzeros /**< should variables set to zero be printed? */
    3602 )
    3603{
    3604 SCIP_RATIONAL* solval;
    3605 char* solvalstr;
    3606 int solvallen;
    3607 int solvalsize = SCIP_MAXSTRLEN;
    3608 int v;
    3609
    3610 assert(sol != NULL);
    3611 assert(prob != NULL);
    3612 assert(sol->solorigin == SCIP_SOLORIGIN_ORIGINAL || prob->transformed || transprob != NULL);
    3613 assert(SCIPsolIsExact(sol));
    3614
    3615 SCIP_CALL( SCIPrationalCreateBuffer(set->buffer, &solval) );
    3616 SCIP_CALL( SCIPsetAllocBufferArray(set, &solvalstr, solvalsize) );
    3617
    3618 /* display variables of problem data */
    3619 for( v = 0; v < prob->nfixedvars; ++v )
    3620 {
    3621 assert(prob->fixedvars[v] != NULL);
    3622
    3623 /* skip non-discrete variables in a mip start */
    3624 if( mipstart && !SCIPvarIsIntegral(prob->fixedvars[v]) )
    3625 continue;
    3626
    3627 SCIPsolGetValExact(solval, sol, set, stat, prob->fixedvars[v]);
    3628 if( printzeros || mipstart
    3629 || (sol->solorigin != SCIP_SOLORIGIN_PARTIAL && !SCIPrationalIsZero(solval))
    3630 || (sol->solorigin == SCIP_SOLORIGIN_PARTIAL) ) /*lint !e777*/
    3631 {
    3632 solvallen = SCIPrationalToString(solval, solvalstr, solvalsize);
    3633 if( solvallen >= solvalsize )
    3634 {
    3635 solvalsize = SCIPrationalStrLen(solval) + 1;
    3636 SCIP_CALL( SCIPsetReallocBufferArray(set, &solvalstr, solvalsize) );
    3637 solvallen = SCIPrationalToString(solval, solvalstr, solvalsize);
    3638 assert(solvallen < solvalsize);
    3639 }
    3640
    3641 SCIPmessageFPrintInfo(messagehdlr, file, "%-32s", SCIPvarGetName(prob->fixedvars[v]));
    3642 SCIPmessageFPrintInfo(messagehdlr, file, " %20s", solvalstr);
    3643
    3644 solvallen = SCIPrationalToString(SCIPvarGetObjExact(prob->fixedvars[v]), solvalstr, solvalsize);
    3645 if( solvallen >= solvalsize )
    3646 {
    3647 solvalsize = SCIPrationalStrLen(solval) + 1;
    3648 SCIP_CALL( SCIPsetReallocBufferArray(set, &solvalstr, solvalsize) );
    3649 solvallen = SCIPrationalToString(solval, solvalstr, solvalsize);
    3650 assert(solvallen < solvalsize);
    3651 }
    3652
    3653 SCIPmessageFPrintInfo(messagehdlr, file, " \t(obj:%s)\n", solvalstr);
    3654 }
    3655 }
    3656
    3657 for( v = 0; v < prob->nvars; ++v )
    3658 {
    3659 assert(prob->vars[v] != NULL);
    3660
    3661 /* skip non-discrete variables in a mip start */
    3662 if( mipstart && !SCIPvarIsIntegral(prob->vars[v]) )
    3663 continue;
    3664
    3665 SCIPsolGetValExact(solval, sol, set, stat, prob->vars[v]);
    3666 if( printzeros || mipstart
    3667 || (sol->solorigin != SCIP_SOLORIGIN_PARTIAL && !SCIPrationalIsZero(solval)) ) /*lint !e777*/
    3668 {
    3669 solvallen = SCIPrationalToString(solval, solvalstr, solvalsize);
    3670 if( solvallen >= solvalsize )
    3671 {
    3672 solvalsize = SCIPrationalStrLen(solval) + 1;
    3673 SCIP_CALL( SCIPsetReallocBufferArray(set, &solvalstr, solvalsize) );
    3674 solvallen = SCIPrationalToString(solval, solvalstr, solvalsize);
    3675 assert(solvallen < solvalsize);
    3676 }
    3677
    3678 SCIPmessageFPrintInfo(messagehdlr, file, "%-32s", SCIPvarGetName(prob->vars[v]));
    3679 SCIPmessageFPrintInfo(messagehdlr, file, " %20s", solvalstr);
    3680
    3681 solvallen = SCIPrationalToString(SCIPvarGetObjExact(prob->vars[v]), solvalstr, solvalsize);
    3682 if( solvallen >= solvalsize )
    3683 {
    3684 solvalsize = SCIPrationalStrLen(solval) + 1;
    3685 SCIP_CALL( SCIPsetReallocBufferArray(set, &solvalstr, solvalsize) );
    3686 solvallen = SCIPrationalToString(solval, solvalstr, solvalsize);
    3687 assert(solvallen < solvalsize);
    3688 }
    3689
    3690 SCIPmessageFPrintInfo(messagehdlr, file, " \t(obj:%s)\n", solvalstr);
    3691 }
    3692 }
    3693
    3694 /* display additional priced variables (if given problem data is original problem) */
    3695 if( !prob->transformed && sol->solorigin != SCIP_SOLORIGIN_ORIGINAL )
    3696 {
    3697 assert(transprob != NULL);
    3698 for( v = 0; v < transprob->nfixedvars; ++v )
    3699 {
    3700 assert(transprob->fixedvars[v] != NULL);
    3701 if( SCIPvarIsTransformedOrigvar(transprob->fixedvars[v]) )
    3702 continue;
    3703
    3704 /* skip non-discrete variables in a mip start */
    3705 if( mipstart && !SCIPvarIsIntegral(transprob->fixedvars[v]) )
    3706 continue;
    3707
    3708 SCIPsolGetValExact(solval, sol, set, stat, transprob->fixedvars[v]);
    3709 if( printzeros || mipstart || !SCIPrationalIsZero(solval) )
    3710 {
    3711 solvallen = SCIPrationalToString(solval, solvalstr, solvalsize);
    3712 if( solvallen >= solvalsize )
    3713 {
    3714 solvalsize = SCIPrationalStrLen(solval) + 1;
    3715 SCIP_CALL( SCIPsetReallocBufferArray(set, &solvalstr, solvalsize) );
    3716 solvallen = SCIPrationalToString(solval, solvalstr, solvalsize);
    3717 assert(solvallen < solvalsize);
    3718 }
    3719
    3720 SCIPmessageFPrintInfo(messagehdlr, file, "%-32s", SCIPvarGetName(transprob->fixedvars[v]));
    3721 SCIPmessageFPrintInfo(messagehdlr, file, " %20s", solvalstr);
    3722
    3723 solvallen = SCIPrationalToString(SCIPvarGetObjExact(transprob->fixedvars[v]), solvalstr, solvalsize);
    3724 if( solvallen >= solvalsize )
    3725 {
    3726 solvalsize = SCIPrationalStrLen(solval) + 1;
    3727 SCIP_CALL( SCIPsetReallocBufferArray(set, &solvalstr, solvalsize) );
    3728 solvallen = SCIPrationalToString(solval, solvalstr, solvalsize);
    3729 assert(solvallen < solvalsize);
    3730 }
    3731
    3732 SCIPmessageFPrintInfo(messagehdlr, file, " \t(obj:%s)\n", solvalstr);
    3733 }
    3734 }
    3735 for( v = 0; v < transprob->nvars; ++v )
    3736 {
    3737 assert(transprob->vars[v] != NULL);
    3738 if( SCIPvarIsTransformedOrigvar(transprob->vars[v]) )
    3739 continue;
    3740
    3741 /* skip non-discrete variables in a mip start */
    3742 if( mipstart && !SCIPvarIsIntegral(transprob->vars[v]) )
    3743 continue;
    3744
    3745 SCIPsolGetValExact(solval, sol, set, stat, transprob->vars[v]);
    3746 if( printzeros || !SCIPrationalIsZero(solval) )
    3747 {
    3748 solvallen = SCIPrationalToString(solval, solvalstr, solvalsize);
    3749 if( solvallen >= solvalsize )
    3750 {
    3751 solvalsize = SCIPrationalStrLen(solval) + 1;
    3752 SCIP_CALL( SCIPsetReallocBufferArray(set, &solvalstr, solvalsize) );
    3753 solvallen = SCIPrationalToString(solval, solvalstr, solvalsize);
    3754 assert(solvallen < solvalsize);
    3755 }
    3756
    3757 SCIPmessageFPrintInfo(messagehdlr, file, "%-32s", SCIPvarGetName(transprob->vars[v]));
    3758 SCIPmessageFPrintInfo(messagehdlr, file, " %20s", solvalstr);
    3759
    3760 solvallen = SCIPrationalToString(SCIPvarGetObjExact(transprob->vars[v]), solvalstr, solvalsize);
    3761 if( solvallen >= solvalsize )
    3762 {
    3763 solvalsize = SCIPrationalStrLen(solval) + 1;
    3764 SCIP_CALL( SCIPsetReallocBufferArray(set, &solvalstr, solvalsize) );
    3765 solvallen = SCIPrationalToString(solval, solvalstr, solvalsize);
    3766 assert(solvallen < solvalsize);
    3767 }
    3768
    3769 SCIPmessageFPrintInfo(messagehdlr, file, " \t(obj:%s)\n", solvalstr);
    3770 }
    3771 }
    3772 }
    3773
    3774 SCIPsetFreeBufferArray(set, &solvalstr);
    3775 SCIPrationalFreeBuffer(set->buffer, &solval);
    3776
    3777 return SCIP_OKAY;
    3778}
    3779
    3780/** outputs non-zero elements of solution representing a ray to file stream */
    3782 SCIP_SOL* sol, /**< primal CIP solution */
    3783 SCIP_SET* set, /**< global SCIP settings */
    3784 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
    3785 SCIP_STAT* stat, /**< problem statistics data */
    3786 SCIP_PROB* prob, /**< problem data (original or transformed) */
    3787 SCIP_PROB* transprob, /**< transformed problem data or NULL (to display priced variables) */
    3788 FILE* file, /**< output file (or NULL for standard output) */
    3789 SCIP_Bool printzeros /**< should variables set to zero be printed? */
    3790 )
    3791{
    3792 SCIP_Real solval;
    3793 int v;
    3794
    3795 assert(sol != NULL);
    3796 assert(prob != NULL);
    3797 assert(SCIPsolIsOriginal(sol) || prob->transformed || transprob != NULL);
    3798
    3799 /* display variables of problem data */
    3800 for( v = 0; v < prob->nfixedvars; ++v )
    3801 {
    3802 assert(prob->fixedvars[v] != NULL);
    3803 solval = SCIPsolGetRayVal(sol, set, stat, prob->fixedvars[v]);
    3804 if( printzeros || !SCIPsetIsZero(set, solval) )
    3805 {
    3806 SCIPmessageFPrintInfo(messagehdlr, file, "%-32s", SCIPvarGetName(prob->fixedvars[v]));
    3807 if( solval == SCIP_UNKNOWN ) /*lint !e777*/
    3808 SCIPmessageFPrintInfo(messagehdlr, file, " unknown");
    3809 else if( SCIPsetIsInfinity(set, solval) )
    3810 SCIPmessageFPrintInfo(messagehdlr, file, " +infinity");
    3811 else if( SCIPsetIsInfinity(set, -solval) )
    3812 SCIPmessageFPrintInfo(messagehdlr, file, " -infinity");
    3813 else
    3814 SCIPmessageFPrintInfo(messagehdlr, file, " %20.15g", solval);
    3815 SCIPmessageFPrintInfo(messagehdlr, file, " \t(obj:%.15g)\n", SCIPvarGetUnchangedObj(prob->fixedvars[v]));
    3816 }
    3817 }
    3818 for( v = 0; v < prob->nvars; ++v )
    3819 {
    3820 assert(prob->vars[v] != NULL);
    3821 solval = SCIPsolGetRayVal(sol, set, stat, prob->vars[v]);
    3822 if( printzeros || !SCIPsetIsZero(set, solval) )
    3823 {
    3824 SCIPmessageFPrintInfo(messagehdlr, file, "%-32s", SCIPvarGetName(prob->vars[v]));
    3825 if( solval == SCIP_UNKNOWN ) /*lint !e777*/
    3826 SCIPmessageFPrintInfo(messagehdlr, file, " unknown");
    3827 else if( SCIPsetIsInfinity(set, solval) )
    3828 SCIPmessageFPrintInfo(messagehdlr, file, " +infinity");
    3829 else if( SCIPsetIsInfinity(set, -solval) )
    3830 SCIPmessageFPrintInfo(messagehdlr, file, " -infinity");
    3831 else
    3832 SCIPmessageFPrintInfo(messagehdlr, file, " %20.15g", solval);
    3833 SCIPmessageFPrintInfo(messagehdlr, file, " \t(obj:%.15g)\n", SCIPvarGetUnchangedObj(prob->vars[v]));
    3834 }
    3835 }
    3836
    3837 /* display additional priced variables (if given problem data is original problem) */
    3838 if( !prob->transformed && !SCIPsolIsOriginal(sol) )
    3839 {
    3840 assert(transprob != NULL);
    3841 for( v = 0; v < transprob->nfixedvars; ++v )
    3842 {
    3843 assert(transprob->fixedvars[v] != NULL);
    3844 if( SCIPvarIsTransformedOrigvar(transprob->fixedvars[v]) )
    3845 continue;
    3846
    3847 solval = SCIPsolGetRayVal(sol, set, stat, transprob->fixedvars[v]);
    3848 if( printzeros || !SCIPsetIsZero(set, solval) )
    3849 {
    3850 SCIPmessageFPrintInfo(messagehdlr, file, "%-32s", SCIPvarGetName(transprob->fixedvars[v]));
    3851 if( solval == SCIP_UNKNOWN ) /*lint !e777*/
    3852 SCIPmessageFPrintInfo(messagehdlr, file, " unknown");
    3853 else if( SCIPsetIsInfinity(set, solval) )
    3854 SCIPmessageFPrintInfo(messagehdlr, file, " +infinity");
    3855 else if( SCIPsetIsInfinity(set, -solval) )
    3856 SCIPmessageFPrintInfo(messagehdlr, file, " -infinity");
    3857 else
    3858 SCIPmessageFPrintInfo(messagehdlr, file, " %20.15g", solval);
    3859 SCIPmessageFPrintInfo(messagehdlr, file, " \t(obj:%.15g)\n", SCIPvarGetUnchangedObj(transprob->fixedvars[v]));
    3860 }
    3861 }
    3862 for( v = 0; v < transprob->nvars; ++v )
    3863 {
    3864 assert(transprob->vars[v] != NULL);
    3865 if( SCIPvarIsTransformedOrigvar(transprob->vars[v]) )
    3866 continue;
    3867
    3868 solval = SCIPsolGetRayVal(sol, set, stat, transprob->vars[v]);
    3869 if( printzeros || !SCIPsetIsZero(set, solval) )
    3870 {
    3871 SCIPmessageFPrintInfo(messagehdlr, file, "%-32s", SCIPvarGetName(transprob->vars[v]));
    3872 if( solval == SCIP_UNKNOWN ) /*lint !e777*/
    3873 SCIPmessageFPrintInfo(messagehdlr, file, " unknown");
    3874 else if( SCIPsetIsInfinity(set, solval) )
    3875 SCIPmessageFPrintInfo(messagehdlr, file, " +infinity");
    3876 else if( SCIPsetIsInfinity(set, -solval) )
    3877 SCIPmessageFPrintInfo(messagehdlr, file, " -infinity");
    3878 else
    3879 SCIPmessageFPrintInfo(messagehdlr, file, " %20.15g", solval);
    3880 SCIPmessageFPrintInfo(messagehdlr, file, " \t(obj:%.15g)\n", SCIPvarGetUnchangedObj(transprob->vars[v]));
    3881 }
    3882 }
    3883 }
    3884
    3885 return SCIP_OKAY;
    3886}
    3887
    3888/** set new origin type for a solution */
    3890 SCIP_SOL* sol, /**< primal CIP solution */
    3891 SCIP_SOLORIGIN origin /**< new origin type of the solution */
    3892 )
    3893{
    3894 assert( sol != NULL );
    3895 sol->solorigin = origin;
    3896}
    3897
    3898/*
    3899 * methods for accumulated numerical violations of a solution
    3900 */
    3901
    3902/** reset violations of a solution */
    3904 SCIP_SOL* sol /**< primal CIP solution */
    3905 )
    3906{
    3907 assert(sol != NULL);
    3908
    3909 sol->viol.absviolbounds = 0.0;
    3910 sol->viol.relviolbounds = 0.0;
    3911 sol->viol.absviolintegrality = 0.0;
    3912 sol->viol.absviollprows = 0.0;
    3913 sol->viol.relviollprows = 0.0;
    3914 sol->viol.absviolcons = 0.0;
    3915 sol->viol.relviolcons = 0.0;
    3916}
    3917
    3918/** update integrality violation of a solution */
    3920 SCIP_SOL* sol, /**< primal CIP solution */
    3921 SCIP_Real absviolintegrality /**< absolute violation of integrality */
    3922 )
    3923{
    3924 assert(sol != NULL);
    3925
    3926 sol->viol.absviolintegrality = MAX(sol->viol.absviolintegrality, absviolintegrality);
    3927}
    3928
    3929/** update bound violation of a solution */
    3931 SCIP_SOL* sol, /**< primal CIP solution */
    3932 SCIP_Real absviolbounds, /**< absolute violation of bounds */
    3933 SCIP_Real relviolbounds /**< relative violation of bounds */
    3934 )
    3935{
    3936 assert(sol != NULL);
    3937
    3938 sol->viol.absviolbounds = MAX(sol->viol.absviolbounds, absviolbounds);
    3939 sol->viol.relviolbounds = MAX(sol->viol.relviolbounds, relviolbounds);
    3940}
    3941
    3942/** update LP row violation of a solution */
    3944 SCIP_SOL* sol, /**< primal CIP solution */
    3945 SCIP_Real absviollprows, /**< absolute violation of LP rows */
    3946 SCIP_Real relviollprows /**< relative violation of LP rows */
    3947 )
    3948{
    3949 assert(sol != NULL);
    3950
    3951 sol->viol.absviollprows = MAX(sol->viol.absviollprows, absviollprows);
    3952 sol->viol.relviollprows = MAX(sol->viol.relviollprows, relviollprows);
    3953}
    3954
    3955/** update constraint violation of a solution */
    3957 SCIP_SOL* sol, /**< primal CIP solution */
    3958 SCIP_Real absviolcons, /**< absolute violation of constraint */
    3959 SCIP_Real relviolcons /**< relative violation of constraint */
    3960 )
    3961{
    3962 assert(sol != NULL);
    3963
    3964 sol->viol.absviolcons = MAX(sol->viol.absviolcons, absviolcons);
    3965 sol->viol.relviolcons = MAX(sol->viol.relviolcons, relviolcons);
    3966}
    3967
    3968/** update violation of a constraint that is represented in the LP */
    3970 SCIP_SOL* sol, /**< primal CIP solution */
    3971 SCIP_Real absviol, /**< absolute violation of constraint */
    3972 SCIP_Real relviol /**< relative violation of constraint */
    3973 )
    3974{
    3975 assert(sol != NULL);
    3976
    3977 SCIPsolUpdateConsViolation(sol, absviol, relviol);
    3978 SCIPsolUpdateLPRowViolation(sol, absviol, relviol);
    3979}
    3980
    3981/** get maximum absolute bound violation of solution */
    3983 SCIP_SOL* sol /**< primal CIP solution */
    3984 )
    3985{
    3986 assert(sol != NULL);
    3987
    3988 return sol->viol.absviolbounds;
    3989}
    3990
    3991/** get maximum relative bound violation of solution */
    3993 SCIP_SOL* sol /**< primal CIP solution */
    3994 )
    3995{
    3996 assert(sol != NULL);
    3997
    3998 return sol->viol.relviolbounds;
    3999}
    4000
    4001/** get maximum absolute integrality violation of solution */
    4003 SCIP_SOL* sol /**< primal CIP solution */
    4004 )
    4005{
    4006 assert(sol != NULL);
    4007
    4008 return sol->viol.absviolintegrality;
    4009}
    4010
    4011/** get maximum absolute LP row violation of solution */
    4013 SCIP_SOL* sol /**< primal CIP solution */
    4014 )
    4015{
    4016 assert(sol != NULL);
    4017
    4018 return sol->viol.absviollprows;
    4019}
    4020
    4021/** get maximum relative LP row violation of solution */
    4023 SCIP_SOL* sol /**< primal CIP solution */
    4024 )
    4025{
    4026 assert(sol != NULL);
    4027
    4028 return sol->viol.relviollprows;
    4029}
    4030
    4031/** get maximum absolute constraint violation of solution */
    4033 SCIP_SOL* sol /**< primal CIP solution */
    4034 )
    4035{
    4036 assert(sol != NULL);
    4037
    4038 return sol->viol.absviolcons;
    4039}
    4040
    4041/** get maximum relative constraint violation of solution */
    4043 SCIP_SOL* sol /**< primal CIP solution */
    4044 )
    4045{
    4046 assert(sol != NULL);
    4047
    4048 return sol->viol.relviolcons;
    4049}
    4050
    4051/** overwrite FP solution with exact values */
    4053 SCIP_SOL* sol, /**< exact primal CIP solution */
    4054 SCIP_SET* set, /**< global SCIP settings */
    4055 SCIP_STAT* stat, /**< problem statistics data */
    4056 SCIP_PROB* origprob, /**< problem data */
    4057 SCIP_PROB* transprob, /**< problem data */
    4058 SCIP_TREE* tree /**< branch and bound tree, or NULL */
    4059 )
    4060{
    4061 SCIP_VAR** vars;
    4062 SCIP_RATIONAL* solval;
    4063 int nvars;
    4064 int i;
    4065
    4066 assert(sol != NULL);
    4067 assert(SCIPsolIsExact(sol));
    4068
    4069 vars = SCIPsolIsOriginal(sol) ? SCIPprobGetVars(origprob) : SCIPprobGetVars(transprob);
    4070 nvars = SCIPsolIsOriginal(sol) ? SCIPprobGetNVars(origprob) : SCIPprobGetNVars(transprob);
    4071
    4072 SCIP_CALL( SCIPrationalCreateBuffer(set->buffer, &solval) );
    4073
    4074 /* overwrite all the variables */
    4075 for( i = 0; i < nvars; i++ )
    4076 {
    4077 SCIP_ROUNDMODE_RAT roundmode;
    4078 SCIPsolGetValExact(solval, sol, set, stat, vars[i]);
    4079 roundmode = vars[i]->obj > 0 ? SCIP_R_ROUND_UPWARDS : SCIP_R_ROUND_DOWNWARDS;
    4080
    4081 SCIPrationalDebugMessage("overwriting value %g of var %s with value %g (%q) \n", SCIPsolGetVal(sol, set, stat, vars[i]),
    4082 vars[i]->name, SCIPrationalRoundReal(solval, roundmode), solval);
    4083
    4084 SCIP_CALL( SCIPsolSetVal(sol, set, stat, tree, vars[i],
    4085 SCIPrationalRoundReal(solval, roundmode)) );
    4086 }
    4087
    4088 if( SCIPsolIsOriginal(sol) )
    4089 {
    4091 }
    4092 else
    4093 {
    4094 SCIPsolGetObjExact(sol, set, transprob, origprob, solval);
    4095 }
    4096
    4097 /* hard-set the obj value of the solution */
    4099
    4100 SCIPrationalFreeBuffer(set->buffer, &solval);
    4101
    4102 return SCIP_OKAY;
    4103}
    4104
    4105/** comparison method for sorting solution by decreasing objective value (best solution will be sorted to the end) */
    4107{
    4108 if( ((SCIP_SOL*)elem1)->obj - ((SCIP_SOL*)elem2)->obj < 0 )
    4109 return 1;
    4110 else if( ((SCIP_SOL*)elem1)->obj - ((SCIP_SOL*)elem2)->obj > 0 )
    4111 return -1;
    4112 else
    4113 return 0;
    4114}
    4115
    4116/*
    4117 * simple functions implemented as defines
    4118 */
    4119
    4120/* In debug mode, the following methods are implemented as function calls to ensure
    4121 * type validity.
    4122 * In optimized mode, the methods are implemented as defines to improve performance.
    4123 * However, we want to have them in the library anyways, so we have to undef the defines.
    4124 */
    4125
    4126#undef SCIPsolGetOrigin
    4127#undef SCIPsolIsOriginal
    4128#undef SCIPsolGetOrigObj
    4129#undef SCIPsolGetTime
    4130#undef SCIPsolGetNodenum
    4131#undef SCIPsolGetRunnum
    4132#undef SCIPsolGetDepth
    4133#undef SCIPsolGetHeur
    4134#undef SCIPsolGetRelax
    4135#undef SCIPsolOrigAddObjval
    4136#undef SCIPsolGetPrimalIndex
    4137#undef SCIPsolSetPrimalIndex
    4138#undef SCIPsolGetIndex
    4139#undef SCIPsolGetType
    4140#undef SCIPsolSetLPRelaxation
    4141#undef SCIPsolSetStrongbranching
    4142#undef SCIPsolSetPseudo
    4143
    4144/** gets origin of solution */
    4146 SCIP_SOL* sol /**< primal CIP solution */
    4147 )
    4148{
    4149 assert(sol != NULL);
    4150
    4151 return sol->solorigin;
    4152}
    4153
    4154/** returns whether the given solution is defined on original variables */
    4156 SCIP_SOL* sol /**< primal CIP solution */
    4157 )
    4158{
    4159 assert(sol != NULL);
    4160
    4162}
    4163
    4164/** returns whether a solution is an exact rational solution */
    4166 SCIP_SOL* sol /**< primal CIP solution */
    4167 )
    4168{
    4169 assert(sol != NULL);
    4170
    4171 return sol->valsexact != NULL;
    4172}
    4173
    4174/** returns whether the given solution is defined on original variables and containes unknown solution values */
    4176 SCIP_SOL* sol /**< primal CIP solution */
    4177 )
    4178{
    4179 assert(sol != NULL);
    4180
    4181 return (sol->solorigin == SCIP_SOLORIGIN_PARTIAL);
    4182}
    4183
    4184/** gets objective value of primal CIP solution which lives in the original problem space */
    4186 SCIP_SOL* sol /**< primal CIP solution */
    4187 )
    4188{
    4189 assert(sol != NULL);
    4190 assert(SCIPsolIsOriginal(sol));
    4191
    4192 return sol->obj;
    4193}
    4194
    4195/** gets objective value of primal CIP solution which lives in the original problem space */
    4197 SCIP_SOL* sol /**< primal CIP solution */
    4198 )
    4199{
    4200 assert(sol != NULL);
    4201 assert(SCIPsolIsOriginal(sol));
    4202 assert(SCIPsolIsExact(sol));
    4203
    4204 return sol->valsexact->obj;
    4205}
    4206
    4207/** adds value to the objective value of a given original primal CIP solution */
    4209 SCIP_SOL* sol, /**< primal CIP solution */
    4210 SCIP_Real addval /**< offset value to add */
    4211 )
    4212{
    4213 assert(sol != NULL);
    4214 assert(sol->solorigin == SCIP_SOLORIGIN_ORIGINAL);
    4215
    4216 sol->obj += addval;
    4217}
    4218
    4219/** adds value to the objective value of a given original primal CIP solution */
    4221 SCIP_SOL* sol, /**< primal CIP solution */
    4222 SCIP_RATIONAL* addval /**< offset value to add */
    4223 )
    4224{
    4225 assert(sol != NULL);
    4226 assert(sol->solorigin == SCIP_SOLORIGIN_ORIGINAL);
    4227 assert(SCIPsolIsExact(sol));
    4228
    4229 SCIPrationalAdd(sol->valsexact->obj, sol->valsexact->obj, addval);
    4230 sol->obj = SCIPrationalGetReal(sol->valsexact->obj);
    4231}
    4232
    4233/** gets clock time, when this solution was found */
    4235 SCIP_SOL* sol /**< primal CIP solution */
    4236 )
    4237{
    4238 assert(sol != NULL);
    4239
    4240 return sol->time;
    4241}
    4242
    4243/** gets branch and bound run number, where this solution was found */
    4245 SCIP_SOL* sol /**< primal CIP solution */
    4246 )
    4247{
    4248 assert(sol != NULL);
    4249
    4250 return sol->runnum;
    4251}
    4252
    4253/** gets node number, where this solution was found */
    4255 SCIP_SOL* sol /**< primal CIP solution */
    4256 )
    4257{
    4258 assert(sol != NULL);
    4259
    4260 return sol->nodenum;
    4261}
    4262
    4263/** gets node's depth, where this solution was found */
    4265 SCIP_SOL* sol /**< primal CIP solution */
    4266 )
    4267{
    4268 assert(sol != NULL);
    4269
    4270 return sol->depth;
    4271}
    4272
    4273/** gets heuristic, that found this solution or NULL if solution has type different than SCIP_SOLTYPE_HEUR */
    4275 SCIP_SOL* sol /**< primal CIP solution */
    4276 )
    4277{
    4278 assert(sol != NULL);
    4279
    4280 return sol->type == SCIP_SOLTYPE_HEUR ? sol->creator.heur : NULL;
    4281}
    4282
    4283/** gets current position of solution in array of existing solutions of primal data */
    4285 SCIP_SOL* sol /**< primal CIP solution */
    4286 )
    4287{
    4288 assert(sol != NULL);
    4289
    4290 return sol->primalindex;
    4291}
    4292
    4293/** sets current position of solution in array of existing solutions of primal data */
    4295 SCIP_SOL* sol, /**< primal CIP solution */
    4296 int primalindex /**< new primal index of solution */
    4297 )
    4298{
    4299 assert(sol != NULL);
    4300
    4301 sol->primalindex = primalindex;
    4302}
    4303
    4304/** returns unique index of given solution */
    4306 SCIP_SOL* sol /**< primal CIP solution */
    4307 )
    4308{
    4309 assert(sol != NULL);
    4310
    4311 return sol->index;
    4312}
    4313
    4314/** informs the solution that it now belongs to the given primal heuristic. For convenience and backwards compatibility,
    4315 * the method accepts NULL as input for \p heur, in which case the solution type is set to SCIP_SOLTYPE_LPRELAX.
    4316 *
    4317 * @note Relaxation handlers should use SCIPsolSetRelax() instead.
    4318 */
    4320 SCIP_SOL* sol, /**< primal CIP solution */
    4321 SCIP_HEUR* heur /**< primal heuristic that found the solution, or NULL for LP solutions */
    4322 )
    4323{
    4324 assert(sol != NULL);
    4325
    4326 if( heur == NULL )
    4328 else
    4329 {
    4330 sol->type = SCIP_SOLTYPE_HEUR;
    4331 sol->creator.heur = heur;
    4332 }
    4333}
    4334
    4335/** gets information if solution was found by the LP, a primal heuristic, or a custom relaxator */
    4337 SCIP_SOL* sol /**< primal CIP solution */
    4338 )
    4339{
    4340 assert(sol != NULL);
    4341
    4342 return sol->type;
    4343}
    4344
    4345/** gets relaxation handler that found this solution, or NULL if solution has different type than SCIP_SOLTYPE_RELAX */
    4347 SCIP_SOL* sol /**< primal CIP solution */
    4348 )
    4349{
    4350 assert(sol != NULL);
    4351
    4352 return sol->type == SCIP_SOLTYPE_RELAX ? sol->creator.relax : NULL;
    4353}
    4354
    4355/** informs the solution that it now belongs to the given relaxation handler */
    4357 SCIP_SOL* sol, /**< primal CIP solution */
    4358 SCIP_RELAX* relax /**< relaxator that found the solution */
    4359 )
    4360{
    4361 assert(sol != NULL);
    4362 assert(relax != NULL);
    4363
    4364 sol->type = SCIP_SOLTYPE_RELAX;
    4365 sol->creator.relax = relax;
    4366}
    4367
    4368/** informs the solution that it is an LP relaxation solution */
    4370 SCIP_SOL* sol /**< primal CIP solution */
    4371 )
    4372{
    4373 assert(sol != NULL);
    4374
    4376}
    4377
    4378/** informs the solution that it is a solution found during strong branching */
    4380 SCIP_SOL* sol /**< primal CIP solution */
    4381 )
    4382{
    4383 assert(sol != NULL);
    4384
    4386}
    4387
    4388/** informs the solution that it originates from a pseudo solution */
    4390 SCIP_SOL* sol /**< primal CIP solution */
    4391 )
    4392{
    4393 assert(sol != NULL);
    4394
    4396}
    4397
    SCIP_VAR * h
    Definition: circlepacking.c:68
    SCIP_Real * r
    Definition: circlepacking.c:59
    SCIP_Real SCIPclockGetLastTime(SCIP_CLOCK *clck)
    Definition: clock.c:529
    SCIP_Real SCIPclockGetTime(SCIP_CLOCK *clck)
    Definition: clock.c:438
    internal methods for clocks and timing issues
    SCIP_RETCODE SCIPconsCheck(SCIP_CONS *cons, SCIP_SET *set, SCIP_SOL *sol, SCIP_Bool checkintegrality, SCIP_Bool checklprows, SCIP_Bool printreason, SCIP_RESULT *result)
    Definition: cons.c:7599
    SCIP_RETCODE SCIPconshdlrCheck(SCIP_CONSHDLR *conshdlr, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_SOL *sol, SCIP_Bool checkintegrality, SCIP_Bool checklprows, SCIP_Bool printreason, SCIP_Bool completely, SCIP_RESULT *result)
    Definition: cons.c:3838
    internal methods for constraints and constraint handlers
    #define NULL
    Definition: def.h:255
    #define SCIP_MAXSTRLEN
    Definition: def.h:276
    #define SCIP_Longint
    Definition: def.h:148
    #define SCIP_INVALID
    Definition: def.h:185
    #define SCIP_Bool
    Definition: def.h:98
    #define SCIP_ALLOC(x)
    Definition: def.h:373
    #define SCIP_Real
    Definition: def.h:163
    #define SCIP_UNKNOWN
    Definition: def.h:186
    #define ABS(x)
    Definition: def.h:223
    #define TRUE
    Definition: def.h:100
    #define FALSE
    Definition: def.h:101
    #define MAX(x, y)
    Definition: def.h:227
    #define SCIP_LONGINT_FORMAT
    Definition: def.h:155
    #define SCIPABORT()
    Definition: def.h:334
    #define REALABS(x)
    Definition: def.h:189
    #define SCIP_CALL(x)
    Definition: def.h:362
    SCIP_Real SCIPrelDiff(SCIP_Real val1, SCIP_Real val2)
    Definition: misc.c:11162
    SCIP_VAR * SCIPcolGetVar(SCIP_COL *col)
    Definition: lp.c:17425
    int SCIPcolGetNNonz(SCIP_COL *col)
    Definition: lp.c:17520
    SCIP_Real * SCIPcolGetVals(SCIP_COL *col)
    Definition: lp.c:17555
    SCIP_ROW ** SCIPcolGetRows(SCIP_COL *col)
    Definition: lp.c:17545
    const char * SCIPconshdlrGetName(SCIP_CONSHDLR *conshdlr)
    Definition: cons.c:4316
    SCIP_Bool SCIPconshdlrNeedsCons(SCIP_CONSHDLR *conshdlr)
    Definition: cons.c:5302
    int SCIPconshdlrGetCheckPriority(SCIP_CONSHDLR *conshdlr)
    Definition: cons.c:5262
    SCIP_CONSHDLR * SCIPconsGetHdlr(SCIP_CONS *cons)
    Definition: cons.c:8409
    SCIP_Bool SCIPconsIsChecked(SCIP_CONS *cons)
    Definition: cons.c:8588
    SCIP_Bool SCIPconsIsModifiable(SCIP_CONS *cons)
    Definition: cons.c:8638
    SCIP_RETCODE SCIPrationalCreateBlock(BMS_BLKMEM *blkmem, SCIP_RATIONAL **rational)
    Definition: rational.cpp:109
    void SCIPrationalMult(SCIP_RATIONAL *res, SCIP_RATIONAL *op1, SCIP_RATIONAL *op2)
    Definition: rational.cpp:1067
    void SCIPrationalSetInfinity(SCIP_RATIONAL *res)
    Definition: rational.cpp:619
    void SCIPrationalAdd(SCIP_RATIONAL *res, SCIP_RATIONAL *op1, SCIP_RATIONAL *op2)
    Definition: rational.cpp:936
    SCIP_Real SCIPrationalGetReal(SCIP_RATIONAL *rational)
    Definition: rational.cpp:2084
    void SCIPrationalFreeBlock(BMS_BLKMEM *mem, SCIP_RATIONAL **rational)
    Definition: rational.cpp:462
    int SCIPrationalToString(SCIP_RATIONAL *rational, char *str, int strlen)
    Definition: rational.cpp:1744
    void SCIPrationalarrayGetVal(SCIP_RATIONALARRAY *rationalarray, int idx, SCIP_RATIONAL *result)
    Definition: rational.cpp:2728
    #define SCIPrationalDebugMessage
    Definition: rational.h:641
    void SCIPrationalDiv(SCIP_RATIONAL *res, SCIP_RATIONAL *op1, SCIP_RATIONAL *op2)
    Definition: rational.cpp:1133
    SCIP_Bool SCIPrationalIsAbsInfinity(SCIP_RATIONAL *rational)
    Definition: rational.cpp:1681
    SCIP_Bool SCIPrationalIsLT(SCIP_RATIONAL *rat1, SCIP_RATIONAL *rat2)
    Definition: rational.cpp:1504
    void SCIPrationalSetReal(SCIP_RATIONAL *res, SCIP_Real real)
    Definition: rational.cpp:604
    SCIP_Bool SCIPrationalIsGT(SCIP_RATIONAL *rat1, SCIP_RATIONAL *rat2)
    Definition: rational.cpp:1475
    SCIP_RETCODE SCIPrationalCopyBlock(BMS_BLKMEM *mem, SCIP_RATIONAL **result, SCIP_RATIONAL *src)
    Definition: rational.cpp:152
    void SCIPrationalFreeBuffer(BMS_BUFMEM *bufmem, SCIP_RATIONAL **rational)
    Definition: rational.cpp:474
    void SCIPrationalDiff(SCIP_RATIONAL *res, SCIP_RATIONAL *op1, SCIP_RATIONAL *op2)
    Definition: rational.cpp:984
    SCIP_Bool SCIPrationalIsPositive(SCIP_RATIONAL *rational)
    Definition: rational.cpp:1641
    int SCIPrationalGetSign(const SCIP_RATIONAL *rational)
    Definition: rational.cpp:2047
    SCIP_RETCODE SCIPrationalCreateBuffer(BMS_BUFMEM *bufmem, SCIP_RATIONAL **rational)
    Definition: rational.cpp:124
    void SCIPrationalAddProd(SCIP_RATIONAL *res, SCIP_RATIONAL *op1, SCIP_RATIONAL *op2)
    Definition: rational.cpp:1174
    SCIP_Bool SCIPrationalIsZero(SCIP_RATIONAL *rational)
    Definition: rational.cpp:1625
    void SCIPrationalSetRational(SCIP_RATIONAL *res, SCIP_RATIONAL *src)
    Definition: rational.cpp:570
    SCIP_RETCODE SCIPrationalarraySetVal(SCIP_RATIONALARRAY *rationalarray, int idx, SCIP_RATIONAL *val)
    Definition: rational.cpp:2745
    void SCIPrationalSetNegInfinity(SCIP_RATIONAL *res)
    Definition: rational.cpp:631
    void SCIPrationalSetFraction(SCIP_RATIONAL *res, SCIP_Longint nom, SCIP_Longint denom)
    Definition: rational.cpp:583
    void SCIPrationalNegate(SCIP_RATIONAL *res, SCIP_RATIONAL *op)
    Definition: rational.cpp:1298
    SCIP_RETCODE SCIPrationalarrayCreate(SCIP_RATIONALARRAY **rationalarray, BMS_BLKMEM *blkmem)
    Definition: rational.cpp:2667
    SCIP_Bool SCIPrationalIsNegative(SCIP_RATIONAL *rational)
    Definition: rational.cpp:1651
    void SCIPrationalDiffReal(SCIP_RATIONAL *res, SCIP_RATIONAL *rat, SCIP_Real real)
    Definition: rational.cpp:1010
    SCIP_Bool SCIPrationalIsInfinity(SCIP_RATIONAL *rational)
    Definition: rational.cpp:1661
    SCIP_Real SCIPrationalRoundReal(SCIP_RATIONAL *rational, SCIP_ROUNDMODE_RAT roundmode)
    Definition: rational.cpp:2109
    SCIP_RETCODE SCIPrationalCreateBufferArray(BMS_BUFMEM *mem, SCIP_RATIONAL ***rational, int size)
    Definition: rational.cpp:215
    SCIP_RETCODE SCIPrationalarrayCopy(SCIP_RATIONALARRAY **rationalarray, BMS_BLKMEM *blkmem, SCIP_RATIONALARRAY *sourcerationalarray)
    Definition: rational.cpp:2696
    SCIP_Bool SCIPrationalIsNegInfinity(SCIP_RATIONAL *rational)
    Definition: rational.cpp:1671
    SCIP_RETCODE SCIPrationalarrayFree(SCIP_RATIONALARRAY **rationalarray, BMS_BLKMEM *blkmem)
    Definition: rational.cpp:2713
    SCIP_Bool SCIPrationalIsEQ(SCIP_RATIONAL *rat1, SCIP_RATIONAL *rat2)
    Definition: rational.cpp:1405
    void SCIPrationalDiffProd(SCIP_RATIONAL *res, SCIP_RATIONAL *op1, SCIP_RATIONAL *op2)
    Definition: rational.cpp:1240
    void SCIPrationalFreeBufferArray(BMS_BUFMEM *mem, SCIP_RATIONAL ***ratbufarray, int size)
    Definition: rational.cpp:519
    int SCIPrationalStrLen(SCIP_RATIONAL *rational)
    Definition: rational.cpp:1775
    SCIP_Real SCIProwGetLhs(SCIP_ROW *row)
    Definition: lp.c:17686
    SCIP_Real SCIProwGetRhs(SCIP_ROW *row)
    Definition: lp.c:17696
    SCIP_Bool SCIProwIsLocal(SCIP_ROW *row)
    Definition: lp.c:17795
    SCIP_Bool SCIProwIsInLP(SCIP_ROW *row)
    Definition: lp.c:17917
    SCIP_SOLORIGIN SCIPsolGetOrigin(SCIP_SOL *sol)
    Definition: sol.c:4145
    SCIP_Real SCIPsolGetOrigObj(SCIP_SOL *sol)
    Definition: sol.c:4185
    void SCIPsolSetLPRelaxation(SCIP_SOL *sol)
    Definition: sol.c:4369
    void SCIPsolOrigAddObjvalExact(SCIP_SOL *sol, SCIP_RATIONAL *addval)
    Definition: sol.c:4220
    void SCIPsolSetStrongbranching(SCIP_SOL *sol)
    Definition: sol.c:4379
    SCIP_Real SCIPsolGetRelBoundViolation(SCIP_SOL *sol)
    Definition: sol.c:3992
    SCIP_Real SCIPsolGetAbsConsViolation(SCIP_SOL *sol)
    Definition: sol.c:4032
    SCIP_Real SCIPsolGetTime(SCIP_SOL *sol)
    Definition: sol.c:4234
    SCIP_RELAX * SCIPsolGetRelax(SCIP_SOL *sol)
    Definition: sol.c:4346
    SCIP_Real SCIPsolGetAbsBoundViolation(SCIP_SOL *sol)
    Definition: sol.c:3982
    SCIP_Longint SCIPsolGetNodenum(SCIP_SOL *sol)
    Definition: sol.c:4254
    SCIP_Real SCIPsolGetAbsIntegralityViolation(SCIP_SOL *sol)
    Definition: sol.c:4002
    SCIP_HEUR * SCIPsolGetHeur(SCIP_SOL *sol)
    Definition: sol.c:4274
    SCIP_Real SCIPsolGetAbsLPRowViolation(SCIP_SOL *sol)
    Definition: sol.c:4012
    void SCIPsolSetRelax(SCIP_SOL *sol, SCIP_RELAX *relax)
    Definition: sol.c:4356
    SCIP_Bool SCIPsolIsOriginal(SCIP_SOL *sol)
    Definition: sol.c:4155
    int SCIPsolGetIndex(SCIP_SOL *sol)
    Definition: sol.c:4305
    int SCIPsolGetDepth(SCIP_SOL *sol)
    Definition: sol.c:4264
    SCIP_Real SCIPsolGetRelLPRowViolation(SCIP_SOL *sol)
    Definition: sol.c:4022
    SCIP_Bool SCIPsolIsPartial(SCIP_SOL *sol)
    Definition: sol.c:4175
    int SCIPsolGetRunnum(SCIP_SOL *sol)
    Definition: sol.c:4244
    SCIP_SOLTYPE SCIPsolGetType(SCIP_SOL *sol)
    Definition: sol.c:4336
    SCIP_Real SCIPsolGetRelConsViolation(SCIP_SOL *sol)
    Definition: sol.c:4042
    void SCIPsolSetPseudo(SCIP_SOL *sol)
    Definition: sol.c:4389
    void SCIPsolSetHeur(SCIP_SOL *sol, SCIP_HEUR *heur)
    Definition: sol.c:4319
    SCIP_DECL_SORTPTRCOMP(SCIPsolComp)
    Definition: sol.c:4106
    SCIP_Bool SCIPsolIsExact(SCIP_SOL *sol)
    Definition: sol.c:4165
    SCIP_RETCODE SCIPvarGetOrigvarSum(SCIP_VAR **var, SCIP_Real *scalar, SCIP_Real *constant)
    Definition: var.c:18320
    SCIP_Real SCIPvarGetNegationConstant(SCIP_VAR *var)
    Definition: var.c:23889
    SCIP_COL * SCIPvarGetCol(SCIP_VAR *var)
    Definition: var.c:23683
    SCIP_Bool SCIPvarMayRoundUp(SCIP_VAR *var)
    Definition: var.c:4484
    SCIP_Real SCIPvarGetMultaggrConstant(SCIP_VAR *var)
    Definition: var.c:23843
    SCIP_Bool SCIPvarIsActive(SCIP_VAR *var)
    Definition: var.c:23642
    SCIP_RATIONAL * SCIPvarGetAggrScalarExact(SCIP_VAR *var)
    Definition: var.c:23760
    SCIP_VARSTATUS SCIPvarGetStatus(SCIP_VAR *var)
    Definition: var.c:23386
    int SCIPvarGetNLocksUpType(SCIP_VAR *var, SCIP_LOCKTYPE locktype)
    Definition: var.c:4386
    SCIP_Real SCIPvarGetAggrConstant(SCIP_VAR *var)
    Definition: var.c:23771
    SCIP_Bool SCIPvarIsImpliedIntegral(SCIP_VAR *var)
    Definition: var.c:23498
    SCIP_Real SCIPvarGetUbLocal(SCIP_VAR *var)
    Definition: var.c:24268
    SCIP_Real SCIPvarGetLbOriginal(SCIP_VAR *var)
    Definition: var.c:24020
    SCIP_RATIONAL * SCIPvarGetAggrConstantExact(SCIP_VAR *var)
    Definition: var.c:23783
    SCIP_RATIONAL * SCIPvarGetPseudoSolExact(SCIP_VAR *var)
    Definition: var.c:24769
    SCIP_Bool SCIPvarIsTransformed(SCIP_VAR *var)
    Definition: var.c:23430
    SCIP_Bool SCIPvarMayRoundDown(SCIP_VAR *var)
    Definition: var.c:4473
    SCIP_Real SCIPvarGetObj(SCIP_VAR *var)
    Definition: var.c:23900
    SCIP_Real SCIPvarGetAggrScalar(SCIP_VAR *var)
    Definition: var.c:23748
    SCIP_RETCODE SCIPvarGetOrigvarSumExact(SCIP_VAR **var, SCIP_RATIONAL *scalar, SCIP_RATIONAL *constant)
    Definition: var.c:18409
    SCIP_Real SCIPvarGetUbGlobal(SCIP_VAR *var)
    Definition: var.c:24142
    SCIP_VARSTATUS SCIPvarGetStatusExact(SCIP_VAR *var)
    Definition: var.c:23396
    int SCIPvarGetIndex(SCIP_VAR *var)
    Definition: var.c:23652
    int SCIPvarGetProbindex(SCIP_VAR *var)
    Definition: var.c:23662
    const char * SCIPvarGetName(SCIP_VAR *var)
    Definition: var.c:23267
    SCIP_Real SCIPvarGetUbOriginal(SCIP_VAR *var)
    Definition: var.c:24063
    SCIP_RATIONAL * SCIPvarGetMultaggrConstantExact(SCIP_VAR *var)
    Definition: var.c:23855
    SCIP_RATIONAL * SCIPvarGetUbLocalExact(SCIP_VAR *var)
    Definition: var.c:24278
    SCIP_Bool SCIPvarIsIntegral(SCIP_VAR *var)
    Definition: var.c:23490
    SCIP_Bool SCIPvarIsTransformedOrigvar(SCIP_VAR *var)
    Definition: var.c:18497
    SCIP_Real SCIPvarGetPseudoSol(SCIP_VAR *var)
    Definition: var.c:24756
    SCIP_Real SCIPvarGetLPSol(SCIP_VAR *var)
    Definition: var.c:24664
    SCIP_VAR ** SCIPvarGetMultaggrVars(SCIP_VAR *var)
    Definition: var.c:23806
    int SCIPvarGetMultaggrNVars(SCIP_VAR *var)
    Definition: var.c:23794
    SCIP_Real SCIPvarGetLbLocal(SCIP_VAR *var)
    Definition: var.c:24234
    SCIP_RATIONAL * SCIPvarGetLbGlobalExact(SCIP_VAR *var)
    Definition: var.c:24130
    SCIP_VAR * SCIPvarGetNegationVar(SCIP_VAR *var)
    Definition: var.c:23878
    SCIP_RATIONAL ** SCIPvarGetMultaggrScalarsExact(SCIP_VAR *var)
    Definition: var.c:23830
    SCIP_Real SCIPvarGetLbGlobal(SCIP_VAR *var)
    Definition: var.c:24120
    void SCIPvarMarkNotDeletable(SCIP_VAR *var)
    Definition: var.c:23557
    SCIP_RATIONAL * SCIPvarGetLbLocalExact(SCIP_VAR *var)
    Definition: var.c:24244
    SCIP_VAR * SCIPvarGetTransVar(SCIP_VAR *var)
    Definition: var.c:23672
    SCIP_Real SCIPvarGetNLPSol(SCIP_VAR *var)
    Definition: var.c:24691
    void SCIPvarGetLPSolExact(SCIP_VAR *var, SCIP_RATIONAL *res)
    Definition: var.c:24677
    int SCIPvarGetNLocksDownType(SCIP_VAR *var, SCIP_LOCKTYPE locktype)
    Definition: var.c:4328
    SCIP_RATIONAL * SCIPvarGetObjExact(SCIP_VAR *var)
    Definition: var.c:23910
    SCIP_RATIONAL * SCIPvarGetUbGlobalExact(SCIP_VAR *var)
    Definition: var.c:24152
    SCIP_Real SCIPvarGetUnchangedObj(SCIP_VAR *var)
    Definition: var.c:23932
    SCIP_Real * SCIPvarGetMultaggrScalars(SCIP_VAR *var)
    Definition: var.c:23818
    SCIP_VAR * SCIPvarGetAggrVar(SCIP_VAR *var)
    Definition: var.c:23736
    SCIP_Real SCIPlpGetLooseObjval(SCIP_LP *lp, SCIP_SET *set, SCIP_PROB *prob)
    Definition: lp.c:13475
    SCIP_Bool SCIPlpDivingObjChanged(SCIP_LP *lp)
    Definition: lp.c:18261
    SCIP_Real SCIPlpGetObjval(SCIP_LP *lp, SCIP_SET *set, SCIP_PROB *prob)
    Definition: lp.c:13436
    SCIP_Real SCIProwGetSolActivity(SCIP_ROW *row, SCIP_SET *set, SCIP_STAT *stat, SCIP_SOL *sol)
    Definition: lp.c:6696
    SCIP_Bool SCIPlpDiving(SCIP_LP *lp)
    Definition: lp.c:18251
    SCIP_Bool SCIPlpIsSolved(SCIP_LP *lp)
    Definition: lp.c:18211
    SCIP_COL ** SCIPlpGetCols(SCIP_LP *lp)
    Definition: lp.c:17969
    int SCIPlpGetNCols(SCIP_LP *lp)
    Definition: lp.c:17979
    static const SCIP_Real scalars[]
    Definition: lp.c:5959
    SCIP_Real SCIPlpGetPseudoObjval(SCIP_LP *lp, SCIP_SET *set, SCIP_PROB *prob)
    Definition: lp.c:13619
    internal methods for LP management
    void SCIPlpExactGetPseudoObjval(SCIP_LPEXACT *lpexact, SCIP_SET *set, SCIP_RATIONAL *res)
    Definition: lpexact.c:7438
    void SCIPlpExactGetObjval(SCIP_LPEXACT *lpexact, SCIP_SET *set, SCIP_RATIONAL *res)
    Definition: lpexact.c:7416
    internal methods for exact LP management
    #define BMSfreeBlockMemory(mem, ptr)
    Definition: memory.h:465
    #define BMSallocBlockMemory(mem, ptr)
    Definition: memory.h:451
    struct BMS_BlkMem BMS_BLKMEM
    Definition: memory.h:437
    void SCIPmessageFPrintInfo(SCIP_MESSAGEHDLR *messagehdlr, FILE *file, const char *formatstr,...)
    Definition: message.c:618
    void SCIPmessagePrintInfo(SCIP_MESSAGEHDLR *messagehdlr, const char *formatstr,...)
    Definition: message.c:594
    SCIP_Bool SCIPboolarrayGetVal(SCIP_BOOLARRAY *boolarray, int idx)
    Definition: misc.c:5056
    SCIP_RETCODE SCIPboolarrayFree(SCIP_BOOLARRAY **boolarray)
    Definition: misc.c:4854
    SCIP_RETCODE SCIPboolarrayCopy(SCIP_BOOLARRAY **boolarray, BMS_BLKMEM *blkmem, SCIP_BOOLARRAY *sourceboolarray)
    Definition: misc.c:4830
    SCIP_RETCODE SCIPrealarraySetVal(SCIP_REALARRAY *realarray, int arraygrowinit, SCIP_Real arraygrowfac, int idx, SCIP_Real val)
    Definition: misc.c:4338
    SCIP_Real SCIPrealarrayGetVal(SCIP_REALARRAY *realarray, int idx)
    Definition: misc.c:4317
    SCIP_RETCODE SCIPrealarrayIncVal(SCIP_REALARRAY *realarray, int arraygrowinit, SCIP_Real arraygrowfac, int idx, SCIP_Real incval)
    Definition: misc.c:4407
    SCIP_RETCODE SCIPrealarrayCreate(SCIP_REALARRAY **realarray, BMS_BLKMEM *blkmem)
    Definition: misc.c:4073
    SCIP_RETCODE SCIPrealarrayCopy(SCIP_REALARRAY **realarray, BMS_BLKMEM *blkmem, SCIP_REALARRAY *sourcerealarray)
    Definition: misc.c:4093
    SCIP_RETCODE SCIPboolarrayCreate(SCIP_BOOLARRAY **boolarray, BMS_BLKMEM *blkmem)
    Definition: misc.c:4810
    SCIP_RETCODE SCIPboolarrayClear(SCIP_BOOLARRAY *boolarray)
    Definition: misc.c:5025
    SCIP_RETCODE SCIPrealarrayFree(SCIP_REALARRAY **realarray)
    Definition: misc.c:4117
    SCIP_RETCODE SCIPboolarraySetVal(SCIP_BOOLARRAY *boolarray, int arraygrowinit, SCIP_Real arraygrowfac, int idx, SCIP_Bool val)
    Definition: misc.c:5077
    internal miscellaneous methods
    SCIP_Bool SCIPnlpIsDivingObjChanged(SCIP_NLP *nlp)
    Definition: nlp.c:4781
    SCIP_Bool SCIPnlpHasSolution(SCIP_NLP *nlp)
    Definition: nlp.c:4544
    SCIP_VAR ** SCIPnlpGetVars(SCIP_NLP *nlp)
    Definition: nlp.c:4292
    int SCIPnlpGetNVars(SCIP_NLP *nlp)
    Definition: nlp.c:4302
    SCIP_Real SCIPnlpGetObjval(SCIP_NLP *nlp)
    Definition: nlp.c:4077
    internal methods for NLP management
    void SCIPprimalSolFreed(SCIP_PRIMAL *primal, SCIP_SOL *sol)
    Definition: primal.c:2024
    SCIP_Bool SCIPprimalUpdateViolations(SCIP_PRIMAL *primal)
    Definition: primal.c:2301
    SCIP_RETCODE SCIPprimalSolCreated(SCIP_PRIMAL *primal, SCIP_SET *set, SCIP_SOL *sol)
    Definition: primal.c:2002
    internal methods for collecting primal CIP solutions and primal informations
    void SCIPprobInternObjvalExact(SCIP_PROB *transprob, SCIP_PROB *origprob, SCIP_SET *set, SCIP_RATIONAL *objval, SCIP_RATIONAL *objvalint)
    Definition: prob.c:2599
    SCIP_Real SCIPprobGetObjoffset(SCIP_PROB *prob)
    Definition: prob.c:2994
    int SCIPprobGetNImplVars(SCIP_PROB *prob)
    Definition: prob.c:2895
    int SCIPprobGetNIntVars(SCIP_PROB *prob)
    Definition: prob.c:2886
    int SCIPprobGetNVars(SCIP_PROB *prob)
    Definition: prob.c:2868
    int SCIPprobGetNBinVars(SCIP_PROB *prob)
    Definition: prob.c:2877
    SCIP_VAR ** SCIPprobGetVars(SCIP_PROB *prob)
    Definition: prob.c:2913
    SCIP_Real SCIPprobInternObjval(SCIP_PROB *transprob, SCIP_PROB *origprob, SCIP_SET *set, SCIP_Real objval)
    Definition: prob.c:2573
    SCIP_RETCODE SCIPprobSortConssCheck(SCIP_PROB *prob)
    Definition: prob.c:748
    internal methods for storing and manipulating the main problem
    public methods for LP management
    public methods for message output
    #define SCIPerrorMessage
    Definition: pub_message.h:64
    #define SCIPdebugPrintf
    Definition: pub_message.h:99
    #define SCIPisFinite(x)
    Definition: pub_misc.h:82
    public methods for primal CIP solutions
    public methods for problem variables
    SCIP_Real SCIPrelaxationGetSolObj(SCIP_RELAXATION *relaxation)
    Definition: relax.c:854
    SCIP_RELAX * SCIPrelaxationGetSolRelax(SCIP_RELAXATION *relaxation)
    Definition: relax.c:906
    SCIP_Bool SCIPrelaxationIsSolValid(SCIP_RELAXATION *relaxation)
    Definition: relax.c:823
    internal methods for relaxators
    SCIP_Real SCIPsetFloor(SCIP_SET *set, SCIP_Real val)
    Definition: set.c:6716
    SCIP_Bool SCIPsetIsFeasPositive(SCIP_SET *set, SCIP_Real val)
    Definition: set.c:7076
    SCIP_Bool SCIPsetIsGE(SCIP_SET *set, SCIP_Real val1, SCIP_Real val2)
    Definition: set.c:6617
    SCIP_Real SCIPsetFeasCeil(SCIP_SET *set, SCIP_Real val)
    Definition: set.c:7136
    SCIP_Bool SCIPsetIsFeasNegative(SCIP_SET *set, SCIP_Real val)
    Definition: set.c:7087
    SCIP_Real SCIPsetCeil(SCIP_SET *set, SCIP_Real val)
    Definition: set.c:6728
    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 SCIPsetIsPositive(SCIP_SET *set, SCIP_Real val)
    Definition: set.c:6648
    SCIP_Bool SCIPsetIsLE(SCIP_SET *set, SCIP_Real val1, SCIP_Real val2)
    Definition: set.c:6577
    SCIP_Real SCIPsetFeasFloor(SCIP_SET *set, SCIP_Real val)
    Definition: set.c:7124
    SCIP_Bool SCIPsetIsEQ(SCIP_SET *set, SCIP_Real val1, SCIP_Real val2)
    Definition: set.c:6537
    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 SCIPsetIsInfinity(SCIP_SET *set, SCIP_Real val)
    Definition: set.c:6515
    SCIP_Bool SCIPsetIsGT(SCIP_SET *set, SCIP_Real val1, SCIP_Real val2)
    Definition: set.c:6597
    SCIP_Bool SCIPsetIsZero(SCIP_SET *set, SCIP_Real val)
    Definition: set.c:6637
    SCIP_Bool SCIPsetIsFeasGE(SCIP_SET *set, SCIP_Real val1, SCIP_Real val2)
    Definition: set.c:7041
    SCIP_Bool SCIPsetIsFeasIntegral(SCIP_SET *set, SCIP_Real val)
    Definition: set.c:7098
    SCIP_Bool SCIPsetIsNegative(SCIP_SET *set, SCIP_Real val)
    Definition: set.c:6659
    internal methods for global SCIP settings
    #define SCIPsetFreeBufferArray(set, ptr)
    Definition: set.h:1782
    #define SCIPsetDebugMsgPrint
    Definition: set.h:1812
    #define SCIPsetAllocBufferArray(set, ptr, num)
    Definition: set.h:1775
    #define SCIPsetDebugMsg
    Definition: set.h:1811
    #define SCIPsetReallocBufferArray(set, ptr, num)
    Definition: set.h:1779
    void SCIPsolUpdateVarObj(SCIP_SOL *sol, SCIP_VAR *var, SCIP_Real oldobj, SCIP_Real newobj)
    Definition: sol.c:2297
    SCIP_RETCODE SCIPsolCreateRelaxSol(SCIP_SOL **sol, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PRIMAL *primal, SCIP_TREE *tree, SCIP_RELAXATION *relaxation, SCIP_HEUR *heur)
    Definition: sol.c:914
    void SCIPsolUpdateConsViolation(SCIP_SOL *sol, SCIP_Real absviolcons, SCIP_Real relviolcons)
    Definition: sol.c:3956
    SCIP_RETCODE SCIPsolMakeReal(SCIP_SOL *sol, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *prob)
    Definition: sol.c:2920
    SCIP_RETCODE SCIPsolLinkPseudoSol(SCIP_SOL *sol, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *prob, SCIP_TREE *tree, SCIP_LP *lp)
    Definition: sol.c:1318
    void SCIPsolSetPrimalIndex(SCIP_SOL *sol, int primalindex)
    Definition: sol.c:4294
    static void solStamp(SCIP_SOL *sol, SCIP_STAT *stat, SCIP_TREE *tree, SCIP_Bool checktime)
    Definition: sol.c:400
    SCIP_RETCODE SCIPsolCreatePartial(SCIP_SOL **sol, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PRIMAL *primal, SCIP_HEUR *heur)
    Definition: sol.c:1039
    SCIP_RETCODE SCIPsolCreateUnknown(SCIP_SOL **sol, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PRIMAL *primal, SCIP_TREE *tree, SCIP_HEUR *heur)
    Definition: sol.c:1079
    void SCIPsolUpdateBoundViolation(SCIP_SOL *sol, SCIP_Real absviolbounds, SCIP_Real relviolbounds)
    Definition: sol.c:3930
    static SCIP_RETCODE solSetArrayVal(SCIP_SOL *sol, SCIP_SET *set, SCIP_VAR *var, SCIP_Real val)
    Definition: sol.c:80
    void SCIPsolGetValExact(SCIP_RATIONAL *res, SCIP_SOL *sol, SCIP_SET *set, SCIP_STAT *stat, SCIP_VAR *var)
    Definition: sol.c:2043
    int SCIPsolGetPrimalIndex(SCIP_SOL *sol)
    Definition: sol.c:4284
    SCIP_RETCODE SCIPsolCreateNLPSol(SCIP_SOL **sol, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PRIMAL *primal, SCIP_TREE *tree, SCIP_NLP *nlp, SCIP_HEUR *heur)
    Definition: sol.c:893
    SCIP_RETCODE SCIPsolMakeExact(SCIP_SOL *sol, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *prob)
    Definition: sol.c:2884
    SCIP_RETCODE SCIPsolLinkCurrentSol(SCIP_SOL *sol, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *prob, SCIP_TREE *tree, SCIP_LP *lp)
    Definition: sol.c:1368
    static SCIP_RETCODE solIncArrayVal(SCIP_SOL *sol, SCIP_SET *set, SCIP_VAR *var, SCIP_Real incval)
    Definition: sol.c:143
    SCIP_RETCODE SCIPsolCheck(SCIP_SOL *sol, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, BMS_BLKMEM *blkmem, SCIP_STAT *stat, SCIP_PROB *prob, SCIP_Bool printreason, SCIP_Bool completely, SCIP_Bool checkbounds, SCIP_Bool checkintegrality, SCIP_Bool checklprows, SCIP_Bool *feasible)
    Definition: sol.c:2681
    SCIP_RETCODE SCIPsolMarkPartial(SCIP_SOL *sol, SCIP_SET *set, SCIP_STAT *stat, SCIP_VAR **vars, int nvars)
    Definition: sol.c:2316
    void SCIPsolRecomputeInternObjExact(SCIP_SOL *sol, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *prob)
    Definition: sol.c:3271
    SCIP_RETCODE SCIPsolCreateOriginal(SCIP_SOL **sol, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *origprob, SCIP_PRIMAL *primal, SCIP_TREE *tree, SCIP_HEUR *heur)
    Definition: sol.c:514
    SCIP_RETCODE SCIPsolSetValExact(SCIP_SOL *sol, SCIP_SET *set, SCIP_STAT *stat, SCIP_TREE *tree, SCIP_VAR *var, SCIP_RATIONAL *val)
    Definition: sol.c:1711
    static SCIP_RETCODE solUnlinkVar(SCIP_SOL *sol, SCIP_SET *set, SCIP_VAR *var)
    Definition: sol.c:285
    static SCIP_RETCODE solUnlinkVarExact(SCIP_SOL *sol, SCIP_SET *set, SCIP_VAR *var)
    Definition: sol.c:347
    SCIP_RETCODE SCIPsolAdjustImplicitSolVals(SCIP_SOL *sol, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *prob, SCIP_TREE *tree, SCIP_Bool uselprows)
    Definition: sol.c:712
    SCIP_RETCODE SCIPsolFree(SCIP_SOL **sol, BMS_BLKMEM *blkmem, SCIP_PRIMAL *primal)
    Definition: sol.c:1133
    SCIP_RETCODE SCIPsolRetransformExact(SCIP_SOL *sol, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *origprob, SCIP_PROB *transprob, SCIP_Bool *hasinfval)
    Definition: sol.c:3117
    static SCIP_RETCODE valsExactFree(SCIP_VALSEXACT **valsexact, BMS_BLKMEM *blkmem)
    Definition: sol.c:1116
    void SCIPsolRecomputeObj(SCIP_SOL *sol, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *origprob)
    Definition: sol.c:3235
    SCIP_RETCODE SCIPsolOverwriteFPSolWithExact(SCIP_SOL *sol, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *origprob, SCIP_PROB *transprob, SCIP_TREE *tree)
    Definition: sol.c:4052
    static void solGetArrayValExact(SCIP_RATIONAL *res, SCIP_SOL *sol, SCIP_VAR *var)
    Definition: sol.c:235
    void SCIPsolUpdateIntegralityViolation(SCIP_SOL *sol, SCIP_Real absviolintegrality)
    Definition: sol.c:3919
    void SCIPsolUpdateLPRowViolation(SCIP_SOL *sol, SCIP_Real absviollprows, SCIP_Real relviollprows)
    Definition: sol.c:3943
    SCIP_RETCODE SCIPsolLinkLPSolExact(SCIP_SOL *sol, SCIP_SET *set, SCIP_LPEXACT *lp)
    Definition: sol.c:1214
    SCIP_RETCODE SCIPsolIncVal(SCIP_SOL *sol, SCIP_SET *set, SCIP_STAT *stat, SCIP_TREE *tree, SCIP_VAR *var, SCIP_Real incval)
    Definition: sol.c:1836
    SCIP_RETCODE SCIPsolLinkNLPSol(SCIP_SOL *sol, SCIP_STAT *stat, SCIP_TREE *tree, SCIP_NLP *nlp)
    Definition: sol.c:1237
    SCIP_RETCODE SCIPsolPrintExact(SCIP_SOL *sol, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, SCIP_STAT *stat, SCIP_PROB *prob, SCIP_PROB *transprob, FILE *file, SCIP_Bool mipstart, SCIP_Bool printzeros)
    Definition: sol.c:3592
    SCIP_RETCODE SCIPsolRetransform(SCIP_SOL *sol, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *origprob, SCIP_PROB *transprob, SCIP_Bool *hasinfval)
    Definition: sol.c:2984
    static SCIP_Real solGetArrayVal(SCIP_SOL *sol, SCIP_VAR *var)
    Definition: sol.c:184
    SCIP_RETCODE SCIPsolCreatePseudoSolExact(SCIP_SOL **sol, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PRIMAL *primal, SCIP_TREE *tree, SCIP_LPEXACT *lp, SCIP_HEUR *heur)
    Definition: sol.c:965
    SCIP_RETCODE SCIPsolCreateCurrentSol(SCIP_SOL **sol, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *prob, SCIP_PRIMAL *primal, SCIP_TREE *tree, SCIP_LP *lp, SCIP_HEUR *heur)
    Definition: sol.c:985
    SCIP_RETCODE SCIPsolRound(SCIP_SOL *sol, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *prob, SCIP_TREE *tree, SCIP_Bool *success)
    Definition: sol.c:2811
    SCIP_RETCODE SCIPsolTransform(SCIP_SOL *sol, SCIP_SOL **transsol, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_PRIMAL *primal)
    Definition: sol.c:658
    SCIP_RETCODE SCIPsolSetVal(SCIP_SOL *sol, SCIP_SET *set, SCIP_STAT *stat, SCIP_TREE *tree, SCIP_VAR *var, SCIP_Real val)
    Definition: sol.c:1490
    SCIP_RETCODE SCIPvalsExactCopy(SCIP_VALSEXACT **valsexact, BMS_BLKMEM *blkmem, SCIP_VALSEXACT *sourcevals)
    Definition: sol.c:497
    static SCIP_RETCODE solClearArrays(SCIP_SOL *sol)
    Definition: sol.c:61
    SCIP_RETCODE SCIPsolCreatePseudoSol(SCIP_SOL **sol, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *prob, SCIP_PRIMAL *primal, SCIP_TREE *tree, SCIP_LP *lp, SCIP_HEUR *heur)
    Definition: sol.c:940
    SCIP_RETCODE SCIPsolClear(SCIP_SOL *sol, SCIP_STAT *stat, SCIP_TREE *tree)
    Definition: sol.c:1394
    SCIP_RETCODE SCIPsolCreateLPSol(SCIP_SOL **sol, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *prob, SCIP_PRIMAL *primal, SCIP_TREE *tree, SCIP_LP *lp, SCIP_HEUR *heur)
    Definition: sol.c:846
    SCIP_RETCODE SCIPsolSetUnknown(SCIP_SOL *sol, SCIP_STAT *stat, SCIP_TREE *tree)
    Definition: sol.c:1414
    SCIP_RETCODE SCIPsolLinkRelaxSol(SCIP_SOL *sol, SCIP_SET *set, SCIP_STAT *stat, SCIP_TREE *tree, SCIP_RELAXATION *relaxation)
    Definition: sol.c:1288
    SCIP_RETCODE SCIPsolCreateOriginalExact(SCIP_SOL **sol, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *origprob, SCIP_PRIMAL *primal, SCIP_TREE *tree, SCIP_HEUR *heur)
    Definition: sol.c:555
    SCIP_Real SCIPsolGetVal(SCIP_SOL *sol, SCIP_SET *set, SCIP_STAT *stat, SCIP_VAR *var)
    Definition: sol.c:1912
    static SCIP_RETCODE solCheckExact(SCIP_SOL *sol, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, BMS_BLKMEM *blkmem, SCIP_STAT *stat, SCIP_PROB *prob, SCIP_Bool printreason, SCIP_Bool completely, SCIP_Bool checklprows, SCIP_Bool *feasible)
    Definition: sol.c:2379
    static SCIP_RETCODE solSetArrayValExact(SCIP_SOL *sol, SCIP_SET *set, SCIP_VAR *var, SCIP_RATIONAL *val)
    Definition: sol.c:111
    SCIP_RETCODE SCIPsolLinkPseudoSolExact(SCIP_SOL *sol, SCIP_SET *set, SCIP_LPEXACT *lp)
    Definition: sol.c:1347
    SCIP_RETCODE SCIPsolCreateExact(SCIP_SOL **sol, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PRIMAL *primal, SCIP_TREE *tree, SCIP_HEUR *heur)
    Definition: sol.c:470
    SCIP_RETCODE SCIPsolCreateCurrentSolExact(SCIP_SOL **sol, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PRIMAL *primal, SCIP_TREE *tree, SCIP_LPEXACT *lp, SCIP_HEUR *heur)
    Definition: sol.c:1012
    SCIP_RETCODE SCIPsolUnlink(SCIP_SOL *sol, SCIP_SET *set, SCIP_PROB *prob)
    Definition: sol.c:1431
    void SCIPsolGetObjExact(SCIP_SOL *sol, SCIP_SET *set, SCIP_PROB *transprob, SCIP_PROB *origprob, SCIP_RATIONAL *objval)
    Definition: sol.c:2278
    SCIP_Real SCIPsolGetRayVal(SCIP_SOL *sol, SCIP_SET *set, SCIP_STAT *stat, SCIP_VAR *var)
    Definition: sol.c:2192
    static SCIP_Bool solsAreEqualExact(SCIP_SOL *sol1, SCIP_SOL *sol2, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *origprob, SCIP_PROB *transprob)
    Definition: sol.c:3308
    SCIP_RETCODE SCIPsolPrintRay(SCIP_SOL *sol, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, SCIP_STAT *stat, SCIP_PROB *prob, SCIP_PROB *transprob, FILE *file, SCIP_Bool printzeros)
    Definition: sol.c:3781
    void SCIPsolResetViolations(SCIP_SOL *sol)
    Definition: sol.c:3903
    void SCIPsolSetOrigin(SCIP_SOL *sol, SCIP_SOLORIGIN origin)
    Definition: sol.c:3889
    SCIP_RETCODE SCIPsolLinkLPSol(SCIP_SOL *sol, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *prob, SCIP_TREE *tree, SCIP_LP *lp)
    Definition: sol.c:1156
    SCIP_Bool SCIPsolsAreEqual(SCIP_SOL *sol1, SCIP_SOL *sol2, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *origprob, SCIP_PROB *transprob)
    Definition: sol.c:3385
    SCIP_RATIONAL * SCIPsolGetOrigObjExact(SCIP_SOL *sol)
    Definition: sol.c:4196
    SCIP_Real SCIPsolGetObj(SCIP_SOL *sol, SCIP_SET *set, SCIP_PROB *transprob, SCIP_PROB *origprob)
    Definition: sol.c:2261
    SCIP_RETCODE SCIPsolPrint(SCIP_SOL *sol, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, SCIP_STAT *stat, SCIP_PROB *prob, SCIP_PROB *transprob, FILE *file, SCIP_Bool mipstart, SCIP_Bool printzeros)
    Definition: sol.c:3456
    void SCIPsolUpdateVarsum(SCIP_SOL *sol, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *prob, SCIP_Real weight)
    Definition: sol.c:2956
    SCIP_RETCODE SCIPsolCopy(SCIP_SOL **sol, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PRIMAL *primal, SCIP_SOL *sourcesol)
    Definition: sol.c:583
    SCIP_RETCODE SCIPsolCheckOrig(SCIP_SOL *sol, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, BMS_BLKMEM *blkmem, SCIP_STAT *stat, SCIP_PROB *prob, SCIP_PRIMAL *primal, SCIP_Bool printreason, SCIP_Bool completely, SCIP_Bool checkbounds, SCIP_Bool checkintegrality, SCIP_Bool checklprows, SCIP_Bool checkmodifiable, SCIP_Bool *feasible)
    Definition: sol.c:2505
    SCIP_RETCODE SCIPsolCreate(SCIP_SOL **sol, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PRIMAL *primal, SCIP_TREE *tree, SCIP_HEUR *heur)
    Definition: sol.c:428
    SCIP_RETCODE SCIPsolCreateLPSolExact(SCIP_SOL **sol, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PRIMAL *primal, SCIP_TREE *tree, SCIP_LPEXACT *lp, SCIP_HEUR *heur)
    Definition: sol.c:871
    void SCIPsolUpdateLPConsViolation(SCIP_SOL *sol, SCIP_Real absviol, SCIP_Real relviol)
    Definition: sol.c:3969
    SCIP_RETCODE SCIPsolUnlinkExact(SCIP_SOL *sol, SCIP_SET *set, SCIP_PROB *prob)
    Definition: sol.c:1460
    void SCIPsolOrigAddObjval(SCIP_SOL *sol, SCIP_Real addval)
    Definition: sol.c:4208
    internal methods for storing primal CIP solutions
    internal methods for problem statistics
    #define SCIPstatDebugMsg
    Definition: stat.h:322
    SCIP_Real primsol
    Definition: struct_lp.h:150
    SCIP_Bool solved
    SCIP_Bool solved
    Definition: struct_lp.h:373
    int ncontimplvars
    Definition: struct_prob.h:79
    SCIP_VAR ** fixedvars
    Definition: struct_prob.h:68
    SCIP_Real objoffset
    Definition: struct_prob.h:50
    SCIP_Bool transformed
    Definition: struct_prob.h:94
    int ncontvars
    Definition: struct_prob.h:80
    SCIP_CONS ** origcheckconss
    Definition: struct_prob.h:72
    int nfixedvars
    Definition: struct_prob.h:83
    SCIP_VAR ** vars
    Definition: struct_prob.h:67
    int nconss
    Definition: struct_prob.h:88
    int depth
    Definition: struct_sol.h:89
    int runnum
    Definition: struct_sol.h:88
    SCIP_Longint lpcount
    Definition: struct_sol.h:99
    SCIP_SOLORIGIN solorigin
    Definition: struct_sol.h:92
    SCIP_REALARRAY * vals
    Definition: struct_sol.h:78
    SCIP_VIOL viol
    Definition: struct_sol.h:87
    int primalindex
    Definition: struct_sol.h:90
    SCIP_Bool hasinfval
    Definition: struct_sol.h:93
    SCIP_Real time
    Definition: struct_sol.h:76
    SCIP_SOLTYPE type
    Definition: struct_sol.h:97
    SCIP_Longint nodenum
    Definition: struct_sol.h:77
    int index
    Definition: struct_sol.h:91
    SCIP_RELAX * relax
    Definition: struct_sol.h:85
    union SCIP_Sol::@20 creator
    SCIP_BOOLARRAY * valid
    Definition: struct_sol.h:79
    SCIP_HEUR * heur
    Definition: struct_sol.h:84
    SCIP_VALSEXACT * valsexact
    Definition: struct_sol.h:81
    SCIP_Real obj
    Definition: struct_sol.h:75
    SCIP * scip
    Definition: struct_sol.h:101
    SCIP_Longint nnodes
    Definition: struct_stat.h:84
    SCIP_Longint lpcount
    Definition: struct_stat.h:205
    int solindex
    Definition: struct_stat.h:306
    SCIP_CLOCK * solvingtime
    Definition: struct_stat.h:168
    SCIP_RATIONAL * obj
    Definition: struct_sol.h:112
    SCIP_BOOLARRAY * valid
    Definition: struct_sol.h:114
    SCIP_RATIONALARRAY * vals
    Definition: struct_sol.h:113
    SCIP * scip
    Definition: struct_var.h:345
    SCIP_Real obj
    Definition: struct_var.h:263
    SCIP_Real primsolavg
    Definition: struct_var.h:272
    SCIP_Real absviolcons
    Definition: struct_sol.h:57
    SCIP_Real absviollprows
    Definition: struct_sol.h:54
    SCIP_Real absviolintegrality
    Definition: struct_sol.h:56
    SCIP_Real relviollprows
    Definition: struct_sol.h:55
    SCIP_Real absviolbounds
    Definition: struct_sol.h:52
    SCIP_Real relviolbounds
    Definition: struct_sol.h:53
    SCIP_Real relviolcons
    Definition: struct_sol.h:58
    data structures for LP management
    data structures for exact LP management
    datastructures for storing and manipulating the main problem
    datastructures for global SCIP settings
    datastructures for storing primal CIP solutions
    datastructures for problem statistics
    datastructures for problem variables
    Definition: heur_padm.c:135
    SCIP_Bool SCIPtreeProbing(SCIP_TREE *tree)
    Definition: tree.c:9400
    SCIP_Bool SCIPtreeHasCurrentNodeLP(SCIP_TREE *tree)
    Definition: tree.c:9535
    int SCIPtreeGetCurrentDepth(SCIP_TREE *tree)
    Definition: tree.c:9518
    internal methods for branch and bound tree
    enum SCIP_RoundModeRational SCIP_ROUNDMODE_RAT
    Definition: type_rational.h:61
    @ SCIP_R_ROUND_UPWARDS
    Definition: type_rational.h:58
    @ SCIP_R_ROUND_DOWNWARDS
    Definition: type_rational.h:57
    @ SCIP_FEASIBLE
    Definition: type_result.h:45
    enum SCIP_Result SCIP_RESULT
    Definition: type_result.h:61
    @ SCIP_INVALIDDATA
    Definition: type_retcode.h:52
    @ SCIP_OKAY
    Definition: type_retcode.h:42
    enum SCIP_Retcode SCIP_RETCODE
    Definition: type_retcode.h:63
    @ SCIP_SOLTYPE_HEUR
    Definition: type_sol.h:65
    @ SCIP_SOLTYPE_STRONGBRANCH
    Definition: type_sol.h:68
    @ SCIP_SOLTYPE_RELAX
    Definition: type_sol.h:66
    @ SCIP_SOLTYPE_PSEUDO
    Definition: type_sol.h:69
    @ SCIP_SOLTYPE_LPRELAX
    Definition: type_sol.h:67
    @ SCIP_SOLTYPE_UNKNOWN
    Definition: type_sol.h:64
    @ SCIP_SOLORIGIN_ZERO
    Definition: type_sol.h:43
    @ SCIP_SOLORIGIN_UNKNOWN
    Definition: type_sol.h:51
    @ SCIP_SOLORIGIN_RELAXSOL
    Definition: type_sol.h:46
    @ SCIP_SOLORIGIN_PSEUDOSOL
    Definition: type_sol.h:47
    @ SCIP_SOLORIGIN_LPSOL
    Definition: type_sol.h:44
    @ SCIP_SOLORIGIN_PARTIAL
    Definition: type_sol.h:48
    @ SCIP_SOLORIGIN_ORIGINAL
    Definition: type_sol.h:42
    @ SCIP_SOLORIGIN_NLPSOL
    Definition: type_sol.h:45
    enum SCIP_SolType SCIP_SOLTYPE
    Definition: type_sol.h:71
    enum SCIP_SolOrigin SCIP_SOLORIGIN
    Definition: type_sol.h:55
    @ SCIP_VARSTATUS_ORIGINAL
    Definition: type_var.h:51
    @ SCIP_VARSTATUS_FIXED
    Definition: type_var.h:54
    @ SCIP_VARSTATUS_COLUMN
    Definition: type_var.h:53
    @ SCIP_VARSTATUS_MULTAGGR
    Definition: type_var.h:56
    @ SCIP_VARSTATUS_NEGATED
    Definition: type_var.h:57
    @ SCIP_VARSTATUS_AGGREGATED
    Definition: type_var.h:55
    @ SCIP_VARSTATUS_LOOSE
    Definition: type_var.h:52
    @ SCIP_LOCKTYPE_MODEL
    Definition: type_var.h:141
    SCIP_Real SCIPvarGetRelaxSolTransVar(SCIP_VAR *var)
    Definition: var.c:19760
    SCIP_RETCODE SCIPvarGetActiveRepresentatives(SCIP_SET *set, SCIP_VAR **vars, SCIP_Real *scalars, int *nvars, int varssize, SCIP_Real *constant, int *requiredsize)
    Definition: var.c:5180
    SCIP_RETCODE SCIPvarGetActiveRepresentativesExact(SCIP_SET *set, SCIP_VAR **vars, SCIP_RATIONAL **scalars, int *nvars, int varssize, SCIP_RATIONAL *constant, int *requiredsize, SCIP_Bool mergemultiples)
    Definition: var.c:5511
    internal methods for problem variables