gemseo_benchmark / results

Hide inherited members

results module

A class to collect the paths to performance histories.

class gemseo_benchmark.results.results.Results(path=None)[source]

Bases: object

A collection of paths to performance histories.

Parameters:

path (str | Path | None) – The path to the JSON file from which to load the paths. If None, the collection is initially empty.

add_path(algorithm_configuration_name, problem_name, path)[source]

Add a path to a performance history.

Parameters:
  • algorithm_configuration_name (str) – The name of the algorithm configuration associated with the history.

  • problem_name (str) – The name of the problem associated with the history.

  • path (str | Path) – The path to the history.

Raises:

FileNotFoundError – If the path to the history does not exist.

Return type:

None

contains(algo_name, problem_name, path)[source]

Check whether a result is stored.

Parameters:
  • algo_name (str) – The name of the algorithm configuration.

  • problem_name (str) – The name of the problem.

  • path (Path) – The path to the performance history

Returns:

Whether the result is stored.

Return type:

bool

from_file(path)[source]

Load paths to performance histories from a JSON file.

Parameters:

path (str | Path) – The path to the JSON file.

Return type:

None

get_paths(algo_name, problem_name)[source]

Return the paths associated with an algorithm and a problem.

Parameters:
  • algo_name (str) – The name of the algorithm.

  • problem_name (str) – The name of the problem.

Returns:

The paths to the performance histories.

Raises:

ValueError – If the algorithm name is unknown, or if the problem name is unknown.

Return type:

list[Path]

get_problems(algo_name)[source]

Return the names of the problems for a given algorithm configuration.

Parameters:

algo_name (str) – The name of the algorithm configuration.

Returns:

The names of the problems.

Raises:

ValueError – If the algorithm configuration name is unknown.

Return type:

list[str]

to_file(path, indent=None)[source]

Save the histories paths to a JSON file.

Parameters:
  • path (str | Path) – The path where to save the JSON file.

  • indent (int | None) – The indent level of the JSON serialization.

Return type:

None

property algorithms: list[str]

Return the names of the algorithms configurations.

Returns:

The names of the algorithms configurations.