Passed
Pull Request — master (#24)
by Grega
01:26
created

Fun()   A

Complexity

Conditions 2

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 13
Bugs 2 Features 3
Metric Value
cc 2
c 13
b 2
f 3
dl 0
loc 5
rs 9.4285
1
# This is temporary fix to import module from parent folder
2
# It will be removed when package is published on PyPI
3
import sys
4
sys.path.append('../')
5
# End of fix
6
7
import random
8
from NiaPy.algorithms.modified import SelfAdaptiveDifferentialEvolutionAlgorithm
9
10
11
def Fun(D, sol):
12
    val = 0.0
13
    for i in range(D):
14
        val = val + sol[i] * sol[i]
15
    return val
16
17
18
for i in range(10):
19
    Algorithm = SelfAdaptiveDifferentialEvolutionAlgorithm(10, 40, 10000, 0.5, 0.9,
20
                             0.0, 2.0, Fun)
21
    Best = Algorithm.run()
22
23
    print(Best)
24