-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_main_entry_point.py
188 lines (163 loc) · 4.57 KB
/
test_main_entry_point.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
import os
import pytest
from poli.benchmarks import PMOBenchmark
from hdbo_benchmark.utils.experiments.load_solvers import (
SOLVER_NAME_TO_ENV,
SOLVER_NAMES,
)
from run import _main
SOLVERS_THAT_RUN_IN_BASE_ENV = [
solver_name
for solver_name in SOLVER_NAMES
if SOLVER_NAME_TO_ENV[solver_name] == "hdbo_benchmark"
]
MAX_ITER = 1
SEED = 1
os.environ["WANDB_MODE"] = "disabled"
def construct_setups(solvers: list[str]):
pmo_setups = [
(function_name, solver_name, 128)
for solver_name in solvers
for function_name in PMOBenchmark(
string_representation="SELFIES"
).problem_names[:1]
]
ehrlich_like_setups = [
(function_name, solver_name, 128)
for function_name in ["ehrlich_holo_tiny", "pest_control_equivalent"]
for solver_name in solvers
]
return pmo_setups + ehrlich_like_setups
@pytest.mark.hdbo_base
@pytest.mark.parametrize(
"function_name, solver_name, latent_dim",
construct_setups(SOLVERS_THAT_RUN_IN_BASE_ENV),
)
def test_main_run(function_name, solver_name, latent_dim):
_main(
solver_name=solver_name,
function_name=function_name,
n_dimensions=latent_dim,
seed=SEED,
max_iter=MAX_ITER,
strict_on_hash=False,
force_run=True,
tag="test",
wandb_mode="disabled",
)
@pytest.mark.hdbo_ax
@pytest.mark.parametrize(
"function_name, solver_name, latent_dim",
construct_setups(["vanilla_bo_hvarfner", "saas_bo"]),
)
def test_main_run_ax(function_name, solver_name, latent_dim):
_main(
solver_name=solver_name,
function_name=function_name,
n_dimensions=latent_dim,
seed=None,
max_iter=MAX_ITER,
strict_on_hash=False,
force_run=True,
tag="test",
wandb_mode="disabled",
)
@pytest.mark.hdbo_baxus
@pytest.mark.parametrize(
"function_name, solver_name, latent_dim",
construct_setups(["baxus"]),
)
def test_main_run_baxus(function_name, solver_name, latent_dim):
_main(
solver_name=solver_name,
function_name=function_name,
n_dimensions=latent_dim,
seed=None,
max_iter=MAX_ITER,
strict_on_hash=False,
force_run=True,
tag="test",
wandb_mode="disabled",
)
@pytest.mark.hdbo_alebo
@pytest.mark.parametrize(
"function_name, solver_name, latent_dim",
construct_setups(["alebo"]),
)
def test_main_run_alebo(function_name, solver_name, latent_dim):
_main(
solver_name=solver_name,
function_name=function_name,
n_dimensions=latent_dim,
seed=None,
max_iter=MAX_ITER,
strict_on_hash=False,
force_run=True,
tag="test",
wandb_mode="disabled",
)
@pytest.mark.hdbo_bounce
@pytest.mark.parametrize(
"function_name, solver_name, latent_dim",
construct_setups(["bounce"]),
)
def test_main_run_bounce(function_name, solver_name, latent_dim):
_main(
solver_name=solver_name,
function_name=function_name,
n_dimensions=latent_dim,
seed=None,
max_iter=MAX_ITER,
strict_on_hash=False,
force_run=True,
tag="test",
wandb_mode="disabled",
)
@pytest.mark.hdbo_pr
@pytest.mark.parametrize(
"function_name, solver_name, latent_dim",
construct_setups(["pr"]),
)
def test_main_run_pr(function_name, solver_name, latent_dim):
_main(
solver_name=solver_name,
function_name=function_name,
n_dimensions=latent_dim,
seed=None,
max_iter=MAX_ITER,
strict_on_hash=False,
force_run=True,
tag="test",
wandb_mode="disabled",
)
@pytest.mark.hdbo_lambo2
@pytest.mark.parametrize(
"function_name, solver_name, latent_dim",
filter(
lambda tuple_: tuple_[0] == "foldx_stability",
construct_setups(["lambo2"]),
),
)
def test_main_run_lambo2(function_name, solver_name, latent_dim):
_main(
solver_name=solver_name,
function_name=function_name,
n_dimensions=latent_dim,
seed=None,
max_iter=MAX_ITER,
strict_on_hash=False,
force_run=True,
tag="test",
wandb_mode="disabled",
)
if __name__ == "__main__":
test_setups_in_main = construct_setups(SOLVERS_THAT_RUN_IN_BASE_ENV)
print(len(test_setups_in_main))
for test_setup in test_setups_in_main:
print(test_setup)
try:
test_main_run(*test_setup)
except Exception as e:
print(f"could not run for {test_setup}")
print(e)
print("-" * 80)