Passed
Push — master ( a5ea26...61a8e6 )
by Simon
03:53 queued 01:30
created

himmelblau_example.himmelblau()   A

Complexity

Conditions 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nop 3
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 -((para["x"]**2 + para["y"] - 11)**2 + (para["x"] + para["y"]**2 - 7)**2)
9
10
11
x_range = np.arange(0, 10, 0.1)
12
13
search_config = {
14
    himmelblau: {
15
        "x": x_range, 
16
        "y": x_range
17
    }
18
}
19
20
opt = Hyperactive(search_config, n_iter=1000000)
21
opt.search(0, 0)
22