From d86e16e3a31365480aaaad4c50c0c5a502d644ad Mon Sep 17 00:00:00 2001 From: AgentLabCn <130165633+AgentLabCn@users.noreply.github.com> Date: Mon, 1 Dec 2025 18:51:07 +0800 Subject: [PATCH] =?UTF-8?q?error=E4=B8=8D=E4=B8=80=E6=A0=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data/2025/ProductionLine.csv | 224 +++++++++++++++--------------- data/2025/factory_data - 鍓湰.csv | 28 ++++ data/2025/factory_data.csv | 54 +++---- data/2025/model_params.json | 1 + data/2026/model_params.json | 1 + simulation_model.py | 183 ++++++++++++++---------- 6 files changed, 278 insertions(+), 213 deletions(-) create mode 100644 data/2025/factory_data - 鍓湰.csv diff --git a/data/2025/ProductionLine.csv b/data/2025/ProductionLine.csv index 05b9eee..2852312 100644 --- a/data/2025/ProductionLine.csv +++ b/data/2025/ProductionLine.csv @@ -1,113 +1,113 @@ 区域名,工厂名,是否新工厂,产线ID,生产型号,开始月份,结束月份,磨合系数,系数最小值,系数最大值 -西北东部,艾郎玉门,是,艾郎玉门1,GWBD-A2,1,12,1.07380061238005,0.5,3 -西北东部,艾郎玉门,是,艾郎玉门2,GWBD-A2,1,12,1.3086756673917384,0.5,3 -华北,艾郎张北,是,艾郎张北1,GWBD-A2,1,12,1.0005776141701213,0.5,3 -华北,艾郎张北,是,艾郎张北2,GWBD-A2,1,12,1.2558624416001731,0.5,3 -西北西部,时代巴里坤,是,时代巴里坤1,GWBD-A2,2,12,2.877701634836078,0.5,3 -西北西部,时代巴里坤,是,时代巴里坤2,GWBD-A2,2,12,2.148476381702223,0.5,3 -西北西部,时代巴里坤,是,时代巴里坤3,GW99A,1,4,2.8216375801071467,0.5,3 -西北西部,时代巴里坤,是,时代巴里坤4,GW99A,1,9,3.0,0.5,3 -华南,时代百色,是,时代百色1,GWBD-A3,2,12,1.2209565088767191,0.5,3 -华南,时代百色,是,时代百色2,GWBD-A3,2,12,2.13505523373714,0.5,3 -华东南北部,时代射阳,是,时代射阳1,GW130,6,12,2.977100640862942,0.5,3 -华东南北部,时代射阳,是,时代射阳2,GW130,8,12,1.4108697454394656,0.5,3 -东北,时代松原,是,时代松原1,GWBD-A3,4,12,1.085052120762868,0.5,3 -东北,时代松原,是,时代松原2,GWBD-A3,4,12,1.4804124608992453,0.5,3 -华东南南部,时代株洲,是,时代株洲1,GW99A,2,12,0.8320501509514534,0.5,3 -华东南南部,时代株洲,是,时代株洲2,GW99A,2,12,1.4984461065581405,0.5,3 -华东南北部,双瑞大丰,是,双瑞大丰1,GW110.5,2,11,0.6454103640653669,0.5,3 -华东南北部,双瑞大丰,是,双瑞大丰2,GW110.5,2,11,0.6530684517974175,0.5,3 -华东南北部,双瑞大丰,否,双瑞大丰3,GW93,1,1,2.085029344273428,0.5,3 -华东南北部,双瑞东营,是,双瑞东营1,GWBD-A2,6,12,2.925213291566798,0.5,3 -华东南北部,双瑞东营,是,双瑞东营2,GWBD-A2,6,12,2.975043017037072,0.5,3 -华东南北部,双瑞东营,是,双瑞东营3,GWBD-A2,7,12,2.9397351966791594,0.5,3 -华东南北部,双瑞东营,是,双瑞东营4,GWBD-A2,7,12,2.616967714504933,0.5,3 -华东南北部,天顺濮阳,否,天顺濮阳1,GW99A,8,12,2.790744177175357,0.5,3 -华东南北部,天顺濮阳,否,天顺濮阳2,GW99A,8,12,0.6411549575195108,0.5,3 -华东南北部,天顺沙洋,否,天顺沙洋1,GW93,2,2,0.8340035880432236,0.5,3 -华东南北部,天顺沙洋,是,天顺沙洋2,GW93,5,5,1.1301574312833809,0.5,3 -华东南北部,天顺沙洋,否,天顺沙洋3,GW93,11,11,2.025384406078239,0.5,3 -华东南北部,天顺沙洋,否,天顺沙洋4,GW99,10,11,1.0429815540113208,0.5,3 -华东南北部,天顺沙洋,否,天顺沙洋5,GW99A,5,12,1.123628778712014,0.5,3 -华东南北部,天顺沙洋,否,天顺沙洋6,GW99A,5,12,0.979164298651741,0.5,3 -东北,中材白城,否,中材白城1,GWBD-A3,8,8,1.763581199916676,0.5,3 -华东南北部,中材阜宁,否,中材阜宁1,GW110.5,1,11,2.959144662478874,0.5,3 -华东南北部,中材阜宁,否,中材阜宁2,GW110.5,1,11,2.92540109166913,0.5,3 -华东南北部,中材阜宁,否,中材阜宁3,GW110.5,1,11,1.1010708194893164,0.5,3 -华东南北部,中材阜宁,否,中材阜宁4,GW83.4,1,11,2.694547075119285,0.5,3 -华东南北部,中材阜宁,否,中材阜宁5,GW93,6,8,2.3745893939183,0.5,3 -华东南北部,中材阜宁,否,中材阜宁6,GW99A,1,7,1.8223796976955784,0.5,3 -华东南北部,中材阜宁,否,中材阜宁7,GW99A,1,7,2.468575784243612,0.5,3 -华东南北部,中材阜宁,否,中材阜宁8,SI90.2,1,12,0.7272902159645727,0.5,3 -华东南北部,中材阜宁,否,中材阜宁9,SI90.2,1,12,2.181467973934617,0.5,3 -华东南北部,中材阜宁,是,中材阜宁10,SI90.2,1,12,1.5244257562540415,0.5,3 -华东南北部,中材阜宁,是,中材阜宁11,SI90.2,1,12,1.4259873327753854,0.5,3 -华东南北部,中材阜宁,是,中材阜宁12,SI90.2,2,12,1.253548054276315,0.5,3 -华东南北部,中材阜宁,是,中材阜宁13,SI90.2,2,12,0.6644941460935946,0.5,3 -西北西部,中材哈密,否,中材哈密1,GWBD-A3,7,11,2.3686587068604954,0.5,3 -西北西部,中材哈密,否,中材哈密2,GWBD-A3,7,11,1.1015355190681149,0.5,3 -华北,中材邯郸,否,中材邯郸1,GW99A,1,12,1.925686336774216,0.5,3 -华北,中材邯郸,否,中材邯郸2,GW99A,1,12,1.166441845882635,0.5,3 -华北,中材邯郸,是,中材邯郸3,GWBD-A2,2,12,2.1539372175131355,0.5,3 -华北,中材邯郸,是,中材邯郸4,GWBD-A2,3,12,0.6366978576009893,0.5,3 -西北东部,中材酒泉,否,中材酒泉1,GW99,1,12,1.1568681400683591,0.5,3 -西北东部,中材酒泉,否,中材酒泉2,GW99,1,12,1.1064271136987875,0.5,3 -西北东部,中材酒泉,否,中材酒泉3,GWBD-A2,1,12,0.9954163068389692,0.5,3 -西北东部,中材酒泉,是,中材酒泉4,GWBD-A2,1,12,1.2193407437521984,0.5,3 -西北东部,中材酒泉,是,中材酒泉5,GWBD-A2,2,12,0.959238907870878,0.5,3 -西北东部,中材酒泉,是,中材酒泉6,GWBD-A2,3,12,1.218588133158403,0.5,3 -西北东部,中材酒泉,否,中材酒泉7,SI90.2,1,1,1.2323208798346863,0.5,3 -西北东部,中材酒泉,否,中材酒泉8,SI90.2,1,4,1.1083005779929354,0.5,3 -西北东部,中材酒泉,否,中材酒泉9,SI90.2,3,4,1.0979168774354644,0.5,3 -西北东部,中材酒泉,否,中材酒泉10,SI90.2,9,9,0.6134714785903335,0.5,3 -西北东部,中材酒泉,否,中材酒泉11,SI90.2,4,12,0.9060377208252096,0.5,3 -西北东部,中材酒泉,否,中材酒泉12,SI90.2,4,12,0.8588420476065148,0.5,3 -华东南北部,中材连云港,否,中材连云港1,GW93,1,4,0.6959224018718012,0.5,3 -华东南北部,中材连云港,否,中材连云港2,GW93,1,12,2.388840113565708,0.5,3 -华东南北部,中材连云港,否,中材连云港3,GW93,1,12,2.023924901276327,0.5,3 -华东南南部,中材萍乡,否,中材萍乡1,GW83.4,1,3,2.7904582895129884,0.5,3 -华东南南部,中材萍乡,否,中材萍乡2,GW93,1,10,1.6925578180285972,0.5,3 -华东南南部,中材萍乡,否,中材萍乡3,GW93,1,10,0.8982597799795793,0.5,3 -华东南南部,中材萍乡,否,中材萍乡4,GWBD-A3,1,12,1.3711168227538089,0.5,3 -华东南南部,中材萍乡,否,中材萍乡5,GWBD-A3,1,12,1.219691503974376,0.5,3 -东北,中材锡林,否,中材锡林1,GW99,1,12,2.9557253831441828,0.5,3 -东北,中材锡林,否,中材锡林2,GW99,1,12,2.462362813243516,0.5,3 -东北,中材锡林,是,中材锡林3,GWBD-A2,1,12,0.5982166642652442,0.5,3 -东北,中材锡林,是,中材锡林4,GWBD-A2,1,12,2.644080826558284,0.5,3 -东北,中材锡林,是,中材锡林5,GWBD-A2,2,12,0.5145312169222124,0.5,3 -东北,中材锡林,否,中材锡林6,SI90.2,1,1,0.9769481674143102,0.5,3 -东北,中材锡林,否,中材锡林7,SI90.2,1,1,1.238170985113167,0.5,3 -东北,中材兴安盟,否,中材兴安盟1,GW93,1,9,1.0683346058426026,0.5,3 -东北,中材兴安盟,否,中材兴安盟2,GW93,1,9,0.942117080768859,0.5,3 -华南,中材阳江,是,中材阳江1,GW130,1,12,1.633431132348781,0.5,3 -华南,中材阳江,是,中材阳江2,GW130,11,12,1.081038974714554,0.5,3 -华南,中材阳江,否,中材阳江3,SI122,1,12,2.975783026146584,0.5,3 -华南,中材阳江,否,中材阳江4,SI122,1,12,1.6018405358345469,0.5,3 -西北西部,中材伊吾,否,中材伊吾1,GWBD-A2,1,12,2.1810444878994515,0.5,3 -西北西部,中材伊吾,否,中材伊吾2,GWBD-A2,1,12,1.613919507763036,0.5,3 -西北西部,中材伊吾,是,中材伊吾3,GWBD-A3,7,9,0.5,0.5,3 -华南,中材玉溪,否,中材玉溪1,GW93,3,3,1.890269922258364,0.5,3 -西北西部,重通昌吉,否,重通昌吉1,GW99,11,11,0.5574628792523443,0.5,3 -西北西部,重通昌吉,是,重通昌吉2,GW99A,1,10,2.1349045617509983,0.5,3 -西北西部,重通昌吉,否,重通昌吉3,GWBD-A2,1,12,2.3607990485978285,0.5,3 -西北西部,重通昌吉,否,重通昌吉4,GWBD-A2,1,12,0.5733216621135748,0.5,3 -西北西部,重通昌吉,是,重通昌吉5,GWBD-A2,1,12,1.6300547095229956,0.5,3 -东北,重通大安,是,重通大安1,GWBD-A2,1,12,2.9190166685770587,0.5,3 -东北,重通大安,是,重通大安2,GWBD-A2,2,12,0.8731389130785212,0.5,3 -华东南北部,重通如东,否,重通如东1,GW110.5,6,10,1.6258348677031254,0.5,3 -华东南北部,重通如东,否,重通如东2,GW110.5,6,10,1.376510869994889,0.5,3 -华东南北部,重通如东,否,重通如东3,GW76,1,6,1.221180288569112,0.5,3 -华东南北部,重通如东,否,重通如东4,GW76,11,12,0.9304707434434764,0.5,3 -华东南北部,重通如东,否,重通如东5,GW76,11,12,1.0654063065239228,0.5,3 -华东南北部,重通如东,否,重通如东6,GW81,1,12,1.1315290493015806,0.5,3 -华东南北部,重通如东,否,重通如东7,GW81,1,12,1.1404930117692385,0.5,3 -华东南北部,重通如东,否,重通如东8,GW81,1,12,1.3014091708393016,0.5,3 -华东南北部,重通如东,是,重通如东9,GW86,10,12,0.5738779043252348,0.5,3 -华东南北部,重通如东,是,重通如东10,GWBD-D,4,10,0.9593048041664796,0.5,3 -华东南北部,重通如东,是,重通如东11,GW83.3,7,9,2.1135988495299616,0.5,3 -西北东部,重通武威,否,重通武威1,GW83.4,1,1,1.0090685780114246,0.5,3 -西北东部,重通武威,否,重通武威2,GW99A,1,1,0.9928464185174258,0.5,3 -西北东部,重通武威,否,重通武威3,GWBD-A2,1,12,0.7701006517043388,0.5,3 -西北东部,重通武威,否,重通武威4,GWBD-A2,1,12,2.1830368275462857,0.5,3 -西北东部,重通武威,是,重通武威5,GWBD-A3,2,12,0.6427854133739357,0.5,3 -西北东部,重通武威,是,重通武威6,GWBD-A3,2,12,0.7212222730295578,0.5,3 +西北东部,艾郎玉门,是,艾郎玉门1,GWBD-A2,1,12,0.8032053657286623,0.5,3 +西北东部,艾郎玉门,是,艾郎玉门2,GWBD-A2,1,12,2.242946843455525,0.5,3 +华北,艾郎张北,是,艾郎张北1,GWBD-A2,1,12,1.0739881298814442,0.5,3 +华北,艾郎张北,是,艾郎张北2,GWBD-A2,1,12,0.9913016076339164,0.5,3 +西北西部,时代巴里坤,是,时代巴里坤1,GWBD-A2,2,12,3.0,0.5,3 +西北西部,时代巴里坤,是,时代巴里坤2,GWBD-A2,2,12,2.311832265915291,0.5,3 +西北西部,时代巴里坤,是,时代巴里坤3,GW99A,1,4,2.9868087839892805,0.5,3 +西北西部,时代巴里坤,是,时代巴里坤4,GW99A,1,9,2.0715004199346243,0.5,3 +华南,时代百色,是,时代百色1,GWBD-A3,2,12,0.9813943031647696,0.5,3 +华南,时代百色,是,时代百色2,GWBD-A3,2,12,2.4817092745783658,0.5,3 +华东南北部,时代射阳,是,时代射阳1,GW130,6,12,2.958234128852966,0.5,3 +华东南北部,时代射阳,是,时代射阳2,GW130,8,12,0.9790769771894252,0.5,3 +东北,时代松原,是,时代松原1,GWBD-A3,4,12,2.359322651601647,0.5,3 +东北,时代松原,是,时代松原2,GWBD-A3,4,12,0.970824759034235,0.5,3 +华东南南部,时代株洲,是,时代株洲1,GW99A,2,12,1.06880969505422,0.5,3 +华东南南部,时代株洲,是,时代株洲2,GW99A,2,12,1.0574518379243223,0.5,3 +华东南北部,双瑞大丰,是,双瑞大丰1,GW110.5,2,11,0.6498736198951686,0.5,3 +华东南北部,双瑞大丰,是,双瑞大丰2,GW110.5,2,11,0.6602103773366866,0.5,3 +华东南北部,双瑞大丰,否,双瑞大丰3,GW93,1,1,1.7074438854550105,0.5,3 +华东南北部,双瑞东营,是,双瑞东营1,GWBD-A2,6,12,2.658522392353532,0.5,3 +华东南北部,双瑞东营,是,双瑞东营2,GWBD-A2,6,12,1.6326535653359566,0.5,3 +华东南北部,双瑞东营,是,双瑞东营3,GWBD-A2,7,12,2.7884634092284912,0.5,3 +华东南北部,双瑞东营,是,双瑞东营4,GWBD-A2,7,12,1.4990532841241448,0.5,3 +华东南北部,天顺濮阳,否,天顺濮阳1,GW99A,8,12,1.0494581838329766,0.5,3 +华东南北部,天顺濮阳,否,天顺濮阳2,GW99A,8,12,1.0687053812272254,0.5,3 +华东南北部,天顺沙洋,否,天顺沙洋1,GW93,2,2,1.0145139485188388,0.5,3 +华东南北部,天顺沙洋,是,天顺沙洋2,GW93,5,5,0.9187771973071808,0.5,3 +华东南北部,天顺沙洋,否,天顺沙洋3,GW93,11,11,1.0227677050731363,0.5,3 +华东南北部,天顺沙洋,否,天顺沙洋4,GW99,10,11,1.0906123896403612,0.5,3 +华东南北部,天顺沙洋,否,天顺沙洋5,GW99A,5,12,1.0000157318056455,0.5,3 +华东南北部,天顺沙洋,否,天顺沙洋6,GW99A,5,12,1.0792176556312845,0.5,3 +东北,中材白城,否,中材白城1,GWBD-A3,8,8,1.84178390427543,0.5,3 +华东南北部,中材阜宁,否,中材阜宁1,GW110.5,1,11,1.912016897604764,0.5,3 +华东南北部,中材阜宁,否,中材阜宁2,GW110.5,1,11,0.8370206795410767,0.5,3 +华东南北部,中材阜宁,否,中材阜宁3,GW110.5,1,11,1.1182849464210354,0.5,3 +华东南北部,中材阜宁,否,中材阜宁4,GW83.4,1,11,1.4119792797149264,0.5,3 +华东南北部,中材阜宁,否,中材阜宁5,GW93,6,8,1.2755620923409356,0.5,3 +华东南北部,中材阜宁,否,中材阜宁6,GW99A,1,7,1.4570004301708643,0.5,3 +华东南北部,中材阜宁,否,中材阜宁7,GW99A,1,7,2.2014135700869284,0.5,3 +华东南北部,中材阜宁,否,中材阜宁8,SI90.2,1,12,2.1614685169948693,0.5,3 +华东南北部,中材阜宁,否,中材阜宁9,SI90.2,1,12,1.275196649549683,0.5,3 +华东南北部,中材阜宁,是,中材阜宁10,SI90.2,1,12,1.5271673397917631,0.5,3 +华东南北部,中材阜宁,是,中材阜宁11,SI90.2,1,12,0.7423712157410889,0.5,3 +华东南北部,中材阜宁,是,中材阜宁12,SI90.2,2,12,1.2646324802629867,0.5,3 +华东南北部,中材阜宁,是,中材阜宁13,SI90.2,2,12,0.9554400175665158,0.5,3 +西北西部,中材哈密,否,中材哈密1,GWBD-A3,7,11,0.998747932696368,0.5,3 +西北西部,中材哈密,否,中材哈密2,GWBD-A3,7,11,2.9767751702801672,0.5,3 +华北,中材邯郸,否,中材邯郸1,GW99A,1,12,1.4830831491291596,0.5,3 +华北,中材邯郸,否,中材邯郸2,GW99A,1,12,1.0888969811545297,0.5,3 +华北,中材邯郸,是,中材邯郸3,GWBD-A2,2,12,1.5023258418752827,0.5,3 +华北,中材邯郸,是,中材邯郸4,GWBD-A2,3,12,1.102775747560624,0.5,3 +西北东部,中材酒泉,否,中材酒泉1,GW99,1,12,0.5622969570539172,0.5,3 +西北东部,中材酒泉,否,中材酒泉2,GW99,1,12,1.150024482747415,0.5,3 +西北东部,中材酒泉,否,中材酒泉3,GWBD-A2,1,12,1.5459022834883542,0.5,3 +西北东部,中材酒泉,是,中材酒泉4,GWBD-A2,1,12,2.9639734937057667,0.5,3 +西北东部,中材酒泉,是,中材酒泉5,GWBD-A2,2,12,2.212176654543076,0.5,3 +西北东部,中材酒泉,是,中材酒泉6,GWBD-A2,3,12,1.0356930471233745,0.5,3 +西北东部,中材酒泉,否,中材酒泉7,SI90.2,1,1,2.4273446212774297,0.5,3 +西北东部,中材酒泉,否,中材酒泉8,SI90.2,1,4,1.0649603727762178,0.5,3 +西北东部,中材酒泉,否,中材酒泉9,SI90.2,3,4,0.6376416250041546,0.5,3 +西北东部,中材酒泉,否,中材酒泉10,SI90.2,9,9,2.0072777075728943,0.5,3 +西北东部,中材酒泉,否,中材酒泉11,SI90.2,4,12,1.3664189491081575,0.5,3 +西北东部,中材酒泉,否,中材酒泉12,SI90.2,4,12,2.7585455100963725,0.5,3 +华东南北部,中材连云港,否,中材连云港1,GW93,1,4,0.6380193777126062,0.5,3 +华东南北部,中材连云港,否,中材连云港2,GW93,1,12,2.4506758131580946,0.5,3 +华东南北部,中材连云港,否,中材连云港3,GW93,1,12,2.669431356239481,0.5,3 +华东南南部,中材萍乡,否,中材萍乡1,GW83.4,1,3,1.9110812265524788,0.5,3 +华东南南部,中材萍乡,否,中材萍乡2,GW93,1,10,2.6507295870466416,0.5,3 +华东南南部,中材萍乡,否,中材萍乡3,GW93,1,10,1.687082980580373,0.5,3 +华东南南部,中材萍乡,否,中材萍乡4,GWBD-A3,1,12,0.6783033734311962,0.5,3 +华东南南部,中材萍乡,否,中材萍乡5,GWBD-A3,1,12,1.3047442992624676,0.5,3 +东北,中材锡林,否,中材锡林1,GW99,1,12,1.0622480731614574,0.5,3 +东北,中材锡林,否,中材锡林2,GW99,1,12,0.9848399267309024,0.5,3 +东北,中材锡林,是,中材锡林3,GWBD-A2,1,12,2.254156012076419,0.5,3 +东北,中材锡林,是,中材锡林4,GWBD-A2,1,12,1.7254468138843502,0.5,3 +东北,中材锡林,是,中材锡林5,GWBD-A2,2,12,0.5705179617507162,0.5,3 +东北,中材锡林,否,中材锡林6,SI90.2,1,1,0.8214144687810874,0.5,3 +东北,中材锡林,否,中材锡林7,SI90.2,1,1,2.545528482349731,0.5,3 +东北,中材兴安盟,否,中材兴安盟1,GW93,1,9,1.0695212200904811,0.5,3 +东北,中材兴安盟,否,中材兴安盟2,GW93,1,9,1.0912804475566316,0.5,3 +华南,中材阳江,是,中材阳江1,GW130,1,12,1.814520488259726,0.5,3 +华南,中材阳江,是,中材阳江2,GW130,11,12,2.838458381081099,0.5,3 +华南,中材阳江,否,中材阳江3,SI122,1,12,2.830586835154425,0.5,3 +华南,中材阳江,否,中材阳江4,SI122,1,12,1.3363257879855754,0.5,3 +西北西部,中材伊吾,否,中材伊吾1,GWBD-A2,1,12,2.4869571005924014,0.5,3 +西北西部,中材伊吾,否,中材伊吾2,GWBD-A2,1,12,2.4698950834768234,0.5,3 +西北西部,中材伊吾,是,中材伊吾3,GWBD-A3,7,9,2.927579772268298,0.5,3 +华南,中材玉溪,否,中材玉溪1,GW93,3,3,1.7651093767774086,0.5,3 +西北西部,重通昌吉,否,重通昌吉1,GW99,11,11,0.7831592691610867,0.5,3 +西北西部,重通昌吉,是,重通昌吉2,GW99A,1,10,1.540926708239259,0.5,3 +西北西部,重通昌吉,否,重通昌吉3,GWBD-A2,1,12,1.931780035552089,0.5,3 +西北西部,重通昌吉,否,重通昌吉4,GWBD-A2,1,12,1.0164084233944286,0.5,3 +西北西部,重通昌吉,是,重通昌吉5,GWBD-A2,1,12,0.840555078914054,0.5,3 +东北,重通大安,是,重通大安1,GWBD-A2,1,12,2.087343566138866,0.5,3 +东北,重通大安,是,重通大安2,GWBD-A2,2,12,1.0704526164218118,0.5,3 +华东南北部,重通如东,否,重通如东1,GW110.5,6,10,1.3241403875683502,0.5,3 +华东南北部,重通如东,否,重通如东2,GW110.5,6,10,1.0779044534267077,0.5,3 +华东南北部,重通如东,否,重通如东3,GW76,1,6,1.2634384670468408,0.5,3 +华东南北部,重通如东,否,重通如东4,GW76,11,12,1.086720532076798,0.5,3 +华东南北部,重通如东,否,重通如东5,GW76,11,12,0.9580780681635088,0.5,3 +华东南北部,重通如东,否,重通如东6,GW81,1,12,1.4244065199658889,0.5,3 +华东南北部,重通如东,否,重通如东7,GW81,1,12,1.1125186832972436,0.5,3 +华东南北部,重通如东,否,重通如东8,GW81,1,12,1.0880193045165334,0.5,3 +华东南北部,重通如东,是,重通如东9,GW86,10,12,1.0228512727112231,0.5,3 +华东南北部,重通如东,是,重通如东10,GWBD-D,4,10,1.0275145272690325,0.5,3 +华东南北部,重通如东,是,重通如东11,GW83.3,7,9,2.7419468504868334,0.5,3 +西北东部,重通武威,否,重通武威1,GW83.4,1,1,1.796533172065262,0.5,3 +西北东部,重通武威,否,重通武威2,GW99A,1,1,1.0773042029829227,0.5,3 +西北东部,重通武威,否,重通武威3,GWBD-A2,1,12,0.8633209522768549,0.5,3 +西北东部,重通武威,否,重通武威4,GWBD-A2,1,12,0.8421534665300137,0.5,3 +西北东部,重通武威,是,重通武威5,GWBD-A3,2,12,0.9182717456417385,0.5,3 +西北东部,重通武威,是,重通武威6,GWBD-A3,2,12,0.9284823666140081,0.5,3 diff --git a/data/2025/factory_data - 鍓湰.csv b/data/2025/factory_data - 鍓湰.csv new file mode 100644 index 0000000..4b54fee --- /dev/null +++ b/data/2025/factory_data - 鍓湰.csv @@ -0,0 +1,28 @@ +工厂中文名,工厂英文名,工厂平均磨合系数,最小误差 +艾郎玉门,AilangYumen,1.5230761045920935,0.3881128436694239 +艾郎张北,AilangZhangbei,1.0326448687576804,0.3875473927222936 +时代巴里坤,ShidaiBalikun,2.592535367459799,0.3447525809589239 +时代百色,ShidaiBaise,1.7315517888715677,0.3810874444018801 +时代射阳,ShidaiSheyang,1.9686555530211955,0.3907170103360906 +时代松原,ShidaiSongyuan,1.665073705317941,0.3762141500549016 +时代株洲,ShidaiZhuzhou,1.063130766489271,0.3441028083793268 +双瑞大丰,ShuangruiDafeng,1.0058426275622885,0.2548982526287585 +双瑞东营,ShuangruiDongying,2.144673162760532,0.2654149421577937 +天顺濮阳,TianshunPuyang,1.059081782530101,0.3420826063591247 +天顺沙洋,TianshunShayang,1.0209841046627413,0.3431195242102018 +中材白城,ZhongcaiBaicheng,1.84178390427543,0.3040622851529628 +中材阜宁,ZhongcaiFuning,1.3953503165990335,0.2224680588438837 +中材哈密,ZhongcaiHami,1.987761551488268,0.2359049003020729 +中材邯郸,ZhongcaiHandan,1.294270429929899,0.2269262246567306 +中材酒泉,ZhongcaiJiuquan,1.6443546420414277,0.2408385393820534 +中材连云港,ZhongcaiLianyungang,1.919375515703394,0.1895613222334434 +中材萍乡,ZhongcaiPingxiang,1.6463882933746317,0.2156093482814695 +中材锡林,ZhongcaiXilin,1.4234502483906664,0.186874092416876 +中材兴安盟,ZhongcaiXinganmeng,1.0804008338235565,0.1888690411673305 +中材阳江,ZhongcaiYangjiang,2.204972873120206,0.1585609701706 +中材伊吾,ZhongcaiYiwu,2.6281439854458406,0.1592597821901667 +中材玉溪,ZhongcaiYuxi,1.7651093767774086,0.1215239331335629 +重通昌吉,ChongtongChangji,1.2225659030521836,0.1187457988190405 +重通大安,ChongtongDaan,1.578898091280339,0.1099638209648977 +重通如东,ChongtongRudong,1.2843217333208146,0.10536445035245522 +重通武威,ChongtongWuwei,1.0,10000.0 diff --git a/data/2025/factory_data.csv b/data/2025/factory_data.csv index bc25beb..89bab4c 100644 --- a/data/2025/factory_data.csv +++ b/data/2025/factory_data.csv @@ -1,28 +1,28 @@ 工厂中文名,工厂英文名,工厂平均磨合系数,最小误差 -艾郎玉门,AilangYumen,1.1912381398858942,0.0383592943400758 -艾郎张北,AilangZhangbei,1.1282200278851473,0.0383834069943968 -时代巴里坤,ShidaiBalikun,2.711953899161362,0.0372831200518159 -时代百色,ShidaiBaise,1.6780058713069297,0.0383834069943968 -时代射阳,ShidaiSheyang,2.193985193151204,0.0381459900903132 -时代松原,ShidaiSongyuan,1.2827322908310568,0.0352284680862539 -时代株洲,ShidaiZhuzhou,1.1652481287547969,0.0351743203712874 -双瑞大丰,ShuangruiDafeng,1.1278360533787375,0.0345299766068848 -双瑞东营,ShuangruiDongying,2.8642398049469904,0.0345680805544538 -天顺濮阳,TianshunPuyang,1.715949567347434,0.0345299766068848 -天顺沙洋,TianshunShayang,1.1892200094633198,0.0350377531255757 -中材白城,ZhongcaiBaicheng,1.763581199916676,0.0352284680862539 -中材阜宁,ZhongcaiFuning,1.855609384916356,0.0344731713353556 -中材哈密,ZhongcaiHami,1.7350971129643051,0.0344731713353556 -中材邯郸,ZhongcaiHandan,1.4706908144427435,0.03437964346405 -中材酒泉,ZhongcaiJiuquan,1.0393974106393948,0.0335524068644557 -中材连云港,ZhongcaiLianyungang,1.7028958055712788,0.034108309859383 -中材萍乡,ZhongcaiPingxiang,1.59441684284987,0.0334380950217488 -中材锡林,ZhongcaiXilin,1.6271480080944165,0.0313354095754113 -中材兴安盟,ZhongcaiXinganmeng,1.0052258433057308,0.0334092499773274 -中材阳江,ZhongcaiYangjiang,1.8230234172611164,0.0302713991840371 -中材伊吾,ZhongcaiYiwu,1.4316546652208293,0.0332345469724357 -中材玉溪,ZhongcaiYuxi,1.890269922258364,0.0302713991840371 -重通昌吉,ChongtongChangji,1.4513085722475485,0.0303973755004896 -重通大安,ChongtongDaan,1.89607779082779,0.0301428254177608 -重通如东,ChongtongRudong,1.2217832605605747,0.0383834069943968 -重通武威,ChongtongWuwei,1.0531766936971614,0.028380612159397973 +艾郎玉门,AilangYumen,1.5230761045920935,0.3881128436694239 +艾郎张北,AilangZhangbei,1.0326448687576804,0.3875473927222936 +时代巴里坤,ShidaiBalikun,2.592535367459799,0.3447525809589239 +时代百色,ShidaiBaise,1.7315517888715677,0.3810874444018801 +时代射阳,ShidaiSheyang,1.9686555530211955,0.3907170103360906 +时代松原,ShidaiSongyuan,1.665073705317941,0.3762141500549016 +时代株洲,ShidaiZhuzhou,1.063130766489271,0.3441028083793268 +双瑞大丰,ShuangruiDafeng,1.0058426275622885,0.2548982526287585 +双瑞东营,ShuangruiDongying,2.144673162760532,0.2654149421577937 +天顺濮阳,TianshunPuyang,1.059081782530101,0.3420826063591247 +天顺沙洋,TianshunShayang,1.0209841046627413,0.3431195242102018 +中材白城,ZhongcaiBaicheng,1.84178390427543,0.3040622851529628 +中材阜宁,ZhongcaiFuning,1.3953503165990335,0.2224680588438837 +中材哈密,ZhongcaiHami,1.987761551488268,0.2359049003020729 +中材邯郸,ZhongcaiHandan,1.294270429929899,0.2269262246567306 +中材酒泉,ZhongcaiJiuquan,1.6443546420414277,0.2408385393820534 +中材连云港,ZhongcaiLianyungang,1.919375515703394,0.1895613222334434 +中材萍乡,ZhongcaiPingxiang,1.6463882933746317,0.2156093482814695 +中材锡林,ZhongcaiXilin,1.4234502483906664,0.186874092416876 +中材兴安盟,ZhongcaiXinganmeng,1.0804008338235565,0.1888690411673305 +中材阳江,ZhongcaiYangjiang,2.204972873120206,0.1585609701706 +中材伊吾,ZhongcaiYiwu,2.6281439854458406,0.1592597821901667 +中材玉溪,ZhongcaiYuxi,1.7651093767774086,0.1215239331335629 +重通昌吉,ChongtongChangji,1.2225659030521836,0.1187457988190405 +重通大安,ChongtongDaan,1.578898091280339,0.1099638209648977 +重通如东,ChongtongRudong,1.2843217333208146,0.1053644503524552 +重通武威,ChongtongWuwei,1.0710109843518,0.10157518253678476 diff --git a/data/2025/model_params.json b/data/2025/model_params.json index 60d122b..8ccb913 100644 --- a/data/2025/model_params.json +++ b/data/2025/model_params.json @@ -11,6 +11,7 @@ "holiday_days_10": 7, "holiday_days_11": 2, "holiday_days_12": 2, + "is_error_max": true, "product_set": [ "GWBD-A2", "GWBD-A3", diff --git a/data/2026/model_params.json b/data/2026/model_params.json index 746b753..6ef2737 100644 --- a/data/2026/model_params.json +++ b/data/2026/model_params.json @@ -11,6 +11,7 @@ "holiday_days_10": 7, "holiday_days_11": 2, "holiday_days_12": 2, + "is_error_max": true, "month1": 217.45894697837934, "month2": 150.20990453556323, "month3": 59.283123188808865, diff --git a/simulation_model.py b/simulation_model.py index 9df9635..97d429c 100644 --- a/simulation_model.py +++ b/simulation_model.py @@ -75,6 +75,7 @@ class SimulationModel(Model): self.ramp_ranges = self._load_product_month_efficiency() self.factory_mapping = self._load_factory_mapping() self.factory_factors = {} + self.use_error_max = self._to_bool(cfg["is_error_max"]) merged_factors = {} merged_factors.update({k: v for k, v in kwargs.items() if k.startswith("factor_")}) if factory_factors: @@ -209,6 +210,58 @@ class SimulationModel(Model): self.running = True self.datacollector.collect(self) + def _compute_factory_error_stats( + self, + factory_pivot: pd.DataFrame, + benchmark_sorted: pd.DataFrame, + total_col: str = "鎬昏", + use_max: bool = True, + ) -> dict: + """ + Compute error metrics based on cumulative monthly deviation. + For each factory: + - cumulative monthly production vs benchmark + - deviation ratio per month (can be negative) + - factory error = max or mean absolute deviation ratio across 12 months + Returns: + { + "mean_abs_error": float, + "factory_max_ratio": {factory_name: value}, + "factory_cum_ratio": {factory_name: pd.Series of length 12 (ratios)} + } + Ratios are unitless (e.g., 0.02 == 2%). + """ + errors = [] + factory_max_ratio = {} + factory_cum_ratio = {} + month_cols = [f"{m}鏈" for m in range(1, 13)] + bench_name_col = benchmark_sorted.columns[0] + + for _, prow in factory_pivot.iterrows(): + fname = prow["宸ュ巶鍚嶇О"] + brow = benchmark_sorted[benchmark_sorted[bench_name_col] == fname] + if brow.empty: + continue + prod_months = pd.Series([float(prow[col]) for col in month_cols]) + bench_months = pd.Series([float(brow.iloc[0][col]) for col in month_cols]) + prod_cum = prod_months.cumsum() + bench_cum = bench_months.cumsum() + actual_total = float(brow.iloc[0][total_col]) if total_col in brow.columns else float(bench_cum.iloc[-1]) + if actual_total <= 0: + continue + pct_ratio = (prod_cum - bench_cum) / actual_total # signed ratio + agg_val = pct_ratio.abs().max() if use_max else pct_ratio.abs().mean() + errors.append(float(agg_val)) + factory_max_ratio[fname] = float(agg_val) + factory_cum_ratio[fname] = pct_ratio + + mean_abs_error = float("inf") if not errors else sum(errors) / len(errors) + return { + "mean_abs_error": mean_abs_error, + "factory_max_ratio": factory_max_ratio, + "factory_cum_ratio": factory_cum_ratio, + } + def _get_output_timestamp(self) -> str: if not hasattr(self, "_output_timestamp"): self._output_timestamp = datetime.now().strftime("%Y%m%d_%H%M%S") @@ -840,28 +893,12 @@ class SimulationModel(Model): month_cols = [f"{m}鏈" for m in range(1, 13)] if total_col not in benchmark_sorted.columns: benchmark_sorted[total_col] = benchmark_sorted[month_cols].sum(axis=1) - errors = [] - bench_name_col = benchmark_sorted.columns[0] - for _, prow in factory_pivot.iterrows(): - fname = prow["宸ュ巶鍚嶇О"] - brow = benchmark_sorted[benchmark_sorted[bench_name_col] == fname] - if brow.empty: - continue - prod_months = pd.Series([float(prow[f"{m}鏈"]) for m in range(1, 13)]) - bench_months = pd.Series([float(brow.iloc[0][f"{m}鏈"]) for m in range(1, 13)]) - prod_cum = prod_months.cumsum() - bench_cum = bench_months.cumsum() - actual_total = float(brow.iloc[0][total_col]) if total_col in brow.columns else float(bench_cum.iloc[-1]) - if actual_total <= 0: - continue - diff = prod_cum - bench_cum - pct = diff.abs() / actual_total - err = pct.mean() - errors.append(float(err)) - if not errors: + stats = self._compute_factory_error_stats(factory_pivot, benchmark_sorted, total_col=total_col, use_max=self.use_error_max) + cum_pct_by_factory = {k: v * 100.0 for k, v in stats["factory_cum_ratio"].items()} # to % + if stats["mean_abs_error"] == float("inf"): self.mean_abs_error = float("inf") return - self.mean_abs_error = sum(errors) / len(errors) + self.mean_abs_error = stats["mean_abs_error"] if not write_files: return @@ -872,65 +909,63 @@ class SimulationModel(Model): factory_report_path = os.path.join(output_dir, f"factory_report_{timestamp}.csv") factory_pivot.to_csv(factory_report_path, index=False, encoding="utf-8-sig") - error_df = pd.DataFrame( - { - "宸ュ巶鍚嶇О": factory_pivot["宸ュ巶鍚嶇О"].iloc[:min_len], - "浠跨湡鎬昏": prod_total, - "鍩哄噯鎬昏": bench_total, - "璇樊锛堟瘮渚嬶級": rel_errors.round(6), - "璇樊缁濆鍊硷紙姣斾緥锛": abs_rel_errors.round(6), - } - ) + # Error summary based on cumulative deviation percentage (max abs per factory) + err_rows = [] + for fname, pct_series in cum_pct_by_factory.items(): + max_abs_pct = pct_series.abs().max() if self.use_error_max else pct_series.abs().mean() + err_rows.append({"宸ュ巶鍚嶇О": fname, "鏈澶х疮绉亸宸甗%]" if self.use_error_max else "骞冲潎绱Н鍋忓樊[%]": float(max_abs_pct)}) + error_df = pd.DataFrame(err_rows) error_path = os.path.join(output_dir, f"factory_error_{timestamp}.csv") error_df.to_csv(error_path, index=False, encoding="utf-8-sig") - # Error bar charts by month and by factory (mean error) - # Align monthly errors - prod_months = factory_pivot[[f"{m}鏈" for m in range(1, 13)]].iloc[:min_len].astype(float) - bench_months = benchmark_sorted[[f"{m}鏈" for m in range(1, 13)]].iloc[:min_len].astype(float) - bench_months_safe = bench_months.replace(0, pd.NA) - month_pct_errors = (prod_months - bench_months_safe) / bench_months_safe * 100 - month_pct_errors = month_pct_errors.fillna(0).infer_objects(copy=False).astype(float) - month_error_means = pd.Series(month_pct_errors.mean(axis=0), index=[f"{m}鏈" for m in range(1, 13)]) + # Error bar charts by month using cumulative percentage deviations + if cum_pct_by_factory: + month_labels = [f"{m}鏈" for m in range(1, 13)] + month_pct_df = pd.DataFrame( + {fname: pct.reset_index(drop=True) for fname, pct in cum_pct_by_factory.items()} + ).transpose() + month_abs_means = month_pct_df.abs().mean(axis=0) + month_abs_means.index = month_labels[: len(month_abs_means)] - plt.figure(figsize=(10, 5)) - month_error_means.plot(kind="bar") - plt.ylabel("骞冲潎璇樊锛%锛") - plt.title("鎸夋湀浠界殑骞冲潎璇樊锛堢櫨鍒嗘瘮锛") - plt.tight_layout() - month_plot_path = os.path.join(output_dir, f"error_by_month_{timestamp}.png") - plt.savefig(month_plot_path) - plt.close() + plt.figure(figsize=(10, 5)) + month_abs_means.plot(kind="bar") + plt.ylabel("鏈堝害绱Н鍋忓樊骞冲潎鍊糩%]") + plt.title("鎸夋湀浠界殑绱Н鍋忓樊锛堝彇缁濆鍊煎悗骞冲潎锛") + plt.tight_layout() + month_plot_path = os.path.join(output_dir, f"error_by_month_{timestamp}.png") + plt.savefig(month_plot_path) + plt.close() - bench_totals_safe = bench_total.replace(0, pd.NA) - factory_pct_errors = (prod_total - bench_totals_safe) / bench_totals_safe * 100 - factory_pct_errors = factory_pct_errors.fillna(0).infer_objects(copy=False).astype(float) - factory_names = factory_pivot["宸ュ巶鍚嶇О"].iloc[:min_len].reset_index(drop=True) - factory_df = pd.DataFrame({"name": factory_names, "error_pct": factory_pct_errors}).sort_values( - by="error_pct" - ) - self.factory_error_df = factory_df.reset_index(drop=True) - plt.figure(figsize=(12, 6)) - ax = factory_df["error_pct"].reset_index(drop=True).plot(kind="bar") - plt.ylabel("璇樊锛%锛") - plt.title("鎸夊伐鍘傜殑璇樊锛堟昏锛岀櫨鍒嗘瘮锛") - plt.tight_layout() - # Annotate large absolute errors - for idx, row in factory_df.reset_index(drop=True).iterrows(): - val = row["error_pct"] - if abs(val) >= 50: # threshold - ax.text( - idx, - val, - row["name"], - rotation=90, - va="bottom" if val >= 0 else "top", - ha="center", - fontsize=8, - ) - factory_plot_path = os.path.join(output_dir, f"error_by_factory_{timestamp}.png") - plt.savefig(factory_plot_path) - plt.close() + factory_df = pd.DataFrame( + { + "name": list(cum_pct_by_factory.keys()), + "error_pct": [ + (pct.abs().max() if self.use_error_max else pct.abs().mean()) for pct in cum_pct_by_factory.values() + ], + } + ).sort_values(by="error_pct") + self.factory_error_df = factory_df.reset_index(drop=True) + plt.figure(figsize=(12, 6)) + ax = factory_df["error_pct"].reset_index(drop=True).plot(kind="bar") + metric_label = "鏈澶" if self.use_error_max else "骞冲潎" + plt.ylabel(f"{metric_label}绱Н鍋忓樊[%]") + plt.title(f"鎸夊伐鍘傜殑{metric_label}绱Н鍋忓樊锛堢櫨鍒嗘瘮锛") + plt.tight_layout() + for idx, row in factory_df.reset_index(drop=True).iterrows(): + val = row["error_pct"] + if abs(val) >= 50: + ax.text( + idx, + val, + row["name"], + rotation=90, + va="bottom" if val >= 0 else "top", + ha="center", + fontsize=8, + ) + factory_plot_path = os.path.join(output_dir, f"error_by_factory_{timestamp}.png") + plt.savefig(factory_plot_path) + plt.close() # Save histories for inventory, fulfillment pct, unmet backlog inv_path = os.path.join(output_dir, f"inventory_history_{timestamp}.csv")