Scippy

SoPlex

Sequential object-oriented simPlex

spxdefines.h File Reference

Debugging, floating point type and parameter definitions. More...

#include <cmath>
#include <assert.h>
#include <stdarg.h>
#include <stdio.h>
#include <iostream>
#include <cstdlib>
#include <memory>
#include "soplex/config.h"
#include "boost/multiprecision/number.hpp"
#include <boost/serialization/nvp.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/gmp.hpp>
#include "spxdefines.hpp"

Go to the source code of this file.

Classes

class  Tolerances
 

Namespaces

 soplex
 Everything should be within this namespace.
 

Macros

#define SOPLEX_VERSION   700
 
#define SOPLEX_SUBVERSION   0
 
#define SOPLEX_APIVERSION   14
 
#define SOPLEX_COPYRIGHT   "Copyright (c) 1996-2023 Zuse Institute Berlin (ZIB)"
 
#define SOPLEX_ASSERT_WARN(prefix, expr)   ( assert( expr ) )
 Macro to turn some assertions into warnings. More...
 
#define SOPLEX_DO_WITH_TMP_VERBOSITY(verbosity, spxout, do_something)
 
#define SOPLEX_DO_WITH_ERR_VERBOSITY(do_something)   { do_something; }
 
#define SPX_MSG_ERROR(x)   { SOPLEX_DO_WITH_ERR_VERBOSITY( x ) }
 Prints out message x if the verbosity level is at least SPxOut::ERROR. More...
 
#define SPX_MSG_WARNING(spxout, x)   { SOPLEX_DO_WITH_TMP_VERBOSITY( SPxOut::WARNING, spxout, x ) }
 Prints out message x if the verbosity level is at least SPxOut::WARNING. More...
 
#define SPX_MSG_INFO1(spxout, x)   { SOPLEX_DO_WITH_TMP_VERBOSITY( SPxOut::INFO1, spxout, x ) }
 Prints out message x if the verbosity level is at least SPxOut::INFO1. More...
 
#define SPX_MSG_INFO2(spxout, x)   { SOPLEX_DO_WITH_TMP_VERBOSITY( SPxOut::INFO2, spxout, x ) }
 Prints out message x if the verbosity level is at least SPxOut::INFO2. More...
 
#define SPX_MSG_INFO3(spxout, x)   { SOPLEX_DO_WITH_TMP_VERBOSITY( SPxOut::INFO3, spxout, x ) }
 Prints out message x if the verbosity level is at least SPxOut::INFO3. More...
 
#define SPX_MSG_INCONSISTENT(name)   msginconsistent(name, __FILE__, __LINE__)
 
#define SPX_MSG_DEBUG(x)
 
#define SPX_DEBUG(x)
 
#define SOPLEX_THREADLOCAL   thread_local
 SOPLEX_DEBUG. More...
 
#define SOPLEX_REAL(x)   x
 
#define SOPLEX_REAL_FORMAT   "lf"
 
#define SOPLEX_DEFAULT_BND_VIOL   1e-6
 default allowed bound violation More...
 
#define SOPLEX_DEFAULT_EPS_ZERO   1e-16
 default allowed additive zero: 1.0 + EPS_ZERO == 1.0 More...
 
#define SOPLEX_DEFAULT_EPS_FACTOR   1e-20
 
#define SOPLEX_DEFAULT_EPS_UPDATE   1e-16
 
#define SOPLEX_DEFAULT_EPS_PIVOR   1e-10
 
#define SOPLEX_DEFAULT_INFINITY   1e100
 
#define SOPLEX_MAX(x, y)   ((x)>(y) ? (x) : (y))
 
#define SOPLEX_MIN(x, y)   ((x)<(y) ? (x) : (y))
 
#define SPX_MAXSTRLEN   1024
 

Typedefs

typedef double Real
 

Functions

bool EQ (int a, int b)
 
bool msginconsistent (const char *name, const char *file, int line)
 
template<class R >
spxAbs (R a)
 
Real spxNextafter (Real x, Real y)
 
template<>
Real spxAbs (Real a)
 returns |a| More...
 
Real spxSqrt (Real a)
 returns square root More...
 
Real maxAbs (Real a, Real b)
 returns max(|a|,|b|) More...
 
