NiaPy
¶
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. LaTeX, Excel, JSON)
- Variables
- 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
-
classmethod
_Runner__create_export_dir
()¶ Create export directory if not already createed.
-
_Runner__export_to_json
()¶ Export the results in the JSON form.
See also
NiaPy.Runner.__createExportDir()
-
_Runner__export_to_latex
()¶ Export the results in the form of latex table.
See also
NiaPy.Runner.__createExportDir()
NiaPy.Runner.__generateExportName()
-
_Runner__export_to_log
()¶ Print the results to terminal.
-
_Runner__export_to_xlsx
()¶ Export the results in the xlsx form.
See also
NiaPy.Runner.__generateExportName()
-
classmethod
_Runner__generate_export_name
(extension)¶ Generate export file name.
- Parameters
extension (str) – File format.
Returns:
-
__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
-
benchmark_factory
(name)[source]¶ Create optimization task.
- Parameters
name (str) – Benchmark name.
- Returns
Optimization task to use.
- Return type
Task
-
run
(export='log', verbose=False)[source]¶ Execute runner.
- Parameters
export (str) – Takes export type (e.g. log, json, xlsx, latex) (default: “log”)
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. LaTeX, Excel, JSON)
- Variables
- 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