set to removed only for disrupted firm
This commit is contained in:
parent
afc74765ad
commit
0965a5daa4
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -81,9 +81,9 @@ class ControllerDB:
|
|||
list_dct.append(dct)
|
||||
# list_dct = [{'140': ['1.4.5.1']}]
|
||||
# list_dct = [{'133': ['1.4.4.1']}]
|
||||
list_dct = [{'2': ['1.1.3']}]
|
||||
# list_dct = [{'2': ['1.1.3']}]
|
||||
# list_dct = [{'135': ['1.3.2.1']}]
|
||||
# list_dct = [{'79': ['2.1.3.4']}]
|
||||
list_dct = [{'79': ['2.1.3.4']}]
|
||||
# list_dct = [{'99': ['1.3.3']}]
|
||||
# list_dct = [{'41': ['1.4.5']}]
|
||||
|
||||
|
|
18
model.py
18
model.py
|
@ -349,10 +349,10 @@ class Model(ap.Model):
|
|||
firm.size_stat.append((size, self.t))
|
||||
print(f'in ts {self.t}, reduce {firm.name} size '
|
||||
f'to {firm.size_stat[-1][0]} due to {prod.code}')
|
||||
if self.t - ts + 1 == self.remove_t:
|
||||
# turn disrupted firm into removed firm
|
||||
firm.dct_prod_up_prod_stat[
|
||||
prod]['status'].append(('R', self.t))
|
||||
if self.t - ts + 1 == self.remove_t:
|
||||
# turn disrupted firm into removed firm
|
||||
firm.dct_prod_up_prod_stat[
|
||||
prod]['status'].append(('R', self.t))
|
||||
|
||||
# stop simulation if any firm still in disrupted except inital removal
|
||||
if self.t > 0:
|
||||
|
@ -422,6 +422,16 @@ class Model(ap.Model):
|
|||
def end(self):
|
||||
print('/' * 20, 'output', '/' * 20)
|
||||
|
||||
for firm in self.a_lst_total_firms:
|
||||
is_size = False
|
||||
for prod, dct_status_supply in firm.dct_prod_up_prod_stat.items():
|
||||
if len(dct_status_supply['status']) > 1:
|
||||
is_size = True
|
||||
print(f"{firm.name} {prod.code}:")
|
||||
print(dct_status_supply['status'])
|
||||
if is_size:
|
||||
print(firm.size_stat)
|
||||
|
||||
# qry_result = db_session.query(Result).filter_by(s_id=self.sample.id)
|
||||
# if qry_result.count() == 0:
|
||||
# lst_result_info = []
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
n_max_trial,prf_size,prf_conn,cap_limit_prob_type,cap_limit_level,diff_new_conn,crit_supplier,proactive_ratio,remove_t,netw_prf_n
|
||||
10,TRUE,TRUE,uniform,10,0.1,0.1,1,5,2
|
||||
10,TRUE,TRUE,uniform,10,0.5,0.1,1,5,2
|
||||
|
|
|
Loading…
Reference in New Issue