4
4
import pytest
5
5
from pytest import param
6
6
7
+ from baybe .campaign import Campaign
7
8
from baybe .constraints import ContinuousLinearConstraint
9
+ from baybe .searchspace import SearchSpace
8
10
from tests .conftest import run_iterations
9
11
10
12
TOLERANCE = 0.01
@@ -67,7 +69,21 @@ def test_inequality3(campaign, n_iterations, batch_size):
67
69
68
70
@pytest .mark .parametrize ("parameter_names" , [["Conti_finite1" , "Conti_finite2" ]])
69
71
@pytest .mark .parametrize ("constraint_names" , [["InterConstraint_1" ]])
70
- def test_interpoint_equality_single_parameter (campaign , n_iterations , batch_size ):
72
+ def test_interpoint_equality_single_parameter (
73
+ non_sequential_recommender ,
74
+ parameters ,
75
+ constraints ,
76
+ objective ,
77
+ n_iterations ,
78
+ batch_size ,
79
+ ):
80
+ campaign = Campaign (
81
+ searchspace = SearchSpace .from_product (
82
+ parameters = parameters , constraints = constraints
83
+ ),
84
+ recommender = non_sequential_recommender ,
85
+ objective = objective ,
86
+ )
71
87
"""Test single parameter interpoint equality constraint."""
72
88
run_iterations (campaign , n_iterations , batch_size , add_noise = False )
73
89
res = campaign .measurements
@@ -79,8 +95,22 @@ def test_interpoint_equality_single_parameter(campaign, n_iterations, batch_size
79
95
80
96
@pytest .mark .parametrize ("parameter_names" , [["Conti_finite1" , "Conti_finite2" ]])
81
97
@pytest .mark .parametrize ("constraint_names" , [["InterConstraint_2" ]])
82
- def test_interpoint_inequality_single_parameter (campaign , n_iterations , batch_size ):
98
+ def test_interpoint_inequality_single_parameter (
99
+ non_sequential_recommender ,
100
+ parameters ,
101
+ constraints ,
102
+ objective ,
103
+ n_iterations ,
104
+ batch_size ,
105
+ ):
83
106
"""Test single parameter interpoint inequality constraint."""
107
+ campaign = Campaign (
108
+ searchspace = SearchSpace .from_product (
109
+ parameters = parameters , constraints = constraints
110
+ ),
111
+ recommender = non_sequential_recommender ,
112
+ objective = objective ,
113
+ )
84
114
run_iterations (campaign , n_iterations , batch_size , add_noise = False )
85
115
res = campaign .measurements
86
116
@@ -91,8 +121,22 @@ def test_interpoint_inequality_single_parameter(campaign, n_iterations, batch_si
91
121
92
122
@pytest .mark .parametrize ("parameter_names" , [["Conti_finite1" , "Conti_finite2" ]])
93
123
@pytest .mark .parametrize ("constraint_names" , [["InterConstraint_3" ]])
94
- def test_interpoint_equality_multiple_parameters (campaign , n_iterations , batch_size ):
124
+ def test_interpoint_equality_multiple_parameters (
125
+ non_sequential_recommender ,
126
+ parameters ,
127
+ constraints ,
128
+ objective ,
129
+ n_iterations ,
130
+ batch_size ,
131
+ ):
95
132
"""Test interpoint equality constraint involving multiple parameters."""
133
+ campaign = Campaign (
134
+ searchspace = SearchSpace .from_product (
135
+ parameters = parameters , constraints = constraints
136
+ ),
137
+ recommender = non_sequential_recommender ,
138
+ objective = objective ,
139
+ )
96
140
run_iterations (campaign , n_iterations , batch_size , add_noise = False )
97
141
res = campaign .measurements
98
142
@@ -106,9 +150,21 @@ def test_interpoint_equality_multiple_parameters(campaign, n_iterations, batch_s
106
150
@pytest .mark .parametrize ("parameter_names" , [["Conti_finite1" , "Conti_finite2" ]])
107
151
@pytest .mark .parametrize ("constraint_names" , [["InterConstraint_4" ]])
108
152
def test_geq_interpoint_inequality_multiple_parameters (
109
- campaign , n_iterations , batch_size
153
+ non_sequential_recommender ,
154
+ parameters ,
155
+ constraints ,
156
+ objective ,
157
+ n_iterations ,
158
+ batch_size ,
110
159
):
111
160
"""Test geq-interpoint inequality constraint involving multiple parameters."""
161
+ campaign = Campaign (
162
+ searchspace = SearchSpace .from_product (
163
+ parameters = parameters , constraints = constraints
164
+ ),
165
+ recommender = non_sequential_recommender ,
166
+ objective = objective ,
167
+ )
112
168
run_iterations (campaign , n_iterations , batch_size , add_noise = False )
113
169
res = campaign .measurements
114
170
@@ -123,9 +179,21 @@ def test_geq_interpoint_inequality_multiple_parameters(
123
179
@pytest .mark .parametrize ("parameter_names" , [["Conti_finite1" , "Conti_finite2" ]])
124
180
@pytest .mark .parametrize ("constraint_names" , [["InterConstraint_5" ]])
125
181
def test_leq_interpoint_inequality_multiple_parameters (
126
- campaign , n_iterations , batch_size
182
+ non_sequential_recommender ,
183
+ parameters ,
184
+ constraints ,
185
+ objective ,
186
+ n_iterations ,
187
+ batch_size ,
127
188
):
128
189
"""Test leq-interpoint inequality constraint involving multiple parameters."""
190
+ campaign = Campaign (
191
+ searchspace = SearchSpace .from_product (
192
+ parameters = parameters , constraints = constraints
193
+ ),
194
+ recommender = non_sequential_recommender ,
195
+ objective = objective ,
196
+ )
129
197
run_iterations (campaign , n_iterations , batch_size , add_noise = False )
130
198
res = campaign .measurements
131
199
@@ -140,8 +208,22 @@ def test_leq_interpoint_inequality_multiple_parameters(
140
208
@pytest .mark .parametrize (
141
209
"constraint_names" , [["ContiConstraint_4" , "InterConstraint_2" ]]
142
210
)
143
- def test_interpoint_normal_mix (campaign , n_iterations , batch_size ):
211
+ def test_interpoint_normal_mix (
212
+ non_sequential_recommender ,
213
+ parameters ,
214
+ constraints ,
215
+ objective ,
216
+ n_iterations ,
217
+ batch_size ,
218
+ ):
144
219
"""Test mixing interpoint and normal inequality constraints."""
220
+ campaign = Campaign (
221
+ searchspace = SearchSpace .from_product (
222
+ parameters = parameters , constraints = constraints
223
+ ),
224
+ recommender = non_sequential_recommender ,
225
+ objective = objective ,
226
+ )
145
227
run_iterations (campaign , n_iterations , batch_size , add_noise = False )
146
228
res = campaign .measurements
147
229
0 commit comments