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.util import StoppingTask, OptimizationType |
||
6 | from NiaPy.algorithms.basic import MonarchButterflyOptimization |
||
7 | import random |
||
8 | import sys |
||
9 | sys.path.append('../') |
||
10 | # End of fix |
||
11 | |||
12 | |||
13 | # we will run Forest Optimization Algorithm for 5 independent runs |
||
14 | for i in range(5): |
||
15 | task = StoppingTask(D=10, nFES=100000, optType=OptimizationType.MINIMIZATION, benchmark=Sphere()) |
||
16 | algo = MonarchButterflyOptimization(NP=50) |
||
17 | best = algo.run(task=task) |
||
18 | print(best) |
||
19 |