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

himmelblau_example   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

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

1 Function

Rating   Name   Duplication   Size   Complexity  
A himmelblau() 0 4 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 -((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