Total Complexity | 0 |
Total Lines | 26 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | # This is temporary fix to import module from parent folder |
||
2 | # It will be removed when package is published on PyPI |
||
3 | import sys |
||
4 | sys.path.append('../') |
||
5 | # End of fix |
||
6 | |||
7 | from NiaPy.algorithms.basic import GreyWolfOptimizer |
||
8 | from NiaPy.benchmarks import Pinter |
||
9 | |||
10 | # initialize Pinter benchamrk with custom bound |
||
11 | pinterCustom = Pinter(-5, 5) |
||
12 | |||
13 | # we will run 10 repetitions of Grey Wolf Optimizer against Pinter benchmark function |
||
14 | for i in range(10): |
||
15 | # first parameter takes dimension of problem |
||
16 | # second parameter is population size |
||
17 | # third parameter takes the number of function evaluations |
||
18 | # fourth parameter is benchmark function |
||
19 | algorithm = GreyWolfOptimizer(10, 20 , 10000, pinterCustom) |
||
20 | |||
21 | # running algorithm returns best found minimum |
||
22 | best = algorithm.run() |
||
23 | |||
24 | # printing best minimum |
||
25 | print(best) |
||
26 |