4 status (Normal / Affected / Disrupted / Removed)
This commit is contained in:
@@ -51,11 +51,11 @@ class ControllerDB:
|
||||
Firm['Code'] = Firm['Code'].astype('string')
|
||||
Firm.fillna(0, inplace=True)
|
||||
|
||||
# fill dct_lst_init_remove_firm_prod
|
||||
# fill dct_lst_init_disrupt_firm_prod
|
||||
list_dct = []
|
||||
if self.is_with_exp:
|
||||
str_sql = "select e_id, count, max_max_ts, " \
|
||||
"dct_lst_init_remove_firm_prod from " \
|
||||
"dct_lst_init_disrupt_firm_prod from " \
|
||||
"iiabmdb.without_exp_experiment as a " \
|
||||
"inner join " \
|
||||
"(select e_id, count(id) as count, max(max_ts) as max_max_ts "\
|
||||
@@ -67,11 +67,11 @@ class ControllerDB:
|
||||
"on a.id = b.e_id " \
|
||||
"order by count desc;"
|
||||
result = pd.read_sql(sql=str_sql, con=engine)
|
||||
result['dct_lst_init_remove_firm_prod'] = \
|
||||
result['dct_lst_init_remove_firm_prod'].apply(
|
||||
result['dct_lst_init_disrupt_firm_prod'] = \
|
||||
result['dct_lst_init_disrupt_firm_prod'].apply(
|
||||
lambda x: pickle.loads(x))
|
||||
list_dct = result.loc[result['count'] > 10,
|
||||
'dct_lst_init_remove_firm_prod'].to_list()
|
||||
'dct_lst_init_disrupt_firm_prod'].to_list()
|
||||
else:
|
||||
for _, row in Firm.iterrows():
|
||||
code = row['Code']
|
||||
@@ -125,17 +125,17 @@ class ControllerDB:
|
||||
f"init_removal {idx_init_removal}!")
|
||||
|
||||
def add_experiment_1(self, idx_scenario, idx_init_removal,
|
||||
dct_lst_init_remove_firm_prod, g_bom,
|
||||
dct_lst_init_disrupt_firm_prod, g_bom,
|
||||
n_max_trial, prf_size, prf_conn,
|
||||
cap_limit_prob_type, cap_limit_level,
|
||||
diff_new_conn, crit_supplier, diff_remove,
|
||||
proactive_ratio, drop_t, netw_prf_n):
|
||||
diff_new_conn, crit_supplier, diff_disrupt,
|
||||
proactive_ratio, remove_t, netw_prf_n):
|
||||
e = Experiment(
|
||||
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']),
|
||||
dct_lst_init_remove_firm_prod=dct_lst_init_remove_firm_prod,
|
||||
dct_lst_init_disrupt_firm_prod=dct_lst_init_disrupt_firm_prod,
|
||||
g_bom=g_bom,
|
||||
n_max_trial=n_max_trial,
|
||||
prf_size=prf_size,
|
||||
@@ -144,9 +144,9 @@ class ControllerDB:
|
||||
cap_limit_level=cap_limit_level,
|
||||
diff_new_conn=diff_new_conn,
|
||||
crit_supplier=crit_supplier,
|
||||
diff_remove=diff_remove,
|
||||
diff_disrupt=diff_disrupt,
|
||||
proactive_ratio=proactive_ratio,
|
||||
drop_t=drop_t,
|
||||
remove_t=remove_t,
|
||||
netw_prf_n=netw_prf_n
|
||||
)
|
||||
db_session.add(e)
|
||||
|
||||
Reference in New Issue
Block a user