experiment design
This commit is contained in:
@@ -72,20 +72,34 @@ class ControllerDB:
|
||||
g_product_js = json.dumps(nx.adjacency_data(g_bom))
|
||||
|
||||
# insert exp
|
||||
for idx_exp, dct in enumerate(list_dct):
|
||||
self.add_experiment_1(idx_exp, self.dct_parameter['n_max_trial'],
|
||||
dct, g_product_js) # same g_bom for all exp
|
||||
print(f'Inserted experiment for exp {idx_exp}!')
|
||||
df_xv = pd.read_csv("xv.csv", index_col=None)
|
||||
# read the OA table
|
||||
df_oa = pd.read_fwf("oa.csv", index_col=None)
|
||||
for idx_scenario, row in df_oa.iterrows():
|
||||
dct_exp_para = {}
|
||||
for idx_col, para_level in enumerate(row):
|
||||
dct_exp_para[df_xv.columns[idx_col]] = \
|
||||
df_xv.iloc[para_level, idx_col]
|
||||
# different initial removal
|
||||
for idx_init_removal, dct_init_removal in enumerate(list_dct):
|
||||
self.add_experiment_1(idx_scenario,
|
||||
idx_init_removal,
|
||||
dct_init_removal,
|
||||
g_product_js,
|
||||
**dct_exp_para)
|
||||
print(f"Inserted experiment for scenario {idx_scenario}, "
|
||||
f"init_removal {idx_init_removal}!")
|
||||
|
||||
def add_experiment_1(self, idx_exp, n_max_trial,
|
||||
dct_lst_init_remove_firm_prod, g_bom):
|
||||
def add_experiment_1(self, idx_scenario, idx_init_removal,
|
||||
dct_lst_init_remove_firm_prod, g_bom, n_max_trial):
|
||||
e = Experiment(
|
||||
idx_exp=idx_exp,
|
||||
idx_scenario=idx_scenario,
|
||||
idx_init_removal=idx_init_removal,
|
||||
n_sample=int(self.dct_parameter['n_sample']),
|
||||
n_iter=int(self.dct_parameter['n_iter']),
|
||||
n_max_trial=n_max_trial,
|
||||
dct_lst_init_remove_firm_prod=dct_lst_init_remove_firm_prod,
|
||||
g_bom=g_bom)
|
||||
g_bom=g_bom,
|
||||
n_max_trial=n_max_trial)
|
||||
db_session.add(e)
|
||||
db_session.commit()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user