Total Complexity | 6 |
Total Lines | 17 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | """Utilities for benchmarks.""" |
||
7 | class Utility(object): |
||
8 | |||
9 | @staticmethod |
||
10 | def itialize_benchmark(function): |
||
11 | if callable(function): |
||
12 | return function |
||
13 | else: |
||
14 | if function == 'rastrigin': |
||
15 | return Rastrigin.function() |
||
16 | elif function == 'rosenbrock': |
||
17 | return Rosenbrock.function() |
||
18 | elif function == 'griewank': |
||
19 | return Griewank.function() |
||
20 | elif function == 'sphere': |
||
21 | return Sphere.function() |
||
22 | else: |
||
23 | raise TypeError('Passed benchmark is not defined!') |
||
24 |