Total Complexity | 1 |
Total Lines | 19 |
Duplicated Lines | 0 % |
Changes | 0 |
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 |