proactive choice replace = False

This commit is contained in:
HaoYizhi 2023-06-18 23:01:28 +08:00
parent ae5bebb1f3
commit e6a2f942e0
5 changed files with 7 additions and 6 deletions

Binary file not shown.

Binary file not shown.

View File

@ -255,7 +255,8 @@ class Model(ap.Model):
[lst_affected[i] for i in [lst_affected[i] for i in
self.nprandom.choice(range(len(lst_affected)), self.nprandom.choice(range(len(lst_affected)),
round(len(lst_affected) * round(len(lst_affected) *
self.proactive_ratio))] self.proactive_ratio),
replace=False)]
for firm_code, prod_code in lst_firm_proactive: for firm_code, prod_code in lst_firm_proactive:
pro_firm_prod_code = \ pro_firm_prod_code = \
@ -321,10 +322,10 @@ class Model(ap.Model):
'Product': di_supp_prod.code 'Product': di_supp_prod.code
}) })
]) ])
# print(f"proactive add {select_cand.code} to " print(f"proactive add {select_cand.name} to "
# f"{pro_firm.code} " f"{pro_firm.name} "
# f"for {di_supp_node['Firm_Code']} " f"for {di_supp_node['Firm_Code']} "
# f"{di_supp_node['Product_Code']}") f"{di_supp_node['Product_Code']}")
# change capacity # change capacity
select_cand.dct_prod_capacity[di_supp_prod] -= 1 select_cand.dct_prod_capacity[di_supp_prod] -= 1
break break

View File

@ -1,2 +1,2 @@
n_max_trial,prf_size,prf_conn,cap_limit_prob_type,cap_limit_level,diff_new_conn,crit_supplier,diff_disrupt,proactive_ratio,remove_t,netw_prf_n n_max_trial,prf_size,prf_conn,cap_limit_prob_type,cap_limit_level,diff_new_conn,crit_supplier,diff_disrupt,proactive_ratio,remove_t,netw_prf_n
10,TRUE,TRUE,uniform,10,0.1,1,0.01,0,5,2 10,TRUE,TRUE,uniform,10,0.1,1,0.01,1,5,2

1 n_max_trial prf_size prf_conn cap_limit_prob_type cap_limit_level diff_new_conn crit_supplier diff_disrupt proactive_ratio remove_t netw_prf_n
2 10 TRUE TRUE uniform 10 0.1 1 0.01 0 1 5 2