culebra.tools.abc.DecisionManager class

class DecisionManager(trainer: Trainer)

Bases: Base

Create a decision manager.

Parameters:

trainer (Trainer) – The trainer

Raises:

TypeError – If trainer is not a valid trainer

Class methods

classmethod DecisionManager.load(filename: str) Base

Load a serialized object from a file.

Parameters:

filename (str) – The file name.

Returns:

The loaded object

Raises:

Methods

DecisionManager.dump(filename: str) None

Serialize this object and save it to a file.

Parameters:

filename (str) – The file name.

Raises:
DecisionManager.select() tuple[Solution, ...] | None

Select a solution from the trainer’s best ones.

Returns:

The chosen solution

Return type:

tuple[Solution, …]

Private methods

abstract DecisionManager._choose(all_combinations: list[list[Solution, ...]], all_combinations_fitness: list[Fitness, ...]) tuple[Solution, ...] | None

Choose one combination of solutions.

Parameters:

all_combinations (list[list[Solution, ...]]) – All the combinations of the Pareto optimal solutions from each species

All_combinations_fitness:

The fitness for each combination

Returns:

The chosen combination

Return type:

tuple[Solution, …]

This method must be overridden by subclasses to return a correct value.

abstract DecisionManager._evaluate(all_combinations: list[list[Solution, ...]]) list[Fitness, ...]

Evaluate all the combinations of Pareto optimal solutions.

Parameters:

all_combinations (list[list[Solution, ...]]) – All the combinations of the Pareto optimal solutions from each species

Returns:

The fitness for each combination

Return type:

list[Fitness, …]

This method must be overridden by subclasses to return a correct value.

DecisionManager._generate_all_combinations() list[list[Solution, ...]]

Generate all the combinations of Pareto optimal solutions.

Returns:

The combinations

Return type:

list[list[Solution, …]]

DecisionManager._get_repr_properties() dict[str, object]

Return the subset of properties used for __repr__.

Filters and evaluates all class-level @property attributes, returning only those intended for representation purposes. Private properties (names starting with _) are excluded.

Returns:

Mapping of property names to their corresponding values.

Return type:

dict[str, object]