diff --git a/__pycache__/controller_db.cpython-38.pyc b/__pycache__/controller_db.cpython-38.pyc index 9a63791..7c1cb97 100644 Binary files a/__pycache__/controller_db.cpython-38.pyc and b/__pycache__/controller_db.cpython-38.pyc differ diff --git a/__pycache__/firm.cpython-38.pyc b/__pycache__/firm.cpython-38.pyc index 0463791..b909410 100644 Binary files a/__pycache__/firm.cpython-38.pyc and b/__pycache__/firm.cpython-38.pyc differ diff --git a/__pycache__/model.cpython-38.pyc b/__pycache__/model.cpython-38.pyc index 63a8eab..c6eb21f 100644 Binary files a/__pycache__/model.cpython-38.pyc and b/__pycache__/model.cpython-38.pyc differ diff --git a/controller_db.py b/controller_db.py index 550a28c..9aba433 100644 --- a/controller_db.py +++ b/controller_db.py @@ -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']}] diff --git a/model.py b/model.py index 1ffbb89..352e8d2 100644 --- a/model.py +++ b/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 = [] diff --git a/xv_without_exp.csv b/xv_without_exp.csv index 2f2b311..c53192d 100644 --- a/xv_without_exp.csv +++ b/xv_without_exp.csv @@ -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