cosapp.utils.distributions.distribution¶
Basic class to define a variable distribution.
Classes
|
Abstract class to define a variable distribution. |
-
class
cosapp.utils.distributions.distribution.Distribution(worst: float, best: float, pworst: Optional[float] = 0.15, pbest: Optional[float] = 0.15)[source]¶ Bases:
abc.ABCAbstract class to define a variable distribution.
- Parameters
worst (float) – The parameter absolute worst value.
best (float) – The parameter absolute best value.
pworst (float, optional) – The worst value probability is the probability that the variable will be lower (if worst<best) or higher (if worst>best) than the worst value; default 0.15 (i.e. 15%).
pbest (float, optional) – The best value probability is the probability that the variable will be higher (if worst<best) or lower (if worst>best) than the best value; default 0.15 (i.e. 15%).
-
property
best¶ The best possible value of the variable.
It is defined as an absolute value. It has a physical meaning, i.e. it can be numerically lower than the worst value. The probability to meet the best value is given by the pbest property.
- Type
float
-
abstract
draw(quantile: Optional[float] = None) → float[source]¶ Generate a random number.
If a quantile is given, generate the perturbation for that quantile.
- Parameters
quantile (Optional[float], optional) – Quantile for which the perturbation must be set; default None (i.e. random perturbation)
- Returns
The random number
- Return type
float
-
property
pbest¶ The best value probability.
It is the probability that the variable will be higher (if worst<best) or lower (if worst>best) than the best value.
- Type
float
-
property
pworst¶ The worst value probability.
It is the probability that the variable will be lower (if worst<best) or higher (if worst>best) than the worst value.
- Type
float
-
property
worst¶ The worst possible value of the variable.
It is defined as an absolute value. It has a physical meaning, i.e. it can be numerically higher than the best value. The probability to meet the worst value is given by the pworst property.
- Type
float