Scippy

SoPlex

Sequential object-oriented simPlex

spxdefines.h File Reference

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

#include <math.h>
#include <assert.h>
#include <stdarg.h>
#include <stdio.h>
#include <iostream>

Go to the source code of this file.

Classes

class  Param
 

Namespaces

 soplex
 Everything should be within this namespace.
 

Macros

#define SOPLEX_VERSION   401
 
#define SOPLEX_SUBVERSION   0
 
#define SOPLEX_APIVERSION   6
 
#define SOPLEX_COPYRIGHT   "Copyright (c) 1996-2019 Konrad-Zuse-Zentrum fuer Informationstechnik Berlin (ZIB)"
 
#define ASSERT_WARN(prefix, expr)   ( assert( expr ) )
 Macro to turn some assertions into warnings. More...
 
#define DO_WITH_TMP_VERBOSITY(verbosity, spxout, do_something)
 
#define DO_WITH_ERR_VERBOSITY(do_something)   { do_something; }
 
#define MSG_ERROR(x)   { DO_WITH_ERR_VERBOSITY( x ) }
 Prints out message x if the verbosity level is at least SPxOut::ERROR. More...
 
#define MSG_WARNING(spxout, x)   { DO_WITH_TMP_VERBOSITY( SPxOut::WARNING, spxout, x ) }
 Prints out message x if the verbosity level is at least SPxOut::WARNING. More...
 
#define MSG_INFO1(spxout, x)   { DO_WITH_TMP_VERBOSITY( SPxOut::INFO1, spxout, x ) }
 Prints out message x if the verbosity level is at least SPxOut::INFO1. More...
 
#define MSG_INFO2(spxout, x)   { DO_WITH_TMP_VERBOSITY( SPxOut::INFO2, spxout, x ) }
 Prints out message x if the verbosity level is at least SPxOut::INFO2. More...
 
#define MSG_INFO3(spxout, x)   { DO_WITH_TMP_VERBOSITY( SPxOut::INFO3, spxout, x ) }
 Prints out message x if the verbosity level is at least SPxOut::INFO3. More...
 
#define MSGinconsistent(name)   msginconsistent(name, __FILE__, __LINE__)
 
#define MSG_DEBUG(x)
 
#define THREADLOCAL   thread_local
 SOPLEX_DEBUG. More...
 
#define REAL(x)   x
 
#define REAL_FORMAT   "lf"
 
#define DEFAULT_BND_VIOL   1e-6
 default allowed bound violation More...
 
#define DEFAULT_EPS_ZERO   1e-16
 default allowed additive zero: 1.0 + EPS_ZERO == 1.0 More...
 
#define DEFAULT_EPS_FACTOR   1e-20
 
#define DEFAULT_EPS_UPDATE   1e-16
 
#define DEFAULT_EPS_PIVOT   1e-10
 
#define DEFAULT_INFINITY   1e100
 
#define MAXIMUM(x, y)   ((x)>(y) ? (x) : (y))
 
#define MINIMUM(x, y)   ((x)<(y) ? (x) : (y))
 
#define SPX_MAXSTRLEN   1024
 

Typedefs

typedef double Real
 

Functions

bool msginconsistent (const char *name, const char *file, int line)
 
Real spxAbs (Real a)
 returns |a| More...
 
Real spxSqrt (Real a)
 returns square root More...
 
Real spxNextafter (Real x, Real y)
 
Real spxLdexp (Real x, int exp)
 returns x * 2^exp More...
 
Real spxFrexp (Real y, int *exp)
 
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...
 
bool EQ (Real a, Real b, Real eps=Param::epsilon())
 returns true iff |a-b| <= eps More...
 
bool NE (Real a, Real b, Real eps=Param::epsilon())
 returns true iff |a-b| > eps More...
 
bool LT (Real a, Real b, Real eps=Param::epsilon())
 returns true iff a < b + eps More...
 
bool LE (Real a, Real b, Real eps=Param::epsilon())
 returns true iff a <= b + eps More...
 
