forked from NiaOrg/NiaPy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_mts.py
More file actions
20 lines (17 loc) · 682 Bytes
/
run_mts.py
File metadata and controls
20 lines (17 loc) · 682 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# encoding=utf8
# This is temporary fix to import module from parent folder
# It will be removed when package is published on PyPI
import sys
sys.path.append('../')
# End of fix
import random
from NiaPy.algorithms.other import MultipleTrajectorySearch
from NiaPy.task.task import StoppingTask, OptimizationType
from NiaPy.benchmarks import Sphere
# we will run Nelder Mead algorithm for 5 independent runs
for i in range(5):
task = StoppingTask(D=10, nGEN=40, optType=OptimizationType.MINIMIZATION, benchmark=Sphere())
algo = MultipleTrajectorySearch()
best = algo.run(task=task)
print('%s -> %s' % (best[0], best[1]))
# vim: tabstop=3 noexpandtab shiftwidth=3 softtabstop=3