culebra.tools.decision_manager.LexicographicDM class

class LexicographicDM(trainer: Trainer, obj_thresholds: float | None = None)

Bases: DecisionManager

Init the decesion manager.

Parameters:

Class methods

classmethod LexicographicDM.load(filename: str) Base

Load a serialized object from a file.

Parameters:

filename (str) – The file name.

Returns:

The loaded object

Raises:

Properties

property LexicographicDM.obj_thresholds: tuple[float]

Objective similarity thresholds.

Return type:

tuple[float]

Setter:

Set new thresholds.

Parameters:

values (float | Sequence[float]) – The new values. If only a single value is provided, the same threshold will be used for all the objectives. Different thresholds can be provided in a Sequence. If set to None, all the thresholds are set to _default_similarity_threshold

Raises:
  • TypeError – If neither a real number nor a Sequence of real numbers is provided

  • ValueError – If any value is negative

  • ValueError – If the length of the thresholds sequence does not match the number of objectives

Private properties

property LexicographicDM._default_similarity_threshold: float

Default similarity threshold for fitnesses.

Returns:

DEFAULT_SIMILARITY_THRESHOLD

Return type:

float

Methods

LexicographicDM.dump(filename: str) None

Serialize this object and save it to a file.

Parameters:

filename (str) – The file name.

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

Select a solution from the trainer’s best ones.

Returns:

The chosen solution

Return type:

tuple[Solution, …]

Private methods

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

Choose one combination of solutions.

The combinations are ranked lexicographically and the first one is selected.

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, …]

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

Evaluate all the combinations of Pareto optimal solutions.

The trainer’s training fitness function is used to evaluate each combination.

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, …]

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

Generate all the combinations of Pareto optimal solutions.

Returns:

The combinations

Return type:

list[list[Solution, …]]

LexicographicDM._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]