| Conditions | 1 |
| Total Lines | 11 |
| Code Lines | 8 |
| Lines | 11 |
| Ratio | 100 % |
| Changes | 0 | ||
| 1 | import numpy as np |
||
| 5 | View Code Duplication | 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 | |||
| 26 |