cosapp.utils.distributions.triangular

Class defining a triangular distribution.

Classes

Triangular(worst, likely, best[, pworst, pbest])

A class to define a triangular distribution.

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

Bases: Distribution

A class to define a triangular distribution.

Parameters:
  • worst (float) – The parameter absolute worst value.

  • likely (float) – The parameter absolute likely value (i.e. corresponding to the peak probability).

  • 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

property likely: float

The parameter absolute likely value

It corresponds to the peak probability.

Type:

float