Passed
Push — master ( 90fac4...b39ade )
by Grega
51s
created

Sphere.function()   A

Complexity

Conditions 3

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
dl 0
loc 9
rs 9.6666
c 1
b 0
f 1
cc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A Sphere.evaluate() 0 5 2
1
"""Implementation of Sphere function."""
2
3
__all__ = ['Sphere']
4
5
6
class Sphere(object):
7
8
    @classmethod
9
    def function(cls):
10
        def evaluate(D, sol):
11
            val = 0.0
12
            for i in range(D):
13
                val = val + sol[i] * sol[i]
14
            return val
15
16
        return evaluate
17