Skip to content

Commit 3a6ef44

Browse files
committed
Update model manager test
1 parent 6f0933f commit 3a6ef44

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

tests/test_ax_model_manager.py

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
from matplotlib.gridspec import GridSpec
55

66
from optimas.explorations import Exploration
7-
from optimas.core import VaryingParameter, Objective
87
from optimas.generators import AxSingleFidelityGenerator
98
from optimas.evaluators import FunctionEvaluator
109
from optimas.diagnostics import ExplorationDiagnostics
1110
from optimas.utils.ax import AxModelManager
11+
from generator_standard.vocs import VOCS
1212

1313

1414
def eval_func_sf_moo(input_params, output_params):
@@ -26,15 +26,13 @@ def test_ax_model_manager():
2626
runs and that the generator and Ax client are updated after running.
2727
"""
2828

29-
var1 = VaryingParameter("x0", -50.0, 5.0)
30-
var2 = VaryingParameter("x1", -5.0, 15.0)
31-
var3 = VaryingParameter("x2", -5.0, 15.0)
32-
obj = Objective("f", minimize=True)
33-
obj2 = Objective("f2", minimize=False)
34-
35-
gen = AxSingleFidelityGenerator(
36-
varying_parameters=[var1, var2, var3], objectives=[obj, obj2]
29+
# Create VOCS object
30+
vocs = VOCS(
31+
variables={"x0": [-50.0, 5.0], "x1": [-5.0, 15.0], "x2": [-5.0, 15.0]},
32+
objectives={"f": "MINIMIZE", "f2": "MAXIMIZE"},
3733
)
34+
35+
gen = AxSingleFidelityGenerator(vocs=vocs)
3836
ev = FunctionEvaluator(function=eval_func_sf_moo)
3937
exploration = Exploration(
4038
generator=gen,
@@ -88,8 +86,12 @@ def test_ax_model_manager():
8886
gs = GridSpec(2, 2, wspace=0.2, hspace=0.3)
8987

9088
# center coordinates
91-
x1_c = 0.5 * (var2.lower_bound + var2.upper_bound)
92-
x2_c = 0.5 * (var3.lower_bound + var3.upper_bound)
89+
x1_c = 0.5 * (
90+
vocs.variables["x1"].domain[0] + vocs.variables["x1"].domain[1]
91+
)
92+
x2_c = 0.5 * (
93+
vocs.variables["x2"].domain[0] + vocs.variables["x2"].domain[1]
94+
)
9395

9496
# plot model for `f` with custom slice value
9597
fig, ax1 = mm_axcl.plot_contour(

0 commit comments

Comments
 (0)