| Total Complexity | 0 | 
| Total Lines | 18 | 
| 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 | import sys  | 
            ||
| 5 | sys.path.append('../') | 
            ||
| 6 | # End of fix  | 
            ||
| 7 | |||
| 8 | from NiaPy.algorithms.modified import DynNpMultiStrategyDifferentialEvolutionMTS  | 
            ||
| 9 | from NiaPy.util import StoppingTask, OptimizationType  | 
            ||
| 10 | from NiaPy.benchmarks import Sphere  | 
            ||
| 11 | |||
| 12 | # we will run Differential Evolution for 5 independent runs  | 
            ||
| 13 | for i in range(5):  | 
            ||
| 14 | task = StoppingTask(D=10, nFES=5000, optType=OptimizationType.MINIMIZATION, benchmark=Sphere())  | 
            ||
| 15 | algo = DynNpMultiStrategyDifferentialEvolutionMTS(NP=50, F=0.5, CR=0.9, pmax=10)  | 
            ||
| 16 | best = algo.run(task=task)  | 
            ||
| 17 | 	print('%s -> %s' % (best[0].x, best[1])) | 
            ||
| 18 | |||
| 20 |