| Total Complexity | 3 |
| Total Lines | 30 |
| Duplicated Lines | 0 % |
| Changes | 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 |