wfcommons.utils

class wfcommons.utils.NoValue(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Enum

wfcommons.utils.best_fit_distribution(data: List[float], logger: Logger | None = None) Tuple

Fit a list of values to a distribution.

Parameters:
  • data (List[float]) – List of values to be fitted to a distribution.

  • logger (Logger) – The logger uses to output debug information.

Returns:

The name of the distribution and its parameters.

Return type:

Tuple

wfcommons.utils.generate_rvs(distribution: Dict, min_value: float, max_value: float) float

Generate a random variable from a distribution.

Parameters:
  • distribution (Dict) – Distribution dictionary (name and parameters).

  • min_value (float) – Minimum value accepted as a random variable.

  • max_value (float) – Maximum value accepted as a random variable.

Returns:

Random variable generated from a distribution.

Return type:

float

wfcommons.utils.ncr(n: int, r: int) int

Calculate the number of combinations.

Parameters:
  • n (int) – The number of items.

  • r (int) – The number of items being chosen at a time.

Returns:

The number of combinations.

Return type:

int

wfcommons.utils.read_json(instance_filename: Path) Dict[str, Any]

Read the JSON from the file path.

Parameters:

instance_filename (str) – The absolute path of the instance file.

Returns:

The json object loaded with json data from the file

Return type:

Dict[str, Any]