gemseo_benchmark / algorithms

Hide inherited members

algorithm_configuration module

Configuration of an algorithm defined by the values of its options.

An algorithm depends on the values of its options. A value set defines a configuration of the algorithm.

class gemseo_benchmark.algorithms.algorithm_configuration.AlgorithmConfiguration(algorithm_name, configuration_name=None, instance_algorithm_options=mappingproxy({}), **algorithm_options)[source]

Bases: object

The configuration of an algorithm.

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

  • configuration_name (str | None) – The name of the configuration of the algorithm. If None, a name will be generated based on the algorithm name and its options, based on the pattern "algorithm_name[option_name=option_value, ...]".

  • instance_algorithm_options (InstanceAlgorithmOptions) –

    The options of the algorithm specific to instances of a problem. They shall be passed as a mapping that links the name of an algorithm option to a callable that takes the 0-based index of the instance as argument and returns the value of the option.

    By default it is set to {}.

  • **algorithm_options (Any) – The options of the algorithm.

copy()[source]

Return a copy of the algorithm configuration.

Returns:

A copy of the algorithm configuration.

Return type:

AlgorithmConfiguration

classmethod from_dict(algorithm_configuration)[source]

Load an algorithm configuration from a dictionary.

Parameters:

algorithm_configuration (dict[str, str | dict[str, Any]]) – The algorithm configuration.

Returns:

The algorithm configuration.

Return type:

AlgorithmConfiguration

to_dict(skip_instance_algorithm_options=False)[source]

Return the algorithm configuration as a dictionary.

Parameters:

skip_instance_algorithm_options (bool) –

Whether to skip the algorithm options specific to problem instances.

By default it is set to False.

Returns:

The algorithm configuration as a dictionary.

Return type:

dict[str, str | dict[str, Any]]

property algorithm_name: str

The name of the algorithm.

property algorithm_options: dict[str, Any]

The options of the algorithm.

property instance_algorithm_options: MutableMapping[str, Callable[[int], Any]]

The instance-specific options of the algorithm.

property name: str

The name of the algorithm configuration.