Python micro framework for building nature-inspired algorithms.
-
class
NiaPy.
Runner
(D=10, nFES=1000000, nRuns=1, useAlgorithms='ArtificialBeeColonyAlgorithm', useBenchmarks='Ackley', **kwargs)[source]
Bases: object
Runner utility feature.
Feature which enables running multiple algorithms with multiple benchmarks.
It also support exporting results in various formats (e.g. Pandas DataFrame, JSON, Excel)
- Variables
D (int) – Dimension of problem
NP (int) – Population size
nFES (int) – Number of function evaluations
nRuns (int) – Number of repetitions
useAlgorithms (Union[List[str], List[Algorithm]]) – List of algorithms to run
useBenchmarks (Union[List[str], List[Benchmark]]) – List of benchmarks to run
- Returns
Returns the results.
- Return type
results (Dict[str, Dict])
Initialize Runner.
- Parameters
D (int) – Dimension of problem
nFES (int) – Number of function evaluations
nRuns (int) – Number of repetitions
useAlgorithms (List[Algorithm]) – List of algorithms to run
useBenchmarks (List[Benchmarks]) – List of benchmarks to run
-
__init__
(D=10, nFES=1000000, nRuns=1, useAlgorithms='ArtificialBeeColonyAlgorithm', useBenchmarks='Ackley', **kwargs)[source]
Initialize Runner.
- Parameters
D (int) – Dimension of problem
nFES (int) – Number of function evaluations
nRuns (int) – Number of repetitions
useAlgorithms (List[Algorithm]) – List of algorithms to run
useBenchmarks (List[Benchmarks]) – List of benchmarks to run
-
_export_to_xls
()[source]
Export the results in the xls file.
-
benchmark_factory
(name)[source]
Create optimization task.
- Parameters
name (str) – Benchmark name.
- Returns
Optimization task to use.
- Return type
Task
-
run
(export='dataframe', verbose=False)[source]
Execute runner.
- Parameters
export (str) – Takes export type (e.g. dataframe, json, xls, xlsx) (default: “dataframe”)
verbose (bool) – Switch for verbose logging (default: {False})
- Raises
TypeError – Raises TypeError if export type is not supported
- Returns
Returns dictionary of results
- Return type
dict
See also
NiaPy.Runner.useAlgorithms()
NiaPy.Runner.useBenchmarks()
NiaPy.Runner.__algorithmFactory()
-
class
NiaPy.
Runner
(D=10, nFES=1000000, nRuns=1, useAlgorithms='ArtificialBeeColonyAlgorithm', useBenchmarks='Ackley', **kwargs)[source]
Runner utility feature.
Feature which enables running multiple algorithms with multiple benchmarks.
It also support exporting results in various formats (e.g. Pandas DataFrame, JSON, Excel)
- Variables
D (int) – Dimension of problem
NP (int) – Population size
nFES (int) – Number of function evaluations
nRuns (int) – Number of repetitions
useAlgorithms (Union[List[str], List[Algorithm]]) – List of algorithms to run
useBenchmarks (Union[List[str], List[Benchmark]]) – List of benchmarks to run
- Returns
Returns the results.
- Return type
results (Dict[str, Dict])
Initialize Runner.
- Parameters
D (int) – Dimension of problem
nFES (int) – Number of function evaluations
nRuns (int) – Number of repetitions
useAlgorithms (List[Algorithm]) – List of algorithms to run
useBenchmarks (List[Benchmarks]) – List of benchmarks to run