| Total Complexity | 0 | 
| Total Lines | 19 | 
| Duplicated Lines | 0 % | 
| Changes | 0 | ||
| 1 | # encoding=utf8 | ||
| 2 | # This is temporary fix to import module from parent folder | ||
| 3 | # It will be removed when package is published on PyPI | ||
| 4 | from NiaPy.benchmarks import Sphere | ||
| 5 | from NiaPy.task.task import StoppingTask, OptimizationType | ||
| 6 | from NiaPy.algorithms.basic import BeesAlgorithm | ||
| 7 | |||
| 8 | import sys | ||
| 9 | sys.path.append('../') | ||
| 10 | # End of fix | ||
| 11 | |||
| 12 | |||
| 13 | # we will run Bees Algorithm for 5 independent runs | ||
| 14 | for i in range(5): | ||
| 15 | task = StoppingTask(D=20, nGEN=2, optType=OptimizationType.MINIMIZATION, benchmark=Sphere()) | ||
| 16 | algo = BeesAlgorithm(NP=50, m=20, e=10, nep=20, nsp=15, ngh=7) | ||
| 17 | best = algo.run(task=task) | ||
| 18 |     print('%s -> %s' % (best[0], best[1])) | ||
| 19 |