Spaces:
Runtime error
Runtime error
change back to number
Browse files
app.py
CHANGED
|
@@ -7,7 +7,7 @@ def branin(x1, x2):
|
|
| 7 |
(x2 - 5.1 / (4 * np.pi**2) * x1**2 + 5.0 / np.pi * x1 - 6.0) ** 2
|
| 8 |
+ 10 * (1 - 1.0 / (8 * np.pi)) * np.cos(x1)
|
| 9 |
+ 10
|
| 10 |
-
)
|
| 11 |
|
| 12 |
return y
|
| 13 |
|
|
@@ -15,9 +15,27 @@ def branin(x1, x2):
|
|
| 15 |
iface = gr.Interface(
|
| 16 |
fn=branin,
|
| 17 |
inputs=[
|
| 18 |
-
gr.
|
| 19 |
-
gr.
|
| 20 |
],
|
| 21 |
outputs=gr.Number(branin(0.25, 0.75), label="branin function value"),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
)
|
| 23 |
iface.launch()
|
|
|
|
| 7 |
(x2 - 5.1 / (4 * np.pi**2) * x1**2 + 5.0 / np.pi * x1 - 6.0) ** 2
|
| 8 |
+ 10 * (1 - 1.0 / (8 * np.pi)) * np.cos(x1)
|
| 9 |
+ 10
|
| 10 |
+
) #
|
| 11 |
|
| 12 |
return y
|
| 13 |
|
|
|
|
| 15 |
iface = gr.Interface(
|
| 16 |
fn=branin,
|
| 17 |
inputs=[
|
| 18 |
+
gr.Number(0.25, label="x1", minimum=-5.0, maximum=10.0),
|
| 19 |
+
gr.Number(0.75, label="x2", minimum=0.0, maximum=10.0),
|
| 20 |
],
|
| 21 |
outputs=gr.Number(branin(0.25, 0.75), label="branin function value"),
|
| 22 |
+
description="""
|
| 23 |
+
## Objective
|
| 24 |
+
|
| 25 |
+
Minimize the Branin function by selecting appropriate values of x1 and x2.
|
| 26 |
+
|
| 27 |
+
## Constraints
|
| 28 |
+
|
| 29 |
+
### Bounds
|
| 30 |
+
|
| 31 |
+
-5 <= x1 <= 10
|
| 32 |
+
|
| 33 |
+
0 <= x2 <= 15
|
| 34 |
+
|
| 35 |
+
## References
|
| 36 |
+
|
| 37 |
+
- https://ax.dev/api/_modules/ax/utils/measurement/synthetic_functions.html#Branin
|
| 38 |
+
|
| 39 |
+
""",
|
| 40 |
)
|
| 41 |
iface.launch()
|