dojo - Training classes for functions and algorithms¶
-
class
dojo.
Dojo
(algorithms : sequence, environ : object[, runs=100])¶ A simple testing class for competing algorithms.
Dojo
is the base class for concrete implementations to measure the performance of algorithms that shall perform the same task.-
algorithms
¶ The list of algorithms to compare
-
environ
¶ An arbeitrary object that simulates the execution environment for the algorithms. A copy of it will be passed as first argument to each algorithm.
Note
The copy will be created via
copy.deepcopy()
to ensure that (hopefully) no value of the original environment will be modified by an algorithm.
-
runs
¶ The number of consecutive runs for each algorithm.
-
train
(*args) → None¶ Executes the algorithms, comparing their performance.
This has to be implemented by inheriting classes.
-
-
class
dojo.
TimingDojo
(algorithms : sequence, environ : object[, runs=100])¶ A
Dojo
implementation measuring the execution time of its algorithms.
-
class
dojo.
FitnessDojo
(algorithms : sequence, environ : object[, runs=100[, cmpfunc=min]])¶ A
Dojo
implementation measuring the fitness of its algorithms. The fitness is determined by the passed cmpfunc.-
cmpfunc
¶ Comparision function for the fitness measurement. It has to return a single object of a passed iterable and must accept a named argument
key
, since its execution looks likedojo.cmpfunc(result_dict, key=result_dict.get)
-