41 #ifndef BPP_NUMERIC_PROB_ABSTRACTDISCRETEDISTRIBUTION_H
42 #define BPP_NUMERIC_PROB_ABSTRACTDISCRETEDISTRIBUTION_H
46 #include "../AbstractParameterAliasable.h"
47 #include "../Constraints.h"
160 void set(
double category,
double probability);
161 void add(
double category,
double probability);
167 double randC()
const {
throw Exception(
"AbstractDiscreteDistribution::randC. No continuous version available for this distribution."); }
Comparator class for AbstractDiscreteDistribution.
Order(double prec=NumConstants::TINY())
Order & operator=(const Order &ord)
bool operator()(double l1, double l2) const
void setPrecision(double prec)
Partial implementation of the DiscreteDistribution interface.
size_t getCategoryIndex(double value) const
double getCategory(size_t categoryIndex) const
double randC() const
Draw a random number from the continuous version of this distribution, if it exists.
double getIInfCumulativeProbability(double category) const
virtual ~AbstractDiscreteDistribution()
void set(double category, double probability)
Set the probability associated to a class.
bool strictUpperBound() const
double getUpperBound() const
std::vector< double > bounds_
bool strictLowerBound() const
Vdouble getCategories() const
void add(double category, double probability)
Modify the probability associated to a class.
void setMedian(bool median)
Sets the median value to true to say that the value in a class is proportional to the median value of...
double getSSupCumulativeProbability(double category) const
Vdouble getProbabilities() const
double rand() const
Draw a random number from this distribution.
double getProbability(size_t categoryIndex) const
double getValueCategory(double value) const
virtual void restrictToConstraint(const Constraint &c)
Restricts the distribution to the domain where the constraint is respected, in addition of other pred...
size_t getNumberOfCategories() const
std::map< double, double, Order > distribution_
double getLowerBound() const
methods about the range of the definition
double getInfCumulativeProbability(double category) const
void setNumberOfCategories(size_t nbClasses)
sets the number of categories and discretizes if there is a change in this number.
double getSupCumulativeProbability(double category) const
size_t numberOfCategories_
Vdouble getBounds() const
AbstractDiscreteDistribution(size_t nbClasses, const std::string &prefix="")
void print(OutputStream &out) const
Print the distribution (categories and corresponding probabilities) to a stream.
AbstractDiscreteDistribution & operator=(const AbstractDiscreteDistribution &adde)
double getBound(size_t i) const
virtual void discretize()
Discretizes the distribution in equiprobable classes.
std::shared_ptr< IntervalConstraint > intMinMax_
the interval where the distribution is defined/restricted.
A partial implementation of the Parametrizable interface.
The constraint interface.
Interface for discrete distribution objects.
Exception base class. Overload exception constructor (to control the exceptions mechanism)....
Index out of bounds exception class.
std::vector< double > Vdouble