Skip to content

Commit

Permalink
fix init input
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonBlanke committed Dec 31, 2023
1 parent 1caadcc commit 5659988
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
5 changes: 2 additions & 3 deletions surfaces/mathematical_functions/drop_wave_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ class DropWaveFunction(MathematicalFunction):
formula = r"""f(x, y) = -\frac{1+\cos (12\sqrt{x^2+y^2})}{0.5 (x^2 + y^2) + 2}"""
global_minimum = r"""f(0, 0)= -1"""

def __init__(self, *args, **kwargs):
super().__init__(args, **kwargs)
def __init__(self, metric="score", input_type="dictionary", sleep=0):
super().__init__(metric, input_type, sleep)
self.n_dim = 2

def objective_function_dict(self, params):
Expand All @@ -28,5 +28,4 @@ def objective_function_dict(self, params):
loss = -(1 + np.cos(12 * np.sqrt(x**2 + y**2))) / (
0.5 * (x**2 + y**2) + 2
)

return self.return_metric(loss)
4 changes: 2 additions & 2 deletions surfaces/mathematical_functions/gramacy_and_lee_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ class GramacyAndLeeFunction(MathematicalFunction):
formula = r"""f(x) = \frac{\sin(10\pi x)}{2x} + (x - 1)^4"""
global_minimum = r"""-"""

def __init__(self, *args, **kwargs):
super().__init__(args, **kwargs)
def __init__(self, metric="score", input_type="dictionary", sleep=0):
super().__init__()
self.n_dim = 1

def objective_function_dict(self, params):
Expand Down
4 changes: 2 additions & 2 deletions surfaces/mathematical_functions/griewank_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ class GriewankFunction(MathematicalFunction):
formula = r"""f(\vec x) = \sum^d_{i=1} \frac{x_i^2}{4000} - \prod_{i=1}^d\cos (\frac{x_i}{\sqrt i}) + 1"""
global_minimum = r"""f(\vec x = 0) = 0"""

def __init__(self, *args, n_dim, **kwargs):
super().__init__(args, **kwargs)
def __init__(self, n_dim, metric="score", input_type="dictionary", sleep=0):
super().__init__()
self.n_dim = n_dim

def objective_function_dict(self, params):
Expand Down
4 changes: 2 additions & 2 deletions surfaces/mathematical_functions/langermann_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ class LangermannFunction(MathematicalFunction):
m = 5
A = np.array([[3, 5, 2, 1, 7], [5, 2, 1, 4, 9]])

def __init__(self, *args, **kwargs):
super().__init__(args, **kwargs)
def __init__(self, metric="score", input_type="dictionary", sleep=0):
super().__init__()
self.n_dim = 2

def objective_function_dict(self, params):
Expand Down

0 comments on commit 5659988

Please sign in to comment.