bpp-core3
3.0.0
|
An interval, either bounded or not, which can also have infinite bounds. More...
#include <Bpp/Numeric/Constraints.h>
Public Member Functions | |
IntervalConstraint () | |
IntervalConstraint (double lowerBound, double upperBound, bool inclLower, bool inclUpper, double precision=NumConstants::TINY()) | |
IntervalConstraint (bool isPositive, double bound, bool incl, double precision=NumConstants::TINY()) | |
Create an interval with an infinite lower/upper bound. More... | |
IntervalConstraint (std::string &desc) | |
Create an interval from a string description, using readDescription method. More... | |
virtual | ~IntervalConstraint () |
IntervalConstraint * | clone () const override |
Create a copy of this object and send a pointer to it. More... | |
void | setLowerBound (double lowerBound, bool strict) |
void | setUpperBound (double upperBound, bool strict) |
double | getLowerBound () const |
double | getUpperBound () const |
bool | strictLowerBound () const |
bool | strictUpperBound () const |
bool | finiteLowerBound () const |
bool | finiteUpperBound () const |
bool | includes (double min, double max) const override |
Tell if all the values in a given interval are correct. More... | |
virtual bool | isCorrect (double value) const override |
Tell if a given value is correct. More... | |
bool | operator< (double value) const |
bool | operator> (double value) const |
bool | operator<= (double value) const |
bool | operator>= (double value) const |
double | getLimit (double value) const override |
Give the nearest limit for a bad value. More... | |
double | getAcceptedLimit (double value) const override |
Give the nearest accepted limit for a bad value. More... | |
double | getPrecision () const |
std::string | getDescription () const override |
Give a short description on the type of constraint. More... | |
void | readDescription (std::string &desc) |
Sets the bounds of the interval from a string. More... | |
ConstraintInterface * | operator & (const ConstraintInterface &c) const override |
Intersect this IntervalConstraint with another one. More... | |
IntervalConstraint & | operator &= (const ConstraintInterface &c) |
Intersect this IntervalConstraint with another constraint. More... | |
bool | operator== (const IntervalConstraint &i) const |
Tells if this interval equals another one. More... | |
bool | operator!= (const IntervalConstraint &i) const |
Tells if this interval is different from another one. More... | |
bool | operator<= (const IntervalConstraint &i) const |
Tells if this interval is included or equal in another one. More... | |
bool | isEmpty () const override |
Tells if this interval is empty. More... | |
Protected Attributes | |
double | lowerBound_ |
The boundaries of the interval. More... | |
double | upperBound_ |
bool | inclLowerBound_ |
Boolean flags are true if the boundaries are included. More... | |
bool | inclUpperBound_ |
double | precision_ |
the accepted precision on the boundary (default: 1e-12) More... | |
An interval, either bounded or not, which can also have infinite bounds.
The upper and lower bound can be included or not (strict bound), finite or infinite (in that case, equal to a very large value). Despite the mathematical non-sense, and infinite bound can be either excluded or included.
Definition at line 101 of file Constraints.h.
|
inline |
Definition at line 121 of file Constraints.h.
|
inline |
Definition at line 128 of file Constraints.h.
|
inline |
Create an interval with an infinite lower/upper bound.
The infinite bound will not be included, following mathematical conventions.
isPositive | Tell if the infinite bound is positive or negative. |
bound | The finite bound. |
incl | Tell if the finite bound is included or not. |
precision | Parameter precision. |
Definition at line 145 of file Constraints.h.
|
inline |
Create an interval from a string description, using readDescription method.
Definition at line 156 of file Constraints.h.
|
inlinevirtual |
Definition at line 166 of file Constraints.h.
|
inlineoverridevirtual |
Create a copy of this object and send a pointer to it.
Implements bpp::ConstraintInterface.
Definition at line 168 of file Constraints.h.
|
inline |
Definition at line 180 of file Constraints.h.
References bpp::NumConstants::MINF().
|
inline |
Definition at line 181 of file Constraints.h.
References bpp::NumConstants::PINF().
|
inlineoverridevirtual |
Give the nearest accepted limit for a bad value.
The difference with getLimit() is when the Constraint is open at the limit, in which case the retruned value is the limit +- 1e-12.
value | The bad value. |
Implements bpp::ConstraintInterface.
Definition at line 221 of file Constraints.h.
References bpp::ConstraintInterface::isCorrect().
|
inlineoverridevirtual |
Give a short description on the type of constraint.
Implements bpp::ConstraintInterface.
Definition at line 234 of file Constraints.h.
References bpp::TextTools::toString().
Referenced by bpp::NumCalcApplicationTools::getParameterGrid().
|
inlineoverridevirtual |
Give the nearest limit for a bad value.
value | The bad value. |
Implements bpp::ConstraintInterface.
Definition at line 215 of file Constraints.h.
References bpp::ConstraintInterface::isCorrect().
|
inline |
Definition at line 174 of file Constraints.h.
Referenced by bpp::ReparametrizationFunctionWrapper::init_().
|
inline |
Definition at line 229 of file Constraints.h.
Referenced by operator &(), and operator &=().
|
inline |
Definition at line 175 of file Constraints.h.
|
inlineoverridevirtual |
Tell if all the values in a given interval are correct.
min,max | The bounds of the interval. |
Implements bpp::ConstraintInterface.
Definition at line 183 of file Constraints.h.
|
inlineoverridevirtual |
Tell if a given value is correct.
value | The value to test. |
Implements bpp::ConstraintInterface.
Definition at line 189 of file Constraints.h.
Referenced by bpp::ConstantDistribution::restrictToConstraint(), and bpp::SimpleDiscreteDistribution::restrictToConstraint().
|
inlineoverridevirtual |
Tells if this interval is empty.
Implements bpp::ConstraintInterface.
Definition at line 384 of file Constraints.h.
|
inlineoverridevirtual |
Intersect this IntervalConstraint with another one.
c | the intersected IntervalConstraint |
Implements bpp::ConstraintInterface.
Definition at line 276 of file Constraints.h.
References getPrecision(), inclLowerBound_, inclUpperBound_, lowerBound_, and upperBound_.
|
inline |
Intersect this IntervalConstraint with another constraint.
c | the intersected constraint |
Definition at line 319 of file Constraints.h.
References getPrecision(), inclLowerBound_, inclUpperBound_, lowerBound_, and upperBound_.
|
inline |
Tells if this interval is different from another one.
i | the compared IntervalConstraint |
Definition at line 362 of file Constraints.h.
References inclLowerBound_, inclUpperBound_, lowerBound_, and upperBound_.
|
inline |
Definition at line 195 of file Constraints.h.
|
inline |
Definition at line 205 of file Constraints.h.
|
inline |
Tells if this interval is included or equal in another one.
i | the compared IntervalConstraint |
Definition at line 375 of file Constraints.h.
References lowerBound_, and upperBound_.
|
inline |
Tells if this interval equals another one.
i | the compared IntervalConstraint |
Definition at line 349 of file Constraints.h.
References inclLowerBound_, inclUpperBound_, lowerBound_, and upperBound_.
|
inline |
Definition at line 200 of file Constraints.h.
|
inline |
Definition at line 210 of file Constraints.h.
|
inline |
Sets the bounds of the interval from a string.
desc | the description in interval-like syntax, with signs "[", ";", "]" as well as floats and "-inf" and "inf". |
Definition at line 250 of file Constraints.h.
References bpp::NumConstants::MINF(), bpp::NumConstants::PINF(), and bpp::TextTools::toDouble().
|
inline |
Definition at line 171 of file Constraints.h.
|
inline |
Definition at line 172 of file Constraints.h.
|
inline |
Definition at line 177 of file Constraints.h.
|
inline |
Definition at line 178 of file Constraints.h.
|
protected |
Boolean flags are true if the boundaries are included.
Definition at line 113 of file Constraints.h.
Referenced by operator &(), operator &=(), operator!=(), and operator==().
|
protected |
Definition at line 113 of file Constraints.h.
Referenced by operator &(), operator &=(), operator!=(), and operator==().
|
protected |
The boundaries of the interval.
Definition at line 108 of file Constraints.h.
Referenced by operator &(), operator &=(), operator!=(), operator<=(), and operator==().
|
protected |
the accepted precision on the boundary (default: 1e-12)
Definition at line 118 of file Constraints.h.
|
protected |
Definition at line 108 of file Constraints.h.
Referenced by operator &(), operator &=(), operator!=(), operator<=(), and operator==().