Passed
Push — master ( 3d8385...545ed9 )
by Grega
01:00
created

Sphere.__init__()   A

Complexity

Conditions 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 3
rs 10
c 1
b 0
f 0
cc 1
1
"""Implementation of Sphere function."""
2
3
__all__ = ['Sphere']
4
5
6
class Sphere(object):
7
8
    def __init__(self, Lower=-100, Upper=100):
9
        self.Lower = Lower
10
        self.Upper = Upper
11
12
    @classmethod
13
    def function(cls):
14
        def evaluate(D, sol):
15
            val = 0.0
16
            for i in range(D):
17
                val = val + sol[i] * sol[i]
18
            return val
19
20
        return evaluate
21