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