Scippy

    SCIP

    Solving Constraint Integer Programs

    scip_numerics.h
    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_numerics.h
    26 * @ingroup PUBLICCOREAPI
    27 * @brief public methods for numerical tolerances
    28 * @author Tobias Achterberg
    29 * @author Timo Berthold
    30 * @author Thorsten Koch
    31 * @author Alexander Martin
    32 * @author Marc Pfetsch
    33 * @author Kati Wolter
    34 * @author Gregor Hendel
    35 * @author Leona Gottwald
    36 */
    37
    38/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
    39
    40#ifndef __SCIP_SCIP_NUMERICS_H__
    41#define __SCIP_SCIP_NUMERICS_H__
    42
    43
    44#include "scip/def.h"
    45#include "scip/type_rational.h"
    46#include "scip/type_retcode.h"
    47#include "scip/type_scip.h"
    48
    49/* In debug mode, we include the SCIP's structure in scip.c, such that no one can access
    50 * this structure except the interface methods in scip.c.
    51 * In optimized mode, the structure is included in scip.h, because some of the methods
    52 * are implemented as defines for performance reasons (e.g. the numerical comparisons).
    53 * Additionally, the internal "set.h" is included, such that the defines in set.h are
    54 * available in optimized mode.
    55 */
    56#ifdef NDEBUG
    57#include "scip/struct_scip.h"
    58#include "scip/set.h"
    59#endif
    60
    61#ifdef __cplusplus
    62extern "C" {
    63#endif
    64
    65/**@addtogroup PublicToleranceMethods
    66 *
    67 * @{
    68 */
    69
    70/** returns value treated as zero
    71 *
    72 * @return value treated as zero
    73 */
    74SCIP_EXPORT
    76 SCIP* scip /**< SCIP data structure */
    77 );
    78
    79/** returns value treated as zero for sums of floating point values
    80 *
    81 * @return value treated as zero for sums of floating point values
    82 */
    83SCIP_EXPORT
    85 SCIP* scip /**< SCIP data structure */
    86 );
    87
    88/** returns feasibility tolerance for constraints
    89 *
    90 * @return feasibility tolerance for constraints
    91 */
    92SCIP_EXPORT
    93#ifdef __GNUC__
    94__attribute__ ((pure))
    95#endif
    97 SCIP* scip /**< SCIP data structure */
    98 );
    99
    100/** returns feasibility tolerance for reduced costs
    101 *
    102 * @return feasibility tolerance for reduced costs
    103 */
    104SCIP_EXPORT
    105#ifdef __GNUC__
    106__attribute__ ((pure))
    107#endif
    109 SCIP* scip /**< SCIP data structure */
    110 );
    111
    112/** returns convergence tolerance used in barrier algorithm
    113 *
    114 * @return convergence tolerance used in barrier algorithm
    115 */
    116SCIP_EXPORT
    118 SCIP* scip /**< SCIP data structure */
    119 );
    120
    121/** return the cutoff bound delta
    122 *
    123 * @return cutoff bound data
    124 */
    125SCIP_EXPORT
    127 SCIP* scip /**< SCIP data structure */
    128 );
    129
    130/** return the relaxation primal feasibility tolerance
    131 *
    132 * @see SCIPchgRelaxfeastol
    133 * @return relaxfeastol
    134 */
    135SCIP_EXPORT
    137 SCIP* scip /**< SCIP data structure */
    138 );
    139
    140/** sets the feasibility tolerance for constraints
    141 *
    142 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
    143 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
    144 */
    145SCIP_EXPORT
    147 SCIP* scip, /**< SCIP data structure */
    148 SCIP_Real feastol /**< new feasibility tolerance for constraints */
    149 );
    150
    151/** sets the feasibility tolerance for reduced costs
    152 *
    153 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
    154 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
    155 */
    156SCIP_EXPORT
    158 SCIP* scip, /**< SCIP data structure */
    159 SCIP_Real dualfeastol /**< new feasibility tolerance for reduced costs */
    160 );
    161
    162/** sets the convergence tolerance used in barrier algorithm
    163 *
    164 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
    165 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
    166 */
    167SCIP_EXPORT
    169 SCIP* scip, /**< SCIP data structure */
    170 SCIP_Real barrierconvtol /**< new convergence tolerance used in barrier algorithm */
    171 );
    172
    173/** sets the primal feasibility tolerance of relaxations
    174 *
    175 * This tolerance value is used by the SCIP core and plugins to tighten then feasibility tolerance on relaxations
    176 * (especially the LP relaxation) during a solve. It is set to SCIP_INVALID initially, which means that only the
    177 * feasibility tolerance of the particular relaxation is taken into account. If set to a valid value, however,
    178 * then this value should be used to reduce the primal feasibility tolerance of a relaxation (thus, use the
    179 * minimum of relaxfeastol and the relaxations primal feastol).
    180 *
    181 * @pre The value of relaxfeastol is reset to SCIP_INVALID when initializing the solve (INITSOL).
    182 * Therefore, this method can only be called in one of the following stages of the SCIP solving process:
    183 * - \ref SCIP_STAGE_INITSOLVE
    184 * - \ref SCIP_STAGE_SOLVING
    185 *
    186 * @return previous value of relaxfeastol
    187 */
    188SCIP_EXPORT
    190 SCIP* scip, /**< SCIP data structure */
    191 SCIP_Real relaxfeastol /**< new primal feasibility tolerance of relaxations */
    192 );
    193
    194/** marks that some limit parameter was changed */
    195SCIP_EXPORT
    197 SCIP* scip /**< SCIP data structure */
    198 );
    199
    200/** returns value treated as infinity */
    201SCIP_EXPORT
    203 SCIP* scip /**< SCIP data structure */
    204 );
    205
    206/** returns the minimum value that is regarded as huge and should be handled separately (e.g., in activity
    207 * computation)
    208 */
    209SCIP_EXPORT
    211 SCIP* scip /**< SCIP data structure */
    212 );
    213
    214/** checks if values are in range of epsilon */
    215SCIP_EXPORT
    217 SCIP* scip, /**< SCIP data structure */
    218 SCIP_Real val1, /**< first value to be compared */
    219 SCIP_Real val2 /**< second value to be compared */
    220 );
    221
    222/** checks if val1 is (more than epsilon) lower than val2 */
    223SCIP_EXPORT
    225 SCIP* scip, /**< SCIP data structure */
    226 SCIP_Real val1, /**< first value to be compared */
    227 SCIP_Real val2 /**< second value to be compared */
    228 );
    229
    230/** checks if val1 is not (more than epsilon) greater than val2 */
    231SCIP_EXPORT
    233 SCIP* scip, /**< SCIP data structure */
    234 SCIP_Real val1, /**< first value to be compared */
    235 SCIP_Real val2 /**< second value to be compared */
    236 );
    237
    238/** checks if val1 is (more than epsilon) greater than val2 */
    239SCIP_EXPORT
    241 SCIP* scip, /**< SCIP data structure */
    242 SCIP_Real val1, /**< first value to be compared */
    243 SCIP_Real val2 /**< second value to be compared */
    244 );
    245
    246/** checks if val1 is not (more than epsilon) lower than val2 */
    247SCIP_EXPORT
    249 SCIP* scip, /**< SCIP data structure */
    250 SCIP_Real val1, /**< first value to be compared */
    251 SCIP_Real val2 /**< second value to be compared */
    252 );
    253
    254/** checks if value is (positive) infinite */
    255SCIP_EXPORT
    257 SCIP* scip, /**< SCIP data structure */
    258 SCIP_Real val /**< value to be compared against infinity */
    259 );
    260
    261/** checks if value is huge and should be handled separately (e.g., in activity computation) */
    262SCIP_EXPORT
    264 SCIP* scip, /**< SCIP data structure */
    265 SCIP_Real val /**< value to be checked whether it is huge */
    266 );
    267
    268/** checks if value is in range epsilon of 0.0 */
    269SCIP_EXPORT
    271 SCIP* scip, /**< SCIP data structure */
    272 SCIP_Real val /**< value to process */
    273 );
    274
    275/** checks if value is greater than epsilon */
    276SCIP_EXPORT
    278 SCIP* scip, /**< SCIP data structure */
    279 SCIP_Real val /**< value to process */
    280 );
    281
    282/** checks if value is lower than -epsilon */
    283SCIP_EXPORT
    285 SCIP* scip, /**< SCIP data structure */
    286 SCIP_Real val /**< value to process */
    287 );
    288
    289/** checks if value is integral within epsilon */
    290SCIP_EXPORT
    292 SCIP* scip, /**< SCIP data structure */
    293 SCIP_Real val /**< value to process */
    294 );
    295
    296/** checks whether the product val * scalar is integral in epsilon scaled by scalar */
    297SCIP_EXPORT
    299 SCIP* scip, /**< SCIP data structure */
    300 SCIP_Real val, /**< unscaled value to check for scaled integrality */
    301 SCIP_Real scalar /**< value to scale val with for checking for integrality */
    302 );
    303
    304/** checks if given fractional part is smaller than epsilon */
    305SCIP_EXPORT
    307 SCIP* scip, /**< SCIP data structure */
    308 SCIP_Real val /**< value to process */
    309 );
    310
    311/** rounds value + epsilon down to the next integer */
    312SCIP_EXPORT
    314 SCIP* scip, /**< SCIP data structure */
    315 SCIP_Real val /**< value to process */
    316 );
    317
    318/** rounds value - epsilon up to the next integer */
    319SCIP_EXPORT
    321 SCIP* scip, /**< SCIP data structure */
    322 SCIP_Real val /**< value to process */
    323 );
    324
    325/** rounds value to the nearest integer with epsilon tolerance */
    326SCIP_EXPORT
    328 SCIP* scip, /**< SCIP data structure */
    329 SCIP_Real val /**< value to process */
    330 );
    331
    332/** returns fractional part of value, i.e. x - floor(x) in epsilon tolerance */
    333SCIP_EXPORT
    335 SCIP* scip, /**< SCIP data structure */
    336 SCIP_Real val /**< value to return fractional part for */
    337 );
    338
    339/** checks if values are in range of sumepsilon */
    340SCIP_EXPORT
    342 SCIP* scip, /**< SCIP data structure */
    343 SCIP_Real val1, /**< first value to be compared */
    344 SCIP_Real val2 /**< second value to be compared */
    345 );
    346
    347/** checks if val1 is (more than sumepsilon) lower than val2 */
    348SCIP_EXPORT
    350 SCIP* scip, /**< SCIP data structure */
    351 SCIP_Real val1, /**< first value to be compared */
    352 SCIP_Real val2 /**< second value to be compared */
    353 );
    354
    355/** checks if val1 is not (more than sumepsilon) greater than val2 */
    356SCIP_EXPORT
    358 SCIP* scip, /**< SCIP data structure */
    359 SCIP_Real val1, /**< first value to be compared */
    360 SCIP_Real val2 /**< second value to be compared */
    361 );
    362
    363/** checks if val1 is (more than sumepsilon) greater than val2 */
    364SCIP_EXPORT
    366 SCIP* scip, /**< SCIP data structure */
    367 SCIP_Real val1, /**< first value to be compared */
    368 SCIP_Real val2 /**< second value to be compared */
    369 );
    370
    371/** checks if val1 is not (more than sumepsilon) lower than val2 */
    372SCIP_EXPORT
    374 SCIP* scip, /**< SCIP data structure */
    375 SCIP_Real val1, /**< first value to be compared */
    376 SCIP_Real val2 /**< second value to be compared */
    377 );
    378
    379/** checks if value is in range sumepsilon of 0.0 */
    380SCIP_EXPORT
    382 SCIP* scip, /**< SCIP data structure */
    383 SCIP_Real val /**< value to process */
    384 );
    385
    386/** checks if value is greater than sumepsilon */
    387SCIP_EXPORT
    389 SCIP* scip, /**< SCIP data structure */
    390 SCIP_Real val /**< value to process */
    391 );
    392
    393/** checks if value is lower than -sumepsilon */
    394SCIP_EXPORT
    396 SCIP* scip, /**< SCIP data structure */
    397 SCIP_Real val /**< value to process */
    398 );
    399
    400/** checks if relative difference of values is in range of feasibility tolerance */
    401SCIP_EXPORT
    403 SCIP* scip, /**< SCIP data structure */
    404 SCIP_Real val1, /**< first value to be compared */
    405 SCIP_Real val2 /**< second value to be compared */
    406 );
    407
    408/** checks if relative difference val1 and val2 is lower than feasibility tolerance */
    409SCIP_EXPORT
    411 SCIP* scip, /**< SCIP data structure */
    412 SCIP_Real val1, /**< first value to be compared */
    413 SCIP_Real val2 /**< second value to be compared */
    414 );
    415
    416/** checks if relative difference of val1 and val2 is not greater than feasibility tolerance */
    417SCIP_EXPORT
    419 SCIP* scip, /**< SCIP data structure */
    420 SCIP_Real val1, /**< first value to be compared */
    421 SCIP_Real val2 /**< second value to be compared */
    422 );
    423
    424/** checks if relative difference of val1 and val2 is greater than feastol */
    425SCIP_EXPORT
    427 SCIP* scip, /**< SCIP data structure */
    428 SCIP_Real val1, /**< first value to be compared */
    429 SCIP_Real val2 /**< second value to be compared */
    430 );
    431
    432/** checks if relative difference of val1 and val2 is not lower than -feastol */
    433SCIP_EXPORT
    435 SCIP* scip, /**< SCIP data structure */
    436 SCIP_Real val1, /**< first value to be compared */
    437 SCIP_Real val2 /**< second value to be compared */
    438 );
    439
    440/** checks if value is in range feasibility tolerance of 0.0 */
    441SCIP_EXPORT
    443 SCIP* scip, /**< SCIP data structure */
    444 SCIP_Real val /**< value to process */
    445 );
    446
    447/** checks if value is greater than feasibility tolerance */
    448SCIP_EXPORT
    450 SCIP* scip, /**< SCIP data structure */
    451 SCIP_Real val /**< value to process */
    452 );
    453
    454/** checks if value is lower than -feasibility tolerance */
    455SCIP_EXPORT
    457 SCIP* scip, /**< SCIP data structure */
    458 SCIP_Real val /**< value to process */
    459 );
    460
    461/** checks if value is integral within the LP feasibility bounds */
    462SCIP_EXPORT
    464 SCIP* scip, /**< SCIP data structure */
    465 SCIP_Real val /**< value to process */
    466 );
    467
    468/** checks if given fractional part is smaller than feastol */
    469SCIP_EXPORT
    471 SCIP* scip, /**< SCIP data structure */
    472 SCIP_Real val /**< value to process */
    473 );
    474
    475/** rounds value + feasibility tolerance down to the next integer */
    476SCIP_EXPORT
    478 SCIP* scip, /**< SCIP data structure */
    479 SCIP_Real val /**< value to process */
    480 );
    481
    482/** rounds value - feasibility tolerance up to the next integer */
    483SCIP_EXPORT
    485 SCIP* scip, /**< SCIP data structure */
    486 SCIP_Real val /**< value to process */
    487 );
    488
    489/** rounds value to the nearest integer in feasibility tolerance */
    490SCIP_EXPORT
    492 SCIP* scip, /**< SCIP data structure */
    493 SCIP_Real val /**< value to process */
    494 );
    495
    496/** returns fractional part of value, i.e. x - floor(x) */
    497SCIP_EXPORT
    499 SCIP* scip, /**< SCIP data structure */
    500 SCIP_Real val /**< value to process */
    501 );
    502
    503/** checks if relative difference of values is in range of dual feasibility tolerance */
    504SCIP_EXPORT
    506 SCIP* scip, /**< SCIP data structure */
    507 SCIP_Real val1, /**< first value to be compared */
    508 SCIP_Real val2 /**< second value to be compared */
    509 );
    510
    511/** checks if relative difference val1 and val2 is lower than dual feasibility tolerance */
    512SCIP_EXPORT
    514 SCIP* scip, /**< SCIP data structure */
    515 SCIP_Real val1, /**< first value to be compared */
    516 SCIP_Real val2 /**< second value to be compared */
    517 );
    518
    519/** checks if relative difference of val1 and val2 is not greater than dual feasibility tolerance */
    520SCIP_EXPORT
    522 SCIP* scip, /**< SCIP data structure */
    523 SCIP_Real val1, /**< first value to be compared */
    524 SCIP_Real val2 /**< second value to be compared */
    525 );
    526
    527/** checks if relative difference of val1 and val2 is greater than dual feasibility tolerance */
    528SCIP_EXPORT
    530 SCIP* scip, /**< SCIP data structure */
    531 SCIP_Real val1, /**< first value to be compared */
    532 SCIP_Real val2 /**< second value to be compared */
    533 );
    534
    535/** checks if relative difference of val1 and val2 is not lower than -dual feasibility tolerance */
    536SCIP_EXPORT
    538 SCIP* scip, /**< SCIP data structure */
    539 SCIP_Real val1, /**< first value to be compared */
    540 SCIP_Real val2 /**< second value to be compared */
    541 );
    542
    543/** checks if value is in range dual feasibility tolerance of 0.0 */
    544SCIP_EXPORT
    546 SCIP* scip, /**< SCIP data structure */
    547 SCIP_Real val /**< value to process */
    548 );
    549
    550/** checks if value is greater than dual feasibility tolerance */
    551SCIP_EXPORT
    553 SCIP* scip, /**< SCIP data structure */
    554 SCIP_Real val /**< value to process */
    555 );
    556
    557/** checks if value is lower than -dual feasibility tolerance */
    558SCIP_EXPORT
    560 SCIP* scip, /**< SCIP data structure */
    561 SCIP_Real val /**< value to process */
    562 );
    563
    564/** checks if value is integral within the LP dual feasibility tolerance */
    565SCIP_EXPORT
    567 SCIP* scip, /**< SCIP data structure */
    568 SCIP_Real val /**< value to process */
    569 );
    570
    571/** checks if given fractional part is smaller than dual feasibility tolerance */
    572SCIP_EXPORT
    574 SCIP* scip, /**< SCIP data structure */
    575 SCIP_Real val /**< value to process */
    576 );
    577
    578/** rounds value + dual feasibility tolerance down to the next integer */
    579SCIP_EXPORT
    581 SCIP* scip, /**< SCIP data structure */
    582 SCIP_Real val /**< value to process */
    583 );
    584
    585/** rounds value - dual feasibility tolerance up to the next integer */
    586SCIP_EXPORT
    588 SCIP* scip, /**< SCIP data structure */
    589 SCIP_Real val /**< value to process */
    590 );
    591
    592/** rounds value to the nearest integer in dual feasibility tolerance */
    593SCIP_EXPORT
    595 SCIP* scip, /**< SCIP data structure */
    596 SCIP_Real val /**< value to process */
    597 );
    598
    599/** returns fractional part of value, i.e. x - floor(x) in dual feasibility tolerance */
    600SCIP_EXPORT
    602 SCIP* scip, /**< SCIP data structure */
    603 SCIP_Real val /**< value to process */
    604 );
    605
    606/** checks if the given new lower bound is tighter (w.r.t. bound strengthening epsilon) than the old one */
    607SCIP_EXPORT
    609 SCIP* scip, /**< SCIP data structure */
    610 SCIP_Real newlb, /**< new lower bound */
    611 SCIP_Real oldlb, /**< old lower bound */
    612 SCIP_Real oldub /**< old upper bound */
    613 );
    614
    615/** checks if the given new upper bound is tighter (w.r.t. bound strengthening epsilon) than the old one */
    616SCIP_EXPORT
    618 SCIP* scip, /**< SCIP data structure */
    619 SCIP_Real newub, /**< new upper bound */
    620 SCIP_Real oldlb, /**< old lower bound */
    621 SCIP_Real oldub /**< old upper bound */
    622 );
    623
    624/** checks if relative difference of values is in range of epsilon */
    625SCIP_EXPORT
    627 SCIP* scip, /**< SCIP data structure */
    628 SCIP_Real val1, /**< first value to be compared */
    629 SCIP_Real val2 /**< second value to be compared */
    630 );
    631
    632/** checks if relative difference of val1 and val2 is lower than epsilon */
    633SCIP_EXPORT
    635 SCIP* scip, /**< SCIP data structure */
    636 SCIP_Real val1, /**< first value to be compared */
    637 SCIP_Real val2 /**< second value to be compared */
    638 );
    639
    640/** checks if relative difference of val1 and val2 is not greater than epsilon */
    641SCIP_EXPORT
    643 SCIP* scip, /**< SCIP data structure */
    644 SCIP_Real val1, /**< first value to be compared */
    645 SCIP_Real val2 /**< second value to be compared */
    646 );
    647
    648/** checks if relative difference of val1 and val2 is greater than epsilon */
    649SCIP_EXPORT
    651 SCIP* scip, /**< SCIP data structure */
    652 SCIP_Real val1, /**< first value to be compared */
    653 SCIP_Real val2 /**< second value to be compared */
    654 );
    655
    656/** checks if relative difference of val1 and val2 is not lower than -epsilon */
    657SCIP_EXPORT
    659 SCIP* scip, /**< SCIP data structure */
    660 SCIP_Real val1, /**< first value to be compared */
    661 SCIP_Real val2 /**< second value to be compared */
    662 );
    663
    664/** checks if relative difference of values is in range of sumepsilon */
    665SCIP_EXPORT
    667 SCIP* scip, /**< SCIP data structure */
    668 SCIP_Real val1, /**< first value to be compared */
    669 SCIP_Real val2 /**< second value to be compared */
    670 );
    671
    672/** checks if relative difference of val1 and val2 is lower than sumepsilon */
    673SCIP_EXPORT
    675 SCIP* scip, /**< SCIP data structure */
    676 SCIP_Real val1, /**< first value to be compared */
    677 SCIP_Real val2 /**< second value to be compared */
    678 );
    679
    680/** checks if relative difference of val1 and val2 is not greater than sumepsilon */
    681SCIP_EXPORT
    683 SCIP* scip, /**< SCIP data structure */
    684 SCIP_Real val1, /**< first value to be compared */
    685 SCIP_Real val2 /**< second value to be compared */
    686 );
    687
    688/** checks if relative difference of val1 and val2 is greater than sumepsilon */
    689SCIP_EXPORT
    691 SCIP* scip, /**< SCIP data structure */
    692 SCIP_Real val1, /**< first value to be compared */
    693 SCIP_Real val2 /**< second value to be compared */
    694 );
    695
    696/**! [SnippetCodeStyleNaming] */
    697
    698/** checks if relative difference of val1 and val2 is not lower than -sumepsilon */
    699SCIP_EXPORT
    701 SCIP* scip, /**< SCIP data structure */
    702 SCIP_Real val1, /**< first value to be compared */
    703 SCIP_Real val2 /**< second value to be compared */
    704 );
    705
    706/** converts the given real number representing an integer to an int; in optimized mode the function gets inlined for
    707 * performance; in debug mode we check some additional conditions
    708 */
    709SCIP_EXPORT
    711 SCIP* scip, /**< SCIP data structure */
    712 SCIP_Real real /**< double bound to convert */
    713 );
    714
    715/**! [SnippetCodeStyleNaming] */
    716
    717/** converts the given real number representing an integer to a long integer; in optimized mode the function gets inlined for
    718 * performance; in debug mode we check some additional conditions
    719 */
    720SCIP_EXPORT
    722 SCIP* scip, /**< SCIP data structure */
    723 SCIP_Real real /**< double bound to convert */
    724 );
    725
    726/** Checks if an iteratively updated value is reliable or should be recomputed from scratch.
    727 * This is useful, if the value, e.g., the activity of a linear constraint or the pseudo objective value, gets a high
    728 * absolute value during the optimization process which is later reduced significantly. In this case, the last digits
    729 * were canceled out when increasing the value and are random after decreasing it.
    730 * We do not consider the cancellations which can occur during increasing the absolute value because they just cannot
    731 * be expressed using fixed precision floating point arithmetic, anymore.
    732 * In order to get more reliable values, the idea is to always store the last reliable value, where increasing the
    733 * absolute of the value is viewed as preserving reliability. Then, after each update, the new absolute value can be
    734 * compared against the last reliable one with this method, checking whether it was decreased by a factor of at least
    735 * "lp/recompfac" and should be recomputed.
    736 */
    737SCIP_EXPORT
    739 SCIP* scip, /**< SCIP data structure */
    740 SCIP_Real newvalue, /**< new value after update */
    741 SCIP_Real oldvalue /**< old value, i.e., last reliable value */
    742 );
    743
    744#ifdef NDEBUG
    745
    746/* In optimized mode, the function calls are overwritten by defines to reduce the number of function calls and
    747 * speed up the algorithms.
    748 */
    749
    750#define SCIPinfinity(scip) SCIPsetInfinity((scip)->set)
    751#define SCIPisInfinity(scip, val) SCIPsetIsInfinity((scip)->set, val)
    752#define SCIPisHugeValue(scip, val) SCIPsetIsHugeValue((scip)->set, val)
    753#define SCIPgetHugeValue(scip) SCIPsetGetHugeValue((scip)->set)
    754#define SCIPisEQ(scip, val1, val2) SCIPsetIsEQ((scip)->set, val1, val2)
    755#define SCIPisLT(scip, val1, val2) SCIPsetIsLT((scip)->set, val1, val2)
    756#define SCIPisLE(scip, val1, val2) SCIPsetIsLE((scip)->set, val1, val2)
    757#define SCIPisGT(scip, val1, val2) SCIPsetIsGT((scip)->set, val1, val2)
    758#define SCIPisGE(scip, val1, val2) SCIPsetIsGE((scip)->set, val1, val2)
    759#define SCIPisZero(scip, val) SCIPsetIsZero((scip)->set, val)
    760#define SCIPisPositive(scip, val) SCIPsetIsPositive((scip)->set, val)
    761#define SCIPisNegative(scip, val) SCIPsetIsNegative((scip)->set, val)
    762#define SCIPisIntegral(scip, val) SCIPsetIsIntegral((scip)->set, val)
    763#define SCIPisScalingIntegral(scip, val, scalar) SCIPsetIsScalingIntegral((scip)->set, val, scalar)
    764#define SCIPisFracIntegral(scip, val) SCIPsetIsFracIntegral((scip)->set, val)
    765#define SCIPfloor(scip, val) SCIPsetFloor((scip)->set, val)
    766#define SCIPceil(scip, val) SCIPsetCeil((scip)->set, val)
    767#define SCIPround(scip, val) SCIPsetRound((scip)->set, val)
    768#define SCIPfrac(scip, val) SCIPsetFrac((scip)->set, val)
    769
    770#define SCIPisSumEQ(scip, val1, val2) SCIPsetIsSumEQ((scip)->set, val1, val2)
    771#define SCIPisSumLT(scip, val1, val2) SCIPsetIsSumLT((scip)->set, val1, val2)
    772#define SCIPisSumLE(scip, val1, val2) SCIPsetIsSumLE((scip)->set, val1, val2)
    773#define SCIPisSumGT(scip, val1, val2) SCIPsetIsSumGT((scip)->set, val1, val2)
    774#define SCIPisSumGE(scip, val1, val2) SCIPsetIsSumGE((scip)->set, val1, val2)
    775#define SCIPisSumZero(scip, val) SCIPsetIsSumZero((scip)->set, val)
    776#define SCIPisSumPositive(scip, val) SCIPsetIsSumPositive((scip)->set, val)
    777#define SCIPisSumNegative(scip, val) SCIPsetIsSumNegative((scip)->set, val)
    778
    779#define SCIPisFeasEQ(scip, val1, val2) SCIPsetIsFeasEQ((scip)->set, val1, val2)
    780#define SCIPisFeasLT(scip, val1, val2) SCIPsetIsFeasLT((scip)->set, val1, val2)
    781#define SCIPisFeasLE(scip, val1, val2) SCIPsetIsFeasLE((scip)->set, val1, val2)
    782#define SCIPisFeasGT(scip, val1, val2) SCIPsetIsFeasGT((scip)->set, val1, val2)
    783#define SCIPisFeasGE(scip, val1, val2) SCIPsetIsFeasGE((scip)->set, val1, val2)
    784#define SCIPisFeasZero(scip, val) SCIPsetIsFeasZero((scip)->set, val)
    785#define SCIPisFeasPositive(scip, val) SCIPsetIsFeasPositive((scip)->set, val)
    786#define SCIPisFeasNegative(scip, val) SCIPsetIsFeasNegative((scip)->set, val)
    787#define SCIPisFeasIntegral(scip, val) SCIPsetIsFeasIntegral((scip)->set, val)
    788#define SCIPisFeasFracIntegral(scip, val) SCIPsetIsFeasFracIntegral((scip)->set, val)
    789#define SCIPfeasFloor(scip, val) SCIPsetFeasFloor((scip)->set, val)
    790#define SCIPfeasCeil(scip, val) SCIPsetFeasCeil((scip)->set, val)
    791#define SCIPfeasRound(scip, val) SCIPsetFeasRound((scip)->set, val)
    792#define SCIPfeasFrac(scip, val) SCIPsetFeasFrac((scip)->set, val)
    793
    794#define SCIPisDualfeasEQ(scip, val1, val2) SCIPsetIsDualfeasEQ((scip)->set, val1, val2)
    795#define SCIPisDualfeasLT(scip, val1, val2) SCIPsetIsDualfeasLT((scip)->set, val1, val2)
    796#define SCIPisDualfeasLE(scip, val1, val2) SCIPsetIsDualfeasLE((scip)->set, val1, val2)
    797#define SCIPisDualfeasGT(scip, val1, val2) SCIPsetIsDualfeasGT((scip)->set, val1, val2)
    798#define SCIPisDualfeasGE(scip, val1, val2) SCIPsetIsDualfeasGE((scip)->set, val1, val2)
    799#define SCIPisDualfeasZero(scip, val) SCIPsetIsDualfeasZero((scip)->set, val)
    800#define SCIPisDualfeasPositive(scip, val) SCIPsetIsDualfeasPositive((scip)->set, val)
    801#define SCIPisDualfeasNegative(scip, val) SCIPsetIsDualfeasNegative((scip)->set, val)
    802#define SCIPisDualfeasIntegral(scip, val) SCIPsetIsDualfeasIntegral((scip)->set, val)
    803#define SCIPisDualfeasFracIntegral(scip, val) SCIPsetIsDualfeasFracIntegral((scip)->set, val)
    804#define SCIPdualfeasFloor(scip, val) SCIPsetDualfeasFloor((scip)->set, val)
    805#define SCIPdualfeasCeil(scip, val) SCIPsetDualfeasCeil((scip)->set, val)
    806#define SCIPdualfeasRound(scip, val) SCIPsetDualfeasRound((scip)->set, val)
    807#define SCIPdualfeasFrac(scip, val) SCIPsetDualfeasFrac((scip)->set, val)
    808
    809#define SCIPisLbBetter(scip, newlb, oldlb, oldub) SCIPsetIsLbBetter(scip->set, newlb, oldlb, oldub)
    810#define SCIPisUbBetter(scip, newub, oldlb, oldub) SCIPsetIsUbBetter(scip->set, newub, oldlb, oldub)
    811
    812#define SCIPisRelEQ(scip, val1, val2) SCIPsetIsRelEQ((scip)->set, val1, val2)
    813#define SCIPisRelLT(scip, val1, val2) SCIPsetIsRelLT((scip)->set, val1, val2)
    814#define SCIPisRelLE(scip, val1, val2) SCIPsetIsRelLE((scip)->set, val1, val2)
    815#define SCIPisRelGT(scip, val1, val2) SCIPsetIsRelGT((scip)->set, val1, val2)
    816#define SCIPisRelGE(scip, val1, val2) SCIPsetIsRelGE((scip)->set, val1, val2)
    817
    818#define SCIPisSumRelEQ(scip, val1, val2) SCIPsetIsSumRelEQ((scip)->set, val1, val2)
    819#define SCIPisSumRelLT(scip, val1, val2) SCIPsetIsSumRelLT((scip)->set, val1, val2)
    820#define SCIPisSumRelLE(scip, val1, val2) SCIPsetIsSumRelLE((scip)->set, val1, val2)
    821#define SCIPisSumRelGT(scip, val1, val2) SCIPsetIsSumRelGT((scip)->set, val1, val2)
    822#define SCIPisSumRelGE(scip, val1, val2) SCIPsetIsSumRelGE((scip)->set, val1, val2)
    823#define SCIPconvertRealToInt(scip, real) ((int)((real) < 0 ? ((real) - 0.5) : ((real) + 0.5)))
    824#define SCIPconvertRealToLongint(scip, real) ((SCIP_Longint)((real) < 0 ? ((real) - 0.5) : ((real) + 0.5)))
    825
    826#define SCIPisUpdateUnreliable(scip, newval, oldval) SCIPsetIsUpdateUnreliable((scip)->set, newval, oldval)
    827
    828#endif
    829
    830/** outputs a real number, or "+infinity", or "-infinity" to a file */
    831SCIP_EXPORT
    832void SCIPprintReal(
    833 SCIP* scip, /**< SCIP data structure */
    834 FILE* file, /**< output file (or NULL for standard output) */
    835 SCIP_Real val, /**< value to print */
    836 int width, /**< width of the field */
    837 int precision /**< number of significant digits printed */
    838 );
    839
    840/** parse a real value that was written with SCIPprintReal() */
    841SCIP_EXPORT
    843 SCIP* scip, /**< SCIP data structure */
    844 const char* str, /**< string to search */
    845 SCIP_Real* value, /**< pointer to store the parsed value */
    846 char** endptr /**< pointer to store the final string position if successfully parsed, otherwise @p str */
    847 );
    848
    849/** parse a rational value */
    851 SCIP* scip, /**< SCIP data structure */
    852 const char* str, /**< string to search */
    853 SCIP_RATIONAL* value, /**< pointer to store the parsed value */
    854 char** endptr /**< pointer to store the final string position if successfully parsed, otherwise @p str */
    855 );
    856
    857/**@} */
    858
    859#ifdef __cplusplus
    860}
    861#endif
    862
    863#endif
    common defines and data types used in all packages of SCIP
    #define SCIP_Longint
    Definition: def.h:141
    #define SCIP_Bool
    Definition: def.h:91
    #define SCIP_Real
    Definition: def.h:156
    SCIP_Bool SCIPisRelEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
    SCIP_Real SCIPdualfeasFloor(SCIP *scip, SCIP_Real val)
    SCIP_Bool SCIPisSumPositive(SCIP *scip, SCIP_Real val)
    SCIP_Bool SCIPisRelLE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
    SCIP_Bool SCIPisUbBetter(SCIP *scip, SCIP_Real newub, SCIP_Real oldlb, SCIP_Real oldub)
    SCIP_Bool SCIPisFeasGE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
    SCIP_Real SCIPdualfeasCeil(SCIP *scip, SCIP_Real val)
    SCIP_Bool SCIPisSumRelGT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
    SCIP_Real SCIPinfinity(SCIP *scip)
    SCIP_Bool SCIPisDualfeasNegative(SCIP *scip, SCIP_Real val)
    SCIP_Bool SCIPisGE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
    SCIP_Bool SCIPisFeasFracIntegral(SCIP *scip, SCIP_Real val)
    SCIP_Bool SCIPisIntegral(SCIP *scip, SCIP_Real val)
    SCIP_Real SCIPrelaxfeastol(SCIP *scip)
    SCIP_Real SCIPfeasFrac(SCIP *scip, SCIP_Real val)
    SCIP_Real SCIPchgRelaxfeastol(SCIP *scip, SCIP_Real relaxfeastol)
    SCIP_Bool SCIPisRelLT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
    SCIP_Bool SCIPisSumRelLE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
    SCIP_Bool SCIPparseRational(SCIP *scip, const char *str, SCIP_RATIONAL *value, char **endptr)
    SCIP_Bool SCIPisRelGE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
    SCIP_Bool SCIPisRelGT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
    SCIP_Bool SCIPisSumRelEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
    SCIP_Bool SCIPisSumNegative(SCIP *scip, SCIP_Real val)
    SCIP_Bool SCIPisFeasEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
    SCIP_Bool SCIPisDualfeasLT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
    SCIP_Bool SCIPisPositive(SCIP *scip, SCIP_Real val)
    SCIP_Bool SCIPisDualfeasIntegral(SCIP *scip, SCIP_Real val)
    SCIP_Bool SCIPisLbBetter(SCIP *scip, SCIP_Real newlb, SCIP_Real oldlb, SCIP_Real oldub)
    SCIP_Real SCIPfeasCeil(SCIP *scip, SCIP_Real val)
    SCIP_Bool SCIPisDualfeasPositive(SCIP *scip, SCIP_Real val)
    SCIP_Bool SCIPisLE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
    SCIP_Bool SCIPisFeasZero(SCIP *scip, SCIP_Real val)
    SCIP_Real SCIPfloor(SCIP *scip, SCIP_Real val)
    SCIP_Bool SCIPisHugeValue(SCIP *scip, SCIP_Real val)
    void SCIPprintReal(SCIP *scip, FILE *file, SCIP_Real val, int width, int precision)
    SCIP_Real SCIPfeasFloor(SCIP *scip, SCIP_Real val)
    SCIP_Bool SCIPisInfinity(SCIP *scip, SCIP_Real val)
    SCIP_Bool SCIPisSumLT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
    SCIP_Real SCIPdualfeasRound(SCIP *scip, SCIP_Real val)
    SCIP_Bool SCIPisSumRelLT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
    SCIP_Bool SCIPisDualfeasFracIntegral(SCIP *scip, SCIP_Real val)
    SCIP_Real SCIPround(SCIP *scip, SCIP_Real val)
    SCIP_Bool SCIPisFeasLT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
    SCIP_Real SCIPfeasRound(SCIP *scip, SCIP_Real val)
    SCIP_Bool SCIPisFeasNegative(SCIP *scip, SCIP_Real val)
    SCIP_Bool SCIPisFeasLE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
    SCIP_Bool SCIPisFracIntegral(SCIP *scip, SCIP_Real val)
    SCIP_Bool SCIPisSumEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
    SCIP_RETCODE SCIPchgFeastol(SCIP *scip, SCIP_Real feastol)
    SCIP_Bool SCIPisFeasIntegral(SCIP *scip, SCIP_Real val)
    SCIP_Bool SCIPisDualfeasGT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
    SCIP_Bool SCIPisDualfeasEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
    SCIP_Real SCIPfeastol(SCIP *scip)
    SCIP_Bool SCIPisSumGE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
    SCIP_Real SCIPdualfeastol(SCIP *scip)
    SCIP_Real SCIPfrac(SCIP *scip, SCIP_Real val)
    SCIP_Real SCIPgetHugeValue(SCIP *scip)
    SCIP_Bool SCIPisDualfeasZero(SCIP *scip, SCIP_Real val)
    SCIP_Real SCIPdualfeasFrac(SCIP *scip, SCIP_Real val)
    SCIP_Bool SCIPisGT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
    SCIP_Longint SCIPconvertRealToLongint(SCIP *scip, SCIP_Real real)
    SCIP_Bool SCIPisNegative(SCIP *scip, SCIP_Real val)
    SCIP_Real SCIPceil(SCIP *scip, SCIP_Real val)
    SCIP_Bool SCIPisSumRelGE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
    SCIP_Bool SCIPisScalingIntegral(SCIP *scip, SCIP_Real val, SCIP_Real scalar)
    SCIP_Bool SCIPisFeasGT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
    SCIP_Bool SCIPisEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
    SCIP_Bool SCIPisDualfeasGE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
    SCIP_Bool SCIPisSumZero(SCIP *scip, SCIP_Real val)
    SCIP_Real SCIPcutoffbounddelta(SCIP *scip)
    SCIP_Bool SCIPisUpdateUnreliable(SCIP *scip, SCIP_Real newvalue, SCIP_Real oldvalue)
    int SCIPconvertRealToInt(SCIP *scip, SCIP_Real real)
    SCIP_Bool SCIPisZero(SCIP *scip, SCIP_Real val)
    SCIP_RETCODE SCIPchgBarrierconvtol(SCIP *scip, SCIP_Real barrierconvtol)
    void SCIPmarkLimitChanged(SCIP *scip)
    SCIP_Real SCIPepsilon(SCIP *scip)
    SCIP_Real SCIPsumepsilon(SCIP *scip)
    SCIP_Bool SCIPisLT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
    SCIP_Bool SCIPisDualfeasLE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
    SCIP_Real SCIPbarrierconvtol(SCIP *scip)
    SCIP_Bool SCIPisSumGT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
    SCIP_Bool SCIPisFeasPositive(SCIP *scip, SCIP_Real val)
    SCIP_Bool SCIPisSumLE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
    SCIP_Bool SCIPparseReal(SCIP *scip, const char *str, SCIP_Real *value, char **endptr)
    SCIP_RETCODE SCIPchgDualfeastol(SCIP *scip, SCIP_Real dualfeastol)
    double real
    internal methods for global SCIP settings
    SCIP main data structure.
    type definitions for rational numbers
    type definitions for return codes for SCIP methods
    enum SCIP_Retcode SCIP_RETCODE
    Definition: type_retcode.h:63
    type definitions for SCIP's main datastructure