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