Passed
Pull Request — master (#110)
by
unknown
01:23
created

Parabola._paramnames()   A

Complexity

Conditions 1

Size

Total Lines 2
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nop 1
dl 0
loc 2
rs 10
c 0
b 0
f 0
1
"""2D parabola."""
2
3
from hyperactive.base import BaseExperiment
4
5
6
class Parabola(BaseExperiment):
7
    """2D parabola.
8
9
    Parameters
10
    ----------
11
    a : float, default=1.0
12
        Coefficient of the parabola.
13
    b : float, default=0.0
14
        Coefficient of the parabola.
15
    c : float, default=0.0
16
        Coefficient of the parabola.
17
    """
18
19
    def __init__(self, a=1.0, b=0.0, c=0.0):
20
        super().__init__()
21
        self.a = a
22
        self.b = b
23
        self.c = c
24
25
    def _paramnames(self):
26
        return ["x", "y"]
27
28
    def _score(self, x, y):
29
        return self.a * (x**2 + y**2) + self.b * x + self.c * y, {}
30