Passed
Push — master ( ef01f2...fd3757 )
by Simon
01:46 queued 10s
created

Himmelblau's function   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 10
dl 0
loc 19
rs 10
c 0
b 0
f 0

1 Function

Rating   Name   Duplication   Size   Complexity  
A himmelblau() 0 5 1
1
import numpy as np
2
from hyperactive import Hyperactive
3
4
5
def himmelblau(para, X, y):
6
    """Himmelblau's function"""
7
8
    return -(
9
        (para["x"] ** 2 + para["y"] - 11) ** 2 + (para["x"] + para["y"] ** 2 - 7) ** 2
10
    )
11
12
13
x_range = np.arange(0, 10, 0.1)
14
15
search_config = {himmelblau: {"x": x_range, "y": x_range}}
16
17
opt = Hyperactive(0, 0)
18
opt.search(search_config, n_iter=1000000)
19