Code Duplication    Length = 11-11 lines in 3 locations

examples/optimization_applications/test_function.py 1 location

@@ 5-15 (lines=11) @@
2
from hyperactive import Hyperactive
3
4
5
def ackley_function(para):
6
    x, y = para["x"], para["y"]
7
8
    loss = (
9
        -20 * np.exp(-0.2 * np.sqrt(0.5 * (x * x + y * y)))
10
        - np.exp(0.5 * (np.cos(2 * np.pi * x) + np.cos(2 * np.pi * y)))
11
        + np.exp(1)
12
        + 20
13
    )
14
15
    return -loss
16
17
18
search_space = {

tests/test_empty_output/verbose.py 1 location

@@ 10-20 (lines=11) @@
7
from hyperactive import Hyperactive
8
9
10
def ackley_function(para):
11
    """Ackley optimization function for testing."""
12
    x, y = para["x"], para["y"]
13
14
    loss = (
15
        -20 * np.exp(-0.2 * np.sqrt(0.5 * (x * x + y * y)))
16
        - np.exp(0.5 * (np.cos(2 * np.pi * x) + np.cos(2 * np.pi * y)))
17
        + np.exp(1)
18
        + 20
19
    )
20
21
    return -loss
22
23

tests/test_empty_output/non_verbose.py 1 location

@@ 8-18 (lines=11) @@
5
from hyperactive import Hyperactive
6
7
8
def ackley_function(para):
9
    """Ackley optimization function for testing."""
10
    x, y = para["x"], para["y"]
11
12
    loss = (
13
        -20 * np.exp(-0.2 * np.sqrt(0.5 * (x * x + y * y)))
14
        - np.exp(0.5 * (np.cos(2 * np.pi * x) + np.cos(2 * np.pi * y)))
15
        + np.exp(1)
16
        + 20
17
    )
18
19
    return -loss
20
21