4
4
from matplotlib .gridspec import GridSpec
5
5
6
6
from optimas .explorations import Exploration
7
- from optimas .core import VaryingParameter , Objective
8
7
from optimas .generators import AxSingleFidelityGenerator
9
8
from optimas .evaluators import FunctionEvaluator
10
9
from optimas .diagnostics import ExplorationDiagnostics
11
10
from optimas .utils .ax import AxModelManager
11
+ from generator_standard .vocs import VOCS
12
12
13
13
14
14
def eval_func_sf_moo (input_params , output_params ):
@@ -26,15 +26,13 @@ def test_ax_model_manager():
26
26
runs and that the generator and Ax client are updated after running.
27
27
"""
28
28
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" },
37
33
)
34
+
35
+ gen = AxSingleFidelityGenerator (vocs = vocs )
38
36
ev = FunctionEvaluator (function = eval_func_sf_moo )
39
37
exploration = Exploration (
40
38
generator = gen ,
@@ -88,8 +86,12 @@ def test_ax_model_manager():
88
86
gs = GridSpec (2 , 2 , wspace = 0.2 , hspace = 0.3 )
89
87
90
88
# 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
+ )
93
95
94
96
# plot model for `f` with custom slice value
95
97
fig , ax1 = mm_axcl .plot_contour (
0 commit comments