cosapp.utils.distributions.uniform

Class defining an uniform distribution.

Classes

Uniform(worst, best, pworst, pbest)

A class to define an uniform distribution.

class cosapp.utils.distributions.uniform.Uniform(worst: float, best: float, pworst: Optional[float] = 0.15, pbest: Optional[float] = 0.15)[source]

Bases: cosapp.utils.distributions.distribution.Distribution

A class to define an uniform 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: 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