bool GT (Real a, Real b, Real eps=Param::epsilon())
 returns true iff a > b + eps More...
 
bool GE (Real a, Real b, Real eps=Param::epsilon())
 returns true iff a >= b + eps More...
 
bool isZero (Real a, Real eps=Param::epsilon())
 returns true iff |a| <= eps More...
 
bool isNotZero (Real a, Real eps=Param::epsilon())
 returns true iff |a| > eps More...
 
bool EQrel (Real a, Real b, Real eps=Param::epsilon())
 returns true iff |relDiff(a,b)| <= eps More...
 
bool NErel (Real a, Real b, Real eps=Param::epsilon())
 returns true iff |relDiff(a,b)| > eps More...
 
bool LTrel (Real a, Real b, Real eps=Param::epsilon())
 returns true iff relDiff(a,b) <= -eps More...
 
bool LErel (Real a, Real b, Real eps=Param::epsilon())
 returns true iff relDiff(a,b) <= eps More...
 
bool GTrel (Real a, Real b, Real eps=Param::epsilon())
 returns true iff relDiff(a,b) > eps More...
 
bool GErel (Real a, Real b, Real eps=Param::epsilon())
 returns true iff relDiff(a,b) > -eps More...
 
int spxSnprintf (char *t, size_t len, const char *s,...)
 safe version of snprintf More...
 

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

◆ ASSERT_WARN

#define 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 77 of file spxdefines.h.

Referenced by SPxWeightPR::computeCP(), SPxWeightPR::computeRP(), SPxMainSM::duplicateCols(), SPxMainSM::duplicateRows(), SPxMainSM::ZeroObjColSingletonPS::execute(), SPxMainSM::DoubletonEquationPS::execute(), SPxMainSM::DuplicateRowsPS::execute(), SPxMainSM::DuplicateColsPS::execute(), SPxMainSM::multiaggregation(), SPxMainSM::removeEmpty(), SPxDefaultRT::selectLeave(), SPxMainSM::simplifyCols(), SPxMainSM::simplifyDual(), SPxMainSM::simplifyRows(), CLUFactor::solveUleft(), and SPxMainSM::trivialHeuristic().

◆ DEFAULT_BND_VIOL

#define DEFAULT_BND_VIOL   1e-6

default allowed bound violation

Definition at line 226 of file spxdefines.h.

Referenced by SPxSolver::factorize(), and SPxSolver::SPxSolver().

◆ DEFAULT_EPS_FACTOR

#define DEFAULT_EPS_FACTOR   1e-20

Definition at line 233 of file spxdefines.h.

Referenced by SoPlex::Settings::RealParam::RealParam().

◆ DEFAULT_EPS_PIVOT

#define DEFAULT_EPS_PIVOT   1e-10

Definition at line 239 of file spxdefines.h.

Referenced by SoPlex::Settings::RealParam::RealParam(), and SoPlex::setRealParam().

◆ DEFAULT_EPS_UPDATE

#define DEFAULT_EPS_UPDATE   1e-16

Definition at line 236 of file spxdefines.h.

Referenced by SoPlex::Settings::RealParam::RealParam().

◆ DEFAULT_EPS_ZERO

#define DEFAULT_EPS_ZERO   1e-16

default allowed additive zero: 1.0 + EPS_ZERO == 1.0

Definition at line 230 of file spxdefines.h.

Referenced by soplex::operator!=(), soplex::operator==(), SoPlex::Settings::RealParam::RealParam(), SPxRatioTester::setDelta(), and SPxFastRT::setDelta().

◆ DEFAULT_INFINITY

#define DEFAULT_INFINITY   1e100

Definition at line 241 of file spxdefines.h.

Referenced by SoPlex::Settings::RealParam::RealParam().

◆ DO_WITH_ERR_VERBOSITY

#define DO_WITH_ERR_VERBOSITY (   do_something)    { do_something; }

