From 0965a5daa43b1035297e6aacd36c934df31a655e Mon Sep 17 00:00:00 2001 From: HaoYizhi Date: Sun, 2 Jul 2023 15:51:01 +0800 Subject: [PATCH] set to removed only for disrupted firm --- __pycache__/controller_db.cpython-38.pyc | Bin 7905 -> 7908 bytes __pycache__/firm.cpython-38.pyc | Bin 8626 -> 8626 bytes __pycache__/model.cpython-38.pyc | Bin 12035 -> 12254 bytes controller_db.py | 4 ++-- model.py | 18 ++++++++++++++---- xv_without_exp.csv | 2 +- 6 files changed, 17 insertions(+), 7 deletions(-) diff --git a/__pycache__/controller_db.cpython-38.pyc b/__pycache__/controller_db.cpython-38.pyc index 9a63791e09a21cf9473085097e1957a9ae90c559..7c1cb9727e6b758edf78cb826d2686189b6b25e2 100644 GIT binary patch delta 725 zcmZ{h%WD%+6vn-iN9&M>(>95=X|yWVx(LyVMIlhJAXGP13wAIa^0?CJOgrV=sR>FE zQK2ZJ_AadAEB*(Ph2YY?xNsqaZWINV{t4c1MyeZU@#CEDoO{kU_kJyZFYB|(q`pIa zmk+mbF6r@I9@#7S<*jhkys)o%gJAZrs|?AKn0iwjsSD=Z0ddHZ#fiE zv80hM4Rjf&VWa^Hh-Nxwy2aQf`FU53Rpbd{k=e3s42}k)dsItTvm108fl*s^9ZOWN zam%YM^13g`k>8BT)GDe>gkx7arM?f^K2K@pPT`Z~S8Fb(11kS#FUh{lId(_RXV#dI zTbUBOE0fuayKkbcg?aJ%f@jw`MWNi5t?X3)4TOQG_*L8WIZ;!7%1))$g8l|~xzZdt zlDoieb^P3bmWS`L7!9EzLR^G5Hj6py(#ZGAcYC%>fpi?53EJLI_nZS@3uQ8@^V05iaT;3@Dzp_>qX)wk$C&lJ0I79aop?|<$&_s);$@6*P7EM^?= zzK_Ls#s$N0#mO7tsmZCy%AjZLXu2L9;%aPn5_0blbI9u+05J)ioa#b;sGbK=MJxX6|{!3NPDqs zwIzk%+~b?s+M!#Jext}`%T|)8&!4lk_#Hprk+$?an@4kXad)tqOKXK0Z)ZGAM-b3S zI>D^xan1(6$^ULB$O=+XT8Bn&dI&rMaAW${mmXt@cI3ZDAFAwOTyG59j%qnA?*%sC zKI7eyUuXVXi6VLdBv2mmN8GD~yUFQ7Q*1I7s$(yah|p8`4ESxIK>6d@P}}^q@b)aG zaznP|C^`yv6gURdf#bjy@Z5tNb(E>B_Eo7CyPaT~SJ=c8(`)`z+&&Tfik`XLF&#Pu WA7i+~%Tld&=}Mn!@aA}{H2W6__NC?k diff --git a/__pycache__/firm.cpython-38.pyc b/__pycache__/firm.cpython-38.pyc index 046379154c324a6a17c03a9acc713e51f49d698a..b90941022575c608169dade22bc0e4c60ead138c 100644 GIT binary patch delta 19 Zcmdnwyvdm>l$V!_0SJ;5H*&2|1OPBJ1a$xa delta 19 Zcmdnwyvdm>l$V!_0SKljY~)&@2mmo#1f~E0 diff --git a/__pycache__/model.cpython-38.pyc b/__pycache__/model.cpython-38.pyc index 63a8eab1d3966360267348376da348c5520c1929..c6eb21f76734d74f28393a00e298003139915a7f 100644 GIT binary patch delta 3556 zcmZ`*TWlN06`k27mlP>Vq8^qg$&xJ5dcQ2owqnbP1g*+a=%DH6F{ z`Gwig30-jMR0fd^TA)b{@}vDM+6pP!|K_(qfg(UvzzEQv7U)OYpBDXSd+v~t>?W45 zmos-}?wxb)oja3z>v5v)^++Vd@b}3`S^R$S=XFPU_9_&Tnat#pCAc7|*}BsBa@6w+ zj3*2w14;(fXbrTX>ddg3S!+ksNS*4{+YPE0RlR6+W~1sgR(nmkEV*d5TT1)v)>4~V z5G(UCceveN>X1zGvPSOh&eDFNL9aS= zSu%YCONU)117%>?MO!0lp2P7VR@r`OtjtJfj*Ey0 zW1DqbIyefM6QW+!iiYgR+LLNgze{aM)X%aC9w#irz!Nh2s%UDdT}2am0!^&~qot<_ zj10?K1*WAm=z_sHz+8A(2qO#;V#5t%liAuBQQuaG%7{HFdFhZFE%O{dhDk*&E$vBr zN=982u%}d+#qQj%HkvDQCTPJMYC)WEn7Y(y59JtR_xo-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3wpB`*$dP`+5I*jjb3}W8+`;cf^pJGOxVP zM8*x$^TR-iKjhdy?_yqwVa%+4ahU8Z;uC?l@R}Hb^t-q*TE9s*kYA(lXRO~h{5%Nv z6vrA-Ms{n~Xoy}E{Cm)h$ljXf^x2aoRtecJ$UaI%3Ge6p3#bEqGy0tYc>pg`pc=BO zbi>TZe)ZvTi@i?WmEENJ3#n$<(Dh6<0cs`gPggb5WYhmgYYMsS!+ z_V?}MBq?$GrTPv=n_Fo}w22OHF4A2*@{Ld^#T3+FnpJ3GqITsZ>>q91xZ3Cp8aG3j zvhC)}bVK&aK{2tZV_0R-2gAhkC*&ZF^7&s^(D!83#YeKDOIB2s*I{>kPTEL);(Z6;h&Tv_)L#ukGC4%4SL>?!D$!*L=chB28_OnJlyKLvI*{w6_RfEU3e%14~#?7sh2bQ__sQ+d*Y1yzh+kSgB zw~)`?$}O&0Ib{o0bL-Xv2(34W6p7@C+$54Ca-YaOB9lZWh`a`}9iWghhV{^UFfhe0 zdLIv5+WKPPKfFyTt83)8Vcv@mj`TZpo}QK2I>8u z!7|$4S?_{~xB_U&a6c 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