Scippy

    SCIP

    Solving Constraint Integer Programs

    intervalarith.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 intervalarith.h
    26 * @ingroup PUBLICCOREAPI
    27 * @brief interval arithmetics for provable bounds
    28 * @author Tobias Achterberg
    29 * @author Stefan Vigerske
    30 * @author Kati Wolter
    31 */
    32
    33/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
    34
    35#ifndef __SCIP_INTERVALARITH_H__
    36#define __SCIP_INTERVALARITH_H__
    37
    38
    39#include "scip/def.h"
    40#include "scip/type_rational.h"
    41
    42#ifdef __cplusplus
    43extern "C" {
    44#endif
    45
    46/**@defgroup PublicIntervalArithMethods Interval Arithmetics
    47 * @ingroup MiscellaneousMethods
    48 * @brief methods for interval arithmetics
    49 *
    50 * @{
    51 */
    52
    53/** interval given by infimum and supremum */
    55{
    56 SCIP_Real inf; /**< infimum (lower bound) of interval */
    57 SCIP_Real sup; /**< supremum (upper bound) of interval */
    58};
    60
    61/** rounding mode of floating point operations (upwards, downwards, nearest, ...)
    62 *
    63 * exact values depend on machine and compiler
    64 */
    65typedef int SCIP_ROUNDMODE;
    66
    67/*
    68 * Interval arithmetic operations
    69 */
    70
    71/** returns whether rounding mode control is available */
    72SCIP_EXPORT
    74 void
    75 );
    76
    77/** sets rounding mode of floating point operations */
    78SCIP_EXPORT
    80 SCIP_ROUNDMODE roundmode /**< rounding mode to activate */
    81 );
    82
    83/** gets current rounding mode of floating point operations */
    84SCIP_EXPORT
    86 void
    87 );
    88
    89/** sets rounding mode of floating point operations to downwards rounding */
    90SCIP_EXPORT
    92 void
    93 );
    94
    95/** sets rounding mode of floating point operations to upwards rounding */
    96SCIP_EXPORT
    98 void
    99 );
    100
    101/** sets rounding mode of floating point operations to nearest rounding */
    102SCIP_EXPORT
    104 void
    105 );
    106
    107/** sets rounding mode of floating point operations to towards zero rounding */
    108SCIP_EXPORT
    110 void
    111 );
    112
    113/** negates a number in a way that the compiler does not optimize it away */
    114SCIP_EXPORT
    116 SCIP_Real x /**< number to negate */
    117 );
    118
    119/** returns infimum of interval */
    120SCIP_EXPORT
    122 SCIP_INTERVAL interval /**< interval */
    123 );
    124
    125/** returns supremum of interval */
    126SCIP_EXPORT
    128 SCIP_INTERVAL interval /**< interval */
    129 );
    130
    131/** stores given value as interval */
    132SCIP_EXPORT
    133void SCIPintervalSet(
    134 SCIP_INTERVAL* resultant, /**< interval to store value into */
    135 SCIP_Real value /**< value to store */
    136 );
    137
    138/** stores given value as interval */
    139SCIP_EXPORT
    141 SCIP_INTERVAL* resultant, /**< interval to store value into */
    142 SCIP_RATIONAL* value /**< value to store */
    143 );
    144
    145/** stores given infimum and supremum as interval */
    146SCIP_EXPORT
    148 SCIP_INTERVAL* resultant, /**< interval to store value into */
    149 SCIP_Real inf, /**< value to store as infimum */
    150 SCIP_Real sup /**< value to store as supremum */
    151 );
    152
    153/** sets interval to empty interval, which will be [1.0, -1.0] */
    154SCIP_EXPORT
    156 SCIP_INTERVAL* resultant /**< resultant interval of operation */
    157 );
    158
    159/** indicates whether interval is empty, i.e., whether inf > sup */
    160SCIP_EXPORT
    162 SCIP_Real infinity, /**< value for infinity */
    163 SCIP_INTERVAL operand /**< operand of operation */
    164 );
    165
    166/** sets interval to entire [-infinity, +infinity] */
    167SCIP_EXPORT
    169 SCIP_Real infinity, /**< value for infinity */
    170 SCIP_INTERVAL* resultant /**< resultant interval of operation */
    171 );
    172
    173/** indicates whether interval is entire, i.e., whether inf &le; -infinity and sup &ge; infinity */
    174SCIP_EXPORT
    176 SCIP_Real infinity, /**< value for infinity */
    177 SCIP_INTERVAL operand /**< operand of operation */
    178 );
    179
    180/** indicates whether interval is positive infinity, i.e., [infinity, infinity] */
    181SCIP_EXPORT
    183 SCIP_Real infinity, /**< value for infinity */
    184 SCIP_INTERVAL operand /**< operand of operation */
    185 );
    186
    187/** indicates whether interval is negative infinity, i.e., [-infinity, -infinity] */
    188SCIP_EXPORT
    190 SCIP_Real infinity, /**< value for infinity */
    191 SCIP_INTERVAL operand /**< operand of operation */
    192 );
    193
    194#ifdef NDEBUG
    195
    196/* In optimized mode, some function calls are overwritten by defines to reduce the number of function calls and
    197 * speed up the algorithms.
    198 * With SCIPintervalSetBounds we need to be a bit careful, since i and s could use resultant->inf and resultant->sup,
    199 * e.g., SCIPintervalSetBounds(&resultant, -resultant->sup, -resultant->inf).
    200 * So we need to make sure that we first evaluate both terms before setting resultant.
    201 */
    202
    203#define SCIPintervalGetInf(interval) (interval).inf
    204#define SCIPintervalGetSup(interval) (interval).sup
    205#define SCIPintervalSet(resultant, value) do { (resultant)->inf = (value); (resultant)->sup = (resultant)->inf; } while( FALSE )
    206#define SCIPintervalSetBounds(resultant, i, s) do { SCIP_Real scipintervaltemp; scipintervaltemp = (s); (resultant)->inf = (i); (resultant)->sup = scipintervaltemp; } while( FALSE )
    207#define SCIPintervalSetEmpty(resultant) do { (resultant)->inf = 1.0; (resultant)->sup = -1.0; } while( FALSE )
    208#define SCIPintervalSetEntire(infinity, resultant) do { (resultant)->inf = -(infinity); (resultant)->sup = (infinity); } while( FALSE )
    209#define SCIPintervalIsEmpty(infinity, operand) ( (operand).inf > -(infinity) && (operand).sup < (infinity) && (operand).sup < (operand).inf )
    210#define SCIPintervalIsEntire(infinity, operand) ( (operand).inf <= -(infinity) && (operand).sup >= (infinity) )
    211#define SCIPintervalIsPositiveInfinity(infinity, operand) ( (operand).inf >= (infinity) && (operand).sup >= (operand).inf )
    212#define SCIPintervalIsNegativeInfinity(infinity, operand) ( (operand).sup <= -(infinity) && (operand).sup >= (operand).inf )
    213
    214#endif
    215
    216/** indicates whether operand1 is contained in operand2 */
    217SCIP_EXPORT
    219 SCIP_Real infinity, /**< value for infinity */
    220 SCIP_INTERVAL operand1, /**< first operand of operation */
    221 SCIP_INTERVAL operand2 /**< second operand of operation */
    222 );
    223
    224/** indicates whether operand1 and operand2 are disjoint */
    225SCIP_EXPORT
    227 SCIP_INTERVAL operand1, /**< first operand of operation */
    228 SCIP_INTERVAL operand2 /**< second operand of operation */
    229 );
    230
    231/** indicates whether operand1 and operand2 are disjoint with epsilon tolerance
    232 *
    233 * Returns whether minimal (relative) distance of intervals is larger than epsilon.
    234 * Same as `SCIPintervalIsEmpty(SCIPintervalIntersectEps(operand1, operand2))`.
    235 */
    236SCIP_EXPORT
    238 SCIP_Real eps, /**< epsilon */
    239 SCIP_INTERVAL operand1, /**< first operand of operation */
    240 SCIP_INTERVAL operand2 /**< second operand of operation */
    241 );
    242
    243/** intersection of two intervals */
    244SCIP_EXPORT
    246 SCIP_INTERVAL* resultant, /**< resultant interval of operation */
    247 SCIP_INTERVAL operand1, /**< first operand of operation */
    248 SCIP_INTERVAL operand2 /**< second operand of operation */
    249 );
    250
    251/** intersection of two intervals with epsilon tolerance
    252 *
    253 * If intersection of operand1 and operand2 is empty, but minimal (relative) distance of intervals
    254 * is at most epsilon, then set resultant to singleton containing the point in operand1
    255 * that is closest to operand2, i.e.,
    256 * - `resultant = { operand1.sup }`, if `operand1.sup` < `operand2.inf` and `reldiff(operand2.inf,operand1.sup)` &le; eps
    257 * - `resultant = { operand1.inf }`, if `operand1.inf` > `operand2.sup` and `reldiff(operand1.inf,operand2.sup)` &le; eps
    258 * - `resultant` = intersection of `operand1` and `operand2`, otherwise
    259 */
    260SCIP_EXPORT
    262 SCIP_INTERVAL* resultant, /**< resultant interval of operation */
    263 SCIP_Real eps, /**< epsilon */
    264 SCIP_INTERVAL operand1, /**< first operand of operation */
    265 SCIP_INTERVAL operand2 /**< second operand of operation */
    266 );
    267
    268/** interval enclosure of the union of two intervals */
    269SCIP_EXPORT
    271 SCIP_INTERVAL* resultant, /**< resultant interval of operation */
    272 SCIP_INTERVAL operand1, /**< first operand of operation */
    273 SCIP_INTERVAL operand2 /**< second operand of operation */
    274 );
    275
    276/** adds operand1 and operand2 and stores infimum of result in infimum of resultant */
    277SCIP_EXPORT
    279 SCIP_Real infinity, /**< value for infinity */
    280 SCIP_INTERVAL* resultant, /**< resultant interval of operation */
    281 SCIP_INTERVAL operand1, /**< first operand of operation */
    282 SCIP_INTERVAL operand2 /**< second operand of operation */
    283 );
    284
    285/** adds operand1 and operand2 and stores supremum of result in supremum of resultant */
    286SCIP_EXPORT
    288 SCIP_Real infinity, /**< value for infinity */
    289 SCIP_INTERVAL* resultant, /**< resultant interval of operation */
    290 SCIP_INTERVAL operand1, /**< first operand of operation */
    291 SCIP_INTERVAL operand2 /**< second operand of operation */
    292 );
    293
    294/** adds operand1 and operand2 and stores result in resultant */
    295SCIP_EXPORT
    296void SCIPintervalAdd(
    297 SCIP_Real infinity, /**< value for infinity */
    298 SCIP_INTERVAL* resultant, /**< resultant interval of operation */
    299 SCIP_INTERVAL operand1, /**< first operand of operation */
    300 SCIP_INTERVAL operand2 /**< second operand of operation */
    301 );
    302
    303/** adds operand1 and scalar operand2 and stores result in resultant */
    304SCIP_EXPORT
    306 SCIP_Real infinity, /**< value for infinity */
    307 SCIP_INTERVAL* resultant, /**< resultant interval of operation */
    308 SCIP_INTERVAL operand1, /**< first operand of operation */
    309 SCIP_Real operand2 /**< second operand of operation */
    310 );
    311
    312/** adds vector operand1 and vector operand2 and stores result in vector resultant */
    313SCIP_EXPORT
    315 SCIP_Real infinity, /**< value for infinity */
    316 SCIP_INTERVAL* resultant, /**< array of resultant intervals of operation */
    317 int length, /**< length of arrays */
    318 SCIP_INTERVAL* operand1, /**< array of first operands of operation */
    319 SCIP_INTERVAL* operand2 /**< array of second operands of operation */
    320 );
    321
    322/** subtracts operand2 from operand1 and stores result in resultant */
    323SCIP_EXPORT
    324void SCIPintervalSub(
    325 SCIP_Real infinity, /**< value for infinity */
    326 SCIP_INTERVAL* resultant, /**< resultant interval of operation */
    327 SCIP_INTERVAL operand1, /**< first operand of operation */
    328 SCIP_INTERVAL operand2 /**< second operand of operation */
    329 );
    330
    331/** subtracts scalar operand2 from operand1 and stores result in resultant */
    332SCIP_EXPORT
    334 SCIP_Real infinity, /**< value for infinity */
    335 SCIP_INTERVAL* resultant, /**< resultant interval of operation */
    336 SCIP_INTERVAL operand1, /**< first operand of operation */
    337 SCIP_Real operand2 /**< second operand of operation */
    338 );
    339
    340/** multiplies operand1 with operand2 and stores infimum of result in infimum of resultant */
    341SCIP_EXPORT
    343 SCIP_Real infinity, /**< value for infinity */
    344 SCIP_INTERVAL* resultant, /**< resultant interval of operation */
    345 SCIP_INTERVAL operand1, /**< first operand of operation; can be +/-inf */
    346 SCIP_INTERVAL operand2 /**< second operand of operation; can be +/-inf */
    347 );
    348
    349/** multiplies operand1 with operand2 and stores supremum of result in supremum of resultant */
    350SCIP_EXPORT
    352 SCIP_Real infinity, /**< value for infinity */
    353 SCIP_INTERVAL* resultant, /**< resultant interval of operation */
    354 SCIP_INTERVAL operand1, /**< first operand of operation; can be +/-inf */
    355 SCIP_INTERVAL operand2 /**< second operand of operation; can be +/-inf */
    356 );
    357
    358/** multiplies operand1 with operand2 and stores result in resultant */
    359SCIP_EXPORT
    360void SCIPintervalMul(
    361 SCIP_Real infinity, /**< value for infinity */
    362 SCIP_INTERVAL* resultant, /**< resultant interval of operation */
    363 SCIP_INTERVAL operand1, /**< first operand of operation */
    364 SCIP_INTERVAL operand2 /**< second operand of operation */
    365 );
    366
    367/** multiplies operand1 with scalar operand2 and stores infimum of result in infimum of resultant */
    368SCIP_EXPORT
    370 SCIP_Real infinity, /**< value for infinity */
    371 SCIP_INTERVAL* resultant, /**< resultant interval of operation */
    372 SCIP_INTERVAL operand1, /**< first operand of operation */
    373 SCIP_Real operand2 /**< second operand of operation; can be +/- inf */
    374 );
    375
    376/** multiplies operand1 with scalar operand2 and stores supremum of result in supremum of resultant */
    377SCIP_EXPORT
    379 SCIP_Real infinity, /**< value for infinity */
    380 SCIP_INTERVAL* resultant, /**< resultant interval of operation */
    381 SCIP_INTERVAL operand1, /**< first operand of operation */
    382 SCIP_Real operand2 /**< second operand of operation; can be +/- inf */
    383 );
    384
    385/** multiplies operand1 with scalar operand2 and stores result in resultant */
    386SCIP_EXPORT
    388 SCIP_Real infinity, /**< value for infinity */
    389 SCIP_INTERVAL* resultant, /**< resultant interval of operation */
    390 SCIP_INTERVAL operand1, /**< first operand of operation */
    391 SCIP_Real operand2 /**< second operand of operation */
    392 );
    393
    394/** divides operand1 by operand2 and stores result in resultant */
    395SCIP_EXPORT
    396void SCIPintervalDiv(
    397 SCIP_Real infinity, /**< value for infinity */
    398 SCIP_INTERVAL* resultant, /**< resultant interval of operation */
    399 SCIP_INTERVAL operand1, /**< first operand of operation */
    400 SCIP_INTERVAL operand2 /**< second operand of operation */
    401 );
    402
    403/** divides operand1 by scalar operand2 and stores result in resultant */
    404SCIP_EXPORT
    406 SCIP_Real infinity, /**< value for infinity */
    407 SCIP_INTERVAL* resultant, /**< resultant interval of operation */
    408 SCIP_INTERVAL operand1, /**< first operand of operation */
    409 SCIP_Real operand2 /**< second operand of operation */
    410 );
    411
    412/** computes the scalar product of two vectors of intervals and stores result in resultant */
    413SCIP_EXPORT
    415 SCIP_Real infinity, /**< value for infinity */
    416 SCIP_INTERVAL* resultant, /**< resultant interval of operation */
    417 int length, /**< length of vectors */
    418 SCIP_INTERVAL* operand1, /**< first vector as array of intervals */
    419 SCIP_INTERVAL* operand2 /**< second vector as array of intervals */
    420 );
    421
    422/** computes the scalar product of a vector of intervals and a vector of scalars and stores infimum of result in infimum of resultant */
    423SCIP_EXPORT
    425 SCIP_Real infinity, /**< value for infinity */
    426 SCIP_INTERVAL* resultant, /**< resultant interval of operation */
    427 int length, /**< length of vectors */
    428 SCIP_INTERVAL* operand1, /**< first vector as array of intervals */
    429 SCIP_Real* operand2 /**< second vector as array of scalars; can have +/-inf entries */
    430 );
    431
    432/** computes the scalar product of a vector of intervals and a vector of scalars and stores supremum of result in supremum of resultant */
    433SCIP_EXPORT
    435 SCIP_Real infinity, /**< value for infinity */
    436 SCIP_INTERVAL* resultant, /**< resultant interval of operation */
    437 int length, /**< length of vectors */
    438 SCIP_INTERVAL* operand1, /**< first vector as array of intervals */
    439 SCIP_Real* operand2 /**< second vector as array of scalars; can have +/-inf entries */
    440 );
    441
    442/** computes the scalar product of a vector of intervals and a vector of scalars and stores result in resultant */
    443SCIP_EXPORT
    445 SCIP_Real infinity, /**< value for infinity */
    446 SCIP_INTERVAL* resultant, /**< resultant interval of operation */
    447 int length, /**< length of vectors */
    448 SCIP_INTERVAL* operand1, /**< first vector as array of intervals */
    449 SCIP_Real* operand2 /**< second vector as array of scalars; can have +/-inf entries */
    450 );
    451
    452/** squares operand and stores result in resultant */
    453SCIP_EXPORT
    455 SCIP_Real infinity, /**< value for infinity */
    456 SCIP_INTERVAL* resultant, /**< resultant interval of operation */
    457 SCIP_INTERVAL operand /**< operand of operation */
    458 );
    459
    460/** stores (positive part of) square root of operand in resultant
    461 * @attention we assume a correctly rounded sqrt(double) function when rounding is to nearest
    462 */
    463SCIP_EXPORT
    465 SCIP_Real infinity, /**< value for infinity */
    466 SCIP_INTERVAL* resultant, /**< resultant interval of operation */
    467 SCIP_INTERVAL operand /**< operand of operation */
    468 );
    469
    470/** stores operand1 to the power of operand2 in resultant
    471 *
    472 * uses SCIPintervalPowerScalar if operand2 is a scalar, otherwise computes exp(op2*log(op1))
    473 */
    474SCIP_EXPORT
    476 SCIP_Real infinity, /**< value for infinity */
    477 SCIP_INTERVAL* resultant, /**< resultant interval of operation */
    478 SCIP_INTERVAL operand1, /**< first operand of operation */
    479 SCIP_INTERVAL operand2 /**< second operand of operation */
    480 );
    481
    482/** stores operand1 to the power of the scalar operand2 in resultant
    483 * @attention we assume a correctly rounded pow(double) function when rounding is to nearest
    484 */
    485SCIP_EXPORT
    487 SCIP_Real infinity, /**< value for infinity */
    488 SCIP_INTERVAL* resultant, /**< resultant interval of operation */
    489 SCIP_INTERVAL operand1, /**< first operand of operation */
    490 SCIP_Real operand2 /**< second operand of operation */
    491 );
    492
    493/** stores bounds on the power of a scalar operand1 to a scalar operand2 in resultant
    494 *
    495 * Both operands need to be finite numbers.
    496 * Needs to have operand1 &ge; 0 or operand2 integer and needs to have operand2 &ge; 0 if operand1 = 0.
    497 * @attention we assume a correctly rounded pow(double) function when rounding is to nearest
    498 */
    499SCIP_EXPORT
    501 SCIP_INTERVAL* resultant, /**< resultant of operation */
    502 SCIP_Real operand1, /**< first operand of operation */
    503 SCIP_Real operand2 /**< second operand of operation */
    504 );
    505
    506/** computes lower bound on power of a scalar operand1 to an integer operand2
    507 *
    508 * Both operands need to be finite numbers.
    509 * Needs to have operand1 &ge; 0 and need to have operand2 &ge; 0 if operand1 = 0.
    510 */
    511SCIP_EXPORT
    513 SCIP_Real operand1, /**< first operand of operation */
    514 int operand2 /**< second operand of operation */
    515 );
    516
    517/** computes upper bound on power of a scalar operand1 to an integer operand2
    518 *
    519 * Both operands need to be finite numbers.
    520 * Needs to have operand1 &ge; 0 and needs to have operand2 &ge; 0 if operand1 = 0.
    521 */
    522SCIP_EXPORT
    524 SCIP_Real operand1, /**< first operand of operation */
    525 int operand2 /**< second operand of operation */
    526 );
    527
    528/** computes bounds on power of a scalar operand1 to an integer operand2
    529 *
    530 * Both operands need to be finite numbers.
    531 * Needs to have operand1 &ge; 0 and needs to have operand2 &ge; 0 if operand1 = 0.
    532 */
    533SCIP_EXPORT
    535 SCIP_INTERVAL* resultant, /**< resultant interval of operation */
    536 SCIP_Real operand1, /**< first operand of operation */
    537 int operand2 /**< second operand of operation */
    538 );
    539
    540/** given an interval for the image of a power operation, computes an interval for the origin
    541 *
    542 * That is, for \f$y = x^p\f$ with the exponent \f$p\f$ a given scalar and \f$y\f$ = `image` a given interval,
    543 * computes \f$x \subseteq \text{basedomain}\f$ such that \f$y \in x^p\f$ and such that for all \f$z \in \text{basedomain} \setminus x: z^p \not \in y\f$.
    544 */
    545SCIP_EXPORT
    547 SCIP_Real infinity, /**< value for infinity */
    548 SCIP_INTERVAL* resultant, /**< resultant interval of operation */
    549 SCIP_INTERVAL basedomain, /**< domain of base */
    550 SCIP_Real exponent, /**< exponent */
    551 SCIP_INTERVAL image /**< interval image of power */
    552 );
    553
    554/** stores operand1 to the signed power of the scalar positive operand2 in resultant
    555 *
    556 * The signed power of x w.r.t. an exponent n &ge; 0 is given as \f$\mathrm{sign}(x) |x|^n\f$.
    557 *
    558 * @attention we assume correctly rounded sqrt(double) and pow(double) functions when rounding is to nearest
    559 */
    560SCIP_EXPORT
    562 SCIP_Real infinity, /**< value for infinity */
    563 SCIP_INTERVAL* resultant, /**< resultant interval of operation */
    564 SCIP_INTERVAL operand1, /**< first operand of operation */
    565 SCIP_Real operand2 /**< second operand of operation */
    566 );
    567
    568/** computes the reciprocal of an interval
    569 */
    570SCIP_EXPORT
    572 SCIP_Real infinity, /**< value for infinity */
    573 SCIP_INTERVAL* resultant, /**< resultant interval of operation */
    574 SCIP_INTERVAL operand /**< operand of operation */
    575 );
    576
    577/** stores exponential of operand in resultant
    578 * @attention we assume a correctly rounded exp(double) function when rounding is to nearest
    579 */
    580SCIP_EXPORT
    581void SCIPintervalExp(
    582 SCIP_Real infinity, /**< value for infinity */
    583 SCIP_INTERVAL* resultant, /**< resultant interval of operation */
    584 SCIP_INTERVAL operand /**< operand of operation */
    585 );
    586
    587/** stores natural logarithm of operand in resultant
    588 * @attention we assume a correctly rounded log(double) function when rounding is to nearest
    589 */
    590SCIP_EXPORT
    591void SCIPintervalLog(
    592 SCIP_Real infinity, /**< value for infinity */
    593 SCIP_INTERVAL* resultant, /**< resultant interval of operation */
    594 SCIP_INTERVAL operand /**< operand of operation */
    595 );
    596
    597/** stores minimum of operands in resultant */
    598SCIP_EXPORT
    599void SCIPintervalMin(
    600 SCIP_Real infinity, /**< value for infinity */
    601 SCIP_INTERVAL* resultant, /**< resultant interval of operation */
    602 SCIP_INTERVAL operand1, /**< first operand of operation */
    603 SCIP_INTERVAL operand2 /**< second operand of operation */
    604 );
    605
    606/** stores maximum of operands in resultant */
    607SCIP_EXPORT
    608void SCIPintervalMax(
    609 SCIP_Real infinity, /**< value for infinity */
    610 SCIP_INTERVAL* resultant, /**< resultant interval of operation */
    611 SCIP_INTERVAL operand1, /**< first operand of operation */
    612 SCIP_INTERVAL operand2 /**< second operand of operation */
    613 );
    614
    615/** returns the maximum of the absolute values of the infimum and supremum of the interval */
    616SCIP_EXPORT
    618 SCIP_INTERVAL interval /**< interval */
    619 );
    620
    621/** stores absolute value of operand in resultant */
    622SCIP_EXPORT
    623void SCIPintervalAbs(
    624 SCIP_Real infinity, /**< value for infinity */
    625 SCIP_INTERVAL* resultant, /**< resultant interval of operation */
    626 SCIP_INTERVAL operand /**< operand of operation */
    627 );
    628
    629/** stores sine value of operand in resultant */
    630SCIP_EXPORT
    631void SCIPintervalSin(
    632 SCIP_Real infinity, /**< value for infinity */
    633 SCIP_INTERVAL* resultant, /**< resultant interval of operation */
    634 SCIP_INTERVAL operand /**< operand of operation */
    635 );
    636
    637/** stores cosine value of operand in resultant */
    638SCIP_EXPORT
    639void SCIPintervalCos(
    640 SCIP_Real infinity, /**< value for infinity */
    641 SCIP_INTERVAL* resultant, /**< resultant interval of operation */
    642 SCIP_INTERVAL operand /**< operand of operation */
    643 );
    644
    645/** stores sign of operand in resultant */
    646SCIP_EXPORT
    648 SCIP_Real infinity, /**< value for infinity */
    649 SCIP_INTERVAL* resultant, /**< resultant interval of operation */
    650 SCIP_INTERVAL operand /**< operand of operation */
    651 );
    652
    653/** stores entropy of operand in resultant */
    654SCIP_EXPORT
    656 SCIP_Real infinity, /**< value for infinity */
    657 SCIP_INTERVAL* resultant, /**< resultant interval of operation */
    658 SCIP_INTERVAL operand /**< operand of operation */
    659 );
    660
    661/** computes exact upper bound on \f$ a x^2 + b x \f$ for x in [xlb, xub], b an interval, and a scalar
    662 *
    663 * Uses Algorithm 2.2 from Domes and Neumaier: Constraint propagation on quadratic constraints (2008).
    664 */
    665SCIP_EXPORT
    667 SCIP_Real infinity, /**< value for infinity */
    668 SCIP_Real a, /**< coefficient of x^2 */
    669 SCIP_INTERVAL b_, /**< coefficient of x */
    670 SCIP_INTERVAL x /**< range of x */
    671 );
    672
    673/** stores range of quadratic term in resultant
    674 *
    675 * given scalar a and intervals b and x, computes interval for \f$ a x^2 + b x \f$ */
    676SCIP_EXPORT
    678 SCIP_Real infinity, /**< value for infinity */
    679 SCIP_INTERVAL* resultant, /**< resultant interval of operation */
    680 SCIP_Real sqrcoeff, /**< coefficient of x^2 */
    681 SCIP_INTERVAL lincoeff, /**< coefficient of x */
    682 SCIP_INTERVAL xrng /**< range of x */
    683 );
    684
    685
    686/** computes interval with positive solutions of a quadratic equation with interval coefficients
    687 *
    688 * Given intervals a, b, and c, this function computes an interval that contains all positive solutions of \f$ a x^2 + b x \in c\f$ within xbnds.
    689 */
    690SCIP_EXPORT
    692 SCIP_Real infinity, /**< value for infinity */
    693 SCIP_INTERVAL* resultant, /**< resultant interval of operation */
    694 SCIP_INTERVAL sqrcoeff, /**< coefficient of x^2 */
    695 SCIP_INTERVAL lincoeff, /**< coefficient of x */
    696 SCIP_INTERVAL rhs, /**< right hand side of equation */
    697 SCIP_INTERVAL xbnds /**< bounds on x */
    698 );
    699
    700/** computes interval with negative solutions of a quadratic equation with interval coefficients
    701 *
    702 * Given intervals a, b, and c, this function computes an interval that contains all negative solutions of \f$ a x^2 + b x \in c\f$ within xbnds.
    703 */
    704SCIP_EXPORT
    706 SCIP_Real infinity, /**< value for infinity */
    707 SCIP_INTERVAL* resultant, /**< resultant interval of operation */
    708 SCIP_INTERVAL sqrcoeff, /**< coefficient of x^2 */
    709 SCIP_INTERVAL lincoeff, /**< coefficient of x */
    710 SCIP_INTERVAL rhs, /**< right hand side of equation */
    711 SCIP_INTERVAL xbnds /**< bounds on x */
    712 );
    713
    714/** computes positive solutions of a quadratic equation with scalar coefficients
    715 *
    716 * Givens scalar a, b, and c, this function computes an interval that contains all positive solutions of \f$ a x^2 + b x \geq c\f$ within xbnds.
    717 * Implements Algorithm 3.2 from Domes and Neumaier: Constraint propagation on quadratic constraints (2008).
    718 */
    719SCIP_EXPORT
    721 SCIP_Real infinity, /**< value for infinity */
    722 SCIP_INTERVAL* resultant, /**< resultant interval of operation */
    723 SCIP_Real sqrcoeff, /**< coefficient of x^2 */
    724 SCIP_Real lincoeff, /**< coefficient of x */
    725 SCIP_Real rhs, /**< right hand side of equation */
    726 SCIP_INTERVAL xbnds /**< bounds on x */
    727 );
    728
    729/** solves a quadratic equation with interval coefficients
    730 *
    731 * Given intervals a, b and c, this function computes an interval that contains all solutions of \f$ a x^2 + b x \in c\f$ within xbnds.
    732 */
    733SCIP_EXPORT
    735 SCIP_Real infinity, /**< value for infinity */
    736 SCIP_INTERVAL* resultant, /**< resultant interval of operation */
    737 SCIP_INTERVAL sqrcoeff, /**< coefficient of x^2 */
    738 SCIP_INTERVAL lincoeff, /**< coefficient of x */
    739 SCIP_INTERVAL rhs, /**< right hand side of equation */
    740 SCIP_INTERVAL xbnds /**< bounds on x */
    741 );
    742
    743/** stores range of bivariate quadratic term in resultant
    744 *
    745 * Given scalars \f$a_x\f$, \f$a_y\f$, \f$a_{xy}\f$, \f$b_x\f$, and \f$b_y\f$ and intervals for \f$x\f$ and \f$y\f$,
    746 * computes interval for \f$ a_x x^2 + a_y y^2 + a_{xy} x y + b_x x + b_y y \f$.
    747 *
    748 * \attention The operations are not applied rounding-safe here!
    749 */
    750SCIP_EXPORT
    752 SCIP_Real infinity, /**< value for infinity in interval arithmetics */
    753 SCIP_INTERVAL* resultant, /**< buffer where to store result of operation */
    754 SCIP_Real ax, /**< square coefficient of x */
    755 SCIP_Real ay, /**< square coefficient of y */
    756 SCIP_Real axy, /**< bilinear coefficients */
    757 SCIP_Real bx, /**< linear coefficient of x */
    758 SCIP_Real by, /**< linear coefficient of y */
    759 SCIP_INTERVAL xbnds, /**< bounds on x */
    760 SCIP_INTERVAL ybnds /**< bounds on y */
    761 );
    762
    763/** solves a bivariate quadratic equation for the first variable
    764 *
    765 * Given scalars \f$a_x\f$, \f$a_y\f$, \f$a_{xy}\f$, \f$b_x\f$ and \f$b_y\f$, and intervals for \f$x\f$, \f$y\f$, and rhs,
    766 * computes \f$ \{ x \in \mathbf{x} : \exists y \in \mathbf{y} : a_x x^2 + a_y y^2 + a_{xy} x y + b_x x + b_y y \in \mathbf{\mbox{rhs}} \} \f$.
    767 *
    768 * \attention the operations are not applied rounding-safe here
    769 */
    770SCIP_EXPORT
    772 SCIP_Real infinity, /**< value for infinity in interval arithmetics */
    773 SCIP_INTERVAL* resultant, /**< buffer where to store result of operation */
    774 SCIP_Real ax, /**< square coefficient of x */
    775 SCIP_Real ay, /**< square coefficient of y */
    776 SCIP_Real axy, /**< bilinear coefficients */
    777 SCIP_Real bx, /**< linear coefficient of x */
    778 SCIP_Real by, /**< linear coefficient of y */
    779 SCIP_INTERVAL rhs, /**< right-hand-side of equation */
    780 SCIP_INTERVAL xbnds, /**< bounds on x */
    781 SCIP_INTERVAL ybnds /**< bounds on y */
    782 );
    783
    784/** propagates a weighted sum of intervals in a given interval
    785 *
    786 * Given \f$\text{constant} + \sum_i \text{weights}_i \text{operands}_i \in \text{rhs}\f$,
    787 * computes possibly tighter interval for each term.
    788 *
    789 * @attention Valid values are returned in resultants only if any tightening has been found and no empty interval, that is, function returns with non-zero and `*infeasible` = FALSE.
    790 *
    791 * @return Number of terms for which resulting interval is smaller than operand interval.
    792 */
    793SCIP_EXPORT
    795 SCIP_Real infinity, /**< value for infinity in interval arithmetics */
    796 int noperands, /**< number of operands (intervals) to propagate */
    797 SCIP_INTERVAL* operands, /**< intervals to propagate */
    798 SCIP_Real* weights, /**< weights of intervals in sum */
    799 SCIP_Real constant, /**< constant in sum */
    800 SCIP_INTERVAL rhs, /**< right-hand-side interval */
    801 SCIP_INTERVAL* resultants, /**< array to store propagated intervals, if any reduction is found at all (check return code and *infeasible) */
    802 SCIP_Bool* infeasible /**< buffer to store if propagation produced empty interval */
    803 );
    804
    805/** @} */
    806
    807#ifdef __cplusplus
    808}
    809#endif
    810
    811#endif
    SCIP_VAR * a
    Definition: circlepacking.c:66
    SCIP_VAR ** x
    Definition: circlepacking.c:63
    common defines and data types used in all packages of SCIP
    #define SCIP_Bool
    Definition: def.h:91
    #define SCIP_Real
    Definition: def.h:156
    #define infinity
    Definition: gastrans.c:80
    void SCIPintervalMulSup(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL operand1, SCIP_INTERVAL operand2)
    void SCIPintervalSetRoundingModeUpwards(void)
    void SCIPintervalIntersectEps(SCIP_INTERVAL *resultant, SCIP_Real eps, SCIP_INTERVAL operand1, SCIP_INTERVAL operand2)
    void SCIPintervalAddSup(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL operand1, SCIP_INTERVAL operand2)
    void SCIPintervalMulScalarInf(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL operand1, SCIP_Real operand2)
    void SCIPintervalSetRoundingModeDownwards(void)
    SCIP_Real SCIPintervalGetInf(SCIP_INTERVAL interval)
    SCIP_Real SCIPintervalQuadUpperBound(SCIP_Real infinity, SCIP_Real a, SCIP_INTERVAL b_, SCIP_INTERVAL x)
    SCIP_Bool SCIPintervalIsEntire(SCIP_Real infinity, SCIP_INTERVAL operand)
    void SCIPintervalScalprodScalarsInf(SCIP_Real infinity, SCIP_INTERVAL *resultant, int length, SCIP_INTERVAL *operand1, SCIP_Real *operand2)
    void SCIPintervalSub(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL operand1, SCIP_INTERVAL operand2)
    void SCIPintervalSetEntire(SCIP_Real infinity, SCIP_INTERVAL *resultant)
    SCIP_Bool SCIPintervalIsPositiveInfinity(SCIP_Real infinity, SCIP_INTERVAL operand)
    SCIP_Real SCIPintervalPowerScalarIntegerSup(SCIP_Real operand1, int operand2)
    void SCIPintervalSquareRoot(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL operand)
    void SCIPintervalMulInf(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL operand1, SCIP_INTERVAL operand2)
    void SCIPintervalScalprodScalarsSup(SCIP_Real infinity, SCIP_INTERVAL *resultant, int length, SCIP_INTERVAL *operand1, SCIP_Real *operand2)
    SCIP_ROUNDMODE SCIPintervalGetRoundingMode(void)
    void SCIPintervalSetRoundingModeToNearest(void)
    void SCIPintervalPower(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL operand1, SCIP_INTERVAL operand2)
    void SCIPintervalSolveUnivariateQuadExpression(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL sqrcoeff, SCIP_INTERVAL lincoeff, SCIP_INTERVAL rhs, SCIP_INTERVAL xbnds)
    void SCIPintervalSignPowerScalar(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL operand1, SCIP_Real operand2)
    SCIP_Real SCIPintervalPowerScalarIntegerInf(SCIP_Real operand1, int operand2)
    void SCIPintervalSetRoundingMode(SCIP_ROUNDMODE roundmode)
    void SCIPintervalScalprodScalars(SCIP_Real infinity, SCIP_INTERVAL *resultant, int length, SCIP_INTERVAL *operand1, SCIP_Real *operand2)
    void SCIPintervalUnify(SCIP_INTERVAL *resultant, SCIP_INTERVAL operand1, SCIP_INTERVAL operand2)
    void SCIPintervalAbs(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL operand)
    SCIP_Real SCIPintervalAbsMax(SCIP_INTERVAL interval)
    void SCIPintervalSubScalar(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL operand1, SCIP_Real operand2)
    void SCIPintervalSetRoundingModeTowardsZero(void)
    void SCIPintervalCos(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL operand)
    void SCIPintervalSolveBivariateQuadExpressionAllScalar(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_Real ax, SCIP_Real ay, SCIP_Real axy, SCIP_Real bx, SCIP_Real by, SCIP_INTERVAL rhs, SCIP_INTERVAL xbnds, SCIP_INTERVAL ybnds)
    void SCIPintervalMax(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL operand1, SCIP_INTERVAL operand2)
    void SCIPintervalIntersect(SCIP_INTERVAL *resultant, SCIP_INTERVAL operand1, SCIP_INTERVAL operand2)
    void SCIPintervalSquare(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL operand)
    int SCIP_ROUNDMODE
    Definition: intervalarith.h:65
    void SCIPintervalSet(SCIP_INTERVAL *resultant, SCIP_Real value)
    SCIP_Bool SCIPintervalIsSubsetEQ(SCIP_Real infinity, SCIP_INTERVAL operand1, SCIP_INTERVAL operand2)
    SCIP_Bool SCIPintervalIsEmpty(SCIP_Real infinity, SCIP_INTERVAL operand)
    void SCIPintervalPowerScalarInverse(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL basedomain, SCIP_Real exponent, SCIP_INTERVAL image)
    SCIP_Bool SCIPintervalHasRoundingControl(void)
    void SCIPintervalSin(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL operand)
    void SCIPintervalSolveUnivariateQuadExpressionPositive(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL sqrcoeff, SCIP_INTERVAL lincoeff, SCIP_INTERVAL rhs, SCIP_INTERVAL xbnds)
    void SCIPintervalSetBounds(SCIP_INTERVAL *resultant, SCIP_Real inf, SCIP_Real sup)
    void SCIPintervalAddInf(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL operand1, SCIP_INTERVAL operand2)
    void SCIPintervalMin(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL operand1, SCIP_INTERVAL operand2)
    void SCIPintervalAddVectors(SCIP_Real infinity, SCIP_INTERVAL *resultant, int length, SCIP_INTERVAL *operand1, SCIP_INTERVAL *operand2)
    SCIP_Bool SCIPintervalIsNegativeInfinity(SCIP_Real infinity, SCIP_INTERVAL operand)
    void SCIPintervalMulScalar(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL operand1, SCIP_Real operand2)
    void SCIPintervalReciprocal(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL operand)
    void SCIPintervalPowerScalarInteger(SCIP_INTERVAL *resultant, SCIP_Real operand1, int operand2)
    void SCIPintervalEntropy(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL operand)
    void SCIPintervalMul(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL operand1, SCIP_INTERVAL operand2)
    void SCIPintervalDiv(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL operand1, SCIP_INTERVAL operand2)
    void SCIPintervalPowerScalarScalar(SCIP_INTERVAL *resultant, SCIP_Real operand1, SCIP_Real operand2)
    void SCIPintervalQuad(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_Real sqrcoeff, SCIP_INTERVAL lincoeff, SCIP_INTERVAL xrng)
    void SCIPintervalSign(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL operand)
    void SCIPintervalPowerScalar(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL operand1, SCIP_Real operand2)
    void SCIPintervalLog(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL operand)
    void SCIPintervalAddScalar(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL operand1, SCIP_Real operand2)
    void SCIPintervalMulScalarSup(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL operand1, SCIP_Real operand2)
    void SCIPintervalDivScalar(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL operand1, SCIP_Real operand2)
    SCIP_Bool SCIPintervalAreDisjointEps(SCIP_Real eps, SCIP_INTERVAL operand1, SCIP_INTERVAL operand2)
    void SCIPintervalSolveUnivariateQuadExpressionNegative(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL sqrcoeff, SCIP_INTERVAL lincoeff, SCIP_INTERVAL rhs, SCIP_INTERVAL xbnds)
    SCIP_Real SCIPintervalGetSup(SCIP_INTERVAL interval)
    void SCIPintervalSolveUnivariateQuadExpressionPositiveAllScalar(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_Real sqrcoeff, SCIP_Real lincoeff, SCIP_Real rhs, SCIP_INTERVAL xbnds)
    void SCIPintervalQuadBivar(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_Real ax, SCIP_Real ay, SCIP_Real axy, SCIP_Real bx, SCIP_Real by, SCIP_INTERVAL xbnds, SCIP_INTERVAL ybnds)
    SCIP_Real SCIPintervalNegateReal(SCIP_Real x)
    SCIP_Bool SCIPintervalAreDisjoint(SCIP_INTERVAL operand1, SCIP_INTERVAL operand2)
    int SCIPintervalPropagateWeightedSum(SCIP_Real infinity, int noperands, SCIP_INTERVAL *operands, SCIP_Real *weights, SCIP_Real constant, SCIP_INTERVAL rhs, SCIP_INTERVAL *resultants, SCIP_Bool *infeasible)
    void SCIPintervalExp(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL operand)
    void SCIPintervalAdd(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL operand1, SCIP_INTERVAL operand2)
    void SCIPintervalSetRational(SCIP_INTERVAL *resultant, SCIP_RATIONAL *value)
    void SCIPintervalScalprod(SCIP_Real infinity, SCIP_INTERVAL *resultant, int length, SCIP_INTERVAL *operand1, SCIP_INTERVAL *operand2)
    void SCIPintervalSetEmpty(SCIP_INTERVAL *resultant)
    real eps
    SCIP_Real sup
    Definition: intervalarith.h:57
    SCIP_Real inf
    Definition: intervalarith.h:56
    type definitions for rational numbers