metaheuristic_designer.algorithms.algorithm_selection module#

Utility for benchmarking a set of algorithms with independent repetitions.

class AlgorithmSelection(algorithm_list, repetitions=10)[source]#

Bases: object

Run several algorithms multiple times and collect performance data.

Each algorithm in the list is executed repetitions times. During the runs, every algorithm gets a silent reporter and a fresh HistoryTracker that records best, median, and worst objectives. After all runs finish, you can obtain the raw per-repetition data (raw_data) and an aggregated report().

Parameters:
algorithm_listiterable of Algorithm

The algorithms to evaluate. They are copied before execution so the originals are not modified.

repetitionsint, optional

How many independent repetitions to perform for each algorithm (default 10).

Parameters:
  • algorithm_list (Iterable[Algorithm])

  • repetitions (int)

Methods

optimize()

Execute all repetitions and return the best population found.

report()

Return an aggregated summary of the raw data.

optimize()[source]#

Execute all repetitions and return the best population found.

The raw data is stored in self.raw_data for later inspection.

Return type:

Tuple[Population, DataFrame]

Returns:
Population

The population with the best overall fitness across all repetitions and algorithms.

report()[source]#

Return an aggregated summary of the raw data.

The report contains one row per algorithm, with columns for the number of runs, overall best, average best, standard deviation, timing averages, and more.

Return type:

DataFrame

Returns:
pd.DataFrame

A DataFrame with the aggregated statistics.