Real relDiff (Real a, Real b)
 returns (a-b) / max(|a|,|b|,1.0) More...
 
int spxSnprintf (char *t, size_t len, const char *s,...)
 safe version of snprintf More...
 
template<boost::multiprecision::expression_template_option eto>
number< gmp_rational, eto > ldexp (number< gmp_rational, eto >, int exp)
 
template<boost::multiprecision::expression_template_option eto>
number< gmp_rational, eto > frexp (number< gmp_rational, eto >, int *exp)
 
template<typename T , boost::multiprecision::expression_template_option eto>
boost::multiprecision::number< T, eto > spxFrexp (boost::multiprecision::number< T, eto > y, int *exp)
 
template<typename T , boost::multiprecision::expression_template_option eto>
boost::multiprecision::number< T > spxLdexp (boost::multiprecision::number< T, eto > x, int exp)
 
template<typename T , expression_template_option ep>
number< T, ep > spxSqrt (number< T, ep > a)
 
template<typename T , expression_template_option eto>
number< T, eto > spxNextafter (number< T, eto > x, number< T, eto > y)
 
template<typename T >
number< T > spxSqrt (number< T > a)
 
template<typename T , expression_template_option et>
number< T, et > maxAbs (number< T, et > a, number< T, et > b)
 returns max(|a|,|b|) More...
 
template<typename T , expression_template_option et>
number< T, et > relDiff (number< T, et > a, number< T, et > b)
 

Detailed Description

Debugging, floating point type and parameter definitions.

In optimized code with NDEBUG defined, only INFO1, INFO2, and INFO3 are set. If NDEBUG is not defined, the code within #TRACE is used. If SOPLEX_DEBUG is defined, the code within DEBUG is also used.

If WITH_LONG_DOUBLE is defined, all Real numbers are of type long double instead of just double.

Definition in file spxdefines.h.

Macro Definition Documentation

◆ SOPLEX_APIVERSION

#define SOPLEX_APIVERSION   14

Definition at line 96 of file spxdefines.h.

◆ SOPLEX_ASSERT_WARN

#define SOPLEX_ASSERT_WARN (   prefix,
  expr 
)    ( assert( expr ) )

Macro to turn some assertions into warnings.

If both NDEBUG and WITH_WARNINGS are defined then the failed assertion is converted to a warning. In all other cases this macro is equivalent to assert().

Parameters
prefixShort string for grepping in source code.
exprExpression that must be satisfied.

Definition at line 126 of file spxdefines.h.

◆ SOPLEX_COPYRIGHT

#define SOPLEX_COPYRIGHT   "Copyright (c) 1996-2023 Zuse Institute Berlin (ZIB)"

Definition at line 97 of file spxdefines.h.

Referenced by runSoPlex().

◆ SOPLEX_DEFAULT_BND_VIOL

#define SOPLEX_DEFAULT_BND_VIOL   1e-6

default allowed bound violation

Definition at line 277 of file spxdefines.h.

◆ SOPLEX_DEFAULT_EPS_FACTOR

#define SOPLEX_DEFAULT_EPS_FACTOR   1e-20

Definition at line 284 of file spxdefines.h.

◆ SOPLEX_DEFAULT_EPS_PIVOR

#define SOPLEX_DEFAULT_EPS_PIVOR   1e-10

Definition at line 290 of file spxdefines.h.

◆ SOPLEX_DEFAULT_EPS_UPDATE

#define SOPLEX_DEFAULT_EPS_UPDATE   1e-16

Definition at line 287 of file spxdefines.h.

◆ SOPLEX_DEFAULT_EPS_ZERO

#define SOPLEX_DEFAULT_EPS_ZERO   1e-16

default allowed additive zero: 1.0 + EPS_ZERO == 1.0

Definition at line 281 of file spxdefines.h.

Referenced by Tolerances::setEpsilon().

◆ SOPLEX_DEFAULT_INFINITY

#define SOPLEX_DEFAULT_INFINITY   1e100

Definition at line 292 of file spxdefines.h.

◆ SOPLEX_DO_WITH_ERR_VERBOSITY

#define SOPLEX_DO_WITH_ERR_VERBOSITY (   do_something)    { do_something; }

Definition at line 159 of file spxdefines.h.

◆ SOPLEX_DO_WITH_TMP_VERBOSITY

