Issues (71)

examples/run_msde.py (1 issue)

Severity
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
import sys
5
sys.path.append('../')
6
# End of fix
7
8
import random
9
from NiaPy.algorithms.basic import MultiStrategyDifferentialEvolution
10
from NiaPy.task import StoppingTask
11
from NiaPy.benchmarks import Sphere
12
13
#we will run Differential Evolution for 5 independent runs
14
for i in range(5):
15
	task = StoppingTask(D=10, nFES=5000, benchmark=Sphere())
16
	algo = MultiStrategyDifferentialEvolution(NP=50, F=0.5, CR=0.9)
17
	best = algo.run(task)
18
	print('%s -> %s' % (best[0], best[1]))
19
print(algo.getParameters())
0 ignored issues
show
The variable algo does not seem to be defined in case the for loop on line 14 is not entered. Are you sure this can never be the case?
Loading history...
20
21
# vim: tabstop=3 noexpandtab shiftwidth=3 softtabstop=3
22