![]() |
ALMaSS
1.2 (after EcoStack, March 2024)
The Animal, Landscape and Man Simulation System
|
#include <ALMaSS_Random.h>
Public Member Functions | |
probability_distribution (const std::string &prob_type, std::string prob_params) | |
double | Get () const |
int | Geti () const |
~probability_distribution () | |
Private Attributes | |
const std::string | DISCRETE_DIST_S { "DISCRETE" } |
const std::string | BETABINOMIAL_DIST_S { "BETABINOMIAL" } |
const std::string | NORMAL_DIST_S { "NORMAL" } |
const std::string | UNIREAL_DIST_S { "UNIREAL" } |
const std::string | UNIINT_DIST_S { "UNIINT" } |
const std::string | BETA_DIST_S { "BETA" } |
const std::string | GAMMA_DIST_S { "GAMMA" } |
const std::string | CAUCHY_DIST_S { "CAUCHY" } |
const std::string | EXPONENTIAL_DIST_S { "EXPONENTIAL" } |
void * | m_probDistrib |
void * | m_probDistrib1 |
void * | m_probDistrib2 |
int | m_type |
Static Private Attributes | |
static const int | DISCRETE_DIST_T = 1 |
static const int | NORMAL_DIST_T = 2 |
static const int | UNIREAL_DIST_T = 3 |
static const int | UNIINT_DIST_T = 4 |
static const int | BETA_DIST_T = 5 |
static const int | GAMMA_DIST_T = 6 |
static const int | CAUCHY_DIST_T = 7 |
static const int | EXPONENTIAL_DIST_T = 8 |
ALMaSS Probability Distribution class, wrapping around the Boost-library random distributions classes
probability_distribution::probability_distribution | ( | const std::string & | prob_type, |
std::string | prob_params | ||
) |
Constructor of the class, version 1
[in] | prob_type | a string containing the label of the distribution, must match the supported/predefined values |
[in] | prob_params | a string containing space,comma, or tab separated numerical values of the required parameters associated with the distribution type |
References BETA_DIST_S, BETA_DIST_T, BETABINOMIAL_DIST_S, CAUCHY_DIST_S, CAUCHY_DIST_T, DISCRETE_DIST_S, DISCRETE_DIST_T, EXPONENTIAL_DIST_S, EXPONENTIAL_DIST_T, g_beta_binomial_probabilities_fnc(), g_msg, GAMMA_DIST_S, GAMMA_DIST_T, m_probDistrib, m_probDistrib1, m_probDistrib2, m_type, NORMAL_DIST_S, NORMAL_DIST_T, UNIINT_DIST_S, UNIINT_DIST_T, UNIREAL_DIST_S, UNIREAL_DIST_T, MapErrorMsg::Warn(), WARN_MSG, and WARN_UNDEF.
probability_distribution::~probability_distribution | ( | ) |
double probability_distribution::Get | ( | ) | const |
Returns a numerical random variate extracted from the defined probability distribution
References BETA_DIST_T, CAUCHY_DIST_T, DISCRETE_DIST_T, EXPONENTIAL_DIST_T, g_generator(), g_msg, GAMMA_DIST_T, m_probDistrib, m_probDistrib1, m_probDistrib2, m_type, NORMAL_DIST_T, UNIINT_DIST_T, UNIREAL_DIST_T, MapErrorMsg::Warn(), and WARN_BUG.
Referenced by Osmia_Female::FindNestLocation(), Osmia_Population_Manager::GetFirstCocoonProvisioningMass(), Osmia_Female::LayEgg(), Osmia_Female::PlanEggsPerNest(), and Osmia_Female::st_Dispersal().
int probability_distribution::Geti | ( | ) | const |
Returns an integer random variate extracted from the defined probability distribution Maybe marginally faster than get(), as it has less types to check
References DISCRETE_DIST_T, g_generator(), m_probDistrib, m_type, and UNIINT_DIST_T.
Referenced by Osmia_InCocoon::st_Develop().
|
private |
BETA, the continuous/real-valued beta distribution. BETA distribution is implemented using two gamma distributions since it is not included in the standard library.
Parametres are alpha and beta. The outcomes belong to [0,1]
Referenced by probability_distribution().
|
staticprivate |
Referenced by Get(), probability_distribution(), and ~probability_distribution().
|
private |
BETABINOMIAL, a beta-binomial discrete distribution with outcomes {0,1,2,..,N}
It needs 4 parameters: N (int) - max value of the outcome alpha, beta (real) - the beta binomial parameters, determine the shape of probabilities over the outcome space no_zero (numerical boolean) - extra parameter to cancel out the probability for the zero value
Referenced by probability_distribution().
|
private |
CAUCHY, the continuous/real-valued gamma distribution
Parametres are alpha and beta. The outcomes is any real number.
Referenced by probability_distribution().
|
staticprivate |
Referenced by Get(), probability_distribution(), and ~probability_distribution().
|
private |
DISCRETE, custom build distribution with outcomes {0,1,2,..}
Needs as parameters a (not necesarilly normalized) set of weights (real numbers). The weights correspond to the outcomes {0,1,2,...} Therefore the number of weights give the number of outcomes, where zero is included
Referenced by probability_distribution().
|
staticprivate |
Referenced by Get(), Geti(), probability_distribution(), and ~probability_distribution().
|
private |
EXPONENTIAL, the continuous/real-valued exponential distribution
Parametres are lamda. The outcomes is any real number.
Referenced by probability_distribution().
|
staticprivate |
Referenced by Get(), probability_distribution(), and ~probability_distribution().
|
private |
GAMMA, the continuous/real-valued cauchy distribution
Parametres are location and scale. The outcomes belong to [0,max]
Referenced by probability_distribution().
|
staticprivate |
Referenced by Get(), probability_distribution(), and ~probability_distribution().
|
private |
Referenced by Get(), Geti(), probability_distribution(), and ~probability_distribution().
|
private |
Referenced by Get(), probability_distribution(), and ~probability_distribution().
|
private |
Referenced by Get(), probability_distribution(), and ~probability_distribution().
|
private |
Referenced by Get(), Geti(), probability_distribution(), and ~probability_distribution().
|
private |
NORMAL, a continuous normal distribution
It needs two parameters: the mean (real number) and the standard deviation (real number, >=0)
Referenced by probability_distribution().
|
staticprivate |
Referenced by Get(), probability_distribution(), and ~probability_distribution().
|
private |
UNIINT, a discrete uniform distribution
Parametres are min and max, both integer values. The outcomes belong to {min, min+1, ... , max}
Referenced by probability_distribution().
|
staticprivate |
Referenced by Get(), Geti(), probability_distribution(), and ~probability_distribution().
|
private |
UNIREAL, a continuous uniform distribution
Parametres are min and max, both real values. The outcomes belong to [min,max)
Referenced by probability_distribution().
|
staticprivate |
Referenced by Get(), probability_distribution(), and ~probability_distribution().