cosapp.utils.distributions.normal

Basic class to define a variable distribution.

Classes

Normal(worst, best[, pworst, pbest])

A class to define a gaussian distribution.

class cosapp.utils.distributions.normal.Normal(worst: float, best: float, pworst: float | None = 0.15, pbest: float | None = 0.15)[source]

Bases: Distribution

A class to define a gaussian 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%).

draw(quantile: float | None = 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