Definition at line 110 of file spxdefines.h.

◆ DO_WITH_TMP_VERBOSITY

#define 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 ); \
} \
} \
}

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 MSG_ERROR, MSG_WARNING, etc.

Definition at line 97 of file spxdefines.h.

◆ MAXIMUM

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

◆ MINIMUM

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

◆ MSG_DEBUG

#define MSG_DEBUG (   x)

Definition at line 132 of file spxdefines.h.

Referenced by SoPlex::_computeInfeasBox(), SoPlex::_factorizeColumnRational(), SoPlex::_lift(), SoPlex::_performFeasIRStable(), SoPlex::_performOptIRStable(), SoPlex::_performUnboundedIRStable(), SoPlex::_project(), SoPlex::_reconstructSolutionRational(), SoPlex::_solveRealStable(), SoPlex::_transformEquality(), SoPlex::_transformFeasibility(), SoPlex::_transformUnbounded(), SoPlex::_untransformEquality(), SoPlex::_untransformFeasibility(), SoPlex::_untransformUnbounded(), SPxMainSM::aggregateVars(), SPxScaler::applyScaling(), SLUFactorRational::change(), SLUFactor::change(), SPxBasis::change(), SPxSolver::changeLhsStatus(), SPxSolver::changeLowerStatus(), SPxSolver::changeRhsStatus(), SPxSolver::changeUpperStatus(), SVSetBase< Rational >::countUnusedMem(), SVSetBase< Rational >::deleteVec(), SPxMainSM::duplicateCols(), SPxMainSM::duplicateRows(), SVSetBase< Rational >::ensureMem(), SPxSolver::enter(), SPxMainSM::RowObjPS::execute(), CLUFactorRational::factor(), SPxSolver::factorize(), SPxMainSM::fixColumn(), SPxBoundFlippingRT::flipAndUpdate(), SPxWeightST::generate(), SoPlex::getBoundViolationRational(), SoPlex::getDualViolationRational(), SPxSolver::getEnterVals(), SPxSolver::getEnterVals2(), SPxSolver::getLeaveVals(), SPxSolver::getLeaveVals2(), SoPlex::getRedCostViolationRational(), SoPlex::getRowViolationRational(), SPxMainSM::handleExtremes(), SPxBasis::isDescValid(), SPxSolver::leave(), SLUFactor::load(), SLUFactorRational::load(), soplex::LPFhasKeyword(), soplex::LPFreadColName(), soplex::LPFreadSense(), soplex::LPFreadValue(), SVSetBase< Rational >::memPack(), SVSetBase< Rational >::memRemax(), SPxMainSM::multiaggregation(), SPxSolver::performSolutionPolishing(), SPxSolver::perturbMaxEnter(), SPxSolver::perturbMaxLeave(), SPxSolver::perturbMinEnter(), SPxSolver::perturbMinLeave(), SPxBasis::readBasis(), MPSInput::readLine(), SPxLPBase< Real >::readLPF(), soplex::reconstructVector(), SPxBasis::reDim(), SPxSolver::rejectLeave(), SPxBasis::removedRow(), SPxBasis::removedRows(), SPxMainSM::removeEmpty(), SPxMainSM::removeRowSingleton(), SPxDefaultRT::selectEnter(), SPxHarrisRT::selectEnter(), SPxFastRT::selectEnter(), SPxBoundFlippingRT::selectEnter(), SPxFastRT::selectLeave(), SPxBoundFlippingRT::selectLeave(), SPxBasis::setStatus(), SPxVectorST::setupWeights(), SPxWeightST::setupWeights(), SPxSolver::shiftFvec(), SPxSolver::shiftPvec(), SPxMainSM::simplifyCols(), SPxMainSM::simplifyDual(), SPxMainSM::simplifyRows(), SPxSolver::solve(), CLUFactor::solveLright(), CLUFactorRational::solveLright(), SPxSolver::terminate(), SPxMainSM::unsimplify(), SPxSolver::updateNonbasicValue(), SPxBasis::writeBasis(), and SVSetBase< Rational >::xtend().

