-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_ca1_optimizers.py
More file actions
62 lines (56 loc) · 2.4 KB
/
_ca1_optimizers.py
File metadata and controls
62 lines (56 loc) · 2.4 KB
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
from machinable import Interface, get
import os
class _Ca1Optimizers(Interface):
def populations(self):
return [
"SCA",
"IVY",
"PVBC",
"CCKBC",
"AAC",
"BS",
"OLM",
"NGFC",
"IS",
]
def launch(self):
from models.ops import import_initial_samples
for trial in range(3):
with get("machinable.scope", {"trial": trial}):
for nm in self.populations():
for optimizer in ["age", "smpso"]:
nsga2 = get(
"interface.sopt_modeling",
[
f"""~from_protocol("benchmarks/ca1_pinsky_rinzel_modeling/config/CA1_{nm}.yaml")""",
{
"dopt_params.surrogate_method_name": "gpr",
"dopt_params.initial_method": "slh",
},
],
)
assert nsga2.cached()
nsga2.save_attribute("preflight", True)
e = get(
"interface.sopt_modeling",
[
f"""~from_protocol("benchmarks/ca1_pinsky_rinzel_modeling/config/CA1_{nm}.yaml")""",
{
"dopt_params.surrogate_method_name": "gpr",
"dopt_params.initial_method": "slh",
"dopt_params.optimizer_name": optimizer,
},
],
).launch()
if os.environ.get("LAUNCH", 0) and not os.path.isfile(
e.output_filepath
):
e.commit()
import_initial_samples(
file_path=e.output_filepath,
source=nsga2.output_filepath,
num=e.num_initial_samples,
opt_id=e.config.dopt_params.opt_id,
feature_dtypes=e.feature_dtypes,
param_names=e.parameter_names,
)