Scippy

    SCIP

    Solving Constraint Integer Programs

    scip_general.c
    Go to the documentation of this file.
    1/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
    2/* */
    3/* This file is part of the program and library */
    4/* SCIP --- Solving Constraint Integer Programs */
    5/* */
    6/* Copyright (c) 2002-2025 Zuse Institute Berlin (ZIB) */
    7/* */
    8/* Licensed under the Apache License, Version 2.0 (the "License"); */
    9/* you may not use this file except in compliance with the License. */
    10/* You may obtain a copy of the License at */
    11/* */
    12/* http://www.apache.org/licenses/LICENSE-2.0 */
    13/* */
    14/* Unless required by applicable law or agreed to in writing, software */
    15/* distributed under the License is distributed on an "AS IS" BASIS, */
    16/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
    17/* See the License for the specific language governing permissions and */
    18/* limitations under the License. */
    19/* */
    20/* You should have received a copy of the Apache-2.0 license */
    21/* along with SCIP; see the file LICENSE. If not visit scipopt.org. */
    22/* */
    23/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
    24
    25/**@file scip_general.c
    26 * @ingroup OTHER_CFILES
    27 * @brief general public methods
    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 "lpi/lpi.h"
    47#include "lpiexact/lpiexact.h"
    48#include "scip/exprinterpret.h"
    49#include "scip/clock.h"
    50#include "scip/debug.h"
    51#include "scip/dialog.h"
    52#include "scip/iisfinder.h"
    53#include "scip/interrupt.h"
    54#include "scip/mem.h"
    56#include "scip/nlp.h"
    57#include "scip/pub_message.h"
    58#include "scip/retcode.h"
    59#include "scip/scipbuildflags.h"
    61#include "scip/scip_general.h"
    62#include "scip/scipgithash.h"
    63#include "scip/scip_mem.h"
    64#include "scip/scip_message.h"
    65#include "scip/scip_numerics.h"
    66#include "scip/scip_prob.h"
    68#include "scip/set.h"
    69#include "scip/solve.h"
    70#include "scip/struct_mem.h"
    71#include "scip/struct_primal.h"
    72#include "scip/struct_prob.h"
    73#include "scip/struct_scip.h"
    74#include "scip/struct_set.h"
    75#include "scip/struct_stat.h"
    76#include "scip/syncstore.h"
    77#include "scip/lapack_calls.h"
    78#include "tpi/tpi.h"
    79
    80#include <string.h>
    81#ifndef _WIN32
    82#include <strings.h> /*lint --e{766}*/
    83#endif
    84
    85#ifdef SCIP_WITH_MPFR
    86#include <mpfr.h>
    87#endif
    88
    89#ifdef SCIP_WITH_ZLIB
    90#include <zlib.h>
    91#endif
    92
    93#ifdef SCIP_WITH_BOOST
    94#include <boost/version.hpp>
    95#endif
    96
    97/* In debug mode, the following methods are implemented as function calls to ensure
    98 * type validity.
    99 * In optimized mode, the methods are implemented as defines to improve performance.
    100 * However, we want to have them in the library anyways, so we have to undef the defines.
    101 */
    102
    103#undef SCIPgetStage
    104#undef SCIPgetStatus
    105#undef SCIPhasPerformedPresolve
    106#undef SCIPisStopped
    107
    108/** returns SCIP version number as major + minor / 100
    109 *
    110 * @return SCIP major and minor version number
    111 */
    113 void
    114 )
    115{
    116 return SCIP_VERSION_MAJOR + SCIP_VERSION_MINOR/100.0; /*lint !e835*/
    117}
    118
    119/** returns SCIP major version
    120 *
    121 * @return major SCIP version
    122 */
    124 void
    125 )
    126{
    127 return SCIP_VERSION_MAJOR;
    128}
    129
    130/** returns SCIP minor version
    131 *
    132 * @return minor SCIP version
    133 */
    135 void
    136 )
    137{
    138 return SCIP_VERSION_MINOR;
    139}
    140
    141/** returns SCIP technical (or patch) version
    142 *
    143 * @return technical SCIP version
    144 */
    146 void
    147 )
    148{
    149 return SCIP_VERSION_PATCH;
    150}
    151
    152/** returns SCIP sub version number
    153 *
    154 * @return subversion SCIP version
    155 *
    156 * @deprecated SCIPsubversion() always returns 0 and will be removed in a future release.
    157 */
    159 void
    160 )
    161{
    162 return SCIP_SUBVERSION;
    163}
    164
    165/** prints a version information line to a file stream via the message handler system
    166 *
    167 * @note If the message handler is set to a NULL pointer nothing will be printed
    168 */
    170 SCIP* scip, /**< SCIP data structure */
    171 FILE* file /**< output file (or NULL for standard output) */
    172 )
    173{
    174 assert( scip != NULL );
    175
    176 SCIPmessageFPrintInfo(scip->messagehdlr, file, "SCIP version %d.%d.%d",
    178
    179 SCIPmessageFPrintInfo(scip->messagehdlr, file, " [precision: %d byte]", (int)sizeof(SCIP_Real));
    180
    181#ifndef BMS_NOBLOCKMEM
    182 SCIPmessageFPrintInfo(scip->messagehdlr, file, " [memory: block]");
    183#else
    184 SCIPmessageFPrintInfo(scip->messagehdlr, file, " [memory: standard]");
    185#endif
    186#ifndef NDEBUG
    187 SCIPmessageFPrintInfo(scip->messagehdlr, file, " [mode: debug]");
    188#else
    189 SCIPmessageFPrintInfo(scip->messagehdlr, file, " [mode: optimized]");
    190#endif
    191 SCIPmessageFPrintInfo(scip->messagehdlr, file, " [LP solver: %s]", SCIPlpiGetSolverName());
    192 SCIPmessageFPrintInfo(scip->messagehdlr, file, " [GitHash: %s]", SCIPgetGitHash());
    193 SCIPmessageFPrintInfo(scip->messagehdlr, file, "\n");
    194 SCIPmessageFPrintInfo(scip->messagehdlr, file, "%s\n", SCIP_COPYRIGHT);
    195}
    196
    197/** prints detailed information on the compile-time flags
    198 *
    199 * @note If the message handler is set to a NULL pointer nothing will be printed
    200 */
    202 SCIP* scip, /**< SCIP data structure */
    203 FILE* file /**< output file (or NULL for standard output) */
    204 )
    205{
    206 assert( scip != NULL );
    207
    208 /* compiler */
    209 SCIPmessageFPrintInfo(scip->messagehdlr, file, "Compiler: ");
    210#if defined(__INTEL_COMPILER)
    211 SCIPmessageFPrintInfo(scip->messagehdlr, file, "Intel %d\n", __INTEL_COMPILER);
    212#elif defined(__clang__)
    213 SCIPmessageFPrintInfo(scip->messagehdlr, file, "clang %d.%d.%d\n", __clang_major__, __clang_minor__, __clang_patchlevel__);
    214#elif defined(_MSC_VER)
    215 SCIPmessageFPrintInfo(scip->messagehdlr, file, "microsoft visual c %d\n", _MSC_FULL_VER);
    216#elif defined(__GNUC__)
    217#if defined(__GNUC_PATCHLEVEL__)
    218 SCIPmessageFPrintInfo(scip->messagehdlr, file, "gcc %d.%d.%d\n", __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__);
    219#else
    220 SCIPmessageFPrintInfo(scip->messagehdlr, file, "gcc %d.%d\n", __GNUC__, __GNUC_MINOR__);
    221#endif
    222#else
    223 SCIPmessageFPrintInfo(scip->messagehdlr, file, "unknown\n");
    224#endif
    225
    226 /* build flags */
    227 SCIPmessageFPrintInfo(scip->messagehdlr, file, "\nBuild options:\n%s", SCIPgetBuildFlags());
    228}
    229
    230/** prints error message for the given SCIP_RETCODE via the error prints method */
    232 SCIP_RETCODE retcode /**< SCIP return code causing the error */
    233 )
    234{
    235 SCIPmessagePrintError("SCIP Error (%d): ", retcode);
    236 SCIPretcodePrintError(retcode);
    238}
    239
    240/*
    241 * general SCIP methods
    242 */
    243
    244/** internal method to create SCIP */
    245static
    247 SCIP** scip /**< pointer to SCIP data structure */
    248 )
    249{
    250 assert(scip != NULL);
    251
    253
    254 /* all members are initialized to NULL */
    256
    257 /* create a default message handler */
    258 SCIP_CALL( SCIPcreateMessagehdlrDefault(&(*scip)->messagehdlr, TRUE, NULL, FALSE) );
    259
    260 SCIP_CALL( SCIPmemCreate(&(*scip)->mem) );
    261 SCIP_CALL( SCIPsetCreate(&(*scip)->set, (*scip)->messagehdlr, (*scip)->mem->setmem, *scip) );
    262 SCIP_CALL( SCIPinterruptCreate(&(*scip)->interrupt) );
    263 SCIP_CALL( SCIPdialoghdlrCreate((*scip)->set, &(*scip)->dialoghdlr) );
    264 SCIP_CALL( SCIPclockCreate(&(*scip)->totaltime, SCIP_CLOCKTYPE_DEFAULT) );
    265 SCIP_CALL( SCIPsyncstoreCreate( &(*scip)->syncstore ) );
    266 SCIP_CALL( SCIPiisCreate(&(*scip)->iis, (*scip)->set, SCIPblkmem(*scip)) );
    267
    268 /* include additional core functionality */
    270
    271 SCIPclockStart((*scip)->totaltime, (*scip)->set);
    272
    273 SCIP_CALL( SCIPnlpInclude((*scip)->set, SCIPblkmem(*scip)) );
    274
    275 if( strcmp(SCIPlpiGetSolverName(), "NONE") != 0 )
    276 {
    278 }
    279 if( strcmp(SCIPexprintGetName(), "NONE") != 0 )
    280 {
    282 }
    283 if( strcmp(SCIPlpiExactGetSolverName(), "NONE") != 0 && strcmp(SCIPlpiExactGetSolverName(), SCIPlpiGetSolverName()) != 0 )
    284 {
    286 }
    287
    288#ifdef SCIP_WITH_ZLIB
    289 SCIP_CALL( SCIPsetIncludeExternalCode((*scip)->set, "ZLIB " ZLIB_VERSION, "General purpose compression library by J. Gailly and M. Adler (zlib.net)") );
    290#endif
    291
    292#ifdef SCIP_WITH_LAPACK
    293 {
    294 char name[SCIP_MAXSTRLEN];
    295 int major;
    296 int minor;
    297 int patch;
    298
    299 SCIPlapackVersion(&major, &minor, &patch);
    300 SCIPsnprintf(name, SCIP_MAXSTRLEN, "LAPACK %d.%d.%d", major, minor, patch);
    301
    302 SCIP_CALL( SCIPsetIncludeExternalCode((*scip)->set, name, "General Linear Algebra PACKage (http://www.netlib.org/lapack/)") );
    303 }
    304#endif
    305
    306 /* check whether all dependencies for exact solving mode are present */
    307#ifdef SCIP_WITH_EXACTSOLVE
    308#ifndef SCIP_WITH_GMP
    309 SCIPerrorMessage("SCIP was compiled with exact solve support, but without GMP. Please recompile SCIP with GMP.\n");
    310 return SCIP_ERROR;
    311 /* external code information for GMP added in SCIPincludeConshdlrCountsols() */
    312#endif
    313#ifndef SCIP_WITH_MPFR
    314 SCIPerrorMessage("SCIP was compiled with exact solve support, but without MPFR. Please recompile SCIP with MPFR.\n");
    315 return SCIP_ERROR;
    316#else
    317 {
    318 char name[SCIP_MAXSTRLEN];
    319
    320 (void) SCIPsnprintf(name, SCIP_MAXSTRLEN, "MPFR %s", MPFR_VERSION_STRING);
    321 SCIP_CALL( SCIPsetIncludeExternalCode((*scip)->set, name, "GNU Multiple Precision Floating-Point Reliable Library (mpfr.org)") );
    322 }
    323#endif /*lint --e{529}*/
    324#ifndef SCIP_WITH_BOOST
    325 SCIPerrorMessage("SCIP was compiled with exact solve support, but without Boost. Please recompile SCIP with Boost.\n");
    326 return SCIP_ERROR;
    327#else
    328 {
    329 char name[SCIP_MAXSTRLEN];
    330 int boost_version_major = BOOST_VERSION / 100000;
    331 int boost_version_minor = BOOST_VERSION / 100 % 1000;
    332 int boost_version_patch = BOOST_VERSION % 100; /*lint !e778*/
    333
    334 (void) SCIPsnprintf(name, SCIP_MAXSTRLEN, "Boost %d.%d.%d", boost_version_major, boost_version_minor, boost_version_patch);
    335 SCIP_CALL( SCIPsetIncludeExternalCode((*scip)->set, name, "Boost C++ Libraries (boost.org)") );
    336 }
    337#endif
    338 if( strcmp(SCIPlpiExactGetSolverName(), "NONE") == 0 )
    339 {
    340 SCIPerrorMessage("SCIP was compiled with exact solve support, but without an exact LP solver. Please recompile SCIP with an exact LP solver.\n");
    341 return SCIP_ERROR;
    342 }
    343#endif
    344
    345 if( SCIPtpiIsAvailable() )
    346 {
    347 char name[20];
    348 char desc[80];
    349 SCIPtpiGetLibraryName(name, (int)sizeof(name));
    350 SCIPtpiGetLibraryDesc(desc, (int)sizeof(desc));
    351 SCIP_CALL( SCIPsetIncludeExternalCode((*scip)->set, name, desc) );
    352 }
    353
    354 return SCIP_OKAY;
    355}
    356
    357/** creates and initializes SCIP data structures
    358 *
    359 * @note The SCIP default message handler is installed. Use the method SCIPsetMessagehdlr() to install your own
    360 * message handler or SCIPsetMessagehdlrLogfile() and SCIPsetMessagehdlrQuiet() to write into a log
    361 * file and turn off/on the display output, respectively.
    362 *
    363 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
    364 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
    365 *
    366 * @post After calling this method \SCIP reached the solving stage \ref SCIP_STAGE_INIT
    367 *
    368 * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
    369 */
    371 SCIP** scip /**< pointer to SCIP data structure */
    372 )
    373{
    374 assert(scip != NULL);
    375
    377
    378 return SCIP_OKAY;
    379}
    380
    381/** frees SCIP data structures
    382 *
    383 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
    384 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
    385 *
    386 * @pre This method can be called if @p scip is in one of the following stages:
    387 * - \ref SCIP_STAGE_INIT
    388 * - \ref SCIP_STAGE_PROBLEM
    389 * - \ref SCIP_STAGE_TRANSFORMED
    390 * - \ref SCIP_STAGE_INITPRESOLVE
    391 * - \ref SCIP_STAGE_PRESOLVING
    392 * - \ref SCIP_STAGE_PRESOLVED
    393 * - \ref SCIP_STAGE_EXITPRESOLVE
    394 * - \ref SCIP_STAGE_SOLVING
    395 * - \ref SCIP_STAGE_SOLVED
    396 * - \ref SCIP_STAGE_FREE
    397 *
    398 * @post After calling this method \SCIP reached the solving stage \ref SCIP_STAGE_FREE
    399 *
    400 * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
    401 */
    403 SCIP** scip /**< pointer to SCIP data structure */
    404 )
    405{
    406 assert(scip != NULL);
    407 if( *scip == NULL )
    408 return SCIP_OKAY;
    409
    411
    413 assert((*scip)->set->stage == SCIP_STAGE_INIT);
    414
    415 /* switch stage to FREE */
    416 (*scip)->set->stage = SCIP_STAGE_FREE;
    417
    418 SCIP_CALL( SCIPiisFree(&(*scip)->iis, SCIPblkmem(*scip)) );
    419 SCIP_CALL( SCIPsyncstoreRelease(&(*scip)->syncstore) );
    420 SCIP_CALL( SCIPsetFree(&(*scip)->set, (*scip)->mem->setmem) );
    421 SCIP_CALL( SCIPdialoghdlrFree(*scip, &(*scip)->dialoghdlr) );
    422 SCIPclockFree(&(*scip)->totaltime);
    423 SCIPinterruptFree(&(*scip)->interrupt);
    424 SCIP_CALL( SCIPmemFree(&(*scip)->mem) );
    425
    426 /* release message handler */
    427 SCIP_CALL( SCIPmessagehdlrRelease(&(*scip)->messagehdlr) );
    428
    430
    431 return SCIP_OKAY;
    432}
    433
    434#undef SCIPgetStage
    435#undef SCIPhasPerformedPresolve
    436#undef SCIPisStopped
    437
    438/** returns current stage of SCIP
    439 *
    440 * @return the current SCIP stage
    441 *
    442 * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
    443 */
    445 SCIP* scip /**< SCIP data structure */
    446 )
    447{
    448 assert(scip != NULL);
    449 assert(scip->set != NULL);
    450
    451 return scip->set->stage;
    452}
    453
    454/** outputs SCIP stage and solution status if applicable via the message handler
    455 *
    456 * @note If the message handler is set to a NULL pointer nothing will be printed
    457 *
    458 * @note If limits have been changed between the solution and the call to this function, the status is recomputed and
    459 * thus may to correspond to the original status.
    460 *
    461 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
    462 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
    463 *
    464 * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
    465 */
    467 SCIP* scip, /**< SCIP data structure */
    468 FILE* file /**< output file (or NULL for standard output) */
    469 )
    470{
    471 SCIP_CALL( SCIPcheckStage(scip, "SCIPprintStage", TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE) );
    472
    473 switch( scip->set->stage )
    474 {
    475 case SCIP_STAGE_INIT:
    476 SCIPmessageFPrintInfo(scip->messagehdlr, file, "initialization");
    477 break;
    479 SCIPmessageFPrintInfo(scip->messagehdlr, file, "problem creation / modification");
    480 break;
    482 SCIPmessageFPrintInfo(scip->messagehdlr, file, "problem transformation");
    483 break;
    485 SCIPmessageFPrintInfo(scip->messagehdlr, file, "problem transformed");
    486 break;
    488 SCIPmessageFPrintInfo(scip->messagehdlr, file, "presolving is being initialized");
    489 break;
    491 if( SCIPsolveIsStopped(scip->set, scip->stat, TRUE) )
    492 {
    493 SCIPmessageFPrintInfo(scip->messagehdlr, file, "solving was interrupted [");
    495 SCIPmessageFPrintInfo(scip->messagehdlr, file, "]");
    496 }
    497 else
    498 SCIPmessageFPrintInfo(scip->messagehdlr, file, "presolving process is running");
    499 break;
    501 SCIPmessageFPrintInfo(scip->messagehdlr, file, "presolving is being exited");
    502 break;
    504 if( SCIPsolveIsStopped(scip->set, scip->stat, TRUE) )
    505 {
    506 SCIPmessageFPrintInfo(scip->messagehdlr, file, "solving was interrupted [");
    508 SCIPmessageFPrintInfo(scip->messagehdlr, file, "]");
    509 }
    510 else
    511 SCIPmessageFPrintInfo(scip->messagehdlr, file, "problem is presolved");
    512 break;
    514 SCIPmessageFPrintInfo(scip->messagehdlr, file, "solving process initialization");
    515 break;
    517 if( SCIPsolveIsStopped(scip->set, scip->stat, TRUE) )
    518 {
    519 SCIPmessageFPrintInfo(scip->messagehdlr, file, "solving was interrupted [");
    521 SCIPmessageFPrintInfo(scip->messagehdlr, file, "]");
    522 }
    523 else
    524 SCIPmessageFPrintInfo(scip->messagehdlr, file, "solving process is running");
    525 break;
    527 SCIPmessageFPrintInfo(scip->messagehdlr, file, "problem is solved [");
    529 SCIPmessageFPrintInfo(scip->messagehdlr, file, "]");
    530
    531 /* We output that the objective limit has been reached if no solution respecting the objective limit has been
    532 * found (nlimsolsfound == 0) and the primal bound is finite. Note that it still might be that the original
    533 * problem is infeasible, even without the objective limit, i.e., we cannot be sure that we actually reached the
    534 * objective limit. */
    535 if( scip->primal->nlimsolsfound == 0 && !SCIPisInfinity(scip, (SCIP_Real)SCIPgetObjsense(scip) * SCIPgetPrimalbound(scip)) )
    536 SCIPmessageFPrintInfo(scip->messagehdlr, file, " (objective limit reached)");
    537
    538 break;
    540 SCIPmessageFPrintInfo(scip->messagehdlr, file, "solving process deinitialization");
    541 break;
    543 SCIPmessageFPrintInfo(scip->messagehdlr, file, "freeing transformed problem");
    544 break;
    545 case SCIP_STAGE_FREE:
    546 SCIPmessageFPrintInfo(scip->messagehdlr, file, "freeing SCIP");
    547 break;
    548 default:
    549 SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
    550 return SCIP_INVALIDDATA;
    551 }
    552
    553 return SCIP_OKAY;
    554}
    555
    556/** gets solution status
    557 *
    558 * @return SCIP solution status
    559 *
    560 * See \ref SCIP_Status "SCIP_STATUS" for a complete list of all possible solving status.
    561 */
    563 SCIP* scip /**< SCIP data structure */
    564 )
    565{
    567
    568 assert(scip != NULL);
    569 assert(scip->stat != NULL);
    570 assert(scip->stat->status == SCIP_STATUS_UNKNOWN || (scip->set->stage != SCIP_STAGE_INIT && scip->set->stage != SCIP_STAGE_FREE));
    571
    572 return scip->stat->status;
    573}
    574
    575/** gets name for a solution status */
    576const char* SCIPstatusName(
    577 SCIP_STATUS status /**< SCIP status code */
    578 )
    579{
    580 switch( status )
    581 {
    583 return "unknown";
    585 return "user interrupt";
    587 return "node limit reached";
    589 return "total node limit reached";
    591 return "stall node limit reached";
    593 return "time limit reached";
    595 return "memory limit reached";
    597 return "gap limit reached";
    599 return "primal limit reached";
    601 return "dual limit reached";
    603 return "solution limit reached";
    605 return "solution improvement limit reached";
    607 return "restart limit reached";
    609 return "optimal solution found";
    611 return "infeasible";
    613 return "unbounded";
    615 return "infeasible or unbounded";
    617 return "termination signal received";
    618 default:
    619 SCIPerrorMessage("invalid status code <%d>\n", status);
    620 return NULL;
    621 }
    622}
    623
    624/** outputs solution status
    625 *
    626 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
    627 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
    628 *
    629 * See \ref SCIP_Status "SCIP_STATUS" for a complete list of all possible solving status.
    630 */
    632 SCIP* scip, /**< SCIP data structure */
    633 FILE* file /**< output file (or NULL for standard output) */
    634 )
    635{
    636 SCIP_CALL( SCIPcheckStage(scip, "SCIPprintStatus", TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE) );
    637
    638 SCIPmessageFPrintInfo(scip->messagehdlr, file, "%s", SCIPstatusName(SCIPgetStatus(scip)));
    639
    640 return SCIP_OKAY;
    641}
    642
    643/** returns whether the current stage belongs to the transformed problem space
    644 *
    645 * @return Returns TRUE if the \SCIP instance is transformed, otherwise FALSE
    646 */
    648 SCIP* scip /**< SCIP data structure */
    649 )
    650{
    651 assert(scip != NULL);
    652
    653 return ((int)scip->set->stage >= (int)SCIP_STAGE_TRANSFORMING);
    654}
    655
    656/** returns whether the presolving process would be finished given no more presolving reductions are found in this
    657 * presolving round
    658 *
    659 * Checks whether the number of presolving rounds is not exceeded and the presolving reductions found in the current
    660 * presolving round suffice to trigger another presolving round.
    661 *
    662 * @note if subsequent presolvers find more reductions, presolving might continue even if the method returns FALSE
    663 * @note does not check whether infeasibility or unboundedness was already detected in presolving (which would result
    664 * in presolving being stopped although the method returns TRUE)
    665 *
    666 * @return Returns TRUE if presolving is finished if no further reductions are detected
    667 */
    669 SCIP* scip /**< SCIP data structure */
    670 )
    671{
    672 int maxnrounds;
    673 SCIP_Bool finished;
    674
    675 assert(scip != NULL);
    676 assert(scip->stat != NULL);
    677 assert(scip->transprob != NULL);
    678
    680
    681 /* get maximum number of presolving rounds */
    682 maxnrounds = scip->set->presol_maxrounds;
    683 if( maxnrounds == -1 )
    684 maxnrounds = INT_MAX;
    685
    686 /* don't abort, if enough changes were applied to the variables */
    687 finished = (scip->transprob->nvars == 0
    688 || (scip->stat->npresolfixedvars - scip->stat->lastnpresolfixedvars
    689 + scip->stat->npresolaggrvars - scip->stat->lastnpresolaggrvars
    690 + scip->stat->npresolchgvartypes - scip->stat->lastnpresolchgvartypes
    691 + (scip->stat->npresolchgbds - scip->stat->lastnpresolchgbds)/10.0
    692 + (scip->stat->npresoladdholes - scip->stat->lastnpresoladdholes)/10.0
    693 <= scip->set->presol_abortfac * scip->transprob->nvars)); /*lint !e653*/
    694
    695 /* don't abort, if enough changes were applied to the constraints */
    696 finished = finished
    697 && (scip->transprob->nconss == 0
    698 || (scip->stat->npresoldelconss - scip->stat->lastnpresoldelconss
    699 + scip->stat->npresoladdconss - scip->stat->lastnpresoladdconss
    700 + scip->stat->npresolupgdconss - scip->stat->lastnpresolupgdconss
    701 + scip->stat->npresolchgsides - scip->stat->lastnpresolchgsides
    702 <= scip->set->presol_abortfac * scip->transprob->nconss));
    703
    704 /* don't abort, if enough changes were applied to the coefficients (assume a 1% density of non-zero elements) */
    705 finished = finished
    706 && (scip->transprob->nvars == 0 || scip->transprob->nconss == 0
    707 || (scip->stat->npresolchgcoefs - scip->stat->lastnpresolchgcoefs
    708 <= scip->set->presol_abortfac * 0.01 * scip->transprob->nvars * scip->transprob->nconss));
    709
    710#ifdef SCIP_DISABLED_CODE
    711 /* since 2005, we do not take cliques and implications into account when deciding whether to stop presolving */
    712 /* don't abort, if enough new implications or cliques were found (assume 100 implications per variable) */
    713 finished = finished
    714 && (scip->stat->nimplications - scip->stat->lastnpresolimplications
    715 <= scip->set->presol_abortfac * 100 * scip->transprob->nbinvars)
    716 && (SCIPcliquetableGetNCliques(scip->cliquetable) - scip->stat->lastnpresolcliques
    717 <= scip->set->presol_abortfac * scip->transprob->nbinvars);
    718#endif
    719
    720 /* abort if maximal number of presolving rounds is reached */
    721 finished = finished || (scip->stat->npresolrounds + 1 >= maxnrounds);
    722
    723 return finished;
    724}
    725
    726/** returns whether SCIP has performed presolving during the last solve
    727 *
    728 * @return Returns TRUE if presolving was performed during the last solve
    729 */
    731 SCIP* scip /**< SCIP data structure */
    732 )
    733{
    734 assert(scip != NULL);
    735 assert(scip->stat != NULL);
    736
    737 SCIP_CALL_ABORT( SCIPcheckStage(scip, "SCIPhasPerformedPresolve", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) );
    738
    739 return scip->stat->performpresol;
    740}
    741
    742/** returns whether the user pressed CTRL-C to interrupt the solving process
    743 *
    744 * @return Returns TRUE if Ctrl-C was pressed, otherwise FALSE.
    745 */ /*lint -e715*/
    747 SCIP* scip /**< SCIP data structure */
    748 )
    749{
    750 return SCIPinterrupted();
    751}
    752
    753/** returns whether the solving process should be / was stopped before proving optimality;
    754 * if the solving process should be / was stopped, the status returned by SCIPgetStatus() yields
    755 * the reason for the premature abort
    756 *
    757 * @return Returns TRUE if solving process is stopped/interrupted, otherwise FALSE.
    758 */
    760 SCIP* scip /**< SCIP data structure */
    761 )
    762{
    764
    765 return SCIPsolveIsStopped(scip->set, scip->stat, FALSE);
    766}
    767
    768/** includes information about an external code linked into the SCIP library */
    770 SCIP* scip, /**< SCIP data structure */
    771 const char* name, /**< name of external code */
    772 const char* description /**< description of external code, or NULL */
    773 )
    774{
    775 assert(scip != NULL);
    776 assert(name != NULL);
    777
    778 SCIP_CALL( SCIPcheckStage(scip, "SCIPincludeExternalCodeInformation", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) );
    779
    780 SCIP_CALL( SCIPsetIncludeExternalCode(scip->set, name, description) );
    781
    782 return SCIP_OKAY;
    783}
    784
    785/** returns an array of names of currently included external codes */
    787 SCIP* scip /**< SCIP data structure */
    788 )
    789{
    790 assert(scip != NULL);
    791 assert(scip->set != NULL);
    792
    793 return scip->set->extcodenames;
    794}
    795
    796/** returns an array of the descriptions of currently included external codes
    797 *
    798 * @note some descriptions may be NULL
    799 */
    801 SCIP* scip /**< SCIP data structure */
    802 )
    803{
    804 assert(scip != NULL);
    805 assert(scip->set != NULL);
    806
    807 return scip->set->extcodedescs;
    808}
    809
    810/** returns the number of currently included information on external codes */
    812 SCIP* scip /**< SCIP data structure */
    813 )
    814{
    815 assert(scip != NULL);
    816 assert(scip->set != NULL);
    817
    818 return scip->set->nextcodes;
    819}
    820
    821/** prints information on external libraries to a file stream via the message handler system
    822 *
    823 * @note If the message handler is set to a NULL pointer nothing will be printed
    824 */
    826 SCIP* scip, /**< SCIP data structure */
    827 FILE* file /**< output file (or NULL for standard output) */
    828 )
    829{
    830 int i;
    831
    832 SCIPmessageFPrintInfo(scip->messagehdlr, file, "External libraries: ");
    833 if( scip->set->nextcodes == 0 )
    834 {
    835 SCIPinfoMessage(scip, file, "none\n");
    836 return;
    837 }
    838 SCIPinfoMessage(scip, file, "\n");
    839
    840 for( i = 0; i < scip->set->nextcodes; ++i )
    841 {
    842 SCIPinfoMessage(scip, file, " %-20s %s\n", scip->set->extcodenames[i], scip->set->extcodedescs[i] != NULL ? scip->set->extcodedescs[i] : "");
    843 }
    844}
    void SCIPclockStart(SCIP_CLOCK *clck, SCIP_SET *set)
    Definition: clock.c:290
    void SCIPclockFree(SCIP_CLOCK **clck)
    Definition: clock.c:185
    SCIP_RETCODE SCIPclockCreate(SCIP_CLOCK **clck, SCIP_CLOCKTYPE clocktype)
    Definition: clock.c:170
    internal methods for clocks and timing issues
    methods for debugging
    #define SCIPcheckStage(scip, method, init, problem, transforming, transformed, initpresolve, presolving, exitpresolve, presolved, initsolve, solving, solved, exitsolve, freetrans, freescip)
    Definition: debug.h:364
    #define NULL
    Definition: def.h:248
    #define SCIP_MAXSTRLEN
    Definition: def.h:269
    #define SCIP_SUBVERSION
    Definition: def.h:127
    #define SCIP_COPYRIGHT
    Definition: def.h:129
    #define SCIP_Bool
    Definition: def.h:91
    #define SCIP_ALLOC(x)
    Definition: def.h:366
    #define SCIP_Real
    Definition: def.h:156
    #define TRUE
    Definition: def.h:93
    #define FALSE
    Definition: def.h:94
    #define SCIP_CALL_ABORT(x)
    Definition: def.h:334
    #define SCIP_CALL(x)
    Definition: def.h:355
    #define SCIP_CALL_FINALLY(x, y)
    Definition: def.h:397
    SCIP_RETCODE SCIPdialoghdlrCreate(SCIP_SET *set, SCIP_DIALOGHDLR **dialoghdlr)
    Definition: dialog.c:336
    SCIP_RETCODE SCIPdialoghdlrFree(SCIP *scip, SCIP_DIALOGHDLR **dialoghdlr)
    Definition: dialog.c:367
    internal methods for user interface dialog
    methods to interpret (evaluate) an expression "fast"
    const char * SCIPexprintGetName(void)
    const char * SCIPexprintGetDesc(void)
    SCIP_Bool SCIPisTransformed(SCIP *scip)
    Definition: scip_general.c:647
    SCIP_RETCODE SCIPprintStage(SCIP *scip, FILE *file)
    Definition: scip_general.c:466
    SCIP_Bool SCIPisPresolveFinished(SCIP *scip)
    Definition: scip_general.c:668
    SCIP_Bool SCIPhasPerformedPresolve(SCIP *scip)
    Definition: scip_general.c:730
    const char * SCIPstatusName(SCIP_STATUS status)
    Definition: scip_general.c:576
    SCIP_Bool SCIPpressedCtrlC(SCIP *scip)
    Definition: scip_general.c:746
    SCIP_RETCODE SCIPprintStatus(SCIP *scip, FILE *file)
    Definition: scip_general.c:631
    SCIP_Bool SCIPisStopped(SCIP *scip)
    Definition: scip_general.c:759
    SCIP_RETCODE SCIPfree(SCIP **scip)
    Definition: scip_general.c:402
    SCIP_RETCODE SCIPcreate(SCIP **scip)
    Definition: scip_general.c:370
    SCIP_STATUS SCIPgetStatus(SCIP *scip)
    Definition: scip_general.c:562
    SCIP_STAGE SCIPgetStage(SCIP *scip)
    Definition: scip_general.c:444
    SCIP_RETCODE SCIPfreeProb(SCIP *scip)
    Definition: scip_prob.c:835
    SCIP_OBJSENSE SCIPgetObjsense(SCIP *scip)
    Definition: scip_prob.c:1400
    const char * SCIPlpiExactGetSolverDesc(void)
    const char * SCIPlpiExactGetSolverName(void)
    Definition: lpiexact_none.c:92
    const char * SCIPlpiGetSolverName(void)
    Definition: lpi_clp.cpp:454
    const char * SCIPlpiGetSolverDesc(void)
    Definition: lpi_clp.cpp:463
    void SCIPinfoMessage(SCIP *scip, FILE *file, const char *formatstr,...)
    Definition: scip_message.c:208
    void SCIPprintError(SCIP_RETCODE retcode)
    Definition: scip_general.c:231
    int SCIPsubversion(void)
    Definition: scip_general.c:158
    void SCIPprintBuildOptions(SCIP *scip, FILE *file)
    Definition: scip_general.c:201
    int SCIPminorVersion(void)
    Definition: scip_general.c:134
    SCIP_Real SCIPversion(void)
    Definition: scip_general.c:112
    int SCIPtechVersion(void)
    Definition: scip_general.c:145
    void SCIPprintVersion(SCIP *scip, FILE *file)
    Definition: scip_general.c:169
    int SCIPmajorVersion(void)
    Definition: scip_general.c:123
    char ** SCIPgetExternalCodeDescriptions(SCIP *scip)
    Definition: scip_general.c:800
    SCIP_RETCODE SCIPincludeExternalCodeInformation(SCIP *scip, const char *name, const char *description)
    Definition: scip_general.c:769
    int SCIPgetNExternalCodes(SCIP *scip)
    Definition: scip_general.c:811
    void SCIPprintExternalCodes(SCIP *scip, FILE *file)
    Definition: scip_general.c:825
    char ** SCIPgetExternalCodeNames(SCIP *scip)
    Definition: scip_general.c:786
    BMS_BLKMEM * SCIPblkmem(SCIP *scip)
    Definition: scip_mem.c:57
    SCIP_Real SCIPgetPrimalbound(SCIP *scip)
    SCIP_Bool SCIPisInfinity(SCIP *scip, SCIP_Real val)
    int SCIPsnprintf(char *t, int len, const char *s,...)
    Definition: misc.c:10827
    SCIP_RETCODE SCIPiisCreate(SCIP_IIS **iis, SCIP_SET *set, BMS_BLKMEM *blkmem)
    Definition: iisfinder.c:749
    SCIP_RETCODE SCIPiisFree(SCIP_IIS **iis, BMS_BLKMEM *blkmem)
    Definition: iisfinder.c:774
    internal methods for IIS finder
    int SCIPcliquetableGetNCliques(SCIP_CLIQUETABLE *cliquetable)
    Definition: implics.c:3510
    SCIP_RETCODE SCIPinterruptCreate(SCIP_INTERRUPT **interrupt)
    Definition: interrupt.c:91
    void SCIPinterruptFree(SCIP_INTERRUPT **interrupt)
    Definition: interrupt.c:104
    SCIP_Bool SCIPinterrupted(void)
    Definition: interrupt.c:163
    methods for catching the user CTRL-C interrupt
    void SCIPlapackVersion(int *majorver, int *minorver, int *patchver)
    Definition: lapack_calls.c:181
    interface methods for lapack functions
    interface methods for specific LP solvers
    interface methods for specific exact LP solvers
    SCIP_RETCODE SCIPmemCreate(SCIP_MEM **mem)
    Definition: mem.c:43
    SCIP_RETCODE SCIPmemFree(SCIP_MEM **mem)
    Definition: mem.c:69
    methods for block memory pools and memory buffers
    memory allocation routines
    #define BMSfreeMemory(ptr)
    Definition: memory.h:145
    #define BMSclearMemory(ptr)
    Definition: memory.h:129
    #define BMSallocMemory(ptr)
    Definition: memory.h:118
    void SCIPmessagePrintError(const char *formatstr,...)
    Definition: message.c:791
    void SCIPmessageFPrintInfo(SCIP_MESSAGEHDLR *messagehdlr, FILE *file, const char *formatstr,...)
    Definition: message.c:618
    SCIP_RETCODE SCIPmessagehdlrRelease(SCIP_MESSAGEHDLR **messagehdlr)
    Definition: message.c:348
    SCIP_RETCODE SCIPcreateMessagehdlrDefault(SCIP_MESSAGEHDLR **messagehdlr, SCIP_Bool bufferedoutput, const char *filename, SCIP_Bool quiet)
    default message handler
    SCIP_RETCODE SCIPnlpInclude(SCIP_SET *set, BMS_BLKMEM *blkmem)
    Definition: nlp.c:3511
    internal methods for NLP management
    public methods for message output
    #define SCIPerrorMessage
    Definition: pub_message.h:64
    void SCIPretcodePrintError(SCIP_RETCODE retcode)
    Definition: retcode.c:113
    internal methods for return codes for SCIP methods
    static SCIP_RETCODE doScipCreate(SCIP **scip)
    Definition: scip_general.c:246
    general public methods
    public methods for memory management
    public methods for message handling
    public methods for numerical tolerances
    public methods for global and local (sub)problems
    public methods for querying solving statistics
    const char * SCIPgetBuildFlags(void)
    build flags methods
    SCIP_RETCODE SCIPincludeCorePlugins(SCIP *scip)
    register additional core functionality that is designed as plugins
    const char * SCIPgetGitHash(void)
    Definition: scipgithash.c:37
    git hash methods
    SCIP_RETCODE SCIPsetCreate(SCIP_SET **set, SCIP_MESSAGEHDLR *messagehdlr, BMS_BLKMEM *blkmem, SCIP *scip)
    Definition: set.c:1184
    SCIP_RETCODE SCIPsetFree(SCIP_SET **set, BMS_BLKMEM *blkmem)
    Definition: set.c:2995
    SCIP_RETCODE SCIPsetIncludeExternalCode(SCIP_SET *set, const char *name, const char *description)
    Definition: set.c:5529
    internal methods for global SCIP settings
    SCIP_Bool SCIPsolveIsStopped(SCIP_SET *set, SCIP_STAT *stat, SCIP_Bool checknodelimits)
    Definition: solve.c:110
    internal methods for main solving loop and node processing
    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 problem statistics
    SCIP_RETCODE SCIPsyncstoreRelease(SCIP_SYNCSTORE **syncstore)
    Definition: syncstore.c:89
    SCIP_RETCODE SCIPsyncstoreCreate(SCIP_SYNCSTORE **syncstore)
    Definition: syncstore.c:67
    the function declarations for the synchronization store
    the type definitions for the SCIP parallel interface
    SCIP_Bool SCIPtpiIsAvailable(void)
    Definition: tpi_none.c:225
    void SCIPtpiGetLibraryDesc(char *desc, int descsize)
    Definition: tpi_none.c:242
    void SCIPtpiGetLibraryName(char *name, int namesize)
    Definition: tpi_none.c:231
    @ SCIP_CLOCKTYPE_DEFAULT
    Definition: type_clock.h:43
    @ SCIP_INVALIDDATA
    Definition: type_retcode.h:52
    @ SCIP_OKAY
    Definition: type_retcode.h:42
    @ SCIP_ERROR
    Definition: type_retcode.h:43
    enum SCIP_Retcode SCIP_RETCODE
    Definition: type_retcode.h:63
    @ SCIP_STAGE_PROBLEM
    Definition: type_set.h:45
    @ SCIP_STAGE_INITPRESOLVE
    Definition: type_set.h:48
    @ SCIP_STAGE_SOLVED
    Definition: type_set.h:54
    @ SCIP_STAGE_PRESOLVING
    Definition: type_set.h:49
    @ SCIP_STAGE_TRANSFORMED
    Definition: type_set.h:47
    @ SCIP_STAGE_INITSOLVE
    Definition: type_set.h:52
    @ SCIP_STAGE_EXITPRESOLVE
    Definition: type_set.h:50
    @ SCIP_STAGE_EXITSOLVE
    Definition: type_set.h:55
    @ SCIP_STAGE_INIT
    Definition: type_set.h:44
    @ SCIP_STAGE_FREE
    Definition: type_set.h:57
    @ SCIP_STAGE_FREETRANS
    Definition: type_set.h:56
    @ SCIP_STAGE_SOLVING
    Definition: type_set.h:53
    @ SCIP_STAGE_TRANSFORMING
    Definition: type_set.h:46
    @ SCIP_STAGE_PRESOLVED
    Definition: type_set.h:51
    enum SCIP_Stage SCIP_STAGE
    Definition: type_set.h:59
    @ SCIP_STATUS_OPTIMAL
    Definition: type_stat.h:43
    @ SCIP_STATUS_TOTALNODELIMIT
    Definition: type_stat.h:50
    @ SCIP_STATUS_BESTSOLLIMIT
    Definition: type_stat.h:60
    @ SCIP_STATUS_SOLLIMIT
    Definition: type_stat.h:59
    @ SCIP_STATUS_UNBOUNDED
    Definition: type_stat.h:45
    @ SCIP_STATUS_UNKNOWN
    Definition: type_stat.h:42
    @ SCIP_STATUS_PRIMALLIMIT
    Definition: type_stat.h:57
    @ SCIP_STATUS_GAPLIMIT
    Definition: type_stat.h:56
    @ SCIP_STATUS_USERINTERRUPT
    Definition: type_stat.h:47
    @ SCIP_STATUS_TERMINATE
    Definition: type_stat.h:48
    @ SCIP_STATUS_INFORUNBD
    Definition: type_stat.h:46
    @ SCIP_STATUS_STALLNODELIMIT
    Definition: type_stat.h:52
    @ SCIP_STATUS_TIMELIMIT
    Definition: type_stat.h:54
    @ SCIP_STATUS_INFEASIBLE
    Definition: type_stat.h:44
    @ SCIP_STATUS_NODELIMIT
    Definition: type_stat.h:49
    @ SCIP_STATUS_DUALLIMIT
    Definition: type_stat.h:58
    @ SCIP_STATUS_MEMLIMIT
    Definition: type_stat.h:55
    @ SCIP_STATUS_RESTARTLIMIT
    Definition: type_stat.h:62
    enum SCIP_Status SCIP_STATUS
    Definition: type_stat.h:64