◆ MSG_ERROR

◆ MSG_INFO1

#define MSG_INFO1 (   spxout,
 
)    { DO_WITH_TMP_VERBOSITY( SPxOut::INFO1, spxout, x ) }

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

Definition at line 118 of file spxdefines.h.

Referenced by SoPlex::_checkBasisScaling(), SoPlex::_checkOriginalProblemOptimality(), SoPlex::_checkScaling(), SoPlex::_computeBasisInverseRational(), SoPlex::_computeInfeasBox(), SoPlex::_evaluateSolutionReal(), SoPlex::_factorizeColumnRational(), SoPlex::_lift(), SoPlex::_optimizeRational(), SoPlex::_parseSettingsLine(), SoPlex::_performOptIRStable(), SoPlex::_project(), SoPlex::_reconstructSolutionRational(), SoPlex::_resolveWithoutPreprocessing(), SoPlex::_solveDecompositionDualSimplex(), SoPlex::_solveRealForRational(), SoPlex::_solveRealLPAndRecordStatistics(), SoPlex::_solveRealStable(), SoPlex::_storeSolutionReal(), SoPlex::_storeSolutionRealFromPresol(), SoPlex::_transformEquality(), SoPlex::_transformFeasibility(), SoPlex::_transformUnbounded(), SoPlex::_unscaleSolutionReal(), SoPlex::_verifySolutionReal(), SoPlex::areLPsInSync(), checkSolution(), checkSolutionRational(), checkSolutionReal(), SPxSolver::factorize(), SoPlex::getBasisInverseColRational(), SoPlex::getBasisInverseColReal(), SoPlex::getBasisInverseRowRational(), SoPlex::getBasisInverseRowReal(), SoPlex::getBasisInverseTimesVecRational(), SoPlex::getBasisInverseTimesVecReal(), SoPlex::loadSettingsFile(), main(), SoPlex::optimize(), SoPlex::parseSettingsString(), SPxSolver::performSolutionPolishing(), SoPlex::printDecompDisplayLine(), SPxSolver::printDisplayLine(), printDualSolution(), printPrimalSolution(), SoPlex::printVersion(), SPxLeastSqSC::scale(), SPxEquiliSC::scale(), SPxGeometSC::scale(), SPxAutoPR::selectEnter(), SPxAutoPR::selectLeave(), SPxHybridPR::setType(), SPxSteepPR::setupWeights(), SPxMainSM::simplify(), SPxSolver::solve(), SPxSolver::testVecs(), and SPxMainSM::unsimplify().

◆ MSG_INFO2

◆ MSG_INFO3

◆ MSG_WARNING

◆ MSGinconsistent

◆ REAL

#define REAL (   x)    x

◆ REAL_FORMAT

#define REAL_FORMAT   "lf"

Definition at line 222 of file spxdefines.h.

Referenced by soplex::MPSwriteRecord(), and SPxBasis::printMatrixMTX().

◆ SOPLEX_APIVERSION

#define SOPLEX_APIVERSION   6

Definition at line 47 of file spxdefines.h.

◆ SOPLEX_COPYRIGHT

#define SOPLEX_COPYRIGHT   "Copyright (c) 1996-2019 Konrad-Zuse-Zentrum fuer Informationstechnik Berlin (ZIB)"

Definition at line 48 of file spxdefines.h.

Referenced by main().

◆ SOPLEX_SUBVERSION

#define SOPLEX_SUBVERSION   0

◆ SOPLEX_VERSION

#define SOPLEX_VERSION   401

◆ SPX_MAXSTRLEN

#define SPX_MAXSTRLEN   1024

maximum string length in SoPlex

Definition at line 249 of file spxdefines.h.

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

◆ THREADLOCAL

#define THREADLOCAL   thread_local

SOPLEX_DEBUG.

Definition at line 145 of file spxdefines.h.