| Total Complexity | 0 |
| Total Lines | 22 |
| 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 | |||
| 9 | # we will run 10 repetitions of Grey Wolf Optimizer against Pinter benchmark function |
||
| 10 | for i in range(10): |
||
| 11 | # first parameter takes dimension of problem |
||
| 12 | # second parameter is population size |
||
| 13 | # third parameter takes the number of function evaluations |
||
| 14 | # fourth parameter is benchmark function |
||
| 15 | algorithm = GreyWolfOptimizer(10, 20 , 10000, 'pinter') |
||
| 16 | |||
| 17 | # running algorithm returns best found minimum |
||
| 18 | best = algorithm.run() |
||
| 19 | |||
| 20 | # printing best minimum |
||
| 21 | print(best) |
||
| 22 |