Passed
Push — master ( 907090...e51968 )
by Grega
01:21
created

run_cmaes.MinMB.__init__()   A

Complexity

Conditions 1

Size

Total Lines 3
Code Lines 3

Duplication

Lines 3
Ratio 100 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nop 1
dl 3
loc 3
rs 10
c 0
b 0
f 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.algorithms.basic import CovarianceMatrixAdaptionEvolutionStrategy
5
from NiaPy.task import StoppingTask, OptimizationType
6
from NiaPy.benchmarks import Sphere
7
8
import sys
9
sys.path.append('../')
10
# End of fix
11
12
# we will run CMA-ES for 5 independent runs
13
for i in range(5):
14
    task = StoppingTask(D=10, nFES=1000, optType=OptimizationType.MINIMIZATION, logger=True, benchmark=Sphere())
15
    algo = CovarianceMatrixAdaptionEvolutionStrategy(NP=20)
16
    best = algo.run(task=task)
17
    print('%s -> %s' % (best[0], best[1]))
18
19