#define SOPLEX_DO_WITH_TMP_VERBOSITY (   verbosity,
  spxout,
  do_something 
)
Value:
{ \
if( &spxout != NULL ) \
{ \
if( verbosity <= spxout.getVerbosity() ) \
{ \
const SPxOut::Verbosity old_verbosity = spxout.getVerbosity(); \
spxout.setVerbosity( verbosity ); \
do_something; \
spxout.setVerbosity( old_verbosity ); \
} \
} \
}
Verbosity
Verbosity level.
Definition: spxout.h:86

Prints/Executes stream with verbosity level verbosity, resetting the old verbosity level afterwards. Usually the parameter stream prints something out. This is an internal define used by SPX_MSG_ERROR, SPX_MSG_WARNING, etc.

Definition at line 146 of file spxdefines.h.

◆ SOPLEX_MAX

#define SOPLEX_MAX (   x,
 
)    ((x)>(y) ? (x) : (y))

Definition at line 297 of file spxdefines.h.

Referenced by StableSum< double >::operator double(), and Random::setSeed().

◆ SOPLEX_MIN

#define SOPLEX_MIN (   x,
 
)    ((x)<(y) ? (x) : (y))

Definition at line 298 of file spxdefines.h.

Referenced by soplex::ratFromString().

◆ SOPLEX_REAL

#define SOPLEX_REAL (   x)    x

Definition at line 272 of file spxdefines.h.

◆ SOPLEX_REAL_FORMAT

#define SOPLEX_REAL_FORMAT   "lf"

Definition at line 273 of file spxdefines.h.

◆ SOPLEX_SUBVERSION

#define SOPLEX_SUBVERSION   0

Definition at line 95 of file spxdefines.h.

◆ SOPLEX_THREADLOCAL

#define SOPLEX_THREADLOCAL   thread_local

SOPLEX_DEBUG.

Definition at line 196 of file spxdefines.h.

◆ SOPLEX_VERSION

#define SOPLEX_VERSION   700

Definition at line 94 of file spxdefines.h.

◆ SPX_DEBUG

#define SPX_DEBUG (   x)

Definition at line 183 of file spxdefines.h.

◆ SPX_MAXSTRLEN

#define SPX_MAXSTRLEN   1024

maximum string length in SoPlex

Definition at line 300 of file spxdefines.h.

Referenced by NameSet::add(), and NameSet::memPack().

◆ SPX_MSG_DEBUG

#define SPX_MSG_DEBUG (   x)

Definition at line 182 of file spxdefines.h.

◆ SPX_MSG_ERROR

◆ SPX_MSG_INCONSISTENT

◆ SPX_MSG_INFO1

#define SPX_MSG_INFO1 (   spxout,
 
)    { SOPLEX_DO_WITH_TMP_VERBOSITY( SPxOut::INFO1, spxout, x ) }

Prints out message x if the verbosity level is at least SPxOut::INFO1.

Definition at line 167 of file spxdefines.h.

Referenced by checkSolution(), checkSolutionRational(), checkSolutionReal(), Presol< BP >::getBasis(), printDualSolution(), printPrimalSolution(), and runSoPlex().

◆ SPX_MSG_INFO2

#define SPX_MSG_INFO2 (   spxout,
 
)    { SOPLEX_DO_WITH_TMP_VERBOSITY( SPxOut::INFO2, spxout, x ) }

Prints out message x if the verbosity level is at least SPxOut::INFO2.

Definition at line 169 of file spxdefines.h.

◆ SPX_MSG_INFO3

#define SPX_MSG_INFO3 (   spxout,
 
)    { SOPLEX_DO_WITH_TMP_VERBOSITY( SPxOut::INFO3, spxout, x ) }

Prints out message x if the verbosity level is at least SPxOut::INFO3.

Definition at line 171 of file spxdefines.h.

◆ SPX_MSG_WARNING

#define SPX_MSG_WARNING (   spxout,
 
)    { SOPLEX_DO_WITH_TMP_VERBOSITY( SPxOut::WARNING, spxout, x ) }

Prints out message x if the verbosity level is at least SPxOut::WARNING.

Definition at line 165 of file spxdefines.h.

Referenced by Presol< BP >::getBasis(), and runSoPlex().