Scippy

    SCIP

    Solving Constraint Integer Programs

    scip_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 scip_sol.c
    26 * @ingroup OTHER_CFILES
    27 * @brief public methods for solutions
    28 * @author Tobias Achterberg
    29 * @author Timo Berthold
    30 * @author Gerald Gamrath
    31 * @author Leona Gottwald
    32 * @author Stefan Heinz
    33 * @author Gregor Hendel
    34 * @author Thorsten Koch
    35 * @author Alexander Martin
    36 * @author Marc Pfetsch
    37 * @author Michael Winkler
    38 * @author Kati Wolter
    39 *
    40 * @todo check all SCIP_STAGE_* switches, and include the new stages TRANSFORMED and INITSOLVE
    41 */
    42
    43/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
    44
    45#include <string.h>
    46
    48#include "scip/cons.h"
    49#include "scip/cons_linear.h"
    50#include "scip/debug.h"
    51#include "scip/lp.h"
    52#include "scip/lpexact.h"
    53#include "scip/nlp.h"
    54#include "scip/primal.h"
    55#include "scip/prob.h"
    56#include "scip/pub_cons.h"
    57#include "scip/pub_fileio.h"
    58#include "scip/pub_message.h"
    59#include "scip/pub_misc.h"
    60#include "scip/pub_sol.h"
    61#include "scip/pub_var.h"
    62#include "scip/relax.h"
    63#include "scip/scip_cons.h"
    64#include "scip/scip_copy.h"
    65#include "scip/scip_exact.h"
    66#include "scip/scip_general.h"
    67#include "scip/scip_lpexact.h"
    68#include "scip/scip_mem.h"
    69#include "scip/scip_message.h"
    70#include "scip/scip_nlp.h"
    71#include "scip/scip_numerics.h"
    72#include "scip/scip_param.h"
    73#include "scip/scip_prob.h"
    74#include "scip/scip_sol.h"
    75#include "scip/scip_solve.h"
    77#include "scip/scip_var.h"
    78#include "scip/set.h"
    79#include "scip/sol.h"
    80#include "scip/struct_lp.h"
    81#include "scip/struct_mem.h"
    82#include "scip/struct_primal.h"
    83#include "scip/struct_prob.h"
    84#include "scip/struct_scip.h"
    85#include "scip/struct_set.h"
    86#include "scip/struct_sol.h"
    87#include "scip/struct_stat.h"
    88#include "scip/struct_var.h"
    89#include "scip/tree.h"
    90#include "xml/xml.h"
    91
    92/** checks solution for feasibility in original problem without adding it to the solution store; to improve the
    93 * performance we use the following order when checking for violations:
    94 *
    95 * 1. variable bounds
    96 * 2. constraint handlers with positive or zero priority that don't need constraints (e.g. integral constraint handler)
    97 * 3. original constraints
    98 * 4. constraint handlers with negative priority that don't need constraints (e.g. Benders' decomposition constraint handler)
    99 */
    100static
    102 SCIP* scip, /**< SCIP data structure */
    103 SCIP_SOL* sol, /**< primal CIP solution */
    104 SCIP_Bool* feasible, /**< stores whether given solution is feasible */
    105 SCIP_Bool printreason, /**< Should the reason for the violation be printed? */
    106 SCIP_Bool completely, /**< Should all violations be checked if printreason is true? */
    107 SCIP_Bool checkbounds, /**< Should the bounds of the variables be checked? */
    108 SCIP_Bool checkintegrality, /**< Has integrality to be checked? */
    109 SCIP_Bool checklprows, /**< Do constraints represented by rows in the current LP have to be checked? */
    110 SCIP_Bool checkmodifiable /**< have modifiable constraint to be checked? */
    111 )
    112{
    113 SCIP_RESULT result;
    114 int v;
    115 int c;
    116 int h;
    117
    118 assert(scip != NULL);
    119 assert(sol != NULL);
    120 assert(sol->scip == scip);
    121 assert(feasible != NULL);
    122
    124
    125 *feasible = TRUE;
    126
    128
    129 if( !printreason )
    130 completely = FALSE;
    131
    132 if( SCIPisExact(scip) )
    133 {
    135 SCIP_CALL( SCIPsolMakeExact(sol, SCIPblkmem(scip), scip->set, scip->stat, scip->origprob) );
    136 else
    137 SCIP_CALL( SCIPsolMakeExact(sol, SCIPblkmem(scip), scip->set, scip->stat, scip->transprob) );
    138 }
    139
    140 /* check bounds */
    141 if( checkbounds )
    142 {
    143 for( v = 0; v < scip->origprob->nvars; ++v )
    144 {
    145 SCIP_VAR* var;
    146 SCIP_Real solval;
    147 SCIP_Real lb;
    148 SCIP_Real ub;
    149
    150 var = scip->origprob->vars[v];
    151 solval = SCIPsolGetVal(sol, scip->set, scip->stat, var);
    152
    153 lb = SCIPvarGetLbOriginal(var);
    154 ub = SCIPvarGetUbOriginal(var);
    155
    156 SCIPupdateSolBoundViolation(scip, sol, lb - solval, SCIPrelDiff(lb, solval));
    157 SCIPupdateSolBoundViolation(scip, sol, solval - ub, SCIPrelDiff(solval, ub));
    158
    159 if( SCIPsetIsFeasLT(scip->set, solval, lb) || SCIPsetIsFeasGT(scip->set, solval, ub) )
    160 {
    161 *feasible = FALSE;
    162
    163 if( printreason )
    164 {
    165 SCIPmessagePrintInfo(scip->messagehdlr, "solution violates original bounds of variable <%s> [%g,%g] solution value <%g>\n",
    166 SCIPvarGetName(var), lb, ub, solval);
    167 }
    168
    169 if( !completely )
    170 return SCIP_OKAY;
    171 }
    172 }
    173 }
    174
    175 /* call constraint handlers with positive or zero check priority that don't need constraints */
    176 for( h = 0; h < scip->set->nconshdlrs; ++h )
    177 {
    178 if( SCIPconshdlrGetCheckPriority(scip->set->conshdlrs[h]) >= 0 )
    179 {
    180 if( !SCIPconshdlrNeedsCons(scip->set->conshdlrs[h]) )
    181 {
    182 SCIP_CALL( SCIPconshdlrCheck(scip->set->conshdlrs[h], scip->mem->probmem, scip->set, scip->stat, sol,
    183 checkintegrality, checklprows, printreason, completely, &result) );
    184
    185 if( result != SCIP_FEASIBLE )
    186 {
    187 *feasible = FALSE;
    188
    189 if( !completely )
    190 return SCIP_OKAY;
    191 }
    192 }
    193 }
    194 /* constraint handlers are sorted by priority, so we can break when reaching the first one with negative priority */
    195 else
    196 break;
    197 }
    198
    199 /* check original constraints
    200 *
    201 * in general modifiable constraints can not be checked, because the variables to fulfill them might be missing in
    202 * the original problem; however, if the solution comes from a heuristic during presolving modifiable constraints
    203 * have to be checked;
    204 */
    205 for( c = 0; c < scip->origprob->nconss; ++c )
    206 {
    207 if( SCIPconsIsChecked(scip->origprob->conss[c]) && (checkmodifiable || !SCIPconsIsModifiable(scip->origprob->conss[c])) )
    208 {
    209 /* check solution */
    210 SCIP_CALL( SCIPconsCheck(scip->origprob->conss[c], scip->set, sol,
    211 checkintegrality, checklprows, printreason, &result) );
    212
    213 if( result != SCIP_FEASIBLE )
    214 {
    215 *feasible = FALSE;
    216
    217 if( !completely )
    218 return SCIP_OKAY;
    219 }
    220 }
    221 }
    222
    223 /* call constraint handlers with negative check priority that don't need constraints;
    224 * continue with the first constraint handler with negative priority which caused us to break in the above loop */
    225 for( ; h < scip->set->nconshdlrs; ++h )
    226 {
    227 assert(SCIPconshdlrGetCheckPriority(scip->set->conshdlrs[h]) < 0);
    228 if( !SCIPconshdlrNeedsCons(scip->set->conshdlrs[h]) )
    229 {
    230 SCIP_CALL( SCIPconshdlrCheck(scip->set->conshdlrs[h], scip->mem->probmem, scip->set, scip->stat, sol,
    231 checkintegrality, checklprows, printreason, completely, &result) );
    232
    233 if( result != SCIP_FEASIBLE )
    234 {
    235 *feasible = FALSE;
    236
    237 if( !completely )
    238 return SCIP_OKAY;
    239 }
    240 }
    241 }
    242
    243 return SCIP_OKAY;
    244}
    245
    246/** checks solution (fp or exact) for exact feasibility in original problem without adding it to the solution store;
    247 * to improve the performance we use the following order when checking for violations:
    248 *
    249 * 1. variable bounds
    250 * 2. constraint handlers with positive or zero priority that don't need constraints (e.g. integral constraint handler)
    251 * 3. original constraints
    252 * 4. constraint handlers with negative priority that don't need constraints (e.g. Benders' decomposition constraint handler)
    253 */
    254static
    256 SCIP* scip, /**< SCIP data structure */
    257 SCIP_SOL* sol, /**< primal CIP solution */
    258 SCIP_Bool* feasible, /**< stores whether given solution is feasible */
    259 SCIP_Bool printreason, /**< Should the reason for the violation be printed? */
    260 SCIP_Bool completely, /**< Should all violations be checked if printreason is true? */
    261 SCIP_Bool checkbounds, /**< Should the bounds of the variables be checked? */
    262 SCIP_Bool checkintegrality, /**< Has integrality to be checked? */
    263 SCIP_Bool checklprows, /**< Do constraints represented by rows in the current LP have to be checked? */
    264 SCIP_Bool checkmodifiable /**< have modifiable constraint to be checked? */
    265 )
    266{
    267 SCIP_RATIONAL* solval;
    268 SCIP_RATIONAL* lb;
    269 SCIP_RATIONAL* ub;
    270 SCIP_RESULT result;
    271 int v;
    272 int c;
    273 int h;
    274
    275 assert(scip != NULL);
    276 assert(sol != NULL);
    277 assert(sol->scip == scip);
    278 assert(feasible != NULL);
    279 assert(SCIPisExact(scip));
    280
    281 SCIP_CALL( SCIPcheckStage(scip, "checkSolOrigExact", FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
    282
    283 *feasible = TRUE;
    284
    286
    288 SCIP_CALL( SCIPsolMakeExact(sol, SCIPblkmem(scip), scip->set, scip->stat, scip->origprob) );
    289 else
    290 SCIP_CALL( SCIPsolMakeExact(sol, SCIPblkmem(scip), scip->set, scip->stat, scip->transprob) );
    291
    292 if( !printreason )
    293 completely = FALSE;
    294
    296
    297 /* check bounds */
    298 if( checkbounds )
    299 {
    300 for( v = 0; v < scip->origprob->nvars; ++v )
    301 {
    302 SCIP_VAR* var;
    303
    304 var = scip->origprob->vars[v];
    305 if( SCIPsolIsExact(sol) )
    306 SCIPsolGetValExact(solval, sol, scip->set, scip->stat, var);
    307 else
    308 SCIPrationalSetReal(solval, SCIPsolGetVal(sol, scip->set, scip->stat, var));
    309
    312
    313 if( SCIPrationalIsLT(solval, lb) || SCIPrationalIsGT(solval, ub) )
    314 {
    315 *feasible = FALSE;
    316
    317 if( printreason )
    318 {
    319 SCIPmessagePrintInfo(scip->messagehdlr, "solution violates original bounds of variable <%s> [%g,%g] solution value <%g>\n",
    321 }
    322
    323 if( !completely )
    324 {
    326 return SCIP_OKAY;
    327 }
    328 }
    329 }
    330 }
    331
    333
    334 /* call constraint handlers with positive or zero check priority that don't need constraints */
    335 for( h = 0; h < scip->set->nconshdlrs; ++h )
    336 {
    337 if( SCIPconshdlrGetCheckPriority(scip->set->conshdlrs[h]) >= 0 )
    338 {
    339 if( !SCIPconshdlrNeedsCons(scip->set->conshdlrs[h]) )
    340 {
    341 SCIP_CALL( SCIPconshdlrCheck(scip->set->conshdlrs[h], scip->mem->probmem, scip->set, scip->stat, sol,
    342 checkintegrality, checklprows, printreason, completely, &result) );
    343
    344 if( result != SCIP_FEASIBLE )
    345 {
    346 *feasible = FALSE;
    347
    348 if( !completely )
    349 return SCIP_OKAY;
    350 }
    351 }
    352 }
    353 /* constraint handlers are sorted by priority, so we can break when reaching the first one with negative priority */
    354 else
    355 break;
    356 }
    357
    358 /* check original constraints
    359 *
    360 * in general modifiable constraints can not be checked, because the variables to fulfill them might be missing in
    361 * the original problem; however, if the solution comes from a heuristic during presolving modifiable constraints
    362 * have to be checked;
    363 */
    364 for( c = 0; c < scip->origprob->nconss; ++c )
    365 {
    366 if( SCIPconsIsChecked(scip->origprob->conss[c]) && (checkmodifiable || !SCIPconsIsModifiable(scip->origprob->conss[c])) )
    367 {
    368 /* check solution */
    369 SCIP_CALL( SCIPconsCheck(scip->origprob->conss[c], scip->set, sol,
    370 checkintegrality, checklprows, printreason, &result) );
    371
    372 if( result != SCIP_FEASIBLE )
    373 {
    374 *feasible = FALSE;
    375
    376 if( !completely )
    377 return SCIP_OKAY;
    378 }
    379 }
    380 }
    381
    382 /* call constraint handlers with negative check priority that don't need constraints;
    383 * continue with the first constraint handler with negative priority which caused us to break in the above loop */
    384 for( ; h < scip->set->nconshdlrs; ++h )
    385 {
    386 assert(SCIPconshdlrGetCheckPriority(scip->set->conshdlrs[h]) < 0);
    387 if( !SCIPconshdlrNeedsCons(scip->set->conshdlrs[h]) )
    388 {
    389 SCIP_CALL( SCIPconshdlrCheck(scip->set->conshdlrs[h], scip->mem->probmem, scip->set, scip->stat, sol,
    390 checkintegrality, checklprows, printreason, completely, &result) );
    391
    392 if( result != SCIP_FEASIBLE )
    393 {
    394 *feasible = FALSE;
    395
    396 if( !completely )
    397 return SCIP_OKAY;
    398 }
    399 }
    400 }
    401
    402 return SCIP_OKAY;
    403}
    404
    405/** update integrality violation of a solution */
    407 SCIP* scip, /**< SCIP data structure */
    408 SCIP_SOL* sol, /**< primal CIP solution */
    409 SCIP_Real absviol /**< absolute violation */
    410 )
    411{
    412 assert(scip != NULL);
    413 assert(sol != NULL);
    414 assert(sol->scip == scip);
    415
    416 if( SCIPprimalUpdateViolations(scip->origprimal) )
    418}
    419
    420/** update bound violation of a solution */
    422 SCIP* scip, /**< SCIP data structure */
    423 SCIP_SOL* sol, /**< primal CIP solution */
    424 SCIP_Real absviol, /**< absolute violation */
    425 SCIP_Real relviol /**< relative violation */
    426 )
    427{
    428 assert(scip != NULL);
    429 assert(sol != NULL);
    430 assert(sol->scip == scip);
    431
    432 if( SCIPprimalUpdateViolations(scip->origprimal) )
    433 SCIPsolUpdateBoundViolation(sol, absviol, relviol);
    434}
    435
    436/** update LP row violation of a solution */
    438 SCIP* scip, /**< SCIP data structure */
    439 SCIP_SOL* sol, /**< primal CIP solution */
    440 SCIP_Real absviol, /**< absolute violation */
    441 SCIP_Real relviol /**< relative violation */
    442 )
    443{
    444 assert(scip != NULL);
    445 assert(sol != NULL);
    446 assert(sol->scip == scip);
    447
    448 if( SCIPprimalUpdateViolations(scip->origprimal) )
    449 SCIPsolUpdateLPRowViolation(sol, absviol, relviol);
    450}
    451
    452/** update constraint violation of a solution */
    454 SCIP* scip, /**< SCIP data structure */
    455 SCIP_SOL* sol, /**< primal CIP solution */
    456 SCIP_Real absviol, /**< absolute violation */
    457 SCIP_Real relviol /**< relative violation */
    458 )
    459{
    460 assert(scip != NULL);
    461 assert(sol != NULL);
    462 assert(sol->scip == scip);
    463
    464 if( SCIPprimalUpdateViolations(scip->origprimal) )
    465 SCIPsolUpdateConsViolation(sol, absviol, relviol);
    466}
    467
    468/** update LP row and constraint violations of a solution */
    470 SCIP* scip, /**< SCIP data structure */
    471 SCIP_SOL* sol, /**< primal CIP solution */
    472 SCIP_Real absviol, /**< absolute violation */
    473 SCIP_Real relviol /**< relative violation */
    474 )
    475{
    476 assert(scip != NULL);
    477 assert(sol != NULL);
    478 assert(sol->scip == scip);
    479
    480 if( SCIPprimalUpdateViolations(scip->origprimal) )
    481 SCIPsolUpdateLPConsViolation(sol, absviol, relviol);
    482}
    483
    484/** allow violation updates */
    486 SCIP* scip /**< SCIP data structure */
    487 )
    488{
    490}
    491
    492/** disallow violation updates */
    494 SCIP* scip /**< SCIP data structure */
    495 )
    496{
    498}
    499
    500/** creates a primal solution, initialized to zero
    501 *
    502 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
    503 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
    504 *
    505 * @pre This method can be called if SCIP is in one of the following stages:
    506 * - \ref SCIP_STAGE_PROBLEM
    507 * - \ref SCIP_STAGE_TRANSFORMING
    508 * - \ref SCIP_STAGE_TRANSFORMED
    509 * - \ref SCIP_STAGE_INITPRESOLVE
    510 * - \ref SCIP_STAGE_PRESOLVING
    511 * - \ref SCIP_STAGE_EXITPRESOLVE
    512 * - \ref SCIP_STAGE_PRESOLVED
    513 * - \ref SCIP_STAGE_INITSOLVE
    514 * - \ref SCIP_STAGE_SOLVING
    515 */
    517 SCIP* scip, /**< SCIP data structure */
    518 SCIP_SOL** sol, /**< pointer to store the solution */
    519 SCIP_HEUR* heur /**< heuristic that found the solution (or NULL if it's from the tree) */
    520 )
    521{
    523
    524 switch( scip->set->stage )
    525 {
    527 SCIP_CALL( SCIPsolCreateOriginal(sol, scip->mem->probmem, scip->set, scip->stat, scip->origprob, scip->origprimal, NULL, heur) );
    528 return SCIP_OKAY;
    529
    538 SCIP_CALL( SCIPsolCreate(sol, scip->mem->probmem, scip->set, scip->stat, scip->primal, scip->tree, heur) );
    539 return SCIP_OKAY;
    540
    544 default:
    545 SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
    546 return SCIP_INVALIDDATA;
    547 } /*lint !e788*/
    548}
    549
    550/** creates an exact primal solution, initialized to zero
    551 *
    552 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
    553 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
    554 *
    555 * @pre This method can be called if SCIP is in one of the following stages:
    556 * - \ref SCIP_STAGE_PROBLEM
    557 * - \ref SCIP_STAGE_TRANSFORMING
    558 * - \ref SCIP_STAGE_TRANSFORMED
    559 * - \ref SCIP_STAGE_INITPRESOLVE
    560 * - \ref SCIP_STAGE_PRESOLVING
    561 * - \ref SCIP_STAGE_EXITPRESOLVE
    562 * - \ref SCIP_STAGE_PRESOLVED
    563 * - \ref SCIP_STAGE_INITSOLVE
    564 * - \ref SCIP_STAGE_SOLVING
    565 */
    567 SCIP* scip, /**< SCIP data structure */
    568 SCIP_SOL** sol, /**< pointer to store the solution */
    569 SCIP_HEUR* heur /**< heuristic that found the solution (or NULL if it's from the tree) */
    570 )
    571{
    572 SCIP_CALL( SCIPcheckStage(scip, "SCIPcreateSolExact", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
    573
    574 switch( scip->set->stage )
    575 {
    577 SCIP_CALL( SCIPsolCreateOriginalExact(sol, scip->mem->probmem, scip->set, scip->stat, scip->origprob, scip->origprimal, NULL, heur) );
    578 return SCIP_OKAY;
    579
    588 SCIP_CALL( SCIPsolCreateExact(sol, scip->mem->probmem, scip->set, scip->stat, scip->primal, scip->tree, heur) );
    589 return SCIP_OKAY;
    590
    594 default:
    595 SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
    596 return SCIP_INVALIDDATA;
    597 } /*lint !e788*/
    598}
    599
    600/** creates a primal solution, initialized to the current LP solution
    601 *
    602 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
    603 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
    604 *
    605 * @pre This method can be called if SCIP is in one of the following stages:
    606 * - \ref SCIP_STAGE_SOLVING
    607 */
    609 SCIP* scip, /**< SCIP data structure */
    610 SCIP_SOL** sol, /**< pointer to store the solution */
    611 SCIP_HEUR* heur /**< heuristic that found the solution (or NULL if it's from the tree) */
    612 )
    613{
    615
    616 if( !SCIPtreeHasCurrentNodeLP(scip->tree) )
    617 {
    618 SCIPerrorMessage("LP solution does not exist\n");
    619 return SCIP_INVALIDCALL;
    620 }
    621
    622 SCIP_CALL( SCIPsolCreateLPSol(sol, scip->mem->probmem, scip->set, scip->stat, scip->transprob, scip->primal,
    623 scip->tree, scip->lp, heur) );
    624
    625 return SCIP_OKAY;
    626}
    627
    628/** creates an exact primal solution, initialized to the current exact LP solution
    629 *
    630 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
    631 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
    632 *
    633 * @pre This method can be called if SCIP is in one of the following stages:
    634 * - \ref SCIP_STAGE_SOLVING
    635 */
    637 SCIP* scip, /**< SCIP data structure */
    638 SCIP_SOL** sol, /**< pointer to store the solution */
    639 SCIP_HEUR* heur /**< heuristic that found the solution (or NULL if it's from the tree) */
    640 )
    641{
    642 SCIP_CALL( SCIPcheckStage(scip, "SCIPcreateLPSolExact", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
    643
    644 if( !SCIPtreeHasCurrentNodeLP(scip->tree) )
    645 {
    646 SCIPerrorMessage("LP solution does not exist\n");
    647 return SCIP_INVALIDCALL;
    648 }
    649
    650 SCIP_CALL( SCIPsolCreateLPSolExact(sol, scip->mem->probmem, scip->set, scip->stat, scip->primal,
    651 scip->tree, scip->lpexact, heur) );
    652
    653 return SCIP_OKAY;
    654}
    655
    656/** creates a primal solution, initialized to the current NLP solution
    657 *
    658 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
    659 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
    660 *
    661 * @pre This method can be called if SCIP is in one of the following stages:
    662 * - \ref SCIP_STAGE_SOLVING
    663 */
    665 SCIP* scip, /**< SCIP data structure */
    666 SCIP_SOL** sol, /**< pointer to store the solution */
    667 SCIP_HEUR* heur /**< heuristic that found the solution (or NULL if it's from the tree) */
    668 )
    669{
    671
    673 {
    674 SCIPerrorMessage("NLP does not exist\n");
    675 return SCIP_INVALIDCALL;
    676 }
    677 assert(scip->nlp != NULL);
    678
    679 if( !SCIPnlpHasSolution(scip->nlp) )
    680 {
    681 SCIPerrorMessage("NLP solution does not exist\n");
    682 return SCIP_INVALIDCALL;
    683 }
    684
    685 SCIP_CALL( SCIPsolCreateNLPSol(sol, scip->mem->probmem, scip->set, scip->stat, scip->primal, scip->tree, scip->nlp,
    686 heur) );
    687
    688 return SCIP_OKAY;
    689}
    690
    691/** creates a primal solution, initialized to the current relaxation solution
    692 *
    693 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
    694 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
    695 *
    696 * @pre This method can be called if SCIP is in one of the following stages:
    697 * - \ref SCIP_STAGE_SOLVING
    698 */
    700 SCIP* scip, /**< SCIP data structure */
    701 SCIP_SOL** sol, /**< pointer to store the solution */
    702 SCIP_HEUR* heur /**< heuristic that found the solution (or NULL if it's from the tree) */
    703 )
    704{
    706
    707 if( !SCIPrelaxationIsSolValid(scip->relaxation) )
    708 {
    709 SCIPerrorMessage("relaxation solution is not valid\n");
    710 return SCIP_INVALIDCALL;
    711 }
    712
    713 SCIP_CALL( SCIPsolCreateRelaxSol(sol, scip->mem->probmem, scip->set, scip->stat, scip->primal, scip->tree, scip->relaxation, heur) );
    714
    715 return SCIP_OKAY;
    716}
    717
    718/** creates a primal solution, initialized to the current pseudo solution
    719 *
    720 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
    721 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
    722 *
    723 * @pre This method can be called if SCIP is in one of the following stages:
    724 * - \ref SCIP_STAGE_SOLVING
    725 */
    727 SCIP* scip, /**< SCIP data structure */
    728 SCIP_SOL** sol, /**< pointer to store the solution */
    729 SCIP_HEUR* heur /**< heuristic that found the solution (or NULL if it's from the tree) */
    730 )
    731{
    733
    734 SCIP_CALL( SCIPsolCreatePseudoSol(sol, scip->mem->probmem, scip->set, scip->stat, scip->transprob, scip->primal,
    735 scip->tree, scip->lp, heur) );
    736
    737 return SCIP_OKAY;
    738}
    739
    740/** creates a primal solution, initialized to the current LP or pseudo solution, depending on whether the LP was solved
    741 * at the current node
    742 *
    743 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
    744 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
    745 *
    746 * @pre This method can be called if SCIP is in one of the following stages:
    747 * - \ref SCIP_STAGE_SOLVING
    748 */
    750 SCIP* scip, /**< SCIP data structure */
    751 SCIP_SOL** sol, /**< pointer to store the solution */
    752 SCIP_HEUR* heur /**< heuristic that found the solution (or NULL if it's from the tree) */
    753 )
    754{
    755 SCIP_CALL( SCIPcheckStage(scip, "SCIPcreateCurrentSol", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
    756
    757 SCIP_CALL( SCIPsolCreateCurrentSol(sol, scip->mem->probmem, scip->set, scip->stat, scip->transprob, scip->primal,
    758 scip->tree, scip->lp, heur) );
    759
    760 return SCIP_OKAY;
    761}
    762
    763/** creates a partial primal solution, initialized to unknown values
    764 *
    765 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
    766 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
    767 *
    768 * @pre This method can be called if SCIP is in one of the following stages:
    769 * - \ref SCIP_STAGE_PROBLEM
    770 */
    772 SCIP* scip, /**< SCIP data structure */
    773 SCIP_SOL** sol, /**< pointer to store the solution */
    774 SCIP_HEUR* heur /**< heuristic that found the solution (or NULL if it's from the tree) */
    775 )
    776{
    777 SCIP_CALL( SCIPcheckStage(scip, "SCIPcreatePartialSol", FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
    778
    779 SCIP_CALL( SCIPsolCreatePartial(sol, scip->mem->probmem, scip->set, scip->stat, scip->origprimal, heur) );
    780
    781 return SCIP_OKAY;
    782}
    783
    784/** creates a primal solution, initialized to unknown values
    785 *
    786 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
    787 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
    788 *
    789 * @pre This method can be called if SCIP is in one of the following stages:
    790 * - \ref SCIP_STAGE_TRANSFORMING
    791 * - \ref SCIP_STAGE_TRANSFORMED
    792 * - \ref SCIP_STAGE_INITPRESOLVE
    793 * - \ref SCIP_STAGE_PRESOLVING
    794 * - \ref SCIP_STAGE_EXITPRESOLVE
    795 * - \ref SCIP_STAGE_PRESOLVED
    796 * - \ref SCIP_STAGE_INITSOLVE
    797 * - \ref SCIP_STAGE_SOLVING
    798 */
    800 SCIP* scip, /**< SCIP data structure */
    801 SCIP_SOL** sol, /**< pointer to store the solution */
    802 SCIP_HEUR* heur /**< heuristic that found the solution (or NULL if it's from the tree) */
    803 )
    804{
    805 SCIP_CALL( SCIPcheckStage(scip, "SCIPcreateUnknownSol", FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
    806
    807 SCIP_CALL( SCIPsolCreateUnknown(sol, scip->mem->probmem, scip->set, scip->stat, scip->primal, scip->tree, heur) );
    808
    809 return SCIP_OKAY;
    810}
    811
    812/** creates a primal solution living in the original problem space, initialized to zero;
    813 * a solution in original space allows to set original variables to values that would be invalid in the
    814 * transformed problem due to preprocessing fixings or aggregations
    815 *
    816 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
    817 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
    818 *
    819 * @pre This method can be called if SCIP is in one of the following stages:
    820 * - \ref SCIP_STAGE_PROBLEM
    821 * - \ref SCIP_STAGE_TRANSFORMING
    822 * - \ref SCIP_STAGE_TRANSFORMED
    823 * - \ref SCIP_STAGE_INITPRESOLVE
    824 * - \ref SCIP_STAGE_PRESOLVING
    825 * - \ref SCIP_STAGE_EXITPRESOLVE
    826 * - \ref SCIP_STAGE_PRESOLVED
    827 * - \ref SCIP_STAGE_INITSOLVE
    828 * - \ref SCIP_STAGE_SOLVING
    829 * - \ref SCIP_STAGE_SOLVED
    830 */
    832 SCIP* scip, /**< SCIP data structure */
    833 SCIP_SOL** sol, /**< pointer to store the solution */
    834 SCIP_HEUR* heur /**< heuristic that found the solution (or NULL if it's from the tree) */
    835 )
    836{
    837 SCIP_CALL( SCIPcheckStage(scip, "SCIPcreateOrigSol", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
    838
    839 switch( scip->set->stage )
    840 {
    842 SCIP_CALL( SCIPsolCreateOriginal(sol, scip->mem->probmem, scip->set, scip->stat, scip->origprob, scip->origprimal, NULL, heur) );
    843 return SCIP_OKAY;
    844
    854 SCIP_CALL( SCIPsolCreateOriginal(sol, scip->mem->probmem, scip->set, scip->stat, scip->origprob, scip->primal, scip->tree, heur) );
    855 return SCIP_OKAY;
    856
    859 default:
    860 SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
    861 return SCIP_INVALIDCALL;
    862 } /*lint !e788*/
    863}
    864
    865/** creates a copy of a primal solution; note that a copy of a linked solution is also linked and needs to be unlinked
    866 * if it should stay unaffected from changes in the LP or pseudo solution
    867 *
    868 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
    869 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
    870 *
    871 * @pre This method can be called if SCIP is in one of the following stages:
    872 * - \ref SCIP_STAGE_PROBLEM
    873 * - \ref SCIP_STAGE_FREETRANS
    874 * - \ref SCIP_STAGE_TRANSFORMING
    875 * - \ref SCIP_STAGE_TRANSFORMED
    876 * - \ref SCIP_STAGE_INITPRESOLVE
    877 * - \ref SCIP_STAGE_PRESOLVING
    878 * - \ref SCIP_STAGE_EXITPRESOLVE
    879 * - \ref SCIP_STAGE_PRESOLVED
    880 * - \ref SCIP_STAGE_INITSOLVE
    881 * - \ref SCIP_STAGE_SOLVING
    882 * - \ref SCIP_STAGE_SOLVED
    883 */
    885 SCIP* scip, /**< SCIP data structure */
    886 SCIP_SOL** sol, /**< pointer to store the solution */
    887 SCIP_SOL* sourcesol /**< primal CIP solution to copy */
    888 )
    889{
    890 SCIP_CALL( SCIPcheckStage(scip, "SCIPcreateSolCopy", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
    891
    892 /* check if we want to copy the current solution, which is the same as creating a current solution */
    893 if( sourcesol == NULL )
    894 {
    896 }
    897 else
    898 {
    899 SCIP_CALL( SCIPsolCopy(sol, scip->mem->probmem, scip->set, scip->stat, scip->primal, sourcesol) );
    900 }
    901
    902 return SCIP_OKAY;
    903}
    904
    905/** creates a copy of a solution in the original primal solution space
    906 *
    907 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
    908 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
    909 *
    910 * @pre This method can be called if SCIP is in one of the following stages:
    911 * - \ref SCIP_STAGE_PROBLEM
    912 * - \ref SCIP_STAGE_TRANSFORMING
    913 * - \ref SCIP_STAGE_TRANSFORMED
    914 * - \ref SCIP_STAGE_INITPRESOLVE
    915 * - \ref SCIP_STAGE_PRESOLVING
    916 * - \ref SCIP_STAGE_EXITPRESOLVE
    917 * - \ref SCIP_STAGE_PRESOLVED
    918 * - \ref SCIP_STAGE_INITSOLVE
    919 * - \ref SCIP_STAGE_SOLVING
    920 * - \ref SCIP_STAGE_SOLVED
    921 * - \ref SCIP_STAGE_EXITSOLVE
    922 * - \ref SCIP_STAGE_FREETRANS
    923 */
    925 SCIP* scip, /**< SCIP data structure */
    926 SCIP_SOL** sol, /**< pointer to store the solution */
    927 SCIP_SOL* sourcesol /**< primal CIP solution to copy */
    928 )
    929{
    930 SCIP_CALL( SCIPcheckStage(scip, "SCIPcreateSolCopyOrig", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
    931
    932 /* check if we want to copy the current solution, which is the same as creating a current solution */
    933 if( sourcesol == NULL )
    934 {
    936 }
    937 else
    938 {
    939 switch( scip->set->stage )
    940 {
    952 SCIP_CALL( SCIPsolCopy(sol, scip->mem->probmem, scip->set, scip->stat, scip->origprimal, sourcesol) );
    954 break;
    955 default:
    956 assert(FALSE); /*lint !e506*/
    957 } /*lint !e788*/
    958 }
    959
    960 return SCIP_OKAY;
    961}
    962
    963/** helper method that sets up and solves the sub-SCIP for removing infinite values from solutions */
    964static
    966 SCIP* scip, /**< SCIP data structure */
    967 SCIP* subscip, /**< SCIP data structure of sub-SCIP*/
    968 SCIP_VAR** origvars, /**< original problem variables of main SCIP */
    969 int norigvars, /**< number of original problem variables of main SCIP */
    970 SCIP_Real* solvals, /**< array with solution values of variables; infinite ones are replaced */
    971 SCIP_Bool* success /**< pointer to store if removing infinite values was successful */
    972 )
    973{
    974 SCIP_HASHMAP* varmap;
    975 SCIP_VAR* varcopy;
    976 SCIP_Real fixval;
    977 SCIP_Bool valid;
    978 SCIP_SOL* bestsol;
    979 int v;
    980
    981 assert(scip != NULL);
    982 assert(subscip != NULL);
    983 assert(origvars != NULL);
    984 assert(solvals != NULL);
    985 assert(success != NULL);
    986
    987 /* copy the original problem to the sub-SCIP */
    988 SCIP_CALL( SCIPhashmapCreate(&varmap, SCIPblkmem(scip), norigvars) );
    989 SCIP_CALL( SCIPcopyOrig(scip, subscip, varmap, NULL, "removeinffixings", TRUE, FALSE, TRUE, &valid) );
    990
    991 SCIP_CALL( SCIPsetIntParam(subscip, "display/verblevel", (int)SCIP_VERBLEVEL_NONE) );
    992
    993 /* in the sub-SCIP, we try to minimize the absolute values of all variables with infinite values in the solution
    994 * and fix all other variables to the value they have in the solution
    995 */
    996 for( v = 0; v < norigvars; ++v )
    997 {
    998 varcopy = (SCIP_VAR*) SCIPhashmapGetImage(varmap, (void*)origvars[v]);
    999 assert(varcopy != NULL);
    1000
    1001 fixval = solvals[v];
    1002
    1003 if( SCIPisInfinity(scip, fixval) || SCIPisInfinity(scip, -fixval) )
    1004 {
    1005 /* If a variable with a finite finite lower bound was set to +infinity, we just change its objective to 1.0
    1006 * to minimize its value; if a variable with a finite finite upper bound was set to -infinity, we just
    1007 * change its objective to -1.0 to maximize its value; if a variable is free, we split the variable into
    1008 * positive and negative part by creating two new non-negative variables and one constraint linking those
    1009 * variables.
    1010 */
    1011 if( SCIPisInfinity(scip, fixval) && !SCIPisInfinity(scip, -SCIPvarGetLbLocal(varcopy)) )
    1012 {
    1013 SCIP_CALL( SCIPchgVarObj(subscip, varcopy, 1.0) );
    1014 }
    1015 else if( SCIPisInfinity(scip, -fixval) && !SCIPisInfinity(scip, SCIPvarGetUbLocal(varcopy)) )
    1016 {
    1017 SCIP_CALL( SCIPchgVarObj(subscip, varcopy, -1.0) );
    1018 }
    1019 else
    1020 {
    1021 char name[SCIP_MAXSTRLEN];
    1022 SCIP_VAR* posvar;
    1023 SCIP_VAR* negvar;
    1024 SCIP_CONS* linkcons;
    1025
    1026 (void) SCIPsnprintf(name, SCIP_MAXSTRLEN, "%s_%s", SCIPvarGetName(varcopy), "run");
    1027 SCIP_CALL( SCIPcreateVar(subscip, &posvar, name, 0.0, SCIPinfinity(scip), 1.0,
    1029 SCIP_CALL( SCIPaddVar(subscip, posvar) );
    1030
    1031 (void) SCIPsnprintf(name, SCIP_MAXSTRLEN, "%s_%s", SCIPvarGetName(varcopy), "neg");
    1032 SCIP_CALL( SCIPcreateVar(subscip, &negvar, name, 0.0, SCIPinfinity(scip), 1.0,
    1034 SCIP_CALL( SCIPaddVar(subscip, negvar) );
    1035
    1036 (void) SCIPsnprintf(name, SCIP_MAXSTRLEN, "%s_%s", SCIPvarGetName(varcopy), "linkcons");
    1037 SCIP_CALL( SCIPcreateConsBasicLinear(subscip, &linkcons, name, 0, NULL, NULL, 0.0, 0.0 ) );
    1038 SCIP_CALL( SCIPaddCoefLinear(subscip, linkcons, varcopy, 1.0) );
    1039 SCIP_CALL( SCIPaddCoefLinear(subscip, linkcons, posvar, -1.0) );
    1040 SCIP_CALL( SCIPaddCoefLinear(subscip, linkcons, negvar, 1.0) );
    1041 SCIP_CALL( SCIPaddCons(subscip, linkcons) );
    1042
    1043 SCIP_CALL( SCIPreleaseCons(subscip, &linkcons) );
    1044 SCIP_CALL( SCIPreleaseVar(subscip, &posvar) );
    1045 SCIP_CALL( SCIPreleaseVar(subscip, &negvar) );
    1046
    1047 SCIP_CALL( SCIPchgVarObj(subscip, varcopy, 0.0) );
    1048 }
    1049 }
    1050 else
    1051 {
    1052 SCIP_Bool infeasible;
    1053 SCIP_Bool fixed;
    1054
    1055 if( SCIPisFeasLT(scip, solvals[v], SCIPvarGetLbLocal(varcopy)) || SCIPisFeasGT(scip, solvals[v], SCIPvarGetUbLocal(varcopy)) )
    1056 {
    1057 SCIP_CALL( SCIPchgVarType(subscip, varcopy, SCIP_VARTYPE_CONTINUOUS, &infeasible) );
    1058 assert(!infeasible);
    1059 }
    1060
    1061 /* fix variable to its value in the solution */
    1062 SCIP_CALL( SCIPfixVar(subscip, varcopy, fixval, &infeasible, &fixed) );
    1063 assert(!infeasible);
    1064 }
    1065 }
    1066
    1067 SCIP_CALL( SCIPsolve(subscip) );
    1068
    1069 bestsol = SCIPgetBestSol(subscip);
    1070
    1071 if( bestsol != NULL )
    1072 {
    1073 /* change the stored solution values for variables fixed to infinite values */
    1074 for( v = 0; v < norigvars; ++v )
    1075 {
    1076 varcopy = (SCIP_VAR*) SCIPhashmapGetImage(varmap, (void*)origvars[v]);
    1077 assert(varcopy != NULL);
    1078
    1079 if( (SCIPisInfinity(scip, solvals[v]) || SCIPisInfinity(scip, -solvals[v])) )
    1080 {
    1081 solvals[v] = SCIPgetSolVal(subscip, bestsol, varcopy);
    1082 }
    1083 }
    1084 }
    1085 else
    1086 {
    1087 *success = FALSE;
    1088 }
    1089
    1090 SCIPhashmapFree(&varmap);
    1091
    1092 return SCIP_OKAY;
    1093}
    1094
    1095
    1096/** creates a copy of a primal solution, thereby replacing infinite fixings of variables by finite values;
    1097 * the copy is always defined in the original variable space;
    1098 * success indicates whether the objective value of the solution was changed by removing infinite values
    1099 *
    1100 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
    1101 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
    1102 *
    1103 * @pre This method can be called if SCIP is in one of the following stages:
    1104 * - \ref SCIP_STAGE_PROBLEM
    1105 * - \ref SCIP_STAGE_TRANSFORMING
    1106 * - \ref SCIP_STAGE_TRANSFORMED
    1107 * - \ref SCIP_STAGE_INITPRESOLVE
    1108 * - \ref SCIP_STAGE_PRESOLVING
    1109 * - \ref SCIP_STAGE_EXITPRESOLVE
    1110 * - \ref SCIP_STAGE_PRESOLVED
    1111 * - \ref SCIP_STAGE_INITSOLVE
    1112 * - \ref SCIP_STAGE_SOLVING
    1113 * - \ref SCIP_STAGE_SOLVED
    1114 * - \ref SCIP_STAGE_EXITSOLVE
    1115 */
    1117 SCIP* scip, /**< SCIP data structure */
    1118 SCIP_SOL** sol, /**< pointer to store the solution */
    1119 SCIP_SOL* sourcesol, /**< primal CIP solution to copy */
    1120 SCIP_Bool* success /**< does the finite solution have the same objective value? */
    1121 )
    1122{
    1123 SCIP_VAR** fixedvars;
    1124 SCIP_VAR** origvars;
    1125 SCIP_Real* solvals;
    1126 SCIP_VAR* var;
    1127 int nfixedvars;
    1128 int norigvars;
    1129 int v;
    1130
    1131 SCIP_CALL( SCIPcheckStage(scip, "SCIPcreateFiniteSolCopy", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE) );
    1132
    1133 assert(scip != NULL);
    1134 assert(sol != NULL);
    1135 assert(sourcesol != NULL);
    1136 assert(success != NULL);
    1137
    1138 *success = TRUE;
    1139 *sol = NULL;
    1140
    1141 fixedvars = SCIPgetFixedVars(scip);
    1142 nfixedvars = SCIPgetNFixedVars(scip);
    1143 assert(fixedvars != NULL || nfixedvars == 0);
    1144
    1145 /* get original variables and their values in the optimal solution */
    1146 SCIP_CALL( SCIPgetOrigVarsData(scip, &origvars, &norigvars, NULL, NULL, NULL, NULL) );
    1147 SCIP_CALL( SCIPallocBufferArray(scip, &solvals, norigvars) );
    1148 SCIP_CALL( SCIPgetSolVals(scip, sourcesol, norigvars, origvars, solvals) );
    1149
    1150 /* check whether there are variables fixed to an infinite value */
    1151 for( v = 0; v < nfixedvars; ++v )
    1152 {
    1153 var = fixedvars[v]; /*lint !e613*/
    1154
    1155 /* skip (multi-)aggregated variables */
    1157 continue;
    1158
    1160
    1162 {
    1163 SCIPdebugMsg(scip, "var <%s> is fixed to infinite value %g\n", SCIPvarGetName(var), SCIPvarGetLbGlobal(var));
    1164 break;
    1165 }
    1166 }
    1167
    1168 /* there were variables fixed to infinite values */
    1169 if( v < nfixedvars )
    1170 {
    1171 SCIP* subscip;
    1172 SCIP_RETCODE retcode;
    1173
    1174 /* if one of the variables was fixed to infinity in the original problem, we stop here */
    1175 for( v = 0; v < norigvars; ++v )
    1176 {
    1177 var = origvars[v];
    1178
    1180 {
    1182
    1183 SCIPdebugMsg(scip, "--> var <%s> is fixed to infinite value %g in the original problem, stop making solution finite\n",
    1185
    1186 *success = FALSE;
    1187
    1188 goto TERMINATE;
    1189 }
    1190 }
    1191
    1192 /* create sub-SCIP */
    1193 SCIP_CALL( SCIPcreate(&subscip) );
    1194
    1195 retcode = setupAndSolveFiniteSolSubscip(scip, subscip, origvars, norigvars, solvals, success);
    1196
    1197 /* free sub-SCIP */
    1198 SCIP_CALL( SCIPfree(&subscip) );
    1199
    1200 SCIP_CALL( retcode );
    1201 }
    1202
    1203 /* create original solution and set the solution values */
    1204 if( *success )
    1205 {
    1207 for( v = 0; v < norigvars; ++v )
    1208 {
    1209 SCIP_CALL( SCIPsetSolVal(scip, *sol, origvars[v], solvals[v]) );
    1210 }
    1211 }
    1212
    1213#ifdef SCIP_DEBUG
    1214 SCIPdebugMsg(scip, "created finites solution copy:\n");
    1215 SCIP_CALL( SCIPprintSol(scip, *sol, NULL, FALSE) );
    1216#endif
    1217
    1218 /* the solution of the sub-SCIP should have the same objective value */
    1219 if( *success && !SCIPisEQ(scip, SCIPgetSolOrigObj(scip, *sol), SCIPgetSolOrigObj(scip, sourcesol)) )
    1220 {
    1221 /* @todo how should we avoid numerical trobles here for large objective values? */
    1222 if( (SCIPgetSolOrigObj(scip, *sol) / SCIPepsilon(scip)) < 1e+15 ||
    1223 REALABS(SCIPgetSolOrigObj(scip, *sol) - SCIPgetSolOrigObj(scip, sourcesol)) > 1e-12 * SCIPgetSolOrigObj(scip, *sol) )
    1224 *success = FALSE;
    1225 }
    1226
    1227 TERMINATE:
    1228 SCIPfreeBufferArray(scip, &solvals);
    1229
    1230 return SCIP_OKAY;
    1231}
    1232
    1233/** frees primal CIP solution
    1234 *
    1235 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
    1236 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
    1237 *
    1238 * @pre This method can be called if SCIP is in one of the following stages:
    1239 * - \ref SCIP_STAGE_PROBLEM
    1240 * - \ref SCIP_STAGE_TRANSFORMING
    1241 * - \ref SCIP_STAGE_TRANSFORMED
    1242 * - \ref SCIP_STAGE_INITPRESOLVE
    1243 * - \ref SCIP_STAGE_PRESOLVING
    1244 * - \ref SCIP_STAGE_EXITPRESOLVE
    1245 * - \ref SCIP_STAGE_PRESOLVED
    1246 * - \ref SCIP_STAGE_INITSOLVE
    1247 * - \ref SCIP_STAGE_SOLVING
    1248 * - \ref SCIP_STAGE_SOLVED
    1249 * - \ref SCIP_STAGE_EXITSOLVE
    1250 * - \ref SCIP_STAGE_FREETRANS
    1251 */
    1253 SCIP* scip, /**< SCIP data structure */
    1254 SCIP_SOL** sol /**< pointer to the solution */
    1255 )
    1256{
    1257 assert(sol != NULL);
    1258
    1260
    1261 switch( scip->set->stage )
    1262 {
    1263 case SCIP_STAGE_PROBLEM:
    1264 SCIP_CALL( SCIPsolFree(sol, scip->mem->probmem, scip->origprimal) );
    1265 break;
    1272 case SCIP_STAGE_SOLVING:
    1275 case SCIP_STAGE_SOLVED:
    1277 SCIP_CALL( SCIPsolFree(sol, scip->mem->probmem, scip->primal) );
    1278 break;
    1279 default:
    1280 SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
    1281 return SCIP_INVALIDCALL;
    1282 } /*lint !e788*/
    1283
    1284 return SCIP_OKAY;
    1285}
    1286
    1287/** links a primal solution to the current LP solution
    1288 *
    1289 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
    1290 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
    1291 *
    1292 * @pre This method can be called if SCIP is in one of the following stages:
    1293 * - \ref SCIP_STAGE_SOLVING
    1294 */
    1296 SCIP* scip, /**< SCIP data structure */
    1297 SCIP_SOL* sol /**< primal solution */
    1298 )
    1299{
    1300 assert(sol != NULL);
    1301 assert(sol->scip == scip);
    1302
    1304
    1305 if( !SCIPlpIsSolved(scip->lp) )
    1306 {
    1307 SCIPerrorMessage("LP solution does not exist\n");
    1308 return SCIP_INVALIDCALL;
    1309 }
    1310
    1311 SCIP_CALL( SCIPsolLinkLPSol(sol, scip->set, scip->stat, scip->transprob, scip->tree, scip->lp) );
    1312
    1313 return SCIP_OKAY;
    1314}
    1315
    1316/** links a primal solution to the current exact LP solution
    1317 *
    1318 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
    1319 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
    1320 *
    1321 * @pre This method can be called if SCIP is in one of the following stages:
    1322 * - \ref SCIP_STAGE_SOLVING
    1323 */
    1325 SCIP* scip, /**< SCIP data structure */
    1326 SCIP_SOL* sol /**< primal solution */
    1327 )
    1328{
    1329 assert(sol != NULL);
    1330 assert(sol->scip == scip);
    1331
    1333
    1335 {
    1336 SCIPerrorMessage("Exact LP solution does not exist\n");
    1337 return SCIP_INVALIDCALL;
    1338 }
    1339
    1340 SCIP_CALL( SCIPsolLinkLPSolExact(sol, scip->set, scip->lpexact) );
    1341
    1342 return SCIP_OKAY;
    1343}
    1344
    1345/** links a primal solution to the current NLP solution
    1346 *
    1347 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
    1348 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
    1349 *
    1350 * @pre This method can be called if SCIP is in one of the following stages:
    1351 * - \ref SCIP_STAGE_SOLVING
    1352 */
    1354 SCIP* scip, /**< SCIP data structure */
    1355 SCIP_SOL* sol /**< primal solution */
    1356 )
    1357{
    1358 assert(sol != NULL);
    1359 assert(sol->scip == scip);
    1360
    1362
    1363 if( scip->nlp == NULL )
    1364 {
    1365 SCIPerrorMessage("NLP does not exist\n");
    1366 return SCIP_INVALIDCALL;
    1367 }
    1368
    1370 {
    1371 SCIPerrorMessage("NLP solution does not exist\n");
    1372 return SCIP_INVALIDCALL;
    1373 }
    1374
    1375 SCIP_CALL( SCIPsolLinkNLPSol(sol, scip->stat, scip->tree, scip->nlp) );
    1376
    1377 return SCIP_OKAY;
    1378}
    1379
    1380/** links a primal solution to the current relaxation solution
    1381 *
    1382 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
    1383 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
    1384 *
    1385 * @pre This method can be called if SCIP is in one of the following stages:
    1386 * - \ref SCIP_STAGE_SOLVING
    1387 */
    1389 SCIP* scip, /**< SCIP data structure */
    1390 SCIP_SOL* sol /**< primal solution */
    1391 )
    1392{
    1393 assert(sol != NULL);
    1394 assert(sol->scip == scip);
    1395
    1397
    1398 if( !SCIPrelaxationIsSolValid(scip->relaxation) )
    1399 {
    1400 SCIPerrorMessage("relaxation solution is not valid\n");
    1401 return SCIP_INVALIDCALL;
    1402 }
    1403
    1404 SCIP_CALL( SCIPsolLinkRelaxSol(sol, scip->set, scip->stat, scip->tree, scip->relaxation) );
    1405
    1406 return SCIP_OKAY;
    1407}
    1408
    1409/** links a primal solution to the current pseudo solution
    1410 *
    1411 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
    1412 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
    1413 *
    1414 * @pre This method can be called if SCIP is in one of the following stages:
    1415 * - \ref SCIP_STAGE_PRESOLVING
    1416 * - \ref SCIP_STAGE_SOLVING
    1417 */
    1419 SCIP* scip, /**< SCIP data structure */
    1420 SCIP_SOL* sol /**< primal solution */
    1421 )
    1422{
    1423 assert(sol != NULL);
    1424 assert(sol->scip == scip);
    1425
    1427
    1428 SCIP_CALL( SCIPsolLinkPseudoSol(sol, scip->set, scip->stat, scip->transprob, scip->tree, scip->lp) );
    1429
    1430 return SCIP_OKAY;
    1431}
    1432
    1433/** links a primal solution to the current LP or pseudo solution
    1434 *
    1435 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
    1436 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
    1437 *
    1438 * @pre This method can be called if SCIP is in one of the following stages:
    1439 * - \ref SCIP_STAGE_SOLVING
    1440 */
    1442 SCIP* scip, /**< SCIP data structure */
    1443 SCIP_SOL* sol /**< primal solution */
    1444 )
    1445{
    1446 assert(sol != NULL);
    1447 assert(sol->scip == scip);
    1448
    1450
    1451 SCIP_CALL( SCIPsolLinkCurrentSol(sol, scip->set, scip->stat, scip->transprob, scip->tree, scip->lp) );
    1452
    1453 return SCIP_OKAY;
    1454}
    1455
    1456/** clears a primal solution
    1457 *
    1458 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
    1459 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
    1460 *
    1461 * @pre This method can be called if SCIP is in one of the following stages:
    1462 * - \ref SCIP_STAGE_PROBLEM
    1463 * - \ref SCIP_STAGE_TRANSFORMING
    1464 * - \ref SCIP_STAGE_TRANSFORMED
    1465 * - \ref SCIP_STAGE_INITPRESOLVE
    1466 * - \ref SCIP_STAGE_PRESOLVING
    1467 * - \ref SCIP_STAGE_EXITPRESOLVE
    1468 * - \ref SCIP_STAGE_PRESOLVED
    1469 * - \ref SCIP_STAGE_INITSOLVE
    1470 * - \ref SCIP_STAGE_SOLVING
    1471 * - \ref SCIP_STAGE_SOLVED
    1472 * - \ref SCIP_STAGE_EXITSOLVE
    1473 * - \ref SCIP_STAGE_FREETRANS
    1474 */
    1476 SCIP* scip, /**< SCIP data structure */
    1477 SCIP_SOL* sol /**< primal solution */
    1478 )
    1479{
    1480 assert(sol != NULL);
    1481 assert(sol->scip == scip);
    1482
    1483 SCIP_CALL( SCIPcheckStage(scip, "SCIPclearSol", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
    1484
    1485 SCIP_CALL( SCIPsolClear(sol, scip->stat, scip->tree) );
    1486
    1487 return SCIP_OKAY;
    1488}
    1489
    1490/** stores solution values of variables in solution's own array
    1491 *
    1492 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
    1493 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
    1494 *
    1495 * @pre This method can be called if SCIP is in one of the following stages:
    1496 * - \ref SCIP_STAGE_TRANSFORMING
    1497 * - \ref SCIP_STAGE_TRANSFORMED
    1498 * - \ref SCIP_STAGE_PRESOLVING
    1499 * - \ref SCIP_STAGE_PRESOLVED
    1500 * - \ref SCIP_STAGE_INITSOLVE
    1501 * - \ref SCIP_STAGE_SOLVING
    1502 * - \ref SCIP_STAGE_SOLVED
    1503 * - \ref SCIP_STAGE_EXITSOLVE
    1504 * - \ref SCIP_STAGE_FREETRANS
    1505 */
    1507 SCIP* scip, /**< SCIP data structure */
    1508 SCIP_SOL* sol /**< primal solution */
    1509 )
    1510{
    1511 assert(sol != NULL);
    1512 assert(sol->scip == scip);
    1513
    1515
    1516 SCIP_CALL( SCIPsolUnlink(sol, scip->set, scip->transprob) );
    1517
    1518 return SCIP_OKAY;
    1519}
    1520
    1521/** stores exact solution values of variables in solution's own array
    1522 *
    1523 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
    1524 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
    1525 *
    1526 * @pre This method can be called if SCIP is in one of the following stages:
    1527 * - \ref SCIP_STAGE_TRANSFORMING
    1528 * - \ref SCIP_STAGE_TRANSFORMED
    1529 * - \ref SCIP_STAGE_PRESOLVING
    1530 * - \ref SCIP_STAGE_PRESOLVED
    1531 * - \ref SCIP_STAGE_INITSOLVE
    1532 * - \ref SCIP_STAGE_SOLVING
    1533 * - \ref SCIP_STAGE_SOLVED
    1534 * - \ref SCIP_STAGE_EXITSOLVE
    1535 * - \ref SCIP_STAGE_FREETRANS
    1536 */
    1538 SCIP* scip, /**< SCIP data structure */
    1539 SCIP_SOL* sol /**< primal solution */
    1540 )
    1541{
    1542 assert(sol != NULL);
    1543 assert(sol->scip == scip);
    1544
    1545 SCIP_CALL( SCIPcheckStage(scip, "SCIPunlinkSolExact", FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
    1546
    1547 SCIP_CALL( SCIPsolUnlinkExact(sol, scip->set, scip->transprob) );
    1548
    1549 return SCIP_OKAY;
    1550}
    1551
    1552/** sets value of variable in primal CIP solution
    1553 *
    1554 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
    1555 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
    1556 *
    1557 * @pre This method can be called if SCIP is in one of the following stages:
    1558 * - \ref SCIP_STAGE_PROBLEM
    1559 * - \ref SCIP_STAGE_TRANSFORMING
    1560 * - \ref SCIP_STAGE_TRANSFORMED
    1561 * - \ref SCIP_STAGE_INITPRESOLVE
    1562 * - \ref SCIP_STAGE_PRESOLVING
    1563 * - \ref SCIP_STAGE_EXITPRESOLVE
    1564 * - \ref SCIP_STAGE_PRESOLVED
    1565 * - \ref SCIP_STAGE_INITSOLVE
    1566 * - \ref SCIP_STAGE_SOLVING
    1567 * - \ref SCIP_STAGE_SOLVED
    1568 * - \ref SCIP_STAGE_EXITSOLVE
    1569 * - \ref SCIP_STAGE_FREETRANS
    1570 */
    1572 SCIP* scip, /**< SCIP data structure */
    1573 SCIP_SOL* sol, /**< primal solution */
    1574 SCIP_VAR* var, /**< variable to add to solution */
    1575 SCIP_Real val /**< solution value of variable */
    1576 )
    1577{
    1578 SCIP_CALL( SCIPcheckStage(scip, "SCIPsetSolVal", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
    1579
    1580 assert(var != NULL);
    1581 assert(var->scip == scip);
    1582 assert(sol != NULL);
    1583 assert(sol->scip == scip);
    1584
    1585 if( SCIPsolIsOriginal(sol) && SCIPvarIsTransformed(var) )
    1586 {
    1587 SCIPerrorMessage("cannot set value of transformed variable <%s> in original space solution\n",
    1588 SCIPvarGetName(var));
    1589 return SCIP_INVALIDCALL;
    1590 }
    1591
    1592 SCIP_CALL( SCIPsolSetVal(sol, scip->set, scip->stat, scip->tree, var, val) );
    1593
    1594 return SCIP_OKAY;
    1595}
    1596
    1597/** sets exact value of variable in primal CIP solution
    1598 *
    1599 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
    1600 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
    1601 *
    1602 * @pre This method can be called if SCIP is in one of the following stages:
    1603 * - \ref SCIP_STAGE_PROBLEM
    1604 * - \ref SCIP_STAGE_TRANSFORMING
    1605 * - \ref SCIP_STAGE_TRANSFORMED
    1606 * - \ref SCIP_STAGE_INITPRESOLVE
    1607 * - \ref SCIP_STAGE_PRESOLVING
    1608 * - \ref SCIP_STAGE_EXITPRESOLVE
    1609 * - \ref SCIP_STAGE_PRESOLVED
    1610 * - \ref SCIP_STAGE_INITSOLVE
    1611 * - \ref SCIP_STAGE_SOLVING
    1612 * - \ref SCIP_STAGE_SOLVED
    1613 * - \ref SCIP_STAGE_EXITSOLVE
    1614 * - \ref SCIP_STAGE_FREETRANS
    1615 */
    1617 SCIP* scip, /**< SCIP data structure */
    1618 SCIP_SOL* sol, /**< primal solution */
    1619 SCIP_VAR* var, /**< variable to add to solution */
    1620 SCIP_RATIONAL* val /**< solution value of variable */
    1621 )
    1622{
    1623 SCIP_CALL( SCIPcheckStage(scip, "SCIPsetSolValExact", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
    1624
    1625 assert(var != NULL);
    1626 assert(var->scip == scip);
    1627 assert(sol != NULL);
    1628 assert(sol->scip == scip);
    1629 assert(SCIPsolIsExact(sol));
    1630
    1631 if( SCIPsolIsOriginal(sol) && SCIPvarIsTransformed(var) )
    1632 {
    1633 SCIPerrorMessage("cannot set value of transformed variable <%s> in original space solution\n",
    1634 SCIPvarGetName(var));
    1635 return SCIP_INVALIDCALL;
    1636 }
    1637
    1638 SCIP_CALL( SCIPsolSetValExact(sol, scip->set, scip->stat, scip->tree, var, val) );
    1639
    1640 return SCIP_OKAY;
    1641}
    1642
    1643/** sets values of multiple variables in primal CIP solution
    1644 *
    1645 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
    1646 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
    1647 *
    1648 * @pre This method can be called if SCIP is in one of the following stages:
    1649 * - \ref SCIP_STAGE_PROBLEM
    1650 * - \ref SCIP_STAGE_TRANSFORMING
    1651 * - \ref SCIP_STAGE_TRANSFORMED
    1652 * - \ref SCIP_STAGE_INITPRESOLVE
    1653 * - \ref SCIP_STAGE_PRESOLVING
    1654 * - \ref SCIP_STAGE_EXITPRESOLVE
    1655 * - \ref SCIP_STAGE_PRESOLVED
    1656 * - \ref SCIP_STAGE_INITSOLVE
    1657 * - \ref SCIP_STAGE_SOLVING
    1658 * - \ref SCIP_STAGE_SOLVED
    1659 * - \ref SCIP_STAGE_EXITSOLVE
    1660 * - \ref SCIP_STAGE_FREETRANS
    1661 */
    1663 SCIP* scip, /**< SCIP data structure */
    1664 SCIP_SOL* sol, /**< primal solution */
    1665 int nvars, /**< number of variables to set solution value for */
    1666 SCIP_VAR** vars, /**< array with variables to add to solution */
    1667 SCIP_Real* vals /**< array with solution values of variables */
    1668 )
    1669{
    1670 int v;
    1671
    1672 assert(sol != NULL);
    1673 assert(sol->scip == scip);
    1674 assert(nvars == 0 || vars != NULL);
    1675 assert(nvars == 0 || vals != NULL);
    1676
    1677 SCIP_CALL( SCIPcheckStage(scip, "SCIPsetSolVals", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
    1678
    1679 if( SCIPsolIsOriginal(sol) )
    1680 {
    1681 for( v = 0; v < nvars; ++v )
    1682 {
    1683 if( SCIPvarIsTransformed(vars[v]) )
    1684 {
    1685 SCIPerrorMessage("cannot set value of transformed variable <%s> in original space solution\n",
    1686 SCIPvarGetName(vars[v]));
    1687 return SCIP_INVALIDCALL;
    1688 }
    1689 }
    1690 }
    1691
    1692 for( v = 0; v < nvars; ++v )
    1693 {
    1694 SCIP_CALL( SCIPsolSetVal(sol, scip->set, scip->stat, scip->tree, vars[v], vals[v]) );
    1695 }
    1696
    1697 return SCIP_OKAY;
    1698}
    1699
    1700/** increases value of variable in primal CIP solution
    1701 *
    1702 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
    1703 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
    1704 *
    1705 * @pre This method can be called if SCIP is in one of the following stages:
    1706 * - \ref SCIP_STAGE_PROBLEM
    1707 * - \ref SCIP_STAGE_TRANSFORMING
    1708 * - \ref SCIP_STAGE_TRANSFORMED
    1709 * - \ref SCIP_STAGE_INITPRESOLVE
    1710 * - \ref SCIP_STAGE_PRESOLVING
    1711 * - \ref SCIP_STAGE_EXITPRESOLVE
    1712 * - \ref SCIP_STAGE_PRESOLVED
    1713 * - \ref SCIP_STAGE_INITSOLVE
    1714 * - \ref SCIP_STAGE_SOLVING
    1715 * - \ref SCIP_STAGE_SOLVED
    1716 * - \ref SCIP_STAGE_EXITSOLVE
    1717 * - \ref SCIP_STAGE_FREETRANS
    1718 */
    1720 SCIP* scip, /**< SCIP data structure */
    1721 SCIP_SOL* sol, /**< primal solution */
    1722 SCIP_VAR* var, /**< variable to increase solution value for */
    1723 SCIP_Real incval /**< increment for solution value of variable */
    1724 )
    1725{
    1726 SCIP_CALL( SCIPcheckStage(scip, "SCIPincSolVal", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
    1727
    1728 assert(var != NULL);
    1729 assert(var->scip == scip);
    1730 assert(sol != NULL);
    1731 assert(sol->scip == scip);
    1732
    1733 if( SCIPsolIsOriginal(sol) && SCIPvarIsTransformed(var) )
    1734 {
    1735 SCIPerrorMessage("cannot increase value of transformed variable <%s> in original space solution\n",
    1736 SCIPvarGetName(var));
    1737 return SCIP_INVALIDCALL;
    1738 }
    1739
    1740 SCIP_CALL( SCIPsolIncVal(sol, scip->set, scip->stat, scip->tree, var, incval) );
    1741
    1742 return SCIP_OKAY;
    1743}
    1744
    1745/** returns value of variable in primal CIP solution, or in current LP/pseudo solution
    1746 *
    1747 * @return value of variable in primal CIP solution, or in current LP/pseudo solution
    1748 *
    1749 * @pre In case the solution pointer @p sol is @b NULL, that means it is asked for the LP or pseudo solution, this method
    1750 * can only be called if @p scip is in the solving stage \ref SCIP_STAGE_SOLVING. In any other case, this method
    1751 * can be called if @p scip is in one of the following stages:
    1752 * - \ref SCIP_STAGE_PROBLEM
    1753 * - \ref SCIP_STAGE_TRANSFORMING
    1754 * - \ref SCIP_STAGE_TRANSFORMED
    1755 * - \ref SCIP_STAGE_INITPRESOLVE
    1756 * - \ref SCIP_STAGE_PRESOLVING
    1757 * - \ref SCIP_STAGE_EXITPRESOLVE
    1758 * - \ref SCIP_STAGE_PRESOLVED
    1759 * - \ref SCIP_STAGE_INITSOLVE
    1760 * - \ref SCIP_STAGE_SOLVING
    1761 * - \ref SCIP_STAGE_SOLVED
    1762 * - \ref SCIP_STAGE_EXITSOLVE
    1763 * - \ref SCIP_STAGE_FREETRANS
    1764 */
    1766 SCIP* scip, /**< SCIP data structure */
    1767 SCIP_SOL* sol, /**< primal solution, or NULL for current LP/pseudo solution */
    1768 SCIP_VAR* var /**< variable to get value for */
    1769 )
    1770{
    1772
    1773 assert(var != NULL);
    1774 assert(var->scip == scip);
    1775 assert(sol == NULL || sol->scip == scip);
    1776
    1777 if( sol != NULL )
    1778 return SCIPsolGetVal(sol, scip->set, scip->stat, var);
    1779
    1780 SCIP_CALL_ABORT( SCIPcheckStage(scip, "SCIPgetSolVal(sol==NULL)", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
    1781
    1782 return SCIPvarGetSol(var, SCIPtreeHasCurrentNodeLP(scip->tree));
    1783}
    1784
    1785/** gets value of variable in exact primal CIP solution, or in current LP/pseudo solution
    1786 *
    1787 * @pre In case the solution pointer @p sol is @b NULL, that means it is asked for the LP or pseudo solution, this method
    1788 * can only be called if @p scip is in the solving stage \ref SCIP_STAGE_SOLVING. In any other case, this method
    1789 * can be called if @p scip is in one of the following stages:
    1790 * - \ref SCIP_STAGE_PROBLEM
    1791 * - \ref SCIP_STAGE_TRANSFORMING
    1792 * - \ref SCIP_STAGE_TRANSFORMED
    1793 * - \ref SCIP_STAGE_INITPRESOLVE
    1794 * - \ref SCIP_STAGE_PRESOLVING
    1795 * - \ref SCIP_STAGE_EXITPRESOLVE
    1796 * - \ref SCIP_STAGE_PRESOLVED
    1797 * - \ref SCIP_STAGE_INITSOLVE
    1798 * - \ref SCIP_STAGE_SOLVING
    1799 * - \ref SCIP_STAGE_SOLVED
    1800 * - \ref SCIP_STAGE_EXITSOLVE
    1801 * - \ref SCIP_STAGE_FREETRANS
    1802 */
    1804 SCIP* scip, /**< SCIP data structure */
    1805 SCIP_SOL* sol, /**< primal solution, or NULL for current LP/pseudo solution */
    1806 SCIP_VAR* var, /**< variable to get value for */
    1807 SCIP_RATIONAL* res /**< resulting rational */
    1808 )
    1809{
    1810 SCIP_CALL_ABORT( SCIPcheckStage(scip, "SCIPgetSolValExact", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
    1811
    1812 assert( var->scip == scip );
    1813 assert(sol == NULL || sol->scip == scip);
    1814
    1815 if( sol != NULL )
    1816 {
    1817 SCIPsolGetValExact(res, sol, scip->set, scip->stat, var);
    1818 }
    1819 else
    1820 {
    1821 SCIP_CALL_ABORT( SCIPcheckStage(scip, "SCIPgetSolValExact(sol==NULL)", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
    1822
    1824 }
    1825}
    1826
    1827/** gets values of multiple variables in primal CIP solution
    1828 *
    1829 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
    1830 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
    1831 *
    1832 * @pre This method can be called if SCIP is in one of the following stages:
    1833 * - \ref SCIP_STAGE_PROBLEM
    1834 * - \ref SCIP_STAGE_TRANSFORMING
    1835 * - \ref SCIP_STAGE_TRANSFORMED
    1836 * - \ref SCIP_STAGE_INITPRESOLVE
    1837 * - \ref SCIP_STAGE_PRESOLVING
    1838 * - \ref SCIP_STAGE_EXITPRESOLVE
    1839 * - \ref SCIP_STAGE_PRESOLVED
    1840 * - \ref SCIP_STAGE_INITSOLVE
    1841 * - \ref SCIP_STAGE_SOLVING
    1842 * - \ref SCIP_STAGE_SOLVED
    1843 * - \ref SCIP_STAGE_EXITSOLVE
    1844 * - \ref SCIP_STAGE_FREETRANS
    1845 */
    1847 SCIP* scip, /**< SCIP data structure */
    1848 SCIP_SOL* sol, /**< primal solution, or NULL for current LP/pseudo solution */
    1849 int nvars, /**< number of variables to get solution value for */
    1850 SCIP_VAR** vars, /**< array with variables to get value for */
    1851 SCIP_Real* vals /**< array to store solution values of variables */
    1852 )
    1853{
    1854 assert(nvars == 0 || vars != NULL);
    1855 assert(nvars == 0 || vals != NULL);
    1856
    1857 SCIP_CALL( SCIPcheckStage(scip, "SCIPgetSolVals", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
    1858
    1859 if( sol != NULL )
    1860 {
    1861 int v;
    1862
    1863 for( v = 0; v < nvars; ++v )
    1864 vals[v] = SCIPsolGetVal(sol, scip->set, scip->stat, vars[v]);
    1865 }
    1866 else
    1867 {
    1868 SCIP_CALL( SCIPgetVarSols(scip, nvars, vars, vals) );
    1869 }
    1870
    1871 return SCIP_OKAY;
    1872}
    1873
    1874/** returns objective value of primal CIP solution w.r.t. original problem, or current LP/pseudo objective value
    1875 *
    1876 * @return objective value of primal CIP solution w.r.t. original problem, or current LP/pseudo objective value
    1877 *
    1878 * @pre This method can be called if SCIP is in one of the following stages:
    1879 * - \ref SCIP_STAGE_PROBLEM
    1880 * - \ref SCIP_STAGE_TRANSFORMING
    1881 * - \ref SCIP_STAGE_TRANSFORMED
    1882 * - \ref SCIP_STAGE_INITPRESOLVE
    1883 * - \ref SCIP_STAGE_PRESOLVING
    1884 * - \ref SCIP_STAGE_EXITPRESOLVE
    1885 * - \ref SCIP_STAGE_PRESOLVED
    1886 * - \ref SCIP_STAGE_INITSOLVE
    1887 * - \ref SCIP_STAGE_SOLVING
    1888 * - \ref SCIP_STAGE_SOLVED
    1889 * - \ref SCIP_STAGE_EXITSOLVE
    1890 * - \ref SCIP_STAGE_FREETRANS
    1891 */
    1893 SCIP* scip, /**< SCIP data structure */
    1894 SCIP_SOL* sol /**< primal solution, or NULL for current LP/pseudo objective value */
    1895 )
    1896{
    1897 assert(sol == NULL || sol->scip == scip);
    1898
    1899 /* for original solutions, an original objective value is already available in SCIP_STAGE_PROBLEM
    1900 * for all other solutions, we should be at least in SCIP_STAGE_TRANSFORMING
    1901 */
    1902 if( sol != NULL && SCIPsolIsOriginal(sol) )
    1903 {
    1904 SCIP_CALL_ABORT( SCIPcheckStage(scip, "SCIPgetSolOrigObj", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
    1905
    1906 return SCIPsolGetOrigObj(sol);
    1907 }
    1908
    1909 SCIP_CALL_ABORT( SCIPcheckStage(scip, "SCIPgetSolOrigObj", FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
    1910
    1911 if( sol != NULL )
    1912 return SCIPprobExternObjval(scip->transprob, scip->origprob, scip->set, SCIPsolGetObj(sol, scip->set, scip->transprob, scip->origprob));
    1913 else
    1914 {
    1915 SCIP_CALL_ABORT( SCIPcheckStage(scip, "SCIPgetSolOrigObj(sol==NULL)", \
    1917 if( SCIPtreeHasCurrentNodeLP(scip->tree) )
    1918 return SCIPprobExternObjval(scip->transprob, scip->origprob, scip->set, SCIPlpGetObjval(scip->lp, scip->set, scip->transprob));
    1919 else
    1920 return SCIPprobExternObjval(scip->transprob, scip->origprob, scip->set, SCIPlpGetPseudoObjval(scip->lp, scip->set, scip->transprob));
    1921 }
    1922}
    1923
    1924/** gets exact objective value of primal CIP solution w.r.t. original problem, or current LP/pseudo objective value
    1925 *
    1926 * @pre This method can be called if SCIP is in one of the following stages:
    1927 * - \ref SCIP_STAGE_PROBLEM
    1928 * - \ref SCIP_STAGE_TRANSFORMING
    1929 * - \ref SCIP_STAGE_TRANSFORMED
    1930 * - \ref SCIP_STAGE_INITPRESOLVE
    1931 * - \ref SCIP_STAGE_PRESOLVING
    1932 * - \ref SCIP_STAGE_EXITPRESOLVE
    1933 * - \ref SCIP_STAGE_PRESOLVED
    1934 * - \ref SCIP_STAGE_INITSOLVE
    1935 * - \ref SCIP_STAGE_SOLVING
    1936 * - \ref SCIP_STAGE_SOLVED
    1937 * - \ref SCIP_STAGE_EXITSOLVE
    1938 * - \ref SCIP_STAGE_FREETRANS
    1939 */
    1941 SCIP* scip, /**< SCIP data structure */
    1942 SCIP_SOL* sol, /**< primal solution, or NULL for current LP/pseudo objective value */
    1943 SCIP_RATIONAL* res /**< result pointer to store rational */
    1944 )
    1945{
    1946 SCIP_RATIONAL* tmp;
    1947
    1948 assert(sol == NULL || sol->scip == scip);
    1949 assert(SCIPsolIsExact(sol));
    1950
    1951 /* for original solutions, an original objective value is already available in SCIP_STAGE_PROBLEM
    1952 * for all other solutions, we should be at least in SCIP_STAGE_TRANSFORMING
    1953 */
    1954 if( sol != NULL && SCIPsolIsOriginal(sol) )
    1955 {
    1956 SCIP_CALL_ABORT( SCIPcheckStage(scip, "SCIPgetSolOrigObjExact", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
    1957
    1959 return;
    1960 }
    1961
    1962 SCIP_CALL_ABORT( SCIPcheckStage(scip, "SCIPgetSolOrigObjExact", FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
    1963
    1965 if( sol != NULL )
    1966 {
    1967 SCIPsolGetObjExact(sol, scip->set, scip->transprob, scip->origprob, tmp);
    1968 SCIPprobExternObjvalExact(scip->transprob, scip->origprob, scip->set, tmp, res);
    1969 }
    1970 else
    1971 {
    1972 SCIP_CALL_ABORT( SCIPcheckStage(scip, "SCIPgetSolOrigObjExact(sol==NULL)", \
    1974 if( SCIPtreeHasCurrentNodeLP(scip->tree) )
    1975 {
    1976 SCIPlpExactGetObjval(scip->lpexact, scip->set, tmp);
    1977 SCIPprobExternObjvalExact(scip->transprob, scip->origprob, scip->set, tmp, res);
    1978 }
    1979 else
    1980 {
    1981 SCIPlpExactGetPseudoObjval(scip->lpexact, scip->set, tmp);
    1982 SCIPprobExternObjvalExact(scip->transprob, scip->origprob, scip->set, tmp, res);
    1983 }
    1984 }
    1986}
    1987
    1988/** returns transformed objective value of primal CIP solution, or transformed current LP/pseudo objective value
    1989 *
    1990 * @return transformed objective value of primal CIP solution, or transformed current LP/pseudo objective value
    1991 *
    1992 * @pre This method can be called if SCIP is in one of the following stages:
    1993 * - \ref SCIP_STAGE_TRANSFORMING
    1994 * - \ref SCIP_STAGE_TRANSFORMED
    1995 * - \ref SCIP_STAGE_INITPRESOLVE
    1996 * - \ref SCIP_STAGE_PRESOLVING
    1997 * - \ref SCIP_STAGE_EXITPRESOLVE
    1998 * - \ref SCIP_STAGE_PRESOLVED
    1999 * - \ref SCIP_STAGE_INITSOLVE
    2000 * - \ref SCIP_STAGE_SOLVING
    2001 * - \ref SCIP_STAGE_SOLVED
    2002 * - \ref SCIP_STAGE_EXITSOLVE
    2003 * - \ref SCIP_STAGE_FREETRANS
    2004 */
    2006 SCIP* scip, /**< SCIP data structure */
    2007 SCIP_SOL* sol /**< primal solution, or NULL for current LP/pseudo objective value */
    2008 )
    2009{
    2010 SCIP_CALL_ABORT( SCIPcheckStage(scip, "SCIPgetSolTransObj", FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
    2011
    2012 assert(sol == NULL || sol->scip == scip);
    2013
    2014 if( sol != NULL )
    2015 return SCIPsolGetObj(sol, scip->set, scip->transprob, scip->origprob);
    2016 else
    2017 {
    2018 SCIP_CALL_ABORT( SCIPcheckStage(scip, "SCIPgetSolTransObj(sol==NULL)", \
    2020 if( SCIPtreeHasCurrentNodeLP(scip->tree) )
    2021 return SCIPlpGetObjval(scip->lp, scip->set, scip->transprob);
    2022 else
    2023 return SCIPlpGetPseudoObjval(scip->lp, scip->set, scip->transprob);
    2024 }
    2025}
    2026
    2027/** gets exact transformed objective value of primal CIP solution, or transformed current exact LP/pseudo objective value
    2028 *
    2029 * @pre This method can be called if SCIP is in one of the following stages:
    2030 * - \ref SCIP_STAGE _TRANSFORMING
    2031 * - \ref SCIP_STAGE_TRANSFORMED
    2032 * - \ref SCIP_STAGE_INITPRESOLVE
    2033 * - \ref SCIP_STAGE_PRESOLVING
    2034 * - \ref SCIP_STAGE_EXITPRESOLVE
    2035 * - \ref SCIP_STAGE_PRESOLVED
    2036 * - \ref SCIP_STAGE_INITSOLVE
    2037 * - \ref SCIP_STAGE_SOLVING
    2038 * - \ref SCIP_STAGE_SOLVED
    2039 * - \ref SCIP_STAGE_EXITSOLVE
    2040 * - \ref SCIP_STAGE_FREETRANS
    2041 */
    2043 SCIP* scip, /**< SCIP data structure */
    2044 SCIP_SOL* sol, /**< primal solution, or NULL for current LP/pseudo objective value */
    2045 SCIP_RATIONAL* res /**< result pointer to store rational */
    2046 )
    2047{
    2048 SCIP_CALL_ABORT( SCIPcheckStage(scip, "SCIPgetSolTransObjExact", FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
    2049
    2050 assert(sol == NULL || sol->scip == scip);
    2051
    2052 if( sol != NULL )
    2053 SCIPsolGetObjExact(sol, scip->set, scip->transprob, scip->origprob, res);
    2054 else
    2055 {
    2056 SCIP_CALL_ABORT( SCIPcheckStage(scip, "SCIPgetSolTransObjExact(sol==NULL)", \
    2058 if( SCIPtreeHasCurrentNodeLP(scip->tree) )
    2059 SCIPlpExactGetObjval(scip->lpexact, scip->set, res);
    2060 else
    2061 SCIPlpExactGetPseudoObjval(scip->lpexact, scip->set, res);
    2062 }
    2063}
    2064
    2065/** recomputes the objective value of an original solution, e.g., when transferring solutions
    2066 * from the solution pool (objective coefficients might have changed in the meantime)
    2067 *
    2068 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
    2069 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
    2070 *
    2071 * @pre This method can be called if SCIP is in one of the following stages:
    2072 * - \ref SCIP_STAGE_TRANSFORMED
    2073 * - \ref SCIP_STAGE_PRESOLVING
    2074 * - \ref SCIP_STAGE_SOLVING
    2075 *
    2076 */
    2078 SCIP* scip,
    2079 SCIP_SOL* sol
    2080 )
    2081{
    2082 assert(scip != NULL);
    2083 assert(sol != NULL);
    2084 assert(sol->scip == scip);
    2085
    2086 SCIP_CALL( SCIPcheckStage(scip, "SCIPrecomputeSolObj", FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
    2087
    2088 if( SCIPsolIsExact(sol) )
    2089 SCIPsolRecomputeInternObjExact(sol, scip->set, scip->stat, scip->origprob);
    2090 else
    2091 SCIPsolRecomputeObj(sol, scip->set, scip->stat, scip->origprob);
    2092
    2093 return SCIP_OKAY;
    2094}
    2095
    2096/** maps original space objective value into transformed objective value
    2097 *
    2098 * @return transformed objective value
    2099 *
    2100 * @pre This method can be called if SCIP is in one of the following stages:
    2101 * - \ref SCIP_STAGE_TRANSFORMING
    2102 * - \ref SCIP_STAGE_TRANSFORMED
    2103 * - \ref SCIP_STAGE_INITPRESOLVE
    2104 * - \ref SCIP_STAGE_PRESOLVING
    2105 * - \ref SCIP_STAGE_EXITPRESOLVE
    2106 * - \ref SCIP_STAGE_PRESOLVED
    2107 * - \ref SCIP_STAGE_INITSOLVE
    2108 * - \ref SCIP_STAGE_SOLVING
    2109 * - \ref SCIP_STAGE_SOLVED
    2110 */
    2112 SCIP* scip, /**< SCIP data structure */
    2113 SCIP_Real obj /**< original space objective value to transform */
    2114 )
    2115{
    2117
    2118 return SCIPprobInternObjval(scip->transprob, scip->origprob, scip->set, obj);
    2119}
    2120
    2121/** maps transformed objective value into original space
    2122 *
    2123 * @return objective value into original space
    2124 *
    2125 * @pre This method can be called if SCIP is in one of the following stages:
    2126 * - \ref SCIP_STAGE_TRANSFORMING
    2127 * - \ref SCIP_STAGE_TRANSFORMED
    2128 * - \ref SCIP_STAGE_INITPRESOLVE
    2129 * - \ref SCIP_STAGE_PRESOLVING
    2130 * - \ref SCIP_STAGE_EXITPRESOLVE
    2131 * - \ref SCIP_STAGE_PRESOLVED
    2132 * - \ref SCIP_STAGE_INITSOLVE
    2133 * - \ref SCIP_STAGE_SOLVING
    2134 * - \ref SCIP_STAGE_SOLVED
    2135 */
    2137 SCIP* scip, /**< SCIP data structure */
    2138 SCIP_Real obj /**< transformed objective value to retransform in original space */
    2139 )
    2140{
    2141 SCIP_CALL_ABORT( SCIPcheckStage(scip, "SCIPretransformObj", FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
    2142
    2143 return SCIPprobExternObjval(scip->transprob, scip->origprob, scip->set, obj);
    2144}
    2145
    2146/** gets clock time, when this solution was found
    2147 *
    2148 * @return clock time, when this solution was found
    2149 *
    2150 * @pre This method can be called if SCIP is in one of the following stages:
    2151 * - \ref SCIP_STAGE_TRANSFORMING
    2152 * - \ref SCIP_STAGE_TRANSFORMED
    2153 * - \ref SCIP_STAGE_INITPRESOLVE
    2154 * - \ref SCIP_STAGE_PRESOLVING
    2155 * - \ref SCIP_STAGE_EXITPRESOLVE
    2156 * - \ref SCIP_STAGE_PRESOLVED
    2157 * - \ref SCIP_STAGE_INITSOLVE
    2158 * - \ref SCIP_STAGE_SOLVING
    2159 * - \ref SCIP_STAGE_SOLVED
    2160 * - \ref SCIP_STAGE_EXITSOLVE
    2161 * - \ref SCIP_STAGE_FREETRANS
    2162 */
    2164 SCIP* scip, /**< SCIP data structure */
    2165 SCIP_SOL* sol /**< primal solution */
    2166 )
    2167{
    2169
    2170 assert(sol != NULL);
    2171 assert(sol->scip == scip);
    2172
    2173 return SCIPsolGetTime(sol);
    2174}
    2175
    2176/** gets branch and bound run number, where this solution was found
    2177 *
    2178 * @return branch and bound run number, where this solution was found
    2179 *
    2180 * @pre This method can be called if SCIP is in one of the following stages:
    2181 * - \ref SCIP_STAGE_TRANSFORMING
    2182 * - \ref SCIP_STAGE_TRANSFORMED
    2183 * - \ref SCIP_STAGE_INITPRESOLVE
    2184 * - \ref SCIP_STAGE_PRESOLVING
    2185 * - \ref SCIP_STAGE_EXITPRESOLVE
    2186 * - \ref SCIP_STAGE_PRESOLVED
    2187 * - \ref SCIP_STAGE_INITSOLVE
    2188 * - \ref SCIP_STAGE_SOLVING
    2189 * - \ref SCIP_STAGE_SOLVED
    2190 * - \ref SCIP_STAGE_EXITSOLVE
    2191 * - \ref SCIP_STAGE_FREETRANS
    2192 */
    2194 SCIP* scip, /**< SCIP data structure */
    2195 SCIP_SOL* sol /**< primal solution */
    2196 )
    2197{
    2199
    2200 assert(sol != NULL);
    2201 assert(sol->scip == scip);
    2202
    2203 return SCIPsolGetRunnum(sol);
    2204}
    2205
    2206/** gets node number of the specific branch and bound run, where this solution was found
    2207 *
    2208 * @return node number of the specific branch and bound run, where this solution was found
    2209 *
    2210 * @pre This method can be called if SCIP is in one of the following stages:
    2211 * - \ref SCIP_STAGE_TRANSFORMING
    2212 * - \ref SCIP_STAGE_TRANSFORMED
    2213 * - \ref SCIP_STAGE_INITPRESOLVE
    2214 * - \ref SCIP_STAGE_PRESOLVING
    2215 * - \ref SCIP_STAGE_EXITPRESOLVE
    2216 * - \ref SCIP_STAGE_PRESOLVED
    2217 * - \ref SCIP_STAGE_INITSOLVE
    2218 * - \ref SCIP_STAGE_SOLVING
    2219 * - \ref SCIP_STAGE_SOLVED
    2220 * - \ref SCIP_STAGE_EXITSOLVE
    2221 * - \ref SCIP_STAGE_FREETRANS
    2222 */
    2224 SCIP* scip, /**< SCIP data structure */
    2225 SCIP_SOL* sol /**< primal solution */
    2226 )
    2227{
    2228 SCIP_CALL_ABORT( SCIPcheckStage(scip, "SCIPgetSolNodenum", FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
    2229
    2230 assert(sol != NULL);
    2231 assert(sol->scip == scip);
    2232
    2233 return SCIPsolGetNodenum(sol);
    2234}
    2235
    2236/** gets heuristic, that found this solution (or NULL if it's from the tree)
    2237 *
    2238 * @return heuristic, that found this solution (or NULL if it's from the tree)
    2239 *
    2240 * @pre This method can be called if SCIP is in one of the following stages:
    2241 * - \ref SCIP_STAGE_TRANSFORMING
    2242 * - \ref SCIP_STAGE_TRANSFORMED
    2243 * - \ref SCIP_STAGE_INITPRESOLVE
    2244 * - \ref SCIP_STAGE_PRESOLVING
    2245 * - \ref SCIP_STAGE_EXITPRESOLVE
    2246 * - \ref SCIP_STAGE_PRESOLVED
    2247 * - \ref SCIP_STAGE_INITSOLVE
    2248 * - \ref SCIP_STAGE_SOLVING
    2249 * - \ref SCIP_STAGE_SOLVED
    2250 * - \ref SCIP_STAGE_EXITSOLVE
    2251 * - \ref SCIP_STAGE_FREETRANS
    2252 */
    2254 SCIP* scip, /**< SCIP data structure */
    2255 SCIP_SOL* sol /**< primal solution */
    2256 )
    2257{
    2259
    2260 assert(sol != NULL);
    2261 assert(sol->scip == scip);
    2262
    2263 return SCIPsolGetHeur(sol);
    2264}
    2265
    2266/** returns whether two given solutions are exactly equal
    2267 *
    2268 * @return returns whether two given solutions are exactly equal
    2269 *
    2270 * @pre This method can be called if SCIP is in one of the following stages:
    2271 * - \ref SCIP_STAGE_PROBLEM
    2272 * - \ref SCIP_STAGE_TRANSFORMING
    2273 * - \ref SCIP_STAGE_TRANSFORMED
    2274 * - \ref SCIP_STAGE_INITPRESOLVE
    2275 * - \ref SCIP_STAGE_PRESOLVING
    2276 * - \ref SCIP_STAGE_EXITPRESOLVE
    2277 * - \ref SCIP_STAGE_PRESOLVED
    2278 * - \ref SCIP_STAGE_INITSOLVE
    2279 * - \ref SCIP_STAGE_SOLVING
    2280 * - \ref SCIP_STAGE_SOLVED
    2281 * - \ref SCIP_STAGE_EXITSOLVE
    2282 * - \ref SCIP_STAGE_FREETRANS
    2283 */
    2285 SCIP* scip, /**< SCIP data structure */
    2286 SCIP_SOL* sol1, /**< first primal CIP solution */
    2287 SCIP_SOL* sol2 /**< second primal CIP solution */
    2288 )
    2289{
    2290 SCIP_CALL_ABORT( SCIPcheckStage(scip, "SCIPareSolsEqual", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
    2291
    2292 assert(sol1 != NULL);
    2293 assert(sol2 != NULL);
    2294 assert(sol1->scip == scip);
    2295 assert(sol2->scip == scip);
    2296
    2297 return SCIPsolsAreEqual(sol1, sol2, scip->set, scip->stat, scip->origprob, scip->transprob);
    2298}
    2299
    2300/** adjusts solution values of implied integral variables in handed solution, solution objective value is not
    2301 * deteriorated by this method
    2302 *
    2303 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
    2304 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
    2305 *
    2306 * @pre This method can be called if SCIP is in one of the following stages:
    2307 * - \ref SCIP_STAGE_SOLVING
    2308 */
    2310 SCIP* scip, /**< SCIP data structure */
    2311 SCIP_SOL* sol, /**< primal CIP solution */
    2312 SCIP_Bool uselprows /**< should LP row information be considered for none-objective variables */
    2313 )
    2314{
    2315 assert(scip != NULL);
    2316 SCIP_CALL( SCIPcheckStage(scip, "SCIPadjustImplicitSolVals", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
    2317
    2318 assert(sol != NULL);
    2319 assert(sol->scip == scip);
    2320 SCIP_CALL( SCIPsolAdjustImplicitSolVals(sol, scip->set, scip->stat, scip->transprob, scip->tree, uselprows) );
    2321
    2322 return SCIP_OKAY;
    2323}
    2324
    2325/** outputs non-zero variables of solution in original problem space to the given file stream
    2326 *
    2327 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
    2328 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
    2329 *
    2330 * @pre In case the solution pointer @p sol is NULL (asking for the current LP/pseudo solution), this method can be
    2331 * called if @p scip is in one of the following stages:
    2332 * - \ref SCIP_STAGE_PRESOLVING
    2333 * - \ref SCIP_STAGE_EXITPRESOLVE
    2334 * - \ref SCIP_STAGE_PRESOLVED
    2335 * - \ref SCIP_STAGE_INITSOLVE
    2336 * - \ref SCIP_STAGE_SOLVING
    2337 * - \ref SCIP_STAGE_SOLVED
    2338 * - \ref SCIP_STAGE_EXITSOLVE
    2339 *
    2340 * @pre In case the solution pointer @p sol is @b not NULL, this method can be called if @p scip is in one of the
    2341 * following stages:
    2342 * - \ref SCIP_STAGE_PROBLEM
    2343 * - \ref SCIP_STAGE_TRANSFORMED
    2344 * - \ref SCIP_STAGE_INITPRESOLVE
    2345 * - \ref SCIP_STAGE_PRESOLVING
    2346 * - \ref SCIP_STAGE_EXITPRESOLVE
    2347 * - \ref SCIP_STAGE_PRESOLVED
    2348 * - \ref SCIP_STAGE_INITSOLVE
    2349 * - \ref SCIP_STAGE_SOLVING
    2350 * - \ref SCIP_STAGE_SOLVED
    2351 * - \ref SCIP_STAGE_EXITSOLVE
    2352 */
    2354 SCIP* scip, /**< SCIP data structure */
    2355 SCIP_SOL* sol, /**< primal solution, or NULL for current LP/pseudo solution */
    2356 FILE* file, /**< output file (or NULL for standard output) */
    2357 SCIP_Bool printzeros /**< should variables set to zero be printed? */
    2358 )
    2359{
    2360 SCIP_Real objval;
    2361 SCIP_Bool currentsol;
    2362 SCIP_Bool oldquiet = FALSE;
    2363
    2364 assert(SCIPisTransformed(scip) || sol != NULL);
    2365 assert(sol == NULL || sol->scip == scip);
    2366
    2368
    2369 currentsol = (sol == NULL);
    2370
    2371 if( currentsol ? SCIPisExact(scip) : SCIPsolIsExact(sol) )
    2372 {
    2373 SCIP_CALL( SCIPprintSolExact(scip, sol, file, printzeros) );
    2374 return SCIP_OKAY;
    2375 }
    2376
    2377 if( currentsol )
    2378 {
    2379 SCIP_CALL( SCIPcheckStage(scip, "SCIPprintSol(sol==NULL)", \
    2381
    2382 /* create a temporary solution that is linked to the current solution */
    2383 SCIP_CALL( SCIPsolCreateCurrentSol(&sol, scip->mem->probmem, scip->set, scip->stat, scip->transprob, scip->primal,
    2384 scip->tree, scip->lp, NULL) );
    2385 }
    2386
    2387 if( file != NULL && scip->messagehdlr != NULL )
    2388 {
    2389 oldquiet = SCIPmessagehdlrIsQuiet(scip->messagehdlr);
    2390 SCIPmessagehdlrSetQuiet(scip->messagehdlr, FALSE);
    2391 }
    2392
    2393 SCIPmessageFPrintInfo(scip->messagehdlr, file, "objective value: ");
    2394
    2395 if( SCIPsolIsPartial(sol) )
    2396 {
    2397 SCIPmessageFPrintInfo(scip->messagehdlr, file, "unknown\n");
    2398 }
    2399 else
    2400 {
    2401 if( SCIPsolIsOriginal(sol) )
    2402 objval = SCIPsolGetOrigObj(sol);
    2403 else
    2404 objval = SCIPprobExternObjval(scip->transprob, scip->origprob, scip->set, SCIPsolGetObj(sol, scip->set, scip->transprob, scip->origprob));
    2405
    2406 SCIPprintReal(scip, file, objval, 20, 15);
    2407 SCIPmessageFPrintInfo(scip->messagehdlr, file, "\n");
    2408 }
    2409
    2410 SCIP_CALL( SCIPsolPrint(sol, scip->set, scip->messagehdlr, scip->stat, scip->origprob, scip->transprob, file, FALSE,
    2411 printzeros) );
    2412
    2413 if( file != NULL && scip->messagehdlr != NULL )
    2414 {
    2415 SCIPmessagehdlrSetQuiet(scip->messagehdlr, oldquiet);
    2416 }
    2417
    2418 if( currentsol )
    2419 {
    2420 /* free temporary solution */
    2421 SCIP_CALL( SCIPsolFree(&sol, scip->mem->probmem, scip->primal) );
    2422 }
    2423
    2424 return SCIP_OKAY;
    2425}
    2426
    2427/** print an exact solution */
    2429 SCIP* scip, /**< SCIP data structure */
    2430 SCIP_SOL* sol, /**< primal solution, or NULL for current LP/pseudo solution */
    2431 FILE* file, /**< output file (or NULL for standard output) */
    2432 SCIP_Bool printzeros /**< should variables set to zero be printed? */
    2433 )
    2434{
    2435 SCIP_RATIONAL* objval;
    2436 SCIP_RATIONAL* tmp;
    2437 SCIP_Bool currentsol;
    2438 SCIP_Bool oldquiet = FALSE;
    2439 char* objvalstr;
    2440 int objvalsize;
    2441
    2442 assert(SCIPisTransformed(scip) || sol != NULL);
    2443 assert(sol == NULL || sol->scip == scip);
    2444
    2445 SCIP_CALL( SCIPcheckStage(scip, "SCIPprintSolExact", FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE) );
    2446
    2447 currentsol = (sol == NULL);
    2448 if( currentsol )
    2449 {
    2450 SCIP_CALL( SCIPcheckStage(scip, "SCIPprintSolExact(sol==NULL)", \
    2452
    2453 /* create a temporary solution that is linked to the current solution */
    2454 SCIP_CALL( SCIPsolCreateCurrentSolExact(&sol, scip->mem->probmem, scip->set, scip->stat, scip->primal,
    2455 scip->tree, scip->lpexact, NULL) );
    2456 }
    2457
    2458 if( file != NULL && scip->messagehdlr != NULL )
    2459 {
    2460 oldquiet = SCIPmessagehdlrIsQuiet(scip->messagehdlr);
    2461 SCIPmessagehdlrSetQuiet(scip->messagehdlr, FALSE);
    2462 }
    2463
    2464 SCIPmessageFPrintInfo(scip->messagehdlr, file, "objective value: ");
    2465
    2466 if( SCIPsolIsPartial(sol) )
    2467 {
    2468 SCIPmessageFPrintInfo(scip->messagehdlr, file, "unknown\n");
    2469 }
    2470 else
    2471 {
    2473
    2474 if( SCIPsolIsOriginal(sol) )
    2476 else
    2477 {
    2479 SCIPsolGetObjExact(sol, scip->set, scip->transprob, scip->origprob, tmp);
    2480 SCIPprobExternObjvalExact(scip->transprob, scip->origprob, scip->set, tmp, objval);
    2482 }
    2483
    2484 objvalsize = SCIPrationalStrLen(objval) + 1;
    2485 SCIP_CALL( SCIPallocBufferArray(scip, &objvalstr, objvalsize) );
    2486 (void)SCIPrationalToString(objval, objvalstr, objvalsize);
    2487 SCIPmessageFPrintInfo(scip->messagehdlr, file, "%20s\n", objvalstr);
    2488 SCIPfreeBufferArray(scip, &objvalstr);
    2490 }
    2491
    2492 SCIP_CALL( SCIPsolPrintExact(sol, scip->set, scip->messagehdlr, scip->stat, scip->origprob, scip->transprob, file, FALSE,
    2493 printzeros) );
    2494
    2495 if( file != NULL && scip->messagehdlr != NULL )
    2496 {
    2497 SCIPmessagehdlrSetQuiet(scip->messagehdlr, oldquiet);
    2498 }
    2499
    2500 if( currentsol )
    2501 {
    2502 /* free temporary solution */
    2503 SCIP_CALL( SCIPsolFree(&sol, scip->mem->probmem, scip->primal) );
    2504 }
    2505
    2506 return SCIP_OKAY;
    2507}
    2508
    2509/** outputs non-zero variables of solution in transformed problem space to file stream
    2510 *
    2511 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
    2512 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
    2513 *
    2514 * @pre This method can be called if SCIP is in one of the following stages:
    2515 * - \ref SCIP_STAGE_TRANSFORMED
    2516 * - \ref SCIP_STAGE_INITPRESOLVE
    2517 * - \ref SCIP_STAGE_PRESOLVING
    2518 * - \ref SCIP_STAGE_EXITPRESOLVE
    2519 * - \ref SCIP_STAGE_PRESOLVED
    2520 * - \ref SCIP_STAGE_INITSOLVE
    2521 * - \ref SCIP_STAGE_SOLVING
    2522 * - \ref SCIP_STAGE_SOLVED
    2523 * - \ref SCIP_STAGE_EXITSOLVE
    2524 */
    2526 SCIP* scip, /**< SCIP data structure */
    2527 SCIP_SOL* sol, /**< primal solution, or NULL for current LP/pseudo solution */
    2528 FILE* file, /**< output file (or NULL for standard output) */
    2529 SCIP_Bool printzeros /**< should variables set to zero be printed? */
    2530 )
    2531{
    2532 SCIP_Bool currentsol;
    2533
    2534 SCIP_CALL( SCIPcheckStage(scip, "SCIPprintTransSol", FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE) );
    2535
    2536 assert(sol == NULL || sol->scip == scip);
    2537
    2538 currentsol = (sol == NULL);
    2539 if( currentsol )
    2540 {
    2541 /* create a temporary solution that is linked to the current solution */
    2542 SCIP_CALL( SCIPsolCreateCurrentSol(&sol, scip->mem->probmem, scip->set, scip->stat, scip->transprob, scip->primal,
    2543 scip->tree, scip->lp, NULL) );
    2544 }
    2545
    2546 if( SCIPsolIsOriginal(sol) )
    2547 {
    2548 SCIPerrorMessage("cannot print original space solution as transformed solution\n");
    2549 return SCIP_INVALIDCALL;
    2550 }
    2551
    2552 SCIPmessageFPrintInfo(scip->messagehdlr, file, "objective value: ");
    2553 SCIPprintReal(scip, file, SCIPsolGetObj(sol, scip->set, scip->transprob, scip->origprob), 20, 9);
    2554 SCIPmessageFPrintInfo(scip->messagehdlr, file, "\n");
    2555
    2556 SCIP_CALL( SCIPsolPrint(sol, scip->set, scip->messagehdlr, scip->stat, scip->transprob, NULL, file, FALSE, printzeros) );
    2557
    2558 if( currentsol )
    2559 {
    2560 /* free temporary solution */
    2561 SCIP_CALL( SCIPsolFree(&sol, scip->mem->probmem, scip->primal) );
    2562 }
    2563
    2564 return SCIP_OKAY;
    2565}
    2566
    2567/** outputs discrete variables of solution in original problem space to the given file stream
    2568 *
    2569 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
    2570 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
    2571 *
    2572 * @pre This method can be called if @p scip is in one of the following stages:
    2573 * - \ref SCIP_STAGE_PROBLEM
    2574 * - \ref SCIP_STAGE_TRANSFORMED
    2575 * - \ref SCIP_STAGE_INITPRESOLVE
    2576 * - \ref SCIP_STAGE_PRESOLVING
    2577 * - \ref SCIP_STAGE_EXITPRESOLVE
    2578 * - \ref SCIP_STAGE_PRESOLVED
    2579 * - \ref SCIP_STAGE_INITSOLVE
    2580 * - \ref SCIP_STAGE_SOLVING
    2581 * - \ref SCIP_STAGE_SOLVED
    2582 * - \ref SCIP_STAGE_EXITSOLVE
    2583 */
    2585 SCIP* scip, /**< SCIP data structure */
    2586 SCIP_SOL* sol, /**< primal solution */
    2587 FILE* file /**< output file (or NULL for standard output) */
    2588 )
    2589{
    2590 SCIP_Real objval;
    2591 SCIP_Bool oldquiet = FALSE;
    2592
    2593 assert(sol != NULL);
    2594 assert(sol->scip == scip);
    2595 assert(!SCIPsolIsPartial(sol));
    2596
    2597 SCIP_CALL( SCIPcheckStage(scip, "SCIPprintMIPStart", FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE) );
    2598
    2599 if( file != NULL && scip->messagehdlr != NULL )
    2600 {
    2601 oldquiet = SCIPmessagehdlrIsQuiet(scip->messagehdlr);
    2602 SCIPmessagehdlrSetQuiet(scip->messagehdlr, FALSE);
    2603 }
    2604
    2605 SCIPmessageFPrintInfo(scip->messagehdlr, file, "objective value: ");
    2606
    2607 if( SCIPsolIsOriginal(sol) )
    2608 objval = SCIPsolGetOrigObj(sol);
    2609 else
    2610 objval = SCIPprobExternObjval(scip->transprob, scip->origprob, scip->set, SCIPsolGetObj(sol, scip->set, scip->transprob, scip->origprob));
    2611
    2612 SCIPprintReal(scip, file, objval, 20, 15);
    2613 SCIPmessageFPrintInfo(scip->messagehdlr, file, "\n");
    2614
    2615 SCIP_CALL( SCIPsolPrint(sol, scip->set, scip->messagehdlr, scip->stat, scip->origprob, scip->transprob, file, TRUE,
    2616 TRUE) );
    2617
    2618 if( file != NULL && scip->messagehdlr != NULL )
    2619 {
    2620 SCIPmessagehdlrSetQuiet(scip->messagehdlr, oldquiet);
    2621 }
    2622
    2623 return SCIP_OKAY;
    2624}
    2625
    2626/** returns dual solution value of a constraint */
    2628 SCIP* scip, /**< SCIP data structure */
    2629 SCIP_CONS* cons, /**< constraint for which the dual solution should be returned */
    2630 SCIP_Real* dualsolval, /**< pointer to store the dual solution value */
    2631 SCIP_Bool* boundconstraint /**< pointer to store whether the constraint is a bound constraint (or NULL) */
    2632 )
    2633{
    2634 SCIP_CONS* transcons;
    2635 int nvars;
    2636 SCIP_Bool success;
    2637
    2638 assert(scip != NULL);
    2639 assert(cons != NULL);
    2640 assert(dualsolval != NULL);
    2641
    2642 assert(SCIPconsGetHdlr(cons) != NULL);
    2643 assert(strcmp(SCIPconshdlrGetName(SCIPconsGetHdlr(cons)), "linear" ) == 0);
    2644
    2645 SCIP_CALL( SCIPconsGetNVars(cons, scip->set, &nvars, &success) );
    2646 assert(success); /* is always successful, since we only have linear constraints */
    2647
    2648 if( boundconstraint != NULL )
    2649 *boundconstraint = (nvars == 1);
    2650
    2651 if( SCIPconsIsTransformed(cons) )
    2652 transcons = cons;
    2653 else
    2654 transcons = SCIPconsGetTransformed(cons);
    2655
    2656 /* it can happen that a transformed constraints gets deleted due to redundancy. by complementary slackness the
    2657 * corresponding dual solution value would be zero. however, if the constraint contains exactly one variable we need
    2658 * to check the reduced costs of the variable.
    2659 */
    2660 if( nvars == 0 || (nvars > 1 && transcons == NULL) )
    2661 (*dualsolval) = 0.0;
    2662 else
    2663 {
    2664 if( nvars > 1 )
    2665 (*dualsolval) = SCIPgetDualsolLinear(scip, transcons);
    2666 else
    2667 {
    2668 /* the constraint is a bound constraint */
    2669 SCIP_VAR** vars;
    2670 SCIP_Real* vals;
    2671 SCIP_Real activity;
    2672
    2673 vars = SCIPgetVarsLinear(scip, cons);
    2674 vals = SCIPgetValsLinear(scip, cons);
    2675
    2676 activity = SCIPvarGetLPSol(vars[0]) * vals[0];
    2677
    2678 /* return the reduced cost of the variable divided by the coefficient if the constraint would be tight */
    2679 if( SCIPsetIsEQ(scip->set, activity, SCIPgetRhsLinear(scip, cons))
    2680 || SCIPsetIsEQ(scip->set, activity, SCIPgetLhsLinear(scip, cons)) )
    2681 {
    2682 assert(vals[0] != 0.0);
    2683 (*dualsolval) = SCIPgetVarRedcost(scip, vars[0]) / vals[0];
    2684 }
    2685 else
    2686 (*dualsolval) = 0.0;
    2687 }
    2688 }
    2689 assert(*dualsolval != SCIP_INVALID); /*lint !e777*/
    2690
    2691 /* dual values are coming from the LP solver that is always solving a minimization problem */
    2693 (*dualsolval) *= -1.0;
    2694
    2695 return SCIP_OKAY;
    2696}
    2697
    2698/** outputs dual solution from LP solver to file stream */
    2699static
    2701 SCIP* scip, /**< SCIP data structure */
    2702 FILE* file, /**< output file (or NULL for standard output) */
    2703 SCIP_Bool printzeros /**< should variables set to zero be printed? */
    2704 )
    2705{
    2706 SCIP_Bool boundconstraint;
    2707 int c;
    2708
    2709 assert(scip->lp != NULL);
    2710 assert(scip->lp->solved);
    2711 assert(scip->lp->dualfeasible);
    2712
    2713 /* print dual solution values of all constraints */
    2714 for( c = 0; c < scip->origprob->nconss; ++c )
    2715 {
    2716 SCIP_CONS* cons;
    2717 SCIP_Real solval;
    2718
    2719 cons = scip->origprob->conss[c];
    2720 assert(cons != NULL);
    2721
    2722 SCIP_CALL( SCIPgetDualSolVal(scip, cons, &solval, &boundconstraint) );
    2723
    2724 if( printzeros || !SCIPisZero(scip, solval) )
    2725 {
    2726 SCIP_MESSAGEHDLR* messagehdlr = scip->messagehdlr;
    2727
    2728 SCIPmessageFPrintInfo(messagehdlr, file, "%-32s", SCIPconsGetName(cons));
    2729
    2730 if( SCIPisInfinity(scip, solval) )
    2731 SCIPmessageFPrintInfo(messagehdlr, file, " +infinity\n");
    2732 else if( SCIPisInfinity(scip, -solval) )
    2733 SCIPmessageFPrintInfo(messagehdlr, file, " -infinity\n");
    2734 else
    2735 {
    2736 if( boundconstraint )
    2737 SCIPmessageFPrintInfo(messagehdlr, file, " %20.15g*\n", solval);
    2738 else
    2739 SCIPmessageFPrintInfo(messagehdlr, file, " %20.15g\n", solval);
    2740 }
    2741 }
    2742 }
    2743
    2744 return SCIP_OKAY;
    2745}
    2746
    2747/** check whether the dual solution is available
    2748 *
    2749 * @note This is used when calling \ref SCIPprintDualSol()
    2750 *
    2751 * @return is dual solution available?
    2752 *
    2753 * @pre This method can be called if SCIP is in one of the following stages:
    2754 * - \ref SCIP_STAGE_SOLVED
    2755 */
    2757 SCIP* scip, /**< SCIP data structure */
    2758 SCIP_Bool printreason /**< print warning message if dualsol is not available? */
    2759 )
    2760{
    2761 int c;
    2762
    2763 assert(scip != NULL);
    2764
    2765 SCIP_CALL_ABORT( SCIPcheckStage(scip, "SCIPisDualSolAvailable", TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE) );
    2766
    2768 {
    2769 if( printreason )
    2770 SCIPmessageFPrintInfo(scip->messagehdlr, NULL, "No dual solution available.\n");
    2771 return FALSE;
    2772 }
    2773
    2774 assert(scip->stat != NULL);
    2775 assert(scip->transprob != NULL);
    2776
    2777 /* dual solution only useful when no presolving was performed */
    2778 if( scip->stat->performpresol )
    2779 {
    2780 if( printreason )
    2781 SCIPwarningMessage(scip, "No dual information available when presolving was performed.\n");
    2782 return FALSE;
    2783 }
    2784
    2785 /* dual solution is created by LP solver and therefore only available for pure LPs */
    2786 if( scip->transprob->nvars != scip->transprob->ncontvars )
    2787 {
    2788 if( printreason )
    2789 SCIPwarningMessage(scip, "Dual information only available for pure LPs (only continuous variables).\n");
    2790 return FALSE;
    2791 }
    2792
    2793 /* dual solution is created by LP solver and therefore only available for linear constraints */
    2794 for( c = scip->transprob->nconss - 1; c >= 0; --c )
    2795 {
    2796 SCIP_CONSHDLR* conshdlr;
    2797
    2798 conshdlr = SCIPconsGetHdlr(scip->transprob->conss[c]);
    2799 assert(conshdlr != NULL);
    2800
    2801 if( strcmp(SCIPconshdlrGetName(conshdlr), "linear" ) != 0 )
    2802 {
    2803 if( printreason )
    2804 SCIPwarningMessage(scip, "Dual information only available for pure LPs (only linear constraints).\n");
    2805 return FALSE;
    2806 }
    2807 }
    2808
    2809 return TRUE;
    2810}
    2811
    2812/** outputs dual solution from LP solver to file stream
    2813 *
    2814 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
    2815 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
    2816 *
    2817 * @pre This method can be called in all stages but only prints dual information when called in \ref SCIP_STAGE_SOLVED
    2818 */
    2820 SCIP* scip, /**< SCIP data structure */
    2821 FILE* file, /**< output file (or NULL for standard output) */
    2822 SCIP_Bool printzeros /**< should variables set to zero be printed? */
    2823 )
    2824{
    2826 {
    2827 /* print dual solution */
    2828 SCIP_CALL( printDualSol(scip, file, printzeros) );
    2829 }
    2830
    2831 return SCIP_OKAY;
    2832}
    2833
    2834
    2835/** outputs non-zero variables of solution representing a ray in original problem space to file stream
    2836 *
    2837 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
    2838 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
    2839 *
    2840 * @pre This method can be called if SCIP is in one of the following stages:
    2841 * - \ref SCIP_STAGE_PROBLEM
    2842 * - \ref SCIP_STAGE_TRANSFORMED
    2843 * - \ref SCIP_STAGE_INITPRESOLVE
    2844 * - \ref SCIP_STAGE_PRESOLVING
    2845 * - \ref SCIP_STAGE_EXITPRESOLVE
    2846 * - \ref SCIP_STAGE_PRESOLVED
    2847 * - \ref SCIP_STAGE_INITSOLVE
    2848 * - \ref SCIP_STAGE_SOLVING
    2849 * - \ref SCIP_STAGE_SOLVED
    2850 * - \ref SCIP_STAGE_EXITSOLVE
    2851 */
    2853 SCIP* scip, /**< SCIP data structure */
    2854 SCIP_SOL* sol, /**< primal solution representing ray */
    2855 FILE* file, /**< output file (or NULL for standard output) */
    2856 SCIP_Bool printzeros /**< should variables set to zero be printed? */
    2857 )
    2858{
    2859 assert(scip != NULL);
    2860 assert(sol != NULL);
    2861 assert(sol->scip == scip);
    2862
    2864
    2865 SCIP_CALL( SCIPsolPrintRay(sol, scip->set, scip->messagehdlr, scip->stat, scip->origprob, scip->transprob, file, printzeros) );
    2866
    2867 return SCIP_OKAY;
    2868}
    2869
    2870/** gets number of feasible primal solutions stored in the solution storage in case the problem is transformed;
    2871 * in case the problem stage is SCIP_STAGE_PROBLEM, the number of solution in the original solution candidate
    2872 * storage is returned
    2873 *
    2874 * @return number of feasible primal solutions stored in the solution storage in case the problem is transformed; or
    2875 * number of solution in the original solution candidate storage if the problem stage is SCIP_STAGE_PROBLEM
    2876 *
    2877 * @pre This method can be called if SCIP is in one of the following stages:
    2878 * - \ref SCIP_STAGE_PROBLEM
    2879 * - \ref SCIP_STAGE_TRANSFORMED
    2880 * - \ref SCIP_STAGE_INITPRESOLVE
    2881 * - \ref SCIP_STAGE_PRESOLVING
    2882 * - \ref SCIP_STAGE_EXITPRESOLVE
    2883 * - \ref SCIP_STAGE_PRESOLVED
    2884 * - \ref SCIP_STAGE_INITSOLVE
    2885 * - \ref SCIP_STAGE_SOLVING
    2886 * - \ref SCIP_STAGE_SOLVED
    2887 * - \ref SCIP_STAGE_EXITSOLVE
    2888 */
    2890 SCIP* scip /**< SCIP data structure */
    2891 )
    2892{
    2894
    2895 switch( scip->set->stage )
    2896 {
    2897 case SCIP_STAGE_PROBLEM:
    2898 return scip->origprimal->nsols;
    2899
    2906 case SCIP_STAGE_SOLVING:
    2907 case SCIP_STAGE_SOLVED:
    2909 return scip->primal->nsols;
    2910
    2911 case SCIP_STAGE_INIT:
    2914 default:
    2915 SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
    2916 SCIPABORT();
    2917 return -1; /*lint !e527*/
    2918 } /*lint !e788*/
    2919}
    2920
    2921/** gets array of feasible primal solutions stored in the solution storage in case the problem is transformed; in case
    2922 * if the problem stage is in SCIP_STAGE_PROBLEM, it returns the number array of solution candidate stored
    2923 *
    2924 * @return array of feasible primal solutions
    2925 *
    2926 * @pre This method can be called if SCIP is in one of the following stages:
    2927 * - \ref SCIP_STAGE_PROBLEM
    2928 * - \ref SCIP_STAGE_TRANSFORMED
    2929 * - \ref SCIP_STAGE_INITPRESOLVE
    2930 * - \ref SCIP_STAGE_PRESOLVING
    2931 * - \ref SCIP_STAGE_EXITPRESOLVE
    2932 * - \ref SCIP_STAGE_PRESOLVED
    2933 * - \ref SCIP_STAGE_INITSOLVE
    2934 * - \ref SCIP_STAGE_SOLVING
    2935 * - \ref SCIP_STAGE_SOLVED
    2936 * - \ref SCIP_STAGE_EXITSOLVE
    2937 */
    2939 SCIP* scip /**< SCIP data structure */
    2940 )
    2941{
    2943
    2944 switch( scip->set->stage )
    2945 {
    2946 case SCIP_STAGE_PROBLEM:
    2947 return scip->origprimal->sols;
    2948
    2955 case SCIP_STAGE_SOLVING:
    2956 case SCIP_STAGE_SOLVED:
    2958 return scip->primal->sols;
    2959
    2960 case SCIP_STAGE_INIT:
    2963 case SCIP_STAGE_FREE:
    2964 default:
    2965 SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
    2966 return NULL;
    2967 } /*lint !e788*/
    2968}
    2969
    2970/** gets best feasible primal solution found so far if the problem is transformed; in case the problem is in
    2971 * SCIP_STAGE_PROBLEM it returns the best solution candidate, or NULL if no solution has been found or the candidate
    2972 * store is empty;
    2973 *
    2974 * @return best feasible primal solution so far
    2975 *
    2976 * @pre This method can be called if SCIP is in one of the following stages:
    2977 * - \ref SCIP_STAGE_PROBLEM
    2978 * - \ref SCIP_STAGE_TRANSFORMED
    2979 * - \ref SCIP_STAGE_INITPRESOLVE
    2980 * - \ref SCIP_STAGE_PRESOLVING
    2981 * - \ref SCIP_STAGE_EXITPRESOLVE
    2982 * - \ref SCIP_STAGE_PRESOLVED
    2983 * - \ref SCIP_STAGE_INITSOLVE
    2984 * - \ref SCIP_STAGE_SOLVING
    2985 * - \ref SCIP_STAGE_SOLVED
    2986 * - \ref SCIP_STAGE_EXITSOLVE
    2987 */
    2989 SCIP* scip /**< SCIP data structure */
    2990 )
    2991{
    2993 switch( scip->set->stage )
    2994 {
    2995 case SCIP_STAGE_INIT:
    2996 return NULL;
    2997 case SCIP_STAGE_PROBLEM:
    2998 assert(scip->origprimal != NULL);
    2999 if( scip->origprimal->nsols > 0 )
    3000 {
    3001 assert(scip->origprimal->sols != NULL);
    3002 assert(scip->origprimal->sols[0] != NULL);
    3003 return scip->origprimal->sols[0];
    3004 }
    3005 break;
    3006
    3013 case SCIP_STAGE_SOLVING:
    3014 case SCIP_STAGE_SOLVED:
    3016 assert(scip->primal != NULL);
    3017 if( scip->primal->nsols > 0 )
    3018 {
    3019 assert(scip->primal->sols != NULL);
    3020 assert(scip->primal->sols[0] != NULL);
    3021 return scip->primal->sols[0];
    3022 }
    3023 break;
    3024
    3027 case SCIP_STAGE_FREE:
    3028 default:
    3029 SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
    3030 return NULL;
    3031 }
    3032
    3033 return NULL;
    3034}
    3035
    3036/** outputs best feasible primal solution found so far to file stream
    3037 *
    3038 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
    3039 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
    3040 *
    3041 * @pre This method can be called if SCIP is in one of the following stages:
    3042 * - \ref SCIP_STAGE_INIT
    3043 * - \ref SCIP_STAGE_PROBLEM
    3044 * - \ref SCIP_STAGE_TRANSFORMED
    3045 * - \ref SCIP_STAGE_INITPRESOLVE
    3046 * - \ref SCIP_STAGE_PRESOLVING
    3047 * - \ref SCIP_STAGE_EXITPRESOLVE
    3048 * - \ref SCIP_STAGE_PRESOLVED
    3049 * - \ref SCIP_STAGE_INITSOLVE
    3050 * - \ref SCIP_STAGE_SOLVING
    3051 * - \ref SCIP_STAGE_SOLVED
    3052 * - \ref SCIP_STAGE_EXITSOLVE
    3053 */
    3055 SCIP* scip, /**< SCIP data structure */
    3056 FILE* file, /**< output file (or NULL for standard output) */
    3057 SCIP_Bool printzeros /**< should variables set to zero be printed? */
    3058 )
    3059{
    3060 SCIP_SOL* sol;
    3061
    3062 SCIP_CALL( SCIPcheckStage(scip, "SCIPprintBestSol", TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE) );
    3063
    3064 sol = SCIPgetBestSol(scip);
    3065
    3066 if( sol == NULL )
    3067 SCIPmessageFPrintInfo(scip->messagehdlr, file, "no solution available\n");
    3068 else
    3069 {
    3070 SCIP_CALL( SCIPprintSol(scip, sol, file, printzeros) );
    3071 }
    3072
    3073 return SCIP_OKAY;
    3074}
    3075
    3076/** outputs best feasible primal solution found so far in transformed variables to file stream
    3077 *
    3078 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
    3079 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
    3080 *
    3081 * @pre This method can be called if SCIP is in one of the following stages:
    3082 * - \ref SCIP_STAGE_INIT
    3083 * - \ref SCIP_STAGE_PROBLEM
    3084 * - \ref SCIP_STAGE_TRANSFORMED
    3085 * - \ref SCIP_STAGE_INITPRESOLVE
    3086 * - \ref SCIP_STAGE_PRESOLVING
    3087 * - \ref SCIP_STAGE_EXITPRESOLVE
    3088 * - \ref SCIP_STAGE_PRESOLVED
    3089 * - \ref SCIP_STAGE_INITSOLVE
    3090 * - \ref SCIP_STAGE_SOLVING
    3091 * - \ref SCIP_STAGE_SOLVED
    3092 * - \ref SCIP_STAGE_EXITSOLVE
    3093 */
    3095 SCIP* scip, /**< SCIP data structure */
    3096 FILE* file, /**< output file (or NULL for standard output) */
    3097 SCIP_Bool printzeros /**< should variables set to zero be printed? */
    3098 )
    3099{
    3100 SCIP_SOL* sol;
    3101
    3102 SCIP_CALL( SCIPcheckStage(scip, "SCIPprintBestTransSol", TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE) );
    3103
    3104 sol = SCIPgetBestSol(scip);
    3105
    3106 if( sol != NULL && SCIPsolIsOriginal(sol) )
    3107 {
    3108 SCIPerrorMessage("best solution is defined in original space - cannot print it as transformed solution\n");
    3109 return SCIP_INVALIDCALL;
    3110 }
    3111
    3112 if( sol == NULL )
    3113 SCIPmessageFPrintInfo(scip->messagehdlr, file, "no solution available\n");
    3114 else
    3115 {
    3116 SCIP_CALL( SCIPprintTransSol(scip, sol, file, printzeros) );
    3117 }
    3118
    3119 return SCIP_OKAY;
    3120}
    3121
    3122/** try to round given solution
    3123 *
    3124 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
    3125 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
    3126 *
    3127 * @pre This method can be called if SCIP is in one of the following stages:
    3128 * - \ref SCIP_STAGE_SOLVING
    3129 */
    3131 SCIP* scip, /**< SCIP data structure */
    3132 SCIP_SOL* sol, /**< primal solution */
    3133 SCIP_Bool* success /**< pointer to store whether rounding was successful */
    3134 )
    3135{
    3137
    3138 assert(sol != NULL);
    3139 assert(sol->scip == scip);
    3140
    3141 if( SCIPsolIsOriginal(sol) )
    3142 {
    3143 SCIPerrorMessage("cannot round original space solution\n");
    3144 return SCIP_INVALIDCALL;
    3145 }
    3146
    3147 SCIP_CALL( SCIPsolRound(sol, scip->set, scip->stat, scip->transprob, scip->tree, success) );
    3148
    3149 return SCIP_OKAY;
    3150}
    3151
    3152/** copy the fp values to the exact arrays of the solution */
    3154 SCIP* scip, /**< SCIP data structure */
    3155 SCIP_SOL* sol /**< primal solution */
    3156 )
    3157{
    3158 assert(sol != NULL);
    3159 assert(sol->scip == scip);
    3160 assert(!SCIPsolIsExact(sol));
    3161
    3162 SCIP_CALL( SCIPcheckStage(scip, "SCIPmakeSolExact", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE) );
    3163
    3165 SCIP_CALL( SCIPsolMakeExact(sol, scip->mem->probmem, scip->set, scip->stat, scip->origprob) );
    3166 else
    3167 SCIP_CALL( SCIPsolMakeExact(sol, scip->mem->probmem, scip->set, scip->stat, scip->transprob) );
    3168
    3169 return SCIP_OKAY;
    3170}
    3171
    3172/** retransforms solution to original problem space
    3173 *
    3174 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
    3175 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
    3176 *
    3177 * @pre This method can be called if SCIP is in one of the following stages:
    3178 * - \ref SCIP_STAGE_TRANSFORMED
    3179 * - \ref SCIP_STAGE_INITPRESOLVE
    3180 * - \ref SCIP_STAGE_PRESOLVING
    3181 * - \ref SCIP_STAGE_EXITPRESOLVE
    3182 * - \ref SCIP_STAGE_PRESOLVED
    3183 * - \ref SCIP_STAGE_INITSOLVE
    3184 * - \ref SCIP_STAGE_SOLVING
    3185 * - \ref SCIP_STAGE_SOLVED
    3186 * - \ref SCIP_STAGE_EXITSOLVE
    3187 * - \ref SCIP_STAGE_FREETRANS
    3188 */
    3190 SCIP* scip, /**< SCIP data structure */
    3191 SCIP_SOL* sol /**< primal CIP solution */
    3192 )
    3193{
    3194 assert(sol != NULL);
    3195 assert(sol->scip == scip);
    3196
    3197 SCIP_CALL( SCIPcheckStage(scip, "SCIPretransformSol", FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
    3198
    3199 switch ( SCIPsolGetOrigin(sol) )
    3200 {
    3202 /* nothing to do */
    3203 return SCIP_OKAY;
    3204
    3209
    3210 /* first unlink solution */
    3211 SCIP_CALL( SCIPunlinkSol(scip, sol) );
    3212
    3213 /*lint -fallthrough*/
    3215 {
    3216 SCIP_Bool hasinfval;
    3217
    3218 SCIP_CALL( SCIPsolRetransform(sol, scip->set, scip->stat, scip->origprob, scip->transprob, &hasinfval) );
    3219 break;
    3220 }
    3223 SCIPerrorMessage("unknown solution origin.\n");
    3224 return SCIP_INVALIDCALL;
    3225
    3226 default:
    3227 /* note that this is in an internal SCIP error since all solution origins are covert in the switch above */
    3228 SCIPerrorMessage("invalid solution origin <%d>\n", SCIPsolGetOrigin(sol));
    3229 return SCIP_ERROR;
    3230 }
    3231
    3232 return SCIP_OKAY;
    3233}
    3234
    3235/** retransforms exact solution to original problem space
    3236 *
    3237 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
    3238 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
    3239 *
    3240 * @pre This method can be called if SCIP is in one of the following stages:
    3241 * - \ref SCIP_STAGE_TRANSFORMED
    3242 * - \ref SCIP_STAGE_INITPRESOLVE
    3243 * - \ref SCIP_STAGE_PRESOLVING
    3244 * - \ref SCIP_STAGE_EXITPRESOLVE
    3245 * - \ref SCIP_STAGE_PRESOLVED
    3246 * - \ref SCIP_STAGE_INITSOLVE
    3247 * - \ref SCIP_STAGE_SOLVING
    3248 * - \ref SCIP_STAGE_SOLVED
    3249 * - \ref SCIP_STAGE_EXITSOLVE
    3250 * - \ref SCIP_STAGE_FREETRANS
    3251 */
    3253 SCIP* scip, /**< SCIP data structure */
    3254 SCIP_SOL* sol /**< primal CIP solution */
    3255 )
    3256{
    3257 assert(sol != NULL);
    3258 assert(sol->scip == scip);
    3259
    3260 SCIP_CALL( SCIPcheckStage(scip, "SCIPretransformSolExact", FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
    3261
    3262 switch( SCIPsolGetOrigin(sol) )
    3263 {
    3265 /* nothing to do */
    3266 return SCIP_OKAY;
    3267
    3272
    3273 /* first unlink solution */
    3275
    3276 /*lint -fallthrough*/
    3278 {
    3279 SCIP_Bool hasinfval;
    3280
    3281 SCIP_CALL( SCIPsolRetransformExact(sol, scip->set, scip->stat, scip->origprob, scip->transprob, &hasinfval) );
    3282 break;
    3283 }
    3286 SCIPerrorMessage("unknown solution origin.\n");
    3287 return SCIP_INVALIDCALL;
    3288
    3289 default:
    3290 /* note that this is in an internal SCIP error since all solution origins are covert in the switch above */
    3291 SCIPerrorMessage("invalid solution origin <%d>\n", SCIPsolGetOrigin(sol));
    3292 return SCIP_ERROR;
    3293 }
    3294
    3295 return SCIP_OKAY;
    3296}
    3297
    3298/** reads a given solution file
    3299 *
    3300 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
    3301 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
    3302 *
    3303 * @pre This method can be called if SCIP is in one of the following stages:
    3304 * - \ref SCIP_STAGE_PROBLEM
    3305 * - \ref SCIP_STAGE_TRANSFORMED
    3306 * - \ref SCIP_STAGE_INITPRESOLVE
    3307 * - \ref SCIP_STAGE_PRESOLVING
    3308 * - \ref SCIP_STAGE_EXITPRESOLVE
    3309 * - \ref SCIP_STAGE_PRESOLVED
    3310 * - \ref SCIP_STAGE_INITSOLVE
    3311 * - \ref SCIP_STAGE_SOLVING
    3312 */
    3314 SCIP* scip, /**< SCIP data structure */
    3315 const char* filename /**< name of the input file */
    3316 )
    3317{
    3319
    3320 /* we pass the reading of the solution file on to reader_sol via the following call */
    3321 SCIP_CALL( SCIPreadProb(scip, filename, "sol") );
    3322
    3323 return SCIP_OKAY;
    3324}
    3325
    3326/** reads a given solution file and store the solution values in the given solution pointer */
    3327static
    3329 SCIP* scip, /**< SCIP data structure */
    3330 const char* filename, /**< name of the input file */
    3331 SCIP_SOL* sol, /**< solution pointer */
    3332 SCIP_Bool* partial, /**< pointer to store if the solution is partial (or NULL, if not needed) */
    3333 SCIP_Bool* error /**< pointer store if an error occured */
    3334 )
    3335{
    3336 SCIP_HASHSET* unknownvars = NULL;
    3337 SCIP_FILE* file;
    3338 SCIP_Bool unknownvariablemessage;
    3339 SCIP_Bool localpartial;
    3340 int lineno;
    3341
    3342 assert(scip != NULL);
    3343 assert(sol != NULL);
    3344 assert(error != NULL);
    3345
    3346 /* open input file */
    3347 file = SCIPfopen(filename, "r");
    3348 if( file == NULL )
    3349 {
    3350 SCIPerrorMessage("cannot open file <%s> for reading\n", filename);
    3351 SCIPprintSysError(filename);
    3352 return SCIP_NOFILE;
    3353 }
    3354
    3355 *error = FALSE;
    3356 localpartial = SCIPsolIsPartial(sol);
    3357
    3358 unknownvariablemessage = FALSE;
    3359 lineno = 0;
    3360
    3361 /* read the file */
    3362 while( !SCIPfeof(file) && !(*error) )
    3363 {
    3364 /**@todo unlimit buffer size */
    3365 char buffer[SCIP_MAXSTRLEN];
    3366 const char* varname;
    3367 const char* valuestring;
    3368 char* endptr;
    3369 SCIP_VAR* var;
    3370 SCIP_RETCODE retcode;
    3371
    3372 /* get next line */
    3373 if( SCIPfgets(buffer, (int)sizeof(buffer), file) == NULL )
    3374 {
    3375 if( !SCIPfeof(file) )
    3376 *error = TRUE;
    3377 break;
    3378 }
    3379 ++lineno;
    3380
    3381 /* there are some lines which may precede the solution information */
    3382 if( SCIPstrncasecmp(buffer, "solution status:", 16) == 0 || SCIPstrncasecmp(buffer, "objective value:", 16) == 0
    3383 || buffer[strspn(buffer, " \t\n\v\f\r")] == '\0' || SCIPstrncasecmp(buffer, "Log started", 11) == 0
    3384 || SCIPstrncasecmp(buffer, "Variable Name", 13) == 0 || SCIPstrncasecmp(buffer, "All other variables", 19) == 0
    3385 || SCIPstrncasecmp(buffer, "NAME", 4) == 0 || SCIPstrncasecmp(buffer, "ENDATA", 6) == 0 /* allow parsing of SOL-format on the MIPLIB 2003 pages */
    3386 || SCIPstrncasecmp(buffer, "=obj=", 5) == 0 ) /* avoid "unknown variable" warning when reading MIPLIB SOL files */
    3387 continue;
    3388
    3389 /* tokenize the line */
    3390 varname = SCIPstrtok(buffer, " \t\v", &endptr);
    3391 valuestring = SCIPstrtok(NULL, " \t\n\v\f\r", &endptr);
    3392 if( valuestring == NULL )
    3393 {
    3394 SCIPerrorMessage("Invalid input line %d in solution file <%s>: <%s>.\n", lineno, filename, buffer);
    3395 *error = TRUE;
    3396 break;
    3397 }
    3398
    3399 /* find the variable */
    3400 var = SCIPfindVar(scip, varname);
    3401 if( var == NULL )
    3402 {
    3403 if( !unknownvariablemessage )
    3404 {
    3405 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL, "unknown variable <%s> in line %d of solution file <%s>\n",
    3406 varname, lineno, filename);
    3407 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL, " (further unknown variables are ignored)\n");
    3408 unknownvariablemessage = TRUE;
    3409 }
    3410 continue;
    3411 }
    3412
    3413 /* ignore multi-aggregated variable */
    3415 {
    3416 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL, "ignored solution value for multiaggregated variable <%s>\n",
    3417 varname);
    3418 continue;
    3419 }
    3420
    3421 /* ignore invalid value */
    3422 if( SCIPstrncasecmp(valuestring, "inv", 3) == 0 )
    3423 {
    3424 SCIPdebugMsg(scip, "ignored invalid assignment for variable <%s>\n", varname);
    3425 continue;
    3426 }
    3427
    3428 /* read the value */
    3429 if( SCIPsolIsExact(sol) )
    3430 {
    3431 SCIP_RATIONAL* value = NULL;
    3432
    3433 assert(SCIPisExact(scip));
    3434
    3435 if( SCIPrationalIsString(valuestring) )
    3436 {
    3437 SCIP_CALL( SCIPrationalCreateString(SCIPblkmem(scip), &value, valuestring) );
    3438 assert(value != NULL);
    3439 }
    3440 else if( SCIPstrncasecmp(valuestring, "unk", 3) == 0 )
    3441 {
    3442 /**@todo handle unknown value as null pointer and set up exact partial solution instead */
    3443 /* value = NULL; */
    3444 if( unknownvars == NULL )
    3445 {
    3447 }
    3448 SCIP_CALL( SCIPhashsetInsert(unknownvars, SCIPblkmem(scip), (void*)var) );
    3449 localpartial = TRUE;
    3450 continue;
    3451 }
    3452 else
    3453 {
    3454 SCIPerrorMessage("Invalid solution value <%s> for variable <%s> in line %d of solution file <%s>.\n",
    3455 valuestring, varname, lineno, filename);
    3456 *error = TRUE;
    3457 break;
    3458 }
    3459
    3460 retcode = SCIPsetSolValExact(scip, sol, var, value);
    3461
    3463 }
    3464 else
    3465 {
    3466 SCIP_Real value;
    3467
    3468 if( SCIPstrncasecmp(valuestring, "+inf", 4) == 0 || SCIPstrncasecmp(valuestring, "inf", 3) == 0 )
    3469 value = SCIPinfinity(scip);
    3470 else if( SCIPstrncasecmp(valuestring, "-inf", 4) == 0 )
    3471 value = -SCIPinfinity(scip);
    3472 else if( SCIPstrncasecmp(valuestring, "unk", 3) == 0 )
    3473 {
    3474 value = SCIP_UNKNOWN;
    3475 localpartial = TRUE;
    3476 }
    3477 else if( !SCIPstrToRealValue(valuestring, &value, &endptr) || *endptr != '\0' )
    3478 {
    3479#ifdef SCIP_WITH_EXACTSOLVE
    3480 /* convert exact value */
    3481 if( SCIPrationalIsString(valuestring) )
    3482 {
    3483 SCIP_RATIONAL* valueexact;
    3484
    3485 SCIP_CALL( SCIPrationalCreateString(SCIPblkmem(scip), &valueexact, valuestring) );
    3486
    3487 value = SCIPrationalGetReal(valueexact);
    3488
    3489 SCIPrationalFreeBlock(SCIPblkmem(scip), &valueexact);
    3490 }
    3491 else
    3492#endif
    3493 {
    3494 SCIPerrorMessage("Invalid solution value <%s> for variable <%s> in line %d of solution file <%s>.\n",
    3495 valuestring, varname, lineno, filename);
    3496 *error = TRUE;
    3497 break;
    3498 }
    3499 }
    3500
    3501 retcode = SCIPsetSolVal(scip, sol, var, value);
    3502 }
    3503
    3504 if( retcode == SCIP_INVALIDDATA )
    3505 SCIPwarningMessage(scip, "ignored conflicting solution value for fixed variable <%s>\n", varname);
    3506 else
    3507 {
    3508 SCIP_CALL_FINALLY( retcode, SCIPfclose(file) );
    3509 }
    3510 }
    3511
    3512 /* close input file */
    3513 SCIPfclose(file);
    3514
    3515 if( localpartial && !SCIPsolIsPartial(sol) )
    3516 {
    3518 {
    3519 if( SCIPsolIsExact(sol) )
    3520 {
    3522 SCIP_CALL( SCIPsolMakeReal(sol, SCIPblkmem(scip), scip->set, scip->stat, scip->origprob) );
    3523 }
    3524
    3525 SCIP_CALL( SCIPsolMarkPartial(sol, scip->set, scip->stat, scip->origprob->vars, scip->origprob->nvars) );
    3526 }
    3527 else
    3528 *error = TRUE;
    3529 }
    3530
    3531 if( unknownvars != NULL )
    3532 {
    3533 if( !(*error) )
    3534 {
    3535 SCIP_VAR** slots = (SCIP_VAR**)SCIPhashsetGetSlots(unknownvars);
    3536 int nslots = SCIPhashsetGetNSlots(unknownvars);
    3537 int i;
    3538
    3539 assert(!SCIPsolIsExact(sol));
    3540 assert(SCIPsolIsPartial(sol));
    3541
    3542 for( i = 0; i < nslots; ++i )
    3543 {
    3544 if( slots[i] != NULL )
    3545 {
    3546 SCIP_CALL( SCIPsetSolVal(scip, sol, slots[i], SCIP_UNKNOWN) );
    3547 }
    3548 }
    3549 }
    3550
    3551 SCIPhashsetFree(&unknownvars, SCIPblkmem(scip));
    3552 }
    3553
    3554 if( partial != NULL )
    3555 *partial = localpartial;
    3556
    3557 return SCIP_OKAY;
    3558}
    3559
    3560/** reads a given xml solution file and store the solution values in the given solution pointer */
    3561static
    3563 SCIP* scip, /**< SCIP data structure */
    3564 const char* filename, /**< name of the input file */
    3565 SCIP_SOL* sol, /**< solution pointer */
    3566 SCIP_Bool* partial, /**< pointer to store if the solution is partial (or NULL if not needed) */
    3567 SCIP_Bool* error /**< pointer store if an error occured */
    3568 )
    3569{
    3570 SCIP_HASHSET* unknownvars = NULL;
    3571 XML_NODE* start;
    3572 const XML_NODE* varsnode;
    3573 const XML_NODE* varnode;
    3574 const char* tag;
    3575 SCIP_Bool unknownvariablemessage;
    3576 SCIP_Bool localpartial;
    3577
    3578 assert(scip != NULL);
    3579 assert(sol != NULL);
    3580 assert(sol->scip == scip);
    3581 assert(error != NULL);
    3582
    3583 /* read xml file */
    3584 start = SCIPxmlProcess(filename);
    3585
    3586 if( start == NULL )
    3587 {
    3588 SCIPerrorMessage("Some error occured during parsing the XML solution file.\n");
    3589 return SCIP_READERROR;
    3590 }
    3591
    3592 *error = FALSE;
    3593 localpartial = SCIPsolIsPartial(sol);
    3594
    3595 /* find variable sections */
    3596 tag = "variables";
    3597 varsnode = SCIPxmlFindNodeMaxdepth(start, tag, 0, 3);
    3598 if( varsnode == NULL )
    3599 {
    3600 /* free xml data */
    3601 SCIPxmlFreeNode(start);
    3602
    3603 SCIPerrorMessage("Variable section not found.\n");
    3604 return SCIP_READERROR;
    3605 }
    3606
    3607 /* loop through all variables */
    3608 unknownvariablemessage = FALSE;
    3609 for( varnode = SCIPxmlFirstChild(varsnode); varnode != NULL; varnode = SCIPxmlNextSibl(varnode) )
    3610 {
    3611 SCIP_VAR* var;
    3612 const char* varname;
    3613 const char* valuestring;
    3614 char* endptr;
    3615 SCIP_RETCODE retcode;
    3616
    3617 /* find variable name */
    3618 varname = SCIPxmlGetAttrval(varnode, "name");
    3619 if( varname == NULL )
    3620 {
    3621 SCIPerrorMessage("Attribute \"name\" of variable not found.\n");
    3622 *error = TRUE;
    3623 break;
    3624 }
    3625
    3626 /* find value of variable */
    3627 valuestring = SCIPxmlGetAttrval(varnode, "value");
    3628 if( valuestring == NULL )
    3629 {
    3630 SCIPerrorMessage("Attribute \"value\" of variable not found.\n");
    3631 *error = TRUE;
    3632 break;
    3633 }
    3634
    3635 /* find the variable */
    3636 var = SCIPfindVar(scip, varname);
    3637 if( var == NULL )
    3638 {
    3639 if( !unknownvariablemessage )
    3640 {
    3641 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL, "unknown variable <%s> of solution file <%s>\n",
    3642 varname, filename);
    3643 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL, " (further unknown variables are ignored)\n");
    3644 unknownvariablemessage = TRUE;
    3645 }
    3646 continue;
    3647 }
    3648
    3649 /* ignore multi-aggregated variable */
    3651 {
    3652 SCIPverbMessage(scip, SCIP_VERBLEVEL_NORMAL, NULL, "ignored solution value for multiaggregated variable <%s>\n",
    3653 varname);
    3654 continue;
    3655 }
    3656
    3657 /* ignore invalid value */
    3658 if( SCIPstrncasecmp(valuestring, "inv", 3) == 0 )
    3659 {
    3660 SCIPdebugMsg(scip, "ignored invalid assignment for variable <%s>\n", varname);
    3661 continue;
    3662 }
    3663
    3664 /* read the value */
    3665 if( SCIPsolIsExact(sol) )
    3666 {
    3667 SCIP_RATIONAL* value = NULL;
    3668
    3669 assert(SCIPisExact(scip));
    3670
    3671 if( SCIPrationalIsString(valuestring) )
    3672 {
    3673 SCIP_CALL( SCIPrationalCreateString(SCIPblkmem(scip), &value, valuestring) );
    3674 assert(value != NULL);
    3675 }
    3676 else if( SCIPstrncasecmp(valuestring, "unk", 3) == 0 )
    3677 {
    3678 /**@todo handle unknown value as null pointer and set up exact partial solution instead */
    3679 /* value = NULL; */
    3680 if( unknownvars == NULL )
    3681 {
    3683 }
    3684 SCIP_CALL( SCIPhashsetInsert(unknownvars, SCIPblkmem(scip), (void*)var) );
    3685 localpartial = TRUE;
    3686 continue;
    3687 }
    3688 else
    3689 {
    3690 SCIPerrorMessage("Invalid solution value <%s> for variable <%s> in XML solution file <%s>.\n",
    3691 valuestring, varname, filename);
    3692 *error = TRUE;
    3693 break;
    3694 }
    3695
    3696 retcode = SCIPsetSolValExact(scip, sol, var, value);
    3697
    3699 }
    3700 else
    3701 {
    3702 SCIP_Real value;
    3703
    3704 if( SCIPstrncasecmp(valuestring, "+inf", 4) == 0 || SCIPstrncasecmp(valuestring, "inf", 3) == 0 )
    3705 value = SCIPinfinity(scip);
    3706 else if( SCIPstrncasecmp(valuestring, "-inf", 4) == 0 )
    3707 value = -SCIPinfinity(scip);
    3708 else if( SCIPstrncasecmp(valuestring, "unk", 3) == 0 )
    3709 {
    3710 value = SCIP_UNKNOWN;
    3711 localpartial = TRUE;
    3712 }
    3713 else if( !SCIPstrToRealValue(valuestring, &value, &endptr) || *endptr != '\0' )
    3714 {
    3715#ifdef SCIP_WITH_EXACTSOLVE
    3716 /* convert exact value */
    3717 if( SCIPrationalIsString(valuestring) )
    3718 {
    3719 SCIP_RATIONAL* valueexact;
    3720
    3721 SCIP_CALL( SCIPrationalCreateString(SCIPblkmem(scip), &valueexact, valuestring) );
    3722
    3723 value = SCIPrationalGetReal(valueexact);
    3724
    3725 SCIPrationalFreeBlock(SCIPblkmem(scip), &valueexact);
    3726 }
    3727 else
    3728#endif
    3729 {
    3730 SCIPerrorMessage("Invalid solution value <%s> for variable <%s> in XML solution file <%s>.\n",
    3731 valuestring, varname, filename);
    3732 *error = TRUE;
    3733 break;
    3734 }
    3735 }
    3736
    3737 retcode = SCIPsetSolVal(scip, sol, var, value);
    3738 }
    3739
    3740 if( retcode == SCIP_INVALIDDATA )
    3741 SCIPwarningMessage(scip, "ignored conflicting solution value for fixed variable <%s>\n", varname);
    3742 else
    3743 {
    3744 SCIP_CALL( retcode );
    3745 }
    3746 }
    3747
    3748 /* free xml data */
    3749 SCIPxmlFreeNode(start);
    3750
    3751 if( localpartial && !SCIPsolIsPartial(sol) )
    3752 {
    3754 {
    3755 if( SCIPsolIsExact(sol) )
    3756 {
    3758 SCIP_CALL( SCIPsolMakeReal(sol, SCIPblkmem(scip), scip->set, scip->stat, scip->origprob) );
    3759 }
    3760
    3761 SCIP_CALL( SCIPsolMarkPartial(sol, scip->set, scip->stat, scip->origprob->vars, scip->origprob->nvars) );
    3762 }
    3763 else
    3764 *error = TRUE;
    3765 }
    3766
    3767 if( unknownvars != NULL )
    3768 {
    3769 if( !(*error) )
    3770 {
    3771 SCIP_VAR** slots = (SCIP_VAR**)SCIPhashsetGetSlots(unknownvars);
    3772 int nslots = SCIPhashsetGetNSlots(unknownvars);
    3773 int i;
    3774
    3775 assert(!SCIPsolIsExact(sol));
    3776 assert(SCIPsolIsPartial(sol));
    3777
    3778 for( i = 0; i < nslots; ++i )
    3779 {
    3780 if( slots[i] != NULL )
    3781 SCIP_CALL( SCIPsetSolVal(scip, sol, slots[i], SCIP_UNKNOWN) );
    3782 }
    3783 }
    3784
    3785 SCIPhashsetFree(&unknownvars, SCIPblkmem(scip));
    3786 }
    3787
    3788 if( partial != NULL )
    3789 *partial = localpartial;
    3790
    3791 return SCIP_OKAY;
    3792}
    3793
    3794/** reads a given solution file and store the solution values in the given solution pointer
    3795 *
    3796 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
    3797 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
    3798 *
    3799 * @pre This method can be called if SCIP is in one of the following stages:
    3800 * - \ref SCIP_STAGE_PROBLEM
    3801 * - \ref SCIP_STAGE_TRANSFORMED
    3802 * - \ref SCIP_STAGE_INITPRESOLVE
    3803 * - \ref SCIP_STAGE_PRESOLVING
    3804 * - \ref SCIP_STAGE_EXITPRESOLVE
    3805 * - \ref SCIP_STAGE_PRESOLVED
    3806 * - \ref SCIP_STAGE_INITSOLVE
    3807 * - \ref SCIP_STAGE_SOLVING
    3808 */
    3810 SCIP* scip, /**< SCIP data structure */
    3811 const char* filename, /**< name of the input file */
    3812 SCIP_SOL* sol, /**< solution pointer */
    3813 SCIP_Bool xml, /**< true, iff the given solution in written in XML */
    3814 SCIP_Bool* partial, /**< pointer to store if the solution is partial */
    3815 SCIP_Bool* error /**< pointer store if an error occured */
    3816 )
    3817{
    3818 SCIP_CALL( SCIPcheckStage(scip, "SCIPreadSolFile", FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) );
    3819
    3820 if( xml )
    3821 {
    3822 SCIP_CALL( readXmlSolFile(scip, filename, sol, partial, error) );
    3823 }
    3824 else
    3825 {
    3826 SCIP_CALL( readSolFile(scip, filename, sol, partial, error) );
    3827 }
    3828
    3829 return SCIP_OKAY;
    3830}
    3831
    3832/** adds feasible primal solution to solution storage by copying it
    3833 *
    3834 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
    3835 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
    3836 *
    3837 * @pre This method can be called if SCIP is in one of the following stages:
    3838 * - \ref SCIP_STAGE_PROBLEM
    3839 * - \ref SCIP_STAGE_TRANSFORMED
    3840 * - \ref SCIP_STAGE_INITPRESOLVE
    3841 * - \ref SCIP_STAGE_PRESOLVING
    3842 * - \ref SCIP_STAGE_EXITPRESOLVE
    3843 * - \ref SCIP_STAGE_PRESOLVED
    3844 * - \ref SCIP_STAGE_SOLVING
    3845 * - \ref SCIP_STAGE_FREETRANS
    3846 *
    3847 * @note Do not call during propagation, use heur_trysol instead.
    3848 */
    3850 SCIP* scip, /**< SCIP data structure */
    3851 SCIP_SOL* sol, /**< primal CIP solution */
    3852 SCIP_Bool* stored /**< stores whether given solution was good enough to keep */
    3853 )
    3854{
    3855 assert(sol != NULL);
    3856 assert(sol->scip == scip);
    3857
    3859
    3860 switch( scip->set->stage )
    3861 {
    3862 case SCIP_STAGE_PROBLEM:
    3864 assert(SCIPsolIsOriginal(sol));
    3865 SCIP_CALL( SCIPprimalAddOrigSol(scip->origprimal, scip->mem->probmem, scip->set, scip->stat, scip->origprob, sol, stored) );
    3866 return SCIP_OKAY;
    3867
    3873 case SCIP_STAGE_SOLVING:
    3874 {
    3875 SCIP_SOL* bestsol = SCIPgetBestSol(scip);
    3876
    3877 SCIP_CALL( SCIPprimalAddSol(scip->primal, scip->mem->probmem, scip->set, scip->messagehdlr, scip->stat,
    3878 scip->origprob, scip->transprob, scip->tree, scip->reopt, scip->lp, scip->eventqueue, scip->eventfilter, sol,
    3879 stored) );
    3880
    3881 /* @todo use solution index rather than pointer */
    3882 if( *stored && (bestsol != SCIPgetBestSol(scip)) )
    3883 {
    3885 }
    3886
    3887 return SCIP_OKAY;
    3888 }
    3891 case SCIP_STAGE_SOLVED:
    3893 default:
    3894 SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
    3895 return SCIP_INVALIDCALL;
    3896 } /*lint !e788*/
    3897}
    3898
    3899/** adds primal solution to solution storage, frees the solution afterwards
    3900 *
    3901 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
    3902 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
    3903 *
    3904 * @pre This method can be called if SCIP is in one of the following stages:
    3905 * - \ref SCIP_STAGE_PROBLEM
    3906 * - \ref SCIP_STAGE_TRANSFORMED
    3907 * - \ref SCIP_STAGE_INITPRESOLVE
    3908 * - \ref SCIP_STAGE_PRESOLVING
    3909 * - \ref SCIP_STAGE_EXITPRESOLVE
    3910 * - \ref SCIP_STAGE_PRESOLVED
    3911 * - \ref SCIP_STAGE_SOLVING
    3912 * - \ref SCIP_STAGE_FREETRANS
    3913 *
    3914 * @note Do not call during propagation, use heur_trysol instead.
    3915 */
    3917 SCIP* scip, /**< SCIP data structure */
    3918 SCIP_SOL** sol, /**< pointer to primal CIP solution; is cleared in function call */
    3919 SCIP_Bool* stored /**< stores whether given solution was good enough to keep */
    3920 )
    3921{
    3922 assert(sol != NULL);
    3923 assert(*sol != NULL);
    3924 assert((*sol)->scip == scip);
    3925
    3927
    3928 switch( scip->set->stage )
    3929 {
    3930 case SCIP_STAGE_PROBLEM:
    3932 assert(SCIPsolIsOriginal(*sol));
    3933 SCIP_CALL( SCIPprimalAddOrigSolFree(scip->origprimal, scip->mem->probmem, scip->set, scip->stat, scip->origprob, sol, stored) );
    3934 return SCIP_OKAY;
    3935
    3941 case SCIP_STAGE_SOLVING:
    3942 {
    3943 SCIP_SOL* bestsol = SCIPgetBestSol(scip);
    3944
    3945 SCIP_CALL( SCIPprimalAddSolFree(scip->primal, scip->mem->probmem, scip->set, scip->messagehdlr, scip->stat,
    3946 scip->origprob, scip->transprob, scip->tree, scip->reopt, scip->lp, scip->eventqueue, scip->eventfilter,
    3947 sol, stored) );
    3948
    3949 if( *stored )
    3950 {
    3951 if( bestsol != SCIPgetBestSol(scip) )
    3952 {
    3953 assert(SCIPgetBestSol(scip) != NULL);
    3955 }
    3956 }
    3957
    3958 return SCIP_OKAY;
    3959 }
    3962 case SCIP_STAGE_SOLVED:
    3964 default:
    3965 SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
    3966 return SCIP_INVALIDCALL;
    3967 } /*lint !e788*/
    3968}
    3969
    3970/** adds current LP/pseudo solution to solution storage
    3971 *
    3972 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
    3973 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
    3974 *
    3975 * @pre This method can be called if SCIP is in one of the following stages:
    3976 * - \ref SCIP_STAGE_PRESOLVED
    3977 * - \ref SCIP_STAGE_SOLVING
    3978 */
    3980 SCIP* scip, /**< SCIP data structure */
    3981 SCIP_HEUR* heur, /**< heuristic that found the solution */
    3982 SCIP_Bool* stored /**< stores whether given solution was good enough to keep */
    3983 )
    3984{
    3985 SCIP_SOL* bestsol;
    3986
    3988
    3989 bestsol = SCIPgetBestSol(scip);
    3990
    3991 SCIP_CALL( SCIPprimalAddCurrentSol(scip->primal, scip->mem->probmem, scip->set, scip->messagehdlr, scip->stat,
    3992 scip->origprob, scip->transprob, scip->tree, scip->reopt, scip->lp, scip->eventqueue, scip->eventfilter, heur,
    3993 stored) );
    3994
    3995 if( *stored )
    3996 {
    3997 if( bestsol != SCIPgetBestSol(scip) )
    3999 }
    4000
    4001 return SCIP_OKAY;
    4002}
    4003
    4004/** checks solution for feasibility; if possible, adds it to storage by copying
    4005 *
    4006 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
    4007 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
    4008 *
    4009 * @pre This method can be called if SCIP is in one of the following stages:
    4010 * - \ref SCIP_STAGE_TRANSFORMED
    4011 * - \ref SCIP_STAGE_INITPRESOLVE
    4012 * - \ref SCIP_STAGE_PRESOLVING
    4013 * - \ref SCIP_STAGE_EXITPRESOLVE
    4014 * - \ref SCIP_STAGE_PRESOLVED
    4015 * - \ref SCIP_STAGE_SOLVING
    4016 *
    4017 * @note Do not call during propagation, use heur_trysol instead.
    4018 */
    4020 SCIP* scip, /**< SCIP data structure */
    4021 SCIP_SOL* sol, /**< primal CIP solution */
    4022 SCIP_Bool printreason, /**< Should all reasons of violation be printed? */
    4023 SCIP_Bool completely, /**< Should all violations be checked if printreason is true? */
    4024 SCIP_Bool checkbounds, /**< Should the bounds of the variables be checked? */
    4025 SCIP_Bool checkintegrality, /**< Has integrality to be checked? */
    4026 SCIP_Bool checklprows, /**< Do constraints represented by rows in the current LP have to be checked? */
    4027 SCIP_Bool* stored /**< stores whether given solution was feasible and good enough to keep */
    4028 )
    4029{
    4030 SCIP_SOL* bestsol;
    4031
    4032 assert(sol != NULL);
    4033 assert(sol->scip == scip);
    4034 assert(stored != NULL);
    4035
    4037
    4038 bestsol = SCIPgetBestSol(scip);
    4039
    4040 if( !printreason )
    4041 completely = FALSE;
    4042
    4043 /* we cannot check partial solutions */
    4044 if( SCIPsolIsPartial(sol) )
    4045 {
    4046 SCIPerrorMessage("Cannot check feasibility of partial solutions.\n");
    4047 return SCIP_INVALIDDATA;
    4048 }
    4049
    4050 if( SCIPsolIsOriginal(sol) )
    4051 {
    4052 SCIP_Bool feasible;
    4053
    4054 /* SCIPprimalTrySol() can only be called on transformed solutions; therefore check solutions in original problem
    4055 * including modifiable constraints */
    4056 SCIP_CALL( SCIPsolCheckOrig(sol, scip->set, scip->messagehdlr, scip->mem->probmem, scip->stat, scip->origprob, scip->origprimal,
    4057 printreason, completely, checkbounds, checkintegrality, checklprows, TRUE, &feasible) );
    4058 if( feasible )
    4059 {
    4060 SCIP_CALL( SCIPprimalAddSol(scip->primal, scip->mem->probmem, scip->set, scip->messagehdlr, scip->stat,
    4061 scip->origprob, scip->transprob, scip->tree, scip->reopt, scip->lp, scip->eventqueue, scip->eventfilter,
    4062 sol, stored) );
    4063
    4064 if( *stored )
    4065 {
    4066 if( bestsol != SCIPgetBestSol(scip) )
    4068 }
    4069 }
    4070 else
    4071 *stored = FALSE;
    4072 }
    4073 else
    4074 {
    4075 SCIP_CALL( SCIPprimalTrySol(scip->primal, scip->mem->probmem, scip->set, scip->messagehdlr, scip->stat, scip->origprob,
    4076 scip->transprob, scip->tree, scip->reopt, scip->lp, scip->eventqueue, scip->eventfilter, sol, printreason,
    4077 completely, checkbounds, checkintegrality, checklprows, stored) );
    4078
    4079 if( *stored )
    4080 {
    4081 if( bestsol != SCIPgetBestSol(scip) )
    4082 {
    4083#ifdef SCIP_DEBUG_ABORTATORIGINFEAS
    4084 SCIP_Bool feasible;
    4085 SCIP_CALL( SCIPsolCheckOrig(sol, scip->set, scip->messagehdlr, scip->mem->probmem, scip->stat, scip->origprob, scip->origprimal, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, &feasible) );
    4086
    4087 if( ! feasible )
    4088 {
    4089 SCIPerrorMessage("Accepted solution not feasible for original problem\n");
    4090 SCIPABORT();
    4091 }
    4092#endif
    4094 }
    4095 }
    4096 }
    4097
    4098 return SCIP_OKAY;
    4099}
    4100
    4101/** checks primal solution; if feasible, adds it to storage; solution is freed afterwards
    4102 *
    4103 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
    4104 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
    4105 *
    4106 * @pre This method can be called if SCIP is in one of the following stages:
    4107 * - \ref SCIP_STAGE_TRANSFORMED
    4108 * - \ref SCIP_STAGE_INITPRESOLVE
    4109 * - \ref SCIP_STAGE_PRESOLVING
    4110 * - \ref SCIP_STAGE_EXITPRESOLVE
    4111 * - \ref SCIP_STAGE_PRESOLVED
    4112 * - \ref SCIP_STAGE_SOLVING
    4113 *
    4114 * @note Do not call during propagation, use heur_trysol instead.
    4115 */
    4117 SCIP* scip, /**< SCIP data structure */
    4118 SCIP_SOL** sol, /**< pointer to primal CIP solution; is cleared in function call */
    4119 SCIP_Bool printreason, /**< Should all reasons of violations be printed */
    4120 SCIP_Bool completely, /**< Should all violations be checked if printreason is true? */
    4121 SCIP_Bool checkbounds, /**< Should the bounds of the variables be checked? */
    4122 SCIP_Bool checkintegrality, /**< Has integrality to be checked? */
    4123 SCIP_Bool checklprows, /**< Do constraints represented by rows in the current LP have to be checked? */
    4124 SCIP_Bool* stored /**< stores whether solution was feasible and good enough to keep */
    4125 )
    4126{
    4127 SCIP_SOL* bestsol;
    4128
    4129 assert(stored != NULL);
    4130 assert(sol != NULL);
    4131 assert(*sol != NULL);
    4132 assert((*sol)->scip == scip);
    4133
    4135
    4136 bestsol = SCIPgetBestSol(scip);
    4137
    4138 if( !printreason )
    4139 completely = FALSE;
    4140
    4141 /* we cannot check partial solutions */
    4142 if( SCIPsolIsPartial(*sol) )
    4143 {
    4144 SCIPerrorMessage("Cannot check feasibility of partial solutions.\n");
    4145 return SCIP_INVALIDDATA;
    4146 }
    4147
    4148 if( SCIPsolIsOriginal(*sol) )
    4149 {
    4150 SCIP_Bool feasible;
    4151
    4152 /* SCIPprimalTrySol() can only be called on transformed solutions; therefore check solutions in original problem
    4153 * including modifiable constraints
    4154 */
    4155 SCIP_CALL( SCIPsolCheckOrig(*sol, scip->set, scip->messagehdlr, scip->mem->probmem, scip->stat, scip->origprob, scip->origprimal,
    4156 printreason, completely, checkbounds, checkintegrality, checklprows, TRUE, &feasible) );
    4157
    4158 if( feasible )
    4159 {
    4160 SCIP_CALL( SCIPprimalAddSolFree(scip->primal, scip->mem->probmem, scip->set, scip->messagehdlr, scip->stat,
    4161 scip->origprob, scip->transprob, scip->tree, scip->reopt, scip->lp, scip->eventqueue, scip->eventfilter,
    4162 sol, stored) );
    4163
    4164 if( *stored )
    4165 {
    4166 if( bestsol != SCIPgetBestSol(scip) )
    4168 }
    4169 }
    4170 else
    4171 {
    4172 SCIP_CALL( SCIPsolFree(sol, scip->mem->probmem, scip->primal) );
    4173 *stored = FALSE;
    4174 }
    4175 }
    4176 else
    4177 {
    4178 SCIP_CALL( SCIPprimalTrySolFree(scip->primal, scip->mem->probmem, scip->set, scip->messagehdlr, scip->stat,
    4179 scip->origprob, scip->transprob, scip->tree, scip->reopt, scip->lp, scip->eventqueue, scip->eventfilter,
    4180 sol, printreason, completely, checkbounds, checkintegrality, checklprows, stored) );
    4181
    4182 if( *stored )
    4183 {
    4184 if( bestsol != SCIPgetBestSol(scip) )
    4185 {
    4186#ifdef SCIP_DEBUG_ABORTATORIGINFEAS
    4187 SCIP_Bool feasible;
    4188 SCIP_CALL( SCIPsolCheckOrig(SCIPgetBestSol(scip), scip->set, scip->messagehdlr, scip->mem->probmem, scip->stat, scip->origprob, scip->origprimal,
    4189 TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, &feasible) );
    4190
    4191 if( ! feasible )
    4192 {
    4193 SCIPerrorMessage("Accepted incumbent not feasible for original problem\n");
    4194 SCIPABORT();
    4195 }
    4196#endif
    4198 }
    4199 }
    4200 }
    4201
    4202 return SCIP_OKAY;
    4203}
    4204
    4205/** checks current LP/pseudo solution for feasibility; if possible, adds it to storage
    4206 *
    4207 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
    4208 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
    4209 *
    4210 * @pre This method can be called if SCIP is in one of the following stages:
    4211 * - \ref SCIP_STAGE_PRESOLVED
    4212 * - \ref SCIP_STAGE_SOLVING
    4213 */
    4215 SCIP* scip, /**< SCIP data structure */
    4216 SCIP_HEUR* heur, /**< heuristic that found the solution */
    4217 SCIP_Bool printreason, /**< Should all reasons of violations be printed? */
    4218 SCIP_Bool completely, /**< Should all violations be checked if printreason is true? */
    4219 SCIP_Bool checkintegrality, /**< Has integrality to be checked? */
    4220 SCIP_Bool checklprows, /**< Do constraints represented by rows in the current LP have to be checked? */
    4221 SCIP_Bool* stored /**< stores whether given solution was feasible and good enough to keep */
    4222 )
    4223{
    4224 SCIP_SOL* bestsol;
    4225
    4227
    4228 bestsol = SCIPgetBestSol(scip);
    4229
    4230 if( !printreason )
    4231 completely = FALSE;
    4232
    4233 SCIP_CALL( SCIPprimalTryCurrentSol(scip->primal, scip->mem->probmem, scip->set, scip->messagehdlr, scip->stat,
    4234 scip->origprob, scip->transprob, scip->tree, scip->reopt, scip->lp, scip->eventqueue, scip->eventfilter, heur,
    4235 printreason, completely, checkintegrality, checklprows, stored) );
    4236
    4237 if( *stored )
    4238 {
    4239 if( bestsol != SCIPgetBestSol(scip) )
    4240 {
    4241#ifdef SCIP_DEBUG_ABORTATORIGINFEAS
    4242 SCIP_Bool feasible;
    4243 SCIP_CALL( SCIPsolCheckOrig(SCIPgetBestSol(scip), scip->set, scip->messagehdlr, scip->mem->probmem, scip->stat, scip->origprob, scip->origprimal,
    4244 TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, &feasible) );
    4245
    4246 if( ! feasible )
    4247 {
    4248 SCIPerrorMessage("Accepted incumbent not feasible for original problem\n");
    4249 SCIPABORT();
    4250 }
    4251#endif
    4253 }
    4254 }
    4255
    4256 return SCIP_OKAY;
    4257}
    4258
    4259/** returns all partial solutions
    4260 *
    4261 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
    4262 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
    4263 *
    4264 * @pre This method can be called if SCIP is in one of the following stages:
    4265 * - \ref SCIP_STAGE_PROBLEM
    4266 * - \ref SCIP_STAGE_PRESOLVING
    4267 * - \ref SCIP_STAGE_SOLVING
    4268 * - \ref SCIP_STAGE_SOLVED
    4269 */
    4271 SCIP* scip /**< SCIP data structure */
    4272 )
    4273{
    4274 assert(scip != NULL);
    4275
    4277
    4278 return scip->origprimal->partialsols;
    4279}
    4280
    4281/** returns number of partial solutions
    4282 *
    4283 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
    4284 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
    4285 *
    4286 * @pre This method can be called if SCIP is in one of the following stages:
    4287 * - \ref SCIP_STAGE_PROBLEM
    4288 * - \ref SCIP_STAGE_PRESOLVING
    4289 * - \ref SCIP_STAGE_SOLVING
    4290 * - \ref SCIP_STAGE_SOLVED
    4291 */
    4293 SCIP* scip /**< SCIP data structure */
    4294 )
    4295{
    4296 assert(scip != NULL);
    4297
    4299
    4300 return scip->origprimal->npartialsols;
    4301}
    4302
    4303/** checks solution for feasibility without adding it to the solution store
    4304 *
    4305 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
    4306 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
    4307 *
    4308 * @pre This method can be called if SCIP is in one of the following stages:
    4309 * - \ref SCIP_STAGE_PROBLEM
    4310 * - \ref SCIP_STAGE_TRANSFORMED
    4311 * - \ref SCIP_STAGE_INITPRESOLVE
    4312 * - \ref SCIP_STAGE_PRESOLVING
    4313 * - \ref SCIP_STAGE_EXITPRESOLVE
    4314 * - \ref SCIP_STAGE_PRESOLVED
    4315 * - \ref SCIP_STAGE_INITSOLVE
    4316 * - \ref SCIP_STAGE_SOLVING
    4317 * - \ref SCIP_STAGE_SOLVED
    4318 */
    4320 SCIP* scip, /**< SCIP data structure */
    4321 SCIP_SOL* sol, /**< primal CIP solution */
    4322 SCIP_Bool printreason, /**< Should all reasons of violations be printed? */
    4323 SCIP_Bool completely, /**< Should all violations be checked if printreason is true? */
    4324 SCIP_Bool checkbounds, /**< Should the bounds of the variables be checked? */
    4325 SCIP_Bool checkintegrality, /**< Has integrality to be checked? */
    4326 SCIP_Bool checklprows, /**< Do constraints represented by rows in the current LP have to be checked? */
    4327 SCIP_Bool* feasible /**< stores whether given solution is feasible */
    4328 )
    4329{
    4330 assert(sol != NULL);
    4331 assert(sol->scip == scip);
    4332
    4334
    4335 /* return immediately if the solution is of type partial */
    4336 if( SCIPsolIsPartial(sol) )
    4337 {
    4338 SCIPerrorMessage("Cannot check feasibility of partial solutions.");
    4339 return SCIP_INVALIDDATA;
    4340 }
    4341
    4342 /* if we want to solve exactly, the constraint handlers cannot rely on the LP's feasibility */
    4343 checklprows = checklprows || scip->set->exact_enable;
    4344
    4345 if( !printreason )
    4346 completely = FALSE;
    4347
    4348 /* SCIPsolCheck() can only be called on transformed solutions */
    4349 if( SCIPsolIsOriginal(sol) )
    4350 {
    4351 if( SCIPisExact(scip) )
    4352 {
    4353 SCIP_CALL( checkSolOrigExact(scip, sol, feasible, printreason, completely, checkbounds, checkintegrality, checklprows, FALSE) );
    4354 }
    4355 else
    4356 {
    4357 SCIP_CALL( SCIPsolCheckOrig(sol, scip->set, scip->messagehdlr, scip->mem->probmem, scip->stat, scip->origprob, scip->origprimal,
    4358 printreason, completely, checkbounds, checkintegrality, checklprows, FALSE, feasible) );
    4359 }
    4360 }
    4361 else
    4362 {
    4363 SCIP_CALL( SCIPsolCheck(sol, scip->set, scip->messagehdlr, scip->mem->probmem, scip->stat, scip->transprob,
    4364 printreason, completely, checkbounds, checkintegrality, checklprows, feasible) );
    4365 }
    4366
    4367 return SCIP_OKAY;
    4368}
    4369
    4370/** checks solution for feasibility in original problem without adding it to the solution store;
    4371 * this method is used to double check a solution in order to validate the presolving process
    4372 *
    4373 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
    4374 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
    4375 *
    4376 * @pre This method can be called if SCIP is in one of the following stages:
    4377 * - \ref SCIP_STAGE_PROBLEM
    4378 * - \ref SCIP_STAGE_TRANSFORMED
    4379 * - \ref SCIP_STAGE_INITPRESOLVE
    4380 * - \ref SCIP_STAGE_PRESOLVING
    4381 * - \ref SCIP_STAGE_EXITPRESOLVE
    4382 * - \ref SCIP_STAGE_PRESOLVED
    4383 * - \ref SCIP_STAGE_INITSOLVE
    4384 * - \ref SCIP_STAGE_SOLVING
    4385 * - \ref SCIP_STAGE_SOLVED
    4386 */
    4388 SCIP* scip, /**< SCIP data structure */
    4389 SCIP_SOL* sol, /**< primal CIP solution */
    4390 SCIP_Bool* feasible, /**< stores whether given solution is feasible */
    4391 SCIP_Bool printreason, /**< should the reason for the violation be printed? */
    4392 SCIP_Bool completely /**< Should all violations be checked if printreason is true? */
    4393 )
    4394{
    4395 assert(scip != NULL);
    4396 assert(sol != NULL);
    4397 assert(sol->scip == scip);
    4398 assert(feasible != NULL);
    4399
    4400 SCIP_CALL( SCIPcheckStage(scip, "SCIPcheckSolOrig", FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) );
    4401
    4402 /* return immediately if the solution is of type partial */
    4403 if( SCIPsolIsPartial(sol) )
    4404 {
    4405 SCIPerrorMessage("Cannot check feasibility of partial solutions.");
    4406 return SCIP_INVALIDDATA;
    4407 }
    4408
    4409 if( !printreason )
    4410 completely = FALSE;
    4411
    4412 /* check solution in original problem; that includes bounds, integrality, and non modifiable constraints */
    4413 if( SCIPisExact(scip) )
    4414 {
    4415 SCIP_CALL( checkSolOrigExact(scip, sol, feasible, printreason, completely, TRUE, TRUE, TRUE, FALSE) );
    4416 }
    4417 else
    4418 {
    4419 SCIP_CALL( SCIPsolCheckOrig(sol, scip->set, scip->messagehdlr, scip->mem->probmem, scip->stat, scip->origprob, scip->origprimal,
    4420 printreason, completely, TRUE, TRUE, TRUE, FALSE, feasible) );
    4421 }
    4422
    4423 return SCIP_OKAY;
    4424}
    4425
    4426/** return whether a primal ray is stored that proves unboundedness of the LP relaxation
    4427 *
    4428 * @return return whether a primal ray is stored that proves unboundedness of the LP relaxation
    4429 *
    4430 * @pre This method can be called if SCIP is in one of the following stages:
    4431 * - \ref SCIP_STAGE_SOLVING
    4432 * - \ref SCIP_STAGE_SOLVED
    4433 */
    4435 SCIP* scip /**< SCIP data structure */
    4436 )
    4437{
    4439
    4440 return scip->primal->primalray != NULL;
    4441}
    4442
    4443/** gets value of given variable in primal ray causing unboundedness of the LP relaxation;
    4444 * should only be called if such a ray is stored (check with SCIPhasPrimalRay())
    4445 *
    4446 * @return value of given variable in primal ray causing unboundedness of the LP relaxation
    4447 *
    4448 * @pre This method can be called if SCIP is in one of the following stages:
    4449 * - \ref SCIP_STAGE_SOLVING
    4450 * - \ref SCIP_STAGE_SOLVED
    4451 */
    4453 SCIP* scip, /**< SCIP data structure */
    4454 SCIP_VAR* var /**< variable to get value for */
    4455 )
    4456{
    4458
    4459 assert(var != NULL);
    4460 assert(var->scip == scip);
    4461 assert(scip->primal != NULL);
    4462 assert(scip->primal->primalray != NULL);
    4463
    4464 return SCIPsolGetRayVal(scip->primal->primalray, scip->set, scip->stat, var);
    4465}
    4466
    4467/** updates the primal ray thats proves unboundedness
    4468 *
    4469 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
    4470 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
    4471 *
    4472 * @pre This method can be called if @p scip is in one of the following stages:
    4473 * - \ref SCIP_STAGE_PRESOLVING
    4474 * - \ref SCIP_STAGE_PRESOLVED
    4475 * - \ref SCIP_STAGE_SOLVING
    4476 * - \ref SCIP_STAGE_SOLVED
    4477 *
    4478 * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
    4479 */
    4481 SCIP* scip, /**< SCIP data structure */
    4482 SCIP_SOL* primalray /**< the new primal ray */
    4483 )
    4484{
    4485 assert(scip != NULL);
    4486 assert(primalray != NULL);
    4487
    4488 SCIP_CALL( SCIPcheckStage(scip, "SCIPupdatePrimalRay", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) );
    4489
    4490 SCIP_CALL( SCIPprimalUpdateRay(scip->primal, scip->set, scip->stat, primalray, scip->mem->probmem) );
    4491
    4492 return SCIP_OKAY;
    4493}
    4494
    4495/** overwrite the fp-values in a solution with the rounded exact ones */
    4497 SCIP* scip, /**< SCIP data structure */
    4498 SCIP_SOL* sol /**< primal CIP solution */
    4499 )
    4500{
    4501 assert(scip != NULL);
    4502 assert(sol != NULL);
    4503 assert(sol->scip == scip);
    4504
    4505 SCIP_CALL_ABORT( SCIPcheckStage(scip, "SCIPoverwriteFPsol", FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
    4506
    4507 SCIP_CALL( SCIPsolOverwriteFPSolWithExact(sol, scip->set, scip->stat, scip->origprob, scip->transprob, scip->tree) );
    4508
    4509 return SCIP_OKAY;
    4510}
    4511
    4512/** checks exact primal solution; if feasible, adds it to storage; solution is freed afterwards
    4513 *
    4514 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
    4515 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
    4516 *
    4517 * @pre This method can be called if SCIP is in one of the following stages:
    4518 * - \ref SCIP_STAGE_TRANSFORMED
    4519 * - \ref SCIP_STAGE_INITPRESOLVE
    4520 * - \ref SCIP_STAGE_PRESOLVING
    4521 * - \ref SCIP_STAGE_EXITPRESOLVE
    4522 * - \ref SCIP_STAGE_PRESOLVED
    4523 * - \ref SCIP_STAGE_SOLVING
    4524 *
    4525 * @note Do not call during propagation, use heur_trysol instead.
    4526 */
    4528 SCIP* scip, /**< SCIP data structure */
    4529 SCIP_SOL** sol, /**< pointer to primal CIP solution; is cleared in function call */
    4530 SCIP_Bool printreason, /**< Should all reasons of violations be printed */
    4531 SCIP_Bool completely, /**< Should all violations be checked if printreason is true? */
    4532 SCIP_Bool checkbounds, /**< Should the bounds of the variables be checked? */
    4533 SCIP_Bool checkintegrality, /**< Has integrality to be checked? */
    4534 SCIP_Bool checklprows, /**< Do constraints represented by rows in the current LP have to be checked? */
    4535 SCIP_Bool* stored /**< stores whether solution was feasible and good enough to keep */
    4536 )
    4537{
    4538 SCIP_SOL* bestsol;
    4539
    4540 assert(stored != NULL);
    4541 assert(sol != NULL);
    4542 assert(*sol != NULL);
    4543 assert((*sol)->scip == scip);
    4544
    4545 SCIP_CALL( SCIPcheckStage(scip, "SCIPtrySolFreeExact", FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) );
    4546
    4547 bestsol = SCIPgetBestSol(scip);
    4548
    4549 if( !printreason )
    4550 completely = FALSE;
    4551
    4552 /* we cannot check partial solutions */
    4553 if( SCIPsolIsPartial(*sol) )
    4554 {
    4555 SCIPerrorMessage("Cannot check feasibility of partial solutions.\n");
    4556 return SCIP_INVALIDDATA;
    4557 }
    4558
    4559 /* if the solution is added during presolving and it is not defined on original variables,
    4560 * presolving operations will destroy its validity, so we retransform it to the original space
    4561 */
    4562 if( scip->set->stage == SCIP_STAGE_PRESOLVING && !SCIPsolIsOriginal(*sol) )
    4563 {
    4564 SCIP_Bool hasinfval;
    4565
    4566 SCIP_CALL( SCIPsolUnlink(*sol, scip->set, scip->transprob) );
    4567 SCIP_CALL( SCIPsolRetransform(*sol, scip->set, scip->stat, scip->origprob, scip->transprob, &hasinfval) );
    4568 }
    4569
    4570 if( SCIPsolIsOriginal(*sol) )
    4571 {
    4572 SCIP_Bool feasible;
    4573
    4574 /* SCIPprimalTrySol() can only be called on transformed solutions; therefore check solutions in original problem
    4575 * including modifiable constraints
    4576 */
    4577 SCIP_CALL( checkSolOrig(scip, *sol, &feasible, printreason, completely, checkbounds, checkintegrality, checklprows, TRUE) );
    4578
    4579 if( feasible )
    4580 {
    4581 SCIP_CALL( SCIPprimalAddSolFreeExact(scip->primal, scip->mem->probmem, scip->set, scip->messagehdlr, scip->stat,
    4582 scip->origprob, scip->transprob, scip->tree, scip->reopt, scip->lpexact, scip->eventqueue, scip->eventfilter,
    4583 sol, stored) );
    4584
    4585 if( *stored )
    4586 {
    4587 if( bestsol != SCIPgetBestSol(scip) )
    4588 {
    4590 }
    4591 }
    4592 }
    4593 else
    4594 {
    4595 SCIP_CALL( SCIPsolFree(sol, scip->mem->probmem, scip->primal) );
    4596 *stored = FALSE;
    4597 }
    4598 }
    4599 else
    4600 {
    4601 SCIP_CALL( SCIPprimalTrySolFreeExact(scip->primal, scip->mem->probmem, scip->set, scip->messagehdlr, scip->stat,
    4602 scip->origprob, scip->transprob, scip->tree, scip->reopt, scip->lpexact, scip->eventqueue, scip->eventfilter,
    4603 sol, printreason, completely, checkbounds, checkintegrality, checklprows, stored) );
    4604
    4605 if( *stored )
    4606 {
    4607 if( bestsol != SCIPgetBestSol(scip) )
    4608 {
    4610 }
    4611 }
    4612 }
    4613
    4614 return SCIP_OKAY;
    4615}
    SCIP_VAR * h
    Definition: circlepacking.c:68
    SCIP_RETCODE SCIPconsGetNVars(SCIP_CONS *cons, SCIP_SET *set, int *nvars, SCIP_Bool *success)
    Definition: cons.c:6554
    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_CONS * SCIPconsGetTransformed(SCIP_CONS *cons)
    Definition: cons.c:7021
    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
    Constraint handler for linear constraints in their most general form, .
    methods for debugging
    #define SCIPcheckStage(scip, method, init, problem, transforming, transformed, initpresolve, presolving, exitpresolve, presolved, initsolve, solving, solved, exitsolve, freetrans, freescip)
    Definition: debug.h:364
    #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_Real
    Definition: def.h:163
    #define SCIP_UNKNOWN
    Definition: def.h:186
    #define TRUE
    Definition: def.h:100
    #define FALSE
    Definition: def.h:101
    #define SCIP_CALL_ABORT(x)
    Definition: def.h:341
    #define SCIPABORT()
    Definition: def.h:334
    #define REALABS(x)
    Definition: def.h:189
    #define SCIP_CALL(x)
    Definition: def.h:362
    #define SCIP_CALL_FINALLY(x, y)
    Definition: def.h:404
    SCIP_FILE * SCIPfopen(const char *path, const char *mode)
    Definition: fileio.c:153
    int SCIPfeof(SCIP_FILE *stream)
    Definition: fileio.c:227
    int SCIPfclose(SCIP_FILE *fp)
    Definition: fileio.c:232
    char * SCIPfgets(char *s, int size, SCIP_FILE *stream)
    Definition: fileio.c:200
    SCIP_Real SCIPgetDualsolLinear(SCIP *scip, SCIP_CONS *cons)
    SCIP_Real SCIPgetRhsLinear(SCIP *scip, SCIP_CONS *cons)
    SCIP_VAR ** SCIPgetVarsLinear(SCIP *scip, SCIP_CONS *cons)
    SCIP_RETCODE SCIPaddCoefLinear(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var, SCIP_Real val)
    SCIP_Real SCIPgetLhsLinear(SCIP *scip, SCIP_CONS *cons)
    SCIP_Real * SCIPgetValsLinear(SCIP *scip, SCIP_CONS *cons)
    SCIP_RETCODE SCIPcreateConsBasicLinear(SCIP *scip, SCIP_CONS **cons, const char *name, int nvars, SCIP_VAR **vars, SCIP_Real *vals, SCIP_Real lhs, SCIP_Real rhs)
    SCIP_RETCODE SCIPcopyOrig(SCIP *sourcescip, SCIP *targetscip, SCIP_HASHMAP *varmap, SCIP_HASHMAP *consmap, const char *suffix, SCIP_Bool enablepricing, SCIP_Bool threadsafe, SCIP_Bool passmessagehdlr, SCIP_Bool *valid)
    Definition: scip_copy.c:3044
    SCIP_Bool SCIPisTransformed(SCIP *scip)
    Definition: scip_general.c:647
    SCIP_RETCODE SCIPfree(SCIP **scip)
    Definition: scip_general.c:402
    SCIP_RETCODE SCIPcreate(SCIP **scip)
    Definition: scip_general.c:370
    SCIP_STAGE SCIPgetStage(SCIP *scip)
    Definition: scip_general.c:444
    SCIP_RETCODE SCIPaddVar(SCIP *scip, SCIP_VAR *var)
    Definition: scip_prob.c:1907
    SCIP_RETCODE SCIPgetOrigVarsData(SCIP *scip, SCIP_VAR ***vars, int *nvars, int *nbinvars, int *nintvars, int *nimplvars, int *ncontvars)
    Definition: scip_prob.c:2753
    int SCIPgetNVars(SCIP *scip)
    Definition: scip_prob.c:2246
    SCIP_RETCODE SCIPaddCons(SCIP *scip, SCIP_CONS *cons)
    Definition: scip_prob.c:3274
    SCIP_OBJSENSE SCIPgetObjsense(SCIP *scip)
    Definition: scip_prob.c:1400
    int SCIPgetNFixedVars(SCIP *scip)
    Definition: scip_prob.c:2705
    SCIP_VAR ** SCIPgetFixedVars(SCIP *scip)
    Definition: scip_prob.c:2662
    SCIP_VAR * SCIPfindVar(SCIP *scip, const char *name)
    Definition: scip_prob.c:3189
    SCIP_RETCODE SCIPreadProb(SCIP *scip, const char *filename, const char *extension)
    Definition: scip_prob.c:341
    void SCIPhashmapFree(SCIP_HASHMAP **hashmap)
    Definition: misc.c:3095
    void * SCIPhashmapGetImage(SCIP_HASHMAP *hashmap, void *origin)
    Definition: misc.c:3284
    SCIP_RETCODE SCIPhashmapCreate(SCIP_HASHMAP **hashmap, BMS_BLKMEM *blkmem, int mapsize)
    Definition: misc.c:3061
    void SCIPhashsetFree(SCIP_HASHSET **hashset, BMS_BLKMEM *blkmem)
    Definition: misc.c:3833
    void ** SCIPhashsetGetSlots(SCIP_HASHSET *hashset)
    Definition: misc.c:4051
    int SCIPhashsetGetNSlots(SCIP_HASHSET *hashset)
    Definition: misc.c:4043
    SCIP_RETCODE SCIPhashsetInsert(SCIP_HASHSET *hashset, BMS_BLKMEM *blkmem, void *element)
    Definition: misc.c:3843
    SCIP_RETCODE SCIPhashsetCreate(SCIP_HASHSET **hashset, BMS_BLKMEM *blkmem, int size)
    Definition: misc.c:3802
    void SCIPverbMessage(SCIP *scip, SCIP_VERBLEVEL msgverblevel, FILE *file, const char *formatstr,...)
    Definition: scip_message.c:225
    #define SCIPdebugMsg
    Definition: scip_message.h:78
    void SCIPwarningMessage(SCIP *scip, const char *formatstr,...)
    Definition: scip_message.c:120
    SCIP_Real SCIPrelDiff(SCIP_Real val1, SCIP_Real val2)
    Definition: misc.c:11162
    SCIP_RETCODE SCIPsetIntParam(SCIP *scip, const char *name, int value)
    Definition: scip_param.c:487
    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 SCIPconsIsTransformed(SCIP_CONS *cons)
    Definition: cons.c:8698
    const char * SCIPconsGetName(SCIP_CONS *cons)
    Definition: cons.c:8389
    SCIP_Bool SCIPconsIsModifiable(SCIP_CONS *cons)
    Definition: cons.c:8638
    SCIP_RETCODE SCIPreleaseCons(SCIP *scip, SCIP_CONS **cons)
    Definition: scip_cons.c:1173
    SCIP_Bool SCIPisExact(SCIP *scip)
    Definition: scip_exact.c:193
    SCIP_Bool SCIPlpExactIsSolved(SCIP *scip)
    Definition: scip_lpexact.c:456
    BMS_BLKMEM * SCIPblkmem(SCIP *scip)
    Definition: scip_mem.c:57
    BMS_BUFMEM * SCIPbuffer(SCIP *scip)
    Definition: scip_mem.c:72
    #define SCIPallocBufferArray(scip, ptr, num)
    Definition: scip_mem.h:124
    #define SCIPfreeBufferArray(scip, ptr)
    Definition: scip_mem.h:136
    SCIP_Bool SCIPisNLPConstructed(SCIP *scip)
    Definition: scip_nlp.c:110
    SCIP_Real SCIPrationalGetReal(SCIP_RATIONAL *rational)
    Definition: rational.cpp:2084
    SCIP_RETCODE SCIPrationalCreateString(BMS_BLKMEM *mem, SCIP_RATIONAL **rational, const char *desc)
    Definition: rational.cpp:797
    SCIP_Bool SCIPrationalIsString(const char *desc)
    Definition: rational.cpp:653
    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
    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
    void SCIPrationalFreeBuffer(BMS_BUFMEM *bufmem, SCIP_RATIONAL **rational)
    Definition: rational.cpp:474
    SCIP_RETCODE SCIPrationalCreateBuffer(BMS_BUFMEM *bufmem, SCIP_RATIONAL **rational)
    Definition: rational.cpp:124
    void SCIPrationalSetRational(SCIP_RATIONAL *res, SCIP_RATIONAL *src)
    Definition: rational.cpp:570
    int SCIPrationalStrLen(SCIP_RATIONAL *rational)
    Definition: rational.cpp:1775
    SCIP_RETCODE SCIPcheckSolOrig(SCIP *scip, SCIP_SOL *sol, SCIP_Bool *feasible, SCIP_Bool printreason, SCIP_Bool completely)
    Definition: scip_sol.c:4387
    SCIP_SOL * SCIPgetBestSol(SCIP *scip)
    Definition: scip_sol.c:2988
    SCIP_RETCODE SCIPcreateSol(SCIP *scip, SCIP_SOL **sol, SCIP_HEUR *heur)
    Definition: scip_sol.c:516
    SCIP_SOLORIGIN SCIPsolGetOrigin(SCIP_SOL *sol)
    Definition: sol.c:4145
    SCIP_RETCODE SCIPlinkPseudoSol(SCIP *scip, SCIP_SOL *sol)
    Definition: scip_sol.c:1418
    int SCIPgetSolRunnum(SCIP *scip, SCIP_SOL *sol)
    Definition: scip_sol.c:2193
    SCIP_RETCODE SCIPreadSolFile(SCIP *scip, const char *filename, SCIP_SOL *sol, SCIP_Bool xml, SCIP_Bool *partial, SCIP_Bool *error)
    Definition: scip_sol.c:3809
    SCIP_RETCODE SCIPcreateUnknownSol(SCIP *scip, SCIP_SOL **sol, SCIP_HEUR *heur)
    Definition: scip_sol.c:799
    SCIP_RETCODE SCIPprintTransSol(SCIP *scip, SCIP_SOL *sol, FILE *file, SCIP_Bool printzeros)
    Definition: scip_sol.c:2525
    SCIP_Real SCIPsolGetOrigObj(SCIP_SOL *sol)
    Definition: sol.c:4185
    SCIP_RETCODE SCIPcreateSolCopy(SCIP *scip, SCIP_SOL **sol, SCIP_SOL *sourcesol)
    Definition: scip_sol.c:884
    void SCIPupdateSolIntegralityViolation(SCIP *scip, SCIP_SOL *sol, SCIP_Real absviol)
    Definition: scip_sol.c:406
    SCIP_RETCODE SCIPprintBestSol(SCIP *scip, FILE *file, SCIP_Bool printzeros)
    Definition: scip_sol.c:3054
    SCIP_SOL ** SCIPgetPartialSols(SCIP *scip)
    Definition: scip_sol.c:4270
    void SCIPupdateSolLPRowViolation(SCIP *scip, SCIP_SOL *sol, SCIP_Real absviol, SCIP_Real relviol)
    Definition: scip_sol.c:437
    SCIP_RETCODE SCIPfreeSol(SCIP *scip, SCIP_SOL **sol)
    Definition: scip_sol.c:1252
    SCIP_HEUR * SCIPgetSolHeur(SCIP *scip, SCIP_SOL *sol)
    Definition: scip_sol.c:2253
    void SCIPupdateSolBoundViolation(SCIP *scip, SCIP_SOL *sol, SCIP_Real absviol, SCIP_Real relviol)
    Definition: scip_sol.c:421
    SCIP_RETCODE SCIPaddSolFree(SCIP *scip, SCIP_SOL **sol, SCIP_Bool *stored)
    Definition: scip_sol.c:3916
    SCIP_RETCODE SCIPprintRay(SCIP *scip, SCIP_SOL *sol, FILE *file, SCIP_Bool printzeros)
    Definition: scip_sol.c:2852
    SCIP_RETCODE SCIPprintSol(SCIP *scip, SCIP_SOL *sol, FILE *file, SCIP_Bool printzeros)
    Definition: scip_sol.c:2353
    SCIP_RETCODE SCIPtrySolFreeExact(SCIP *scip, SCIP_SOL **sol, SCIP_Bool printreason, SCIP_Bool completely, SCIP_Bool checkbounds, SCIP_Bool checkintegrality, SCIP_Bool checklprows, SCIP_Bool *stored)
    Definition: scip_sol.c:4527
    SCIP_RETCODE SCIPsetSolValExact(SCIP *scip, SCIP_SOL *sol, SCIP_VAR *var, SCIP_RATIONAL *val)
    Definition: scip_sol.c:1616
    SCIP_Real SCIPsolGetTime(SCIP_SOL *sol)
    Definition: sol.c:4234
    SCIP_RETCODE SCIPcreateCurrentSol(SCIP *scip, SCIP_SOL **sol, SCIP_HEUR *heur)
    Definition: scip_sol.c:749
    SCIP_RETCODE SCIPgetDualSolVal(SCIP *scip, SCIP_CONS *cons, SCIP_Real *dualsolval, SCIP_Bool *boundconstraint)
    Definition: scip_sol.c:2627
    void SCIPgetSolValExact(SCIP *scip, SCIP_SOL *sol, SCIP_VAR *var, SCIP_RATIONAL *res)
    Definition: scip_sol.c:1803
    SCIP_Bool SCIPareSolsEqual(SCIP *scip, SCIP_SOL *sol1, SCIP_SOL *sol2)
    Definition: scip_sol.c:2284
    SCIP_RETCODE SCIPclearSol(SCIP *scip, SCIP_SOL *sol)
    Definition: scip_sol.c:1475
    SCIP_Longint SCIPsolGetNodenum(SCIP_SOL *sol)
    Definition: sol.c:4254
    SCIP_RETCODE SCIPcreateNLPSol(SCIP *scip, SCIP_SOL **sol, SCIP_HEUR *heur)
    Definition: scip_sol.c:664
    SCIP_Real SCIPtransformObj(SCIP *scip, SCIP_Real obj)
    Definition: scip_sol.c:2111
    SCIP_RETCODE SCIPoverwriteFPsol(SCIP *scip, SCIP_SOL *sol)
    Definition: scip_sol.c:4496
    int SCIPgetNPartialSols(SCIP *scip)
    Definition: scip_sol.c:4292
    int SCIPgetNSols(SCIP *scip)
    Definition: scip_sol.c:2889
    SCIP_HEUR * SCIPsolGetHeur(SCIP_SOL *sol)
    Definition: sol.c:4274
    SCIP_RETCODE SCIPcreateLPSol(SCIP *scip, SCIP_SOL **sol, SCIP_HEUR *heur)
    Definition: scip_sol.c:608
    SCIP_RETCODE SCIPlinkCurrentSol(SCIP *scip, SCIP_SOL *sol)
    Definition: scip_sol.c:1441
    SCIP_RETCODE SCIPcreateFiniteSolCopy(SCIP *scip, SCIP_SOL **sol, SCIP_SOL *sourcesol, SCIP_Bool *success)
    Definition: scip_sol.c:1116
    SCIP_RETCODE SCIPprintBestTransSol(SCIP *scip, FILE *file, SCIP_Bool printzeros)
    Definition: scip_sol.c:3094
    SCIP_RETCODE SCIPadjustImplicitSolVals(SCIP *scip, SCIP_SOL *sol, SCIP_Bool uselprows)
    Definition: scip_sol.c:2309
    SCIP_RETCODE SCIPaddCurrentSol(SCIP *scip, SCIP_HEUR *heur, SCIP_Bool *stored)
    Definition: scip_sol.c:3979
    SCIP_RETCODE SCIPcreateOrigSol(SCIP *scip, SCIP_SOL **sol, SCIP_HEUR *heur)
    Definition: scip_sol.c:831
    SCIP_RETCODE SCIPlinkLPSolExact(SCIP *scip, SCIP_SOL *sol)
    Definition: scip_sol.c:1324
    SCIP_RETCODE SCIPunlinkSol(SCIP *scip, SCIP_SOL *sol)
    Definition: scip_sol.c:1506
    SCIP_Bool SCIPsolIsOriginal(SCIP_SOL *sol)
    Definition: sol.c:4155
    SCIP_RETCODE SCIPcreateRelaxSol(SCIP *scip, SCIP_SOL **sol, SCIP_HEUR *heur)
    Definition: scip_sol.c:699
    SCIP_RETCODE SCIPprintMIPStart(SCIP *scip, SCIP_SOL *sol, FILE *file)
    Definition: scip_sol.c:2584
    SCIP_RETCODE SCIPreadSol(SCIP *scip, const char *filename)
    Definition: scip_sol.c:3313
    SCIP_RETCODE SCIPgetSolVals(SCIP *scip, SCIP_SOL *sol, int nvars, SCIP_VAR **vars, SCIP_Real *vals)
    Definition: scip_sol.c:1846
    SCIP_RETCODE SCIPrecomputeSolObj(SCIP *scip, SCIP_SOL *sol)
    Definition: scip_sol.c:2077
    SCIP_RETCODE SCIPaddSol(SCIP *scip, SCIP_SOL *sol, SCIP_Bool *stored)
    Definition: scip_sol.c:3849
    SCIP_RETCODE SCIPincSolVal(SCIP *scip, SCIP_SOL *sol, SCIP_VAR *var, SCIP_Real incval)
    Definition: scip_sol.c:1719
    SCIP_RETCODE SCIPcreateSolCopyOrig(SCIP *scip, SCIP_SOL **sol, SCIP_SOL *sourcesol)
    Definition: scip_sol.c:924
    SCIP_RETCODE SCIPlinkNLPSol(SCIP *scip, SCIP_SOL *sol)
    Definition: scip_sol.c:1353
    SCIP_RETCODE SCIProundSol(SCIP *scip, SCIP_SOL *sol, SCIP_Bool *success)
    Definition: scip_sol.c:3130
    SCIP_RETCODE SCIPcreatePartialSol(SCIP *scip, SCIP_SOL **sol, SCIP_HEUR *heur)
    Definition: scip_sol.c:771
    SCIP_Longint SCIPgetSolNodenum(SCIP *scip, SCIP_SOL *sol)
    Definition: scip_sol.c:2223
    SCIP_Bool SCIPsolIsPartial(SCIP_SOL *sol)
    Definition: sol.c:4175
    SCIP_Real SCIPgetPrimalRayVal(SCIP *scip, SCIP_VAR *var)
    Definition: scip_sol.c:4452
    void SCIPgetSolTransObjExact(SCIP *scip, SCIP_SOL *sol, SCIP_RATIONAL *res)
    Definition: scip_sol.c:2042
    SCIP_RETCODE SCIPsetSolVals(SCIP *scip, SCIP_SOL *sol, int nvars, SCIP_VAR **vars, SCIP_Real *vals)
    Definition: scip_sol.c:1662
    void SCIPupdateSolConsViolation(SCIP *scip, SCIP_SOL *sol, SCIP_Real absviol, SCIP_Real relviol)
    Definition: scip_sol.c:453
    SCIP_SOL ** SCIPgetSols(SCIP *scip)
    Definition: scip_sol.c:2938
    SCIP_Bool SCIPhasPrimalRay(SCIP *scip)
    Definition: scip_sol.c:4434
    SCIP_RETCODE SCIPlinkRelaxSol(SCIP *scip, SCIP_SOL *sol)
    Definition: scip_sol.c:1388
    int SCIPsolGetRunnum(SCIP_SOL *sol)
    Definition: sol.c:4244
    SCIP_RETCODE SCIPtrySol(SCIP *scip, SCIP_SOL *sol, SCIP_Bool printreason, SCIP_Bool completely, SCIP_Bool checkbounds, SCIP_Bool checkintegrality, SCIP_Bool checklprows, SCIP_Bool *stored)
    Definition: scip_sol.c:4019
    SCIP_RETCODE SCIPcheckSol(SCIP *scip, SCIP_SOL *sol, SCIP_Bool printreason, SCIP_Bool completely, SCIP_Bool checkbounds, SCIP_Bool checkintegrality, SCIP_Bool checklprows, SCIP_Bool *feasible)
    Definition: scip_sol.c:4319
    SCIP_Bool SCIPisDualSolAvailable(SCIP *scip, SCIP_Bool printreason)
    Definition: scip_sol.c:2756
    SCIP_RETCODE SCIPtrySolFree(SCIP *scip, SCIP_SOL **sol, SCIP_Bool printreason, SCIP_Bool completely, SCIP_Bool checkbounds, SCIP_Bool checkintegrality, SCIP_Bool checklprows, SCIP_Bool *stored)
    Definition: scip_sol.c:4116
    SCIP_RETCODE SCIPlinkLPSol(SCIP *scip, SCIP_SOL *sol)
    Definition: scip_sol.c:1295
    SCIP_Real SCIPgetSolOrigObj(SCIP *scip, SCIP_SOL *sol)
    Definition: scip_sol.c:1892
    SCIP_RETCODE SCIPretransformSol(SCIP *scip, SCIP_SOL *sol)
    Definition: scip_sol.c:3189
    SCIP_Real SCIPgetSolTime(SCIP *scip, SCIP_SOL *sol)
    Definition: scip_sol.c:2163
    SCIP_RETCODE SCIPcreateLPSolExact(SCIP *scip, SCIP_SOL **sol, SCIP_HEUR *heur)
    Definition: scip_sol.c:636
    void SCIPdeactivateSolViolationUpdates(SCIP *scip)
    Definition: scip_sol.c:493
    SCIP_RETCODE SCIPsetSolVal(SCIP *scip, SCIP_SOL *sol, SCIP_VAR *var, SCIP_Real val)
    Definition: scip_sol.c:1571
    SCIP_Real SCIPgetSolVal(SCIP *scip, SCIP_SOL *sol, SCIP_VAR *var)
    Definition: scip_sol.c:1765
    void SCIPactivateSolViolationUpdates(SCIP *scip)
    Definition: scip_sol.c:485
    SCIP_Real SCIPgetSolTransObj(SCIP *scip, SCIP_SOL *sol)
    Definition: scip_sol.c:2005
    void SCIPupdateSolLPConsViolation(SCIP *scip, SCIP_SOL *sol, SCIP_Real absviol, SCIP_Real relviol)
    Definition: scip_sol.c:469
    SCIP_RETCODE SCIPupdatePrimalRay(SCIP *scip, SCIP_SOL *primalray)
    Definition: scip_sol.c:4480
    SCIP_Real SCIPretransformObj(SCIP *scip, SCIP_Real obj)
    Definition: scip_sol.c:2136
    SCIP_RETCODE SCIPprintSolExact(SCIP *scip, SCIP_SOL *sol, FILE *file, SCIP_Bool printzeros)
    Definition: scip_sol.c:2428
    SCIP_RETCODE SCIPcreateSolExact(SCIP *scip, SCIP_SOL **sol, SCIP_HEUR *heur)
    Definition: scip_sol.c:566
    SCIP_RETCODE SCIPcreatePseudoSol(SCIP *scip, SCIP_SOL **sol, SCIP_HEUR *heur)
    Definition: scip_sol.c:726
    SCIP_RETCODE SCIPmakeSolExact(SCIP *scip, SCIP_SOL *sol)
    Definition: scip_sol.c:3153
    void SCIPgetSolOrigObjExact(SCIP *scip, SCIP_SOL *sol, SCIP_RATIONAL *res)
    Definition: scip_sol.c:1940
    SCIP_RETCODE SCIPretransformSolExact(SCIP *scip, SCIP_SOL *sol)
    Definition: scip_sol.c:3252
    SCIP_RETCODE SCIPprintDualSol(SCIP *scip, FILE *file, SCIP_Bool printzeros)
    Definition: scip_sol.c:2819
    SCIP_Bool SCIPsolIsExact(SCIP_SOL *sol)
    Definition: sol.c:4165
    SCIP_RETCODE SCIPtryCurrentSol(SCIP *scip, SCIP_HEUR *heur, SCIP_Bool printreason, SCIP_Bool completely, SCIP_Bool checkintegrality, SCIP_Bool checklprows, SCIP_Bool *stored)
    Definition: scip_sol.c:4214
    SCIP_RETCODE SCIPunlinkSolExact(SCIP *scip, SCIP_SOL *sol)
    Definition: scip_sol.c:1537
    SCIP_RETCODE SCIPsolve(SCIP *scip)
    Definition: scip_solve.c:2628
    void SCIPstoreSolutionGap(SCIP *scip)
    SCIP_Real SCIPinfinity(SCIP *scip)
    void SCIPprintReal(SCIP *scip, FILE *file, SCIP_Real val, int width, int precision)
    SCIP_Bool SCIPisInfinity(SCIP *scip, SCIP_Real val)
    SCIP_Bool SCIPisFeasLT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
    SCIP_Bool SCIPisFeasGT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
    SCIP_Bool SCIPisEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
    SCIP_Bool SCIPisZero(SCIP *scip, SCIP_Real val)
    SCIP_Real SCIPepsilon(SCIP *scip)
    SCIP_Real SCIPvarGetSol(SCIP_VAR *var, SCIP_Bool getlpval)
    Definition: var.c:19007
    SCIP_VARSTATUS SCIPvarGetStatus(SCIP_VAR *var)
    Definition: var.c:23386
    SCIP_Real SCIPvarGetUbLocal(SCIP_VAR *var)
    Definition: var.c:24268
    SCIP_Real SCIPvarGetLbOriginal(SCIP_VAR *var)
    Definition: var.c:24020
    SCIP_Bool SCIPvarIsTransformed(SCIP_VAR *var)
    Definition: var.c:23430
    SCIP_VAR * SCIPvarGetProbvar(SCIP_VAR *var)
    Definition: var.c:17550
    SCIP_Real SCIPvarGetUbGlobal(SCIP_VAR *var)
    Definition: var.c:24142
    SCIP_RATIONAL * SCIPvarGetLbOriginalExact(SCIP_VAR *var)
    Definition: var.c:24040
    SCIP_RATIONAL * SCIPvarGetUbOriginalExact(SCIP_VAR *var)
    Definition: var.c:24083
    const char * SCIPvarGetName(SCIP_VAR *var)
    Definition: var.c:23267
    SCIP_Real SCIPvarGetUbOriginal(SCIP_VAR *var)
    Definition: var.c:24063
    SCIP_RETCODE SCIPreleaseVar(SCIP *scip, SCIP_VAR **var)
    Definition: scip_var.c:1887
    SCIP_RETCODE SCIPchgVarType(SCIP *scip, SCIP_VAR *var, SCIP_VARTYPE vartype, SCIP_Bool *infeasible)
    Definition: scip_var.c:10113
    SCIP_Real SCIPvarGetLPSol(SCIP_VAR *var)
    Definition: var.c:24664
    void SCIPvarGetSolExact(SCIP_VAR *var, SCIP_RATIONAL *res, SCIP_Bool getlpval)
    Definition: var.c:19019
    SCIP_Real SCIPvarGetLbLocal(SCIP_VAR *var)
    Definition: var.c:24234
    SCIP_RETCODE SCIPcreateVar(SCIP *scip, SCIP_VAR **var, const char *name, SCIP_Real lb, SCIP_Real ub, SCIP_Real obj, SCIP_VARTYPE vartype, SCIP_Bool initial, SCIP_Bool removable, SCIP_DECL_VARDELORIG((*vardelorig)), SCIP_DECL_VARTRANS((*vartrans)), SCIP_DECL_VARDELTRANS((*vardeltrans)), SCIP_DECL_VARCOPY((*varcopy)), SCIP_VARDATA *vardata)
    Definition: scip_var.c:120
    SCIP_Real SCIPgetVarRedcost(SCIP *scip, SCIP_VAR *var)
    Definition: scip_var.c:2608
    SCIP_Real SCIPvarGetLbGlobal(SCIP_VAR *var)
    Definition: var.c:24120
    SCIP_RETCODE SCIPfixVar(SCIP *scip, SCIP_VAR *var, SCIP_Real fixedval, SCIP_Bool *infeasible, SCIP_Bool *fixed)
    Definition: scip_var.c:10318
    SCIP_RETCODE SCIPgetVarSols(SCIP *scip, int nvars, SCIP_VAR **vars, SCIP_Real *vals)
    Definition: scip_var.c:3071
    SCIP_RETCODE SCIPchgVarObj(SCIP *scip, SCIP_VAR *var, SCIP_Real newobj)
    Definition: scip_var.c:5372
    int SCIPsnprintf(char *t, int len, const char *s,...)
    Definition: misc.c:10827
    SCIP_Bool SCIPstrToRealValue(const char *str, SCIP_Real *value, char **endptr)
    Definition: misc.c:10955
    void SCIPprintSysError(const char *message)
    Definition: misc.c:10719
    int SCIPstrncasecmp(const char *s1, const char *s2, int length)
    Definition: misc.c:10876
    char * SCIPstrtok(char *s, const char *delim, char **ptrptr)
    Definition: misc.c:10768
    SCIP_Real SCIPlpGetObjval(SCIP_LP *lp, SCIP_SET *set, SCIP_PROB *prob)
    Definition: lp.c:13436
    SCIP_Bool SCIPlpIsSolved(SCIP_LP *lp)
    Definition: lp.c:18211
    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
    memory allocation routines
    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
    void SCIPmessagehdlrSetQuiet(SCIP_MESSAGEHDLR *messagehdlr, SCIP_Bool quiet)
    Definition: message.c:411
    SCIP_Bool SCIPmessagehdlrIsQuiet(SCIP_MESSAGEHDLR *messagehdlr)
    Definition: message.c:910
    SCIP_Bool SCIPnlpHasSolution(SCIP_NLP *nlp)
    Definition: nlp.c:4544
    SCIP_NLPSOLSTAT SCIPnlpGetSolstat(SCIP_NLP *nlp)
    Definition: nlp.c:4503
    internal methods for NLP management
    SCIP_RETCODE SCIPprimalAddCurrentSol(SCIP_PRIMAL *primal, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, SCIP_STAT *stat, SCIP_PROB *origprob, SCIP_PROB *transprob, SCIP_TREE *tree, SCIP_REOPT *reopt, SCIP_LP *lp, SCIP_EVENTQUEUE *eventqueue, SCIP_EVENTFILTER *eventfilter, SCIP_HEUR *heur, SCIP_Bool *stored)
    Definition: primal.c:1793
    void SCIPprimalSetUpdateViolations(SCIP_PRIMAL *primal, SCIP_Bool updateviolations)
    Definition: primal.c:2311
    SCIP_RETCODE SCIPprimalUpdateRay(SCIP_PRIMAL *primal, SCIP_SET *set, SCIP_STAT *stat, SCIP_SOL *primalray, BMS_BLKMEM *blkmem)
    Definition: primal.c:810
    SCIP_RETCODE SCIPprimalTrySolFreeExact(SCIP_PRIMAL *primal, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, SCIP_STAT *stat, SCIP_PROB *origprob, SCIP_PROB *transprob, SCIP_TREE *tree, SCIP_REOPT *reopt, SCIP_LPEXACT *lpexact, SCIP_EVENTQUEUE *eventqueue, SCIP_EVENTFILTER *eventfilter, SCIP_SOL **sol, SCIP_Bool printreason, SCIP_Bool completely, SCIP_Bool checkbounds, SCIP_Bool checkintegrality, SCIP_Bool checklprows, SCIP_Bool *stored)
    Definition: primal.c:2382
    SCIP_RETCODE SCIPprimalAddOrigSolFree(SCIP_PRIMAL *primal, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *prob, SCIP_SOL **sol, SCIP_Bool *stored)
    Definition: primal.c:1709
    SCIP_RETCODE SCIPprimalTryCurrentSol(SCIP_PRIMAL *primal, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, SCIP_STAT *stat, SCIP_PROB *origprob, SCIP_PROB *transprob, SCIP_TREE *tree, SCIP_REOPT *reopt, SCIP_LP *lp, SCIP_EVENTQUEUE *eventqueue, SCIP_EVENTFILTER *eventfilter, SCIP_HEUR *heur, SCIP_Bool printreason, SCIP_Bool completely, SCIP_Bool checkintegrality, SCIP_Bool checklprows, SCIP_Bool *stored)
    Definition: primal.c:1967
    SCIP_RETCODE SCIPprimalTrySolFree(SCIP_PRIMAL *primal, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, SCIP_STAT *stat, SCIP_PROB *origprob, SCIP_PROB *transprob, SCIP_TREE *tree, SCIP_REOPT *reopt, SCIP_LP *lp, SCIP_EVENTQUEUE *eventqueue, SCIP_EVENTFILTER *eventfilter, SCIP_SOL **sol, SCIP_Bool printreason, SCIP_Bool completely, SCIP_Bool checkbounds, SCIP_Bool checkintegrality, SCIP_Bool checklprows, SCIP_Bool *stored)
    Definition: primal.c:1893
    SCIP_Bool SCIPprimalUpdateViolations(SCIP_PRIMAL *primal)
    Definition: primal.c:2301
    SCIP_RETCODE SCIPprimalAddOrigSol(SCIP_PRIMAL *primal, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *prob, SCIP_SOL *sol, SCIP_Bool *stored)
    Definition: primal.c:1654
    SCIP_RETCODE SCIPprimalTrySol(SCIP_PRIMAL *primal, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, SCIP_STAT *stat, SCIP_PROB *origprob, SCIP_PROB *transprob, SCIP_TREE *tree, SCIP_REOPT *reopt, SCIP_LP *lp, SCIP_EVENTQUEUE *eventqueue, SCIP_EVENTFILTER *eventfilter, SCIP_SOL *sol, SCIP_Bool printreason, SCIP_Bool completely, SCIP_Bool checkbounds, SCIP_Bool checkintegrality, SCIP_Bool checklprows, SCIP_Bool *stored)
    Definition: primal.c:1823
    SCIP_RETCODE SCIPprimalAddSolFree(SCIP_PRIMAL *primal, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, SCIP_STAT *stat, SCIP_PROB *origprob, SCIP_PROB *transprob, SCIP_TREE *tree, SCIP_REOPT *reopt, SCIP_LP *lp, SCIP_EVENTQUEUE *eventqueue, SCIP_EVENTFILTER *eventfilter, SCIP_SOL **sol, SCIP_Bool *stored)
    Definition: primal.c:1599
    SCIP_RETCODE SCIPprimalAddSol(SCIP_PRIMAL *primal, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, SCIP_STAT *stat, SCIP_PROB *origprob, SCIP_PROB *transprob, SCIP_TREE *tree, SCIP_REOPT *reopt, SCIP_LP *lp, SCIP_EVENTQUEUE *eventqueue, SCIP_EVENTFILTER *eventfilter, SCIP_SOL *sol, SCIP_Bool *stored)
    Definition: primal.c:1523
    SCIP_RETCODE SCIPprimalAddSolFreeExact(SCIP_PRIMAL *primal, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, SCIP_STAT *stat, SCIP_PROB *origprob, SCIP_PROB *transprob, SCIP_TREE *tree, SCIP_REOPT *reopt, SCIP_LPEXACT *lpexact, SCIP_EVENTQUEUE *eventqueue, SCIP_EVENTFILTER *eventfilter, SCIP_SOL **sol, SCIP_Bool *stored)
    Definition: primal.c:2449
    internal methods for collecting primal CIP solutions and primal informations
    SCIP_Real SCIPprobExternObjval(SCIP_PROB *transprob, SCIP_PROB *origprob, SCIP_SET *set, SCIP_Real objval)
    Definition: prob.c:2520
    void SCIPprobExternObjvalExact(SCIP_PROB *transprob, SCIP_PROB *origprob, SCIP_SET *set, SCIP_RATIONAL *objval, SCIP_RATIONAL *objvalext)
    Definition: prob.c:2546
    SCIP_Real SCIPprobInternObjval(SCIP_PROB *transprob, SCIP_PROB *origprob, SCIP_SET *set, SCIP_Real objval)
    Definition: prob.c:2573
    internal methods for storing and manipulating the main problem
    public methods for managing constraints
    wrapper functions to map file i/o to standard or zlib file i/o
    struct SCIP_File SCIP_FILE
    Definition: pub_fileio.h:43
    public methods for message output
    #define SCIPerrorMessage
    Definition: pub_message.h:64
    public data structures and miscellaneous methods
    public methods for primal CIP solutions
    public methods for problem variables
    SCIP_Bool SCIPrelaxationIsSolValid(SCIP_RELAXATION *relaxation)
    Definition: relax.c:823
    internal methods for relaxators
    public methods for constraint handler plugins and constraints
    public methods for problem copies
    public methods for exact solving
    general public methods
    public methods for the LP relaxation, rows and columns
    public methods for memory management
    public methods for message handling
    public methods for nonlinear relaxation
    public methods for numerical tolerances
    public methods for SCIP parameter handling
    public methods for global and local (sub)problems
    static SCIP_RETCODE checkSolOrig(SCIP *scip, SCIP_SOL *sol, SCIP_Bool *feasible, SCIP_Bool printreason, SCIP_Bool completely, SCIP_Bool checkbounds, SCIP_Bool checkintegrality, SCIP_Bool checklprows, SCIP_Bool checkmodifiable)
    Definition: scip_sol.c:101
    static SCIP_RETCODE printDualSol(SCIP *scip, FILE *file, SCIP_Bool printzeros)
    Definition: scip_sol.c:2700
    static SCIP_RETCODE checkSolOrigExact(SCIP *scip, SCIP_SOL *sol, SCIP_Bool *feasible, SCIP_Bool printreason, SCIP_Bool completely, SCIP_Bool checkbounds, SCIP_Bool checkintegrality, SCIP_Bool checklprows, SCIP_Bool checkmodifiable)
    Definition: scip_sol.c:255
    static SCIP_RETCODE readSolFile(SCIP *scip, const char *filename, SCIP_SOL *sol, SCIP_Bool *partial, SCIP_Bool *error)
    Definition: scip_sol.c:3328
    static SCIP_RETCODE setupAndSolveFiniteSolSubscip(SCIP *scip, SCIP *subscip, SCIP_VAR **origvars, int norigvars, SCIP_Real *solvals, SCIP_Bool *success)
    Definition: scip_sol.c:965
    static SCIP_RETCODE readXmlSolFile(SCIP *scip, const char *filename, SCIP_SOL *sol, SCIP_Bool *partial, SCIP_Bool *error)
    Definition: scip_sol.c:3562
    public methods for solutions
    public solving methods
    public methods for querying solving statistics
    public methods for SCIP variables
    SCIP_Bool SCIPsetIsFeasGT(SCIP_SET *set, SCIP_Real val1, SCIP_Real val2)
    Definition: set.c:7017
    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
    internal methods for global SCIP settings
    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
    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
    void SCIPsolGetValExact(SCIP_RATIONAL *res, SCIP_SOL *sol, SCIP_SET *set, SCIP_STAT *stat, SCIP_VAR *var)
    Definition: sol.c:2043
    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
    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
    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
    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
    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
    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 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 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 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
    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
    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
    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
    internal methods for storing primal CIP solutions
    SCIP * scip
    Definition: struct_sol.h:101
    SCIP * scip
    Definition: struct_var.h:345
    data structures for LP management
    datastructures for block memory pools and memory buffers
    datastructures for collecting primal CIP solutions and primal informations
    datastructures for storing and manipulating the main problem
    SCIP main data structure.
    datastructures for global SCIP settings
    datastructures for storing primal CIP solutions
    datastructures for problem statistics
    datastructures for problem variables
    SCIP_Bool SCIPtreeHasCurrentNodeLP(SCIP_TREE *tree)
    Definition: tree.c:9535
    internal methods for branch and bound tree
    @ SCIP_VERBLEVEL_NONE
    Definition: type_message.h:57
    @ SCIP_VERBLEVEL_NORMAL
    Definition: type_message.h:60
    @ SCIP_NLPSOLSTAT_FEASIBLE
    Definition: type_nlpi.h:162
    @ SCIP_OBJSENSE_MAXIMIZE
    Definition: type_prob.h:47
    @ SCIP_FEASIBLE
    Definition: type_result.h:45
    enum SCIP_Result SCIP_RESULT
    Definition: type_result.h:61
    @ SCIP_NOFILE
    Definition: type_retcode.h:47
    @ SCIP_READERROR
    Definition: type_retcode.h:45
    @ SCIP_INVALIDDATA
    Definition: type_retcode.h:52
    @ SCIP_OKAY
    Definition: type_retcode.h:42
    @ SCIP_INVALIDCALL
    Definition: type_retcode.h:51
    @ SCIP_ERROR
    Definition: type_retcode.h:43
    enum SCIP_Retcode SCIP_RETCODE
    Definition: type_retcode.h:63
    @ SCIP_STAGE_PROBLEM
    Definition: type_set.h:45
    @ SCIP_STAGE_INITPRESOLVE
    Definition: type_set.h:48
    @ SCIP_STAGE_SOLVED
    Definition: type_set.h:54
    @ SCIP_STAGE_PRESOLVING
    Definition: type_set.h:49
    @ SCIP_STAGE_TRANSFORMED
    Definition: type_set.h:47
    @ SCIP_STAGE_INITSOLVE
    Definition: type_set.h:52
    @ SCIP_STAGE_EXITPRESOLVE
    Definition: type_set.h:50
    @ SCIP_STAGE_EXITSOLVE
    Definition: type_set.h:55
    @ SCIP_STAGE_INIT
    Definition: type_set.h:44
    @ SCIP_STAGE_FREE
    Definition: type_set.h:57
    @ SCIP_STAGE_FREETRANS
    Definition: type_set.h:56
    @ SCIP_STAGE_SOLVING
    Definition: type_set.h:53
    @ SCIP_STAGE_TRANSFORMING
    Definition: type_set.h:46
    @ SCIP_STAGE_PRESOLVED
    Definition: type_set.h:51
    @ 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
    @ SCIP_VARTYPE_CONTINUOUS
    Definition: type_var.h:71
    @ SCIP_VARSTATUS_FIXED
    Definition: type_var.h:54
    @ SCIP_VARSTATUS_MULTAGGR
    Definition: type_var.h:56
    declarations for XML parsing
    const char * SCIPxmlGetAttrval(const XML_NODE *node, const char *name)
    Definition: xmlparse.c:1333
    const XML_NODE * SCIPxmlFirstChild(const XML_NODE *node)
    Definition: xmlparse.c:1465
    const XML_NODE * SCIPxmlFindNodeMaxdepth(const XML_NODE *node, const char *name, int depth, int maxdepth)
    Definition: xmlparse.c:1415
    const XML_NODE * SCIPxmlNextSibl(const XML_NODE *node)
    Definition: xmlparse.c:1445
    void SCIPxmlFreeNode(XML_NODE *node)
    Definition: xmlparse.c:1271
    struct XML_NODE_struct XML_NODE
    Definition: xml.h:50
    XML_NODE * SCIPxmlProcess(const char *filename)
    Definition: xmlparse.c:1089