debug average vs max
This commit is contained in:
parent
d86e16e3a3
commit
135b762a29
2
app.py
2
app.py
|
|
@ -219,7 +219,7 @@ def Page():
|
|||
return solara.Markdown(f"**累计产量(机组):{model.cumulative_production:.2f}**")
|
||||
|
||||
def get_mean_abs_error(model):
|
||||
return solara.Markdown(f"**工厂年产量均值绝对误差:{model.mean_abs_error:.2f}**")
|
||||
return solara.Markdown(f"**工厂年产量均值绝对误差:{model.error:.2f}**")
|
||||
|
||||
with solara.Column() as main:
|
||||
with solara.Card("产品筛选"):
|
||||
|
|
|
|||
|
|
@ -1,113 +1,113 @@
|
|||
区域名,工厂名,是否新工厂,产线ID,生产型号,开始月份,结束月份,磨合系数,系数最小值,系数最大值
|
||||
西北东部,艾郎玉门,是,艾郎玉门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
|
||||
区域名,工厂名,是否新工厂,产线ID,生产型号,开始月份,结束月份,磨合系数,系数最小值,系数最大值
|
||||
西北东部,艾郎玉门,是,艾郎玉门1,GWBD-A2,1,12,2.573832299130555,0.5,3
|
||||
西北东部,艾郎玉门,是,艾郎玉门2,GWBD-A2,1,12,0.7551349273834977,0.5,3
|
||||
华北,艾郎张北,是,艾郎张北1,GWBD-A2,1,12,2.115080130961469,0.5,3
|
||||
华北,艾郎张北,是,艾郎张北2,GWBD-A2,1,12,0.6797069684688172,0.5,3
|
||||
西北西部,时代巴里坤,是,时代巴里坤1,GWBD-A2,2,12,1.8810616541608631,0.5,3
|
||||
西北西部,时代巴里坤,是,时代巴里坤2,GWBD-A2,2,12,2.987097262834335,0.5,3
|
||||
西北西部,时代巴里坤,是,时代巴里坤3,GW99A,1,4,2.488871403042081,0.5,3
|
||||
西北西部,时代巴里坤,是,时代巴里坤4,GW99A,1,9,2.953943233688721,0.5,3
|
||||
华南,时代百色,是,时代百色1,GWBD-A3,2,12,1.6690292523195245,0.5,3
|
||||
华南,时代百色,是,时代百色2,GWBD-A3,2,12,2.4659503577446857,0.5,3
|
||||
华东南北部,时代射阳,是,时代射阳1,GW130,6,12,2.2076058205327764,0.5,3
|
||||
华东南北部,时代射阳,是,时代射阳2,GW130,8,12,1.430132739097293,0.5,3
|
||||
东北,时代松原,是,时代松原1,GWBD-A3,4,12,1.0363142371846124,0.5,3
|
||||
东北,时代松原,是,时代松原2,GWBD-A3,4,12,2.1701304430049246,0.5,3
|
||||
华东南南部,时代株洲,是,时代株洲1,GW99A,2,12,1.081678858112704,0.5,3
|
||||
华东南南部,时代株洲,是,时代株洲2,GW99A,2,12,1.0913646502654977,0.5,3
|
||||
华东南北部,双瑞大丰,是,双瑞大丰1,GW110.5,2,11,0.7663884592433219,0.5,3
|
||||
华东南北部,双瑞大丰,是,双瑞大丰2,GW110.5,2,11,0.5106326560706359,0.5,3
|
||||
华东南北部,双瑞大丰,否,双瑞大丰3,GW93,1,1,1.3145870292666928,0.5,3
|
||||
华东南北部,双瑞东营,是,双瑞东营1,GWBD-A2,6,12,2.543085429687747,0.5,3
|
||||
华东南北部,双瑞东营,是,双瑞东营2,GWBD-A2,6,12,2.79268044357321,0.5,3
|
||||
华东南北部,双瑞东营,是,双瑞东营3,GWBD-A2,7,12,2.927074556394514,0.5,3
|
||||
华东南北部,双瑞东营,是,双瑞东营4,GWBD-A2,7,12,2.892880738588988,0.5,3
|
||||
华东南北部,天顺濮阳,否,天顺濮阳1,GW99A,8,12,1.0527500393509173,0.5,3
|
||||
华东南北部,天顺濮阳,否,天顺濮阳2,GW99A,8,12,1.069042487726414,0.5,3
|
||||
华东南北部,天顺沙洋,否,天顺沙洋1,GW93,2,2,2.32043479739694,0.5,3
|
||||
华东南北部,天顺沙洋,是,天顺沙洋2,GW93,5,5,0.6973591106929395,0.5,3
|
||||
华东南北部,天顺沙洋,否,天顺沙洋3,GW93,11,11,1.1607811390472684,0.5,3
|
||||
华东南北部,天顺沙洋,否,天顺沙洋4,GW99,10,11,2.9663458837234176,0.5,3
|
||||
华东南北部,天顺沙洋,否,天顺沙洋5,GW99A,5,12,0.913690176263654,0.5,3
|
||||
华东南北部,天顺沙洋,否,天顺沙洋6,GW99A,5,12,0.8787050723740802,0.5,3
|
||||
东北,中材白城,否,中材白城1,GWBD-A3,8,8,2.1402649111425927,0.5,3
|
||||
华东南北部,中材阜宁,否,中材阜宁1,GW110.5,1,11,1.5459138854823482,0.5,3
|
||||
华东南北部,中材阜宁,否,中材阜宁2,GW110.5,1,11,0.5729502079816026,0.5,3
|
||||
华东南北部,中材阜宁,否,中材阜宁3,GW110.5,1,11,1.5694540282848988,0.5,3
|
||||
华东南北部,中材阜宁,否,中材阜宁4,GW83.4,1,11,1.382119991468305,0.5,3
|
||||
华东南北部,中材阜宁,否,中材阜宁5,GW93,6,8,0.8827086544315473,0.5,3
|
||||
华东南北部,中材阜宁,否,中材阜宁6,GW99A,1,7,2.830733081902044,0.5,3
|
||||
华东南北部,中材阜宁,否,中材阜宁7,GW99A,1,7,2.0523054358827126,0.5,3
|
||||
华东南北部,中材阜宁,否,中材阜宁8,SI90.2,1,12,1.6546434532678769,0.5,3
|
||||
华东南北部,中材阜宁,否,中材阜宁9,SI90.2,1,12,2.736515935954447,0.5,3
|
||||
华东南北部,中材阜宁,是,中材阜宁10,SI90.2,1,12,1.056360739447041,0.5,3
|
||||
华东南北部,中材阜宁,是,中材阜宁11,SI90.2,1,12,2.938099080422176,0.5,3
|
||||
华东南北部,中材阜宁,是,中材阜宁12,SI90.2,2,12,0.7522973434359188,0.5,3
|
||||
华东南北部,中材阜宁,是,中材阜宁13,SI90.2,2,12,1.455419784069309,0.5,3
|
||||
西北西部,中材哈密,否,中材哈密1,GWBD-A3,7,11,1.0178664652883072,0.5,3
|
||||
西北西部,中材哈密,否,中材哈密2,GWBD-A3,7,11,2.6355971342265194,0.5,3
|
||||
华北,中材邯郸,否,中材邯郸1,GW99A,1,12,1.1728678581197811,0.5,3
|
||||
华北,中材邯郸,否,中材邯郸2,GW99A,1,12,1.0447043893191337,0.5,3
|
||||
华北,中材邯郸,是,中材邯郸3,GWBD-A2,2,12,1.443120583655738,0.5,3
|
||||
华北,中材邯郸,是,中材邯郸4,GWBD-A2,3,12,1.9378786142508244,0.5,3
|
||||
西北东部,中材酒泉,否,中材酒泉1,GW99,1,12,1.126932621978494,0.5,3
|
||||
西北东部,中材酒泉,否,中材酒泉2,GW99,1,12,1.144783324686626,0.5,3
|
||||
西北东部,中材酒泉,否,中材酒泉3,GWBD-A2,1,12,0.8063768405900967,0.5,3
|
||||
西北东部,中材酒泉,是,中材酒泉4,GWBD-A2,1,12,0.990324308056816,0.5,3
|
||||
西北东部,中材酒泉,是,中材酒泉5,GWBD-A2,2,12,2.265886526545412,0.5,3
|
||||
西北东部,中材酒泉,是,中材酒泉6,GWBD-A2,3,12,1.839298288914216,0.5,3
|
||||
西北东部,中材酒泉,否,中材酒泉7,SI90.2,1,1,1.2621204611288224,0.5,3
|
||||
西北东部,中材酒泉,否,中材酒泉8,SI90.2,1,4,0.8199844980580712,0.5,3
|
||||
西北东部,中材酒泉,否,中材酒泉9,SI90.2,3,4,2.762280541648126,0.5,3
|
||||
西北东部,中材酒泉,否,中材酒泉10,SI90.2,9,9,0.593157493625113,0.5,3
|
||||
西北东部,中材酒泉,否,中材酒泉11,SI90.2,4,12,1.1027785967994126,0.5,3
|
||||
西北东部,中材酒泉,否,中材酒泉12,SI90.2,4,12,0.6872334261934359,0.5,3
|
||||
华东南北部,中材连云港,否,中材连云港1,GW93,1,4,0.947630481798518,0.5,3
|
||||
华东南北部,中材连云港,否,中材连云港2,GW93,1,12,1.3688662392144466,0.5,3
|
||||
华东南北部,中材连云港,否,中材连云港3,GW93,1,12,2.797094312017575,0.5,3
|
||||
华东南南部,中材萍乡,否,中材萍乡1,GW83.4,1,3,2.0773221443454304,0.5,3
|
||||
华东南南部,中材萍乡,否,中材萍乡2,GW93,1,10,1.3802802554963542,0.5,3
|
||||
华东南南部,中材萍乡,否,中材萍乡3,GW93,1,10,1.4002226284151378,0.5,3
|
||||
华东南南部,中材萍乡,否,中材萍乡4,GWBD-A3,1,12,0.7708097434812091,0.5,3
|
||||
华东南南部,中材萍乡,否,中材萍乡5,GWBD-A3,1,12,2.592994930030489,0.5,3
|
||||
东北,中材锡林,否,中材锡林1,GW99,1,12,1.149507908747532,0.5,3
|
||||
东北,中材锡林,否,中材锡林2,GW99,1,12,2.559150953717717,0.5,3
|
||||
东北,中材锡林,是,中材锡林3,GWBD-A2,1,12,0.7655680581592179,0.5,3
|
||||
东北,中材锡林,是,中材锡林4,GWBD-A2,1,12,1.2703315998965434,0.5,3
|
||||
东北,中材锡林,是,中材锡林5,GWBD-A2,2,12,0.8143637605841937,0.5,3
|
||||
东北,中材锡林,否,中材锡林6,SI90.2,1,1,2.306341573772662,0.5,3
|
||||
东北,中材锡林,否,中材锡林7,SI90.2,1,1,1.78433681769329,0.5,3
|
||||
东北,中材兴安盟,否,中材兴安盟1,GW93,1,9,1.102017941748625,0.5,3
|
||||
东北,中材兴安盟,否,中材兴安盟2,GW93,1,9,1.1319603805540963,0.5,3
|
||||
华南,中材阳江,是,中材阳江1,GW130,1,12,1.1786952000344315,0.5,3
|
||||
华南,中材阳江,是,中材阳江2,GW130,11,12,2.401570055570436,0.5,3
|
||||
华南,中材阳江,否,中材阳江3,SI122,1,12,2.9892600685463484,0.5,3
|
||||
华南,中材阳江,否,中材阳江4,SI122,1,12,2.736186842293012,0.5,3
|
||||
西北西部,中材伊吾,否,中材伊吾1,GWBD-A2,1,12,1.3930072691073077,0.5,3
|
||||
西北西部,中材伊吾,否,中材伊吾2,GWBD-A2,1,12,1.977477183020509,0.5,3
|
||||
西北西部,中材伊吾,是,中材伊吾3,GWBD-A3,7,9,0.5529804495458042,0.5,3
|
||||
华南,中材玉溪,否,中材玉溪1,GW93,3,3,1.959546411962172,0.5,3
|
||||
西北西部,重通昌吉,否,重通昌吉1,GW99,11,11,0.5,0.5,3
|
||||
西北西部,重通昌吉,是,重通昌吉2,GW99A,1,10,2.051928553788,0.5,3
|
||||
西北西部,重通昌吉,否,重通昌吉3,GWBD-A2,1,12,2.6658563724837165,0.5,3
|
||||
西北西部,重通昌吉,否,重通昌吉4,GWBD-A2,1,12,0.5338053591905982,0.5,3
|
||||
西北西部,重通昌吉,是,重通昌吉5,GWBD-A2,1,12,1.6278097723685112,0.5,3
|
||||
东北,重通大安,是,重通大安1,GWBD-A2,1,12,1.581903910413776,0.5,3
|
||||
东北,重通大安,是,重通大安2,GWBD-A2,2,12,1.3105714103279738,0.5,3
|
||||
华东南北部,重通如东,否,重通如东1,GW110.5,6,10,2.662169226944904,0.5,3
|
||||
华东南北部,重通如东,否,重通如东2,GW110.5,6,10,2.82368855931312,0.5,3
|
||||
华东南北部,重通如东,否,重通如东3,GW76,1,6,1.8825731353509496,0.5,3
|
||||
华东南北部,重通如东,否,重通如东4,GW76,11,12,0.9278020901772052,0.5,3
|
||||
华东南北部,重通如东,否,重通如东5,GW76,11,12,1.0234023740731988,0.5,3
|
||||
华东南北部,重通如东,否,重通如东6,GW81,1,12,1.0689261905119656,0.5,3
|
||||
华东南北部,重通如东,否,重通如东7,GW81,1,12,1.0733442879188466,0.5,3
|
||||
华东南北部,重通如东,否,重通如东8,GW81,1,12,1.0894565180344418,0.5,3
|
||||
华东南北部,重通如东,是,重通如东9,GW86,10,12,0.9369533470121776,0.5,3
|
||||
华东南北部,重通如东,是,重通如东10,GWBD-D,4,10,1.16385774999936,0.5,3
|
||||
华东南北部,重通如东,是,重通如东11,GW83.3,7,9,1.0150864337534389,0.5,3
|
||||
西北东部,重通武威,否,重通武威1,GW83.4,1,1,1.0249345530326432,0.5,3
|
||||
西北东部,重通武威,否,重通武威2,GW99A,1,1,1.4390978913290176,0.5,3
|
||||
西北东部,重通武威,否,重通武威3,GWBD-A2,1,12,2.2770043222733705,0.5,3
|
||||
西北东部,重通武威,否,重通武威4,GWBD-A2,1,12,0.7021776323779197,0.5,3
|
||||
西北东部,重通武威,是,重通武威5,GWBD-A3,2,12,0.9008060819850424,0.5,3
|
||||
西北东部,重通武威,是,重通武威6,GWBD-A3,2,12,2.1363106837251777,0.5,3
|
||||
|
|
|
|||
|
|
|
@ -1,28 +0,0 @@
|
|||
工厂中文名,工厂英文名,工厂平均磨合系数,最小误差
|
||||
艾郎玉门,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
|
||||
|
|
|
@ -1,28 +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.1053644503524552
|
||||
重通武威,ChongtongWuwei,1.0710109843518,0.10157518253678476
|
||||
工厂中文名,工厂英文名,工厂平均磨合系数,最小误差
|
||||
艾郎玉门,AilangYumen,1.6644836132570262,0.4109048664614467
|
||||
艾郎张北,AilangZhangbei,1.397393549715143,0.3875473927222936
|
||||
时代巴里坤,ShidaiBalikun,2.5777433884315,0.1084387587668106
|
||||
时代百色,ShidaiBaise,2.067489805032105,0.3822434351539541
|
||||
时代射阳,ShidaiSheyang,1.818869279815035,0.3907170103360906
|
||||
时代松原,ShidaiSongyuan,1.6032223400947685,0.3826740983753151
|
||||
时代株洲,ShidaiZhuzhou,1.0865217541891008,0.381593662574357
|
||||
双瑞大丰,ShuangruiDafeng,0.8638693815268835,0.3331325041383269
|
||||
双瑞东营,ShuangruiDongying,2.788930292061115,0.09394600514362228
|
||||
天顺濮阳,TianshunPuyang,1.0608962635386656,0.342536423517118
|
||||
天顺沙洋,TianshunShayang,1.48955269658305,0.3452121483167365
|
||||
中材白城,ZhongcaiBaicheng,2.1402649111425927,0.34455662553732
|
||||
中材阜宁,ZhongcaiFuning,1.6484247401561711,0.2904939733696281
|
||||
中材哈密,ZhongcaiHami,1.8267317997574133,0.2724502886592768
|
||||
中材邯郸,ZhongcaiHandan,1.3996428613363694,0.282263520694731
|
||||
中材酒泉,ZhongcaiJiuquan,1.28342974401872,0.2568142301144558
|
||||
中材连云港,ZhongcaiLianyungang,1.7045303443435131,0.2307662040664297
|
||||
中材萍乡,ZhongcaiPingxiang,1.644325940353724,0.2829493917509724
|
||||
中材锡林,ZhongcaiXilin,1.5213715246530224,0.2281958103288435
|
||||
中材兴安盟,ZhongcaiXinganmeng,1.116989161151361,0.2285419508619
|
||||
中材阳江,ZhongcaiYangjiang,2.3264280416110568,0.1893196457297771
|
||||
中材伊吾,ZhongcaiYiwu,1.307821633891207,0.2163127405194821
|
||||
中材玉溪,ZhongcaiYuxi,1.959546411962172,0.1522826086927401
|
||||
重通昌吉,ChongtongChangji,1.4758800115661652,0.1486544907789079
|
||||
重通大安,ChongtongDaan,1.4462376603708749,0.1364186176846021
|
||||
重通如东,ChongtongRudong,1.424296355735419,0.1440551201664654
|
||||
重通武威,ChongtongWuwei,1.413388527453862,0.1406968232829397
|
||||
|
|
|
|||
|
|
|
@ -23,12 +23,24 @@ def clip(val: float, bounds: Tuple[float, float]) -> float:
|
|||
return max(lo, min(hi, val))
|
||||
|
||||
|
||||
def _match_factory_row(df: pd.DataFrame, cols: dict, factory_code: str) -> pd.Series:
|
||||
"""Match factory by English name first, fall back to Chinese name."""
|
||||
eng_col = cols["工厂英文名"]
|
||||
cn_col = cols["工厂中文名"]
|
||||
code_norm = factory_code.strip().lower()
|
||||
mask_eng = df[eng_col].astype(str).str.strip().str.lower() == code_norm
|
||||
if mask_eng.any():
|
||||
return df.loc[mask_eng].iloc[0]
|
||||
mask_cn = df[cn_col].astype(str).str.strip() == factory_code.strip()
|
||||
if mask_cn.any():
|
||||
return df.loc[mask_cn].iloc[0]
|
||||
raise ValueError(f"在{eng_col}/{cn_col} 中找不到工厂 {factory_code}")
|
||||
|
||||
|
||||
def load_factory_row(csv_path: Path, factory_code: str) -> tuple[pd.Series, pd.DataFrame, dict]:
|
||||
df, cols, _ = read_csv_with_encoding(csv_path, required={"工厂中文名", "工厂英文名", "工厂平均磨合系数", "最小误差"})
|
||||
row = df.loc[df[cols["工厂英文名"]].astype(str).str.strip() == factory_code]
|
||||
if row.empty:
|
||||
raise ValueError(f"在 {csv_path} 中找不到工厂英文名: {factory_code}")
|
||||
return row.iloc[0], df, cols
|
||||
row = _match_factory_row(df, cols, factory_code)
|
||||
return row, df, cols
|
||||
|
||||
|
||||
def _csv_lock_path(csv_path: Path) -> Path:
|
||||
|
|
@ -64,16 +76,14 @@ def update_factory_csv(csv_path: Path, factory_code: str, new_factor: float, new
|
|||
fd = _acquire_lock(lock_path)
|
||||
try:
|
||||
df, cols, enc = read_csv_with_encoding(csv_path, required={"工厂中文名", "工厂英文名", "工厂平均磨合系数", "最小误差"})
|
||||
mask = df[cols["工厂英文名"]].astype(str).str.strip() == factory_code
|
||||
if not mask.any():
|
||||
raise ValueError(f"在 {csv_path} 中找不到工厂英文名: {factory_code}")
|
||||
row = _match_factory_row(df, cols, factory_code)
|
||||
mask = df.index == row.name
|
||||
df.loc[mask, cols["工厂平均磨合系数"]] = float(new_factor)
|
||||
df.loc[mask, cols["最小误差"]] = float(new_error)
|
||||
df.to_csv(csv_path, index=False, encoding=enc)
|
||||
finally:
|
||||
_release_lock(lock_path, fd)
|
||||
|
||||
|
||||
def update_production_line_csv(csv_path: Path, factory_name_cn: str, line_ids: List[str], best_genes: List[float]) -> None:
|
||||
lock_path = _csv_lock_path(csv_path)
|
||||
fd = _acquire_lock(lock_path)
|
||||
|
|
@ -105,7 +115,7 @@ def evaluate(factory_code: str, line_ids: List[str], genes: List[float]) -> floa
|
|||
model.line_factor[lid] = float(val)
|
||||
while model.running:
|
||||
model.step()
|
||||
return model.mean_abs_error
|
||||
return model.error
|
||||
|
||||
|
||||
def mutate(genes: List[float]) -> List[float]:
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ def evaluate(genes: List[float]) -> float:
|
|||
)
|
||||
while model.running:
|
||||
model.step()
|
||||
return model.mean_abs_error
|
||||
return model.error
|
||||
except PermissionError as e:
|
||||
print(f"文件访问冲突: {e}. 正在重试...")
|
||||
return float('inf') # 返回高值以惩罚该个体
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ class SimulationModel(Model):
|
|||
self.cumulative_production = 0
|
||||
self.monthly_totals = {}
|
||||
self.production_log = []
|
||||
self.mean_abs_error = 0.0
|
||||
self.error = 0.0
|
||||
# Allow explicit product_set override; otherwise fall back to config.
|
||||
self.product_set = self._parse_product_set(product_set if product_set is not None else cfg.get("product_set"))
|
||||
self.output_enabled = output_enabled
|
||||
|
|
@ -156,7 +156,7 @@ class SimulationModel(Model):
|
|||
{
|
||||
"cumulative_production": lambda m: m.cumulative_production,
|
||||
"monthly_total": lambda m: m.monthly_totals.get(m.current_month, 0),
|
||||
"mean_abs_error": lambda m: m.mean_abs_error,
|
||||
"error": lambda m: m.error,
|
||||
"fulfill_pct_overall": lambda m: m.overall_fulfill_pct,
|
||||
"transport_cost": lambda m: m.monthly_transport_cost,
|
||||
}
|
||||
|
|
@ -218,20 +218,9 @@ class SimulationModel(Model):
|
|||
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)}
|
||||
}
|
||||
Compute cumulative deviation ratios per factory (no aggregation).
|
||||
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)]
|
||||
|
|
@ -250,14 +239,10 @@ class SimulationModel(Model):
|
|||
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
|
||||
factory_max_ratio[fname] = float(pct_ratio.abs().max())
|
||||
|
||||
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,
|
||||
}
|
||||
|
|
@ -864,7 +849,7 @@ class SimulationModel(Model):
|
|||
|
||||
def _finalize_factory_errors(self, write_files: bool):
|
||||
if not self.production_log:
|
||||
self.mean_abs_error = float("inf")
|
||||
self.error = float("inf")
|
||||
return
|
||||
df = pd.DataFrame(self.production_log)
|
||||
factory_pivot = (
|
||||
|
|
@ -887,18 +872,33 @@ class SimulationModel(Model):
|
|||
benchmark = pd.read_csv(f"data/{filename}/benchmark.csv", encoding="utf-8-sig")
|
||||
except UnicodeDecodeError:
|
||||
benchmark = pd.read_csv(f"data/{filename}/benchmark.csv", encoding="gbk")
|
||||
benchmark = benchmark.rename(columns=lambda c: str(c).strip())
|
||||
month_cols = [col for col in benchmark.columns if str(col).strip().endswith("月") and str(col).strip()[:-1].isdigit()]
|
||||
month_cols = sorted(month_cols, key=lambda x: int(str(x).strip()[:-1]))
|
||||
if len(month_cols) < 12:
|
||||
raise KeyError(f"benchmark.csv 缺少月份列,找到: {month_cols}")
|
||||
benchmark_sorted = benchmark.sort_values(by=benchmark.columns[0])
|
||||
|
||||
total_col = "总计"
|
||||
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)
|
||||
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 = stats["mean_abs_error"]
|
||||
stats = self._compute_factory_error_stats(
|
||||
factory_pivot,
|
||||
benchmark_sorted,
|
||||
total_col=total_col,
|
||||
use_max=self.use_error_max,
|
||||
)
|
||||
cum_ratio_by_factory = stats["factory_cum_ratio"]
|
||||
# Aggregate factory-level errors (mean across factories of max/mean per-month absolute ratio)
|
||||
factory_errors = []
|
||||
for ratio_series in cum_ratio_by_factory.values():
|
||||
metric_val = ratio_series.abs().max() if self.use_error_max else ratio_series.abs().mean()
|
||||
factory_errors.append(float(metric_val))
|
||||
if not factory_errors:
|
||||
self.error = float("inf")
|
||||
else:
|
||||
# Aggregate across factories: max when use_error_max=True, otherwise mean.
|
||||
self.error = max(factory_errors) if self.use_error_max else sum(factory_errors) / len(factory_errors)
|
||||
|
||||
if not write_files:
|
||||
return
|
||||
|
|
@ -909,28 +909,30 @@ 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 summary based on cumulative deviation percentage (max abs per factory)
|
||||
# Error summary based on cumulative deviation ratio (unitless, consistent with GA)
|
||||
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)
|
||||
metric_col = "最大累计偏差" if self.use_error_max else "平均累计偏差"
|
||||
for fname, ratio_series in cum_ratio_by_factory.items():
|
||||
metric_val = ratio_series.abs().max() if self.use_error_max else ratio_series.abs().mean()
|
||||
err_rows.append({"工厂名称": fname, metric_col: float(metric_val)})
|
||||
error_df = pd.DataFrame(err_rows) if err_rows else pd.DataFrame(columns=["工厂名称", metric_col])
|
||||
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 using cumulative percentage deviations
|
||||
if cum_pct_by_factory:
|
||||
if cum_ratio_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()}
|
||||
month_ratio_df = pd.DataFrame(
|
||||
{fname: pct.reset_index(drop=True) for fname, pct in cum_ratio_by_factory.items()}
|
||||
).transpose()
|
||||
month_abs_means = month_pct_df.abs().mean(axis=0)
|
||||
month_abs_means = month_ratio_df.abs().mean(axis=0)
|
||||
month_abs_means.index = month_labels[: len(month_abs_means)]
|
||||
month_abs_means_pct = month_abs_means * 100
|
||||
|
||||
plt.figure(figsize=(10, 5))
|
||||
month_abs_means.plot(kind="bar")
|
||||
plt.ylabel("月度累积偏差平均值[%]")
|
||||
plt.title("按月份的累积偏差(取绝对值后平均)")
|
||||
month_abs_means_pct.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)
|
||||
|
|
@ -938,18 +940,20 @@ class SimulationModel(Model):
|
|||
|
||||
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()
|
||||
"name": list(cum_ratio_by_factory.keys()),
|
||||
"error_ratio": [
|
||||
(pct.abs().max() if self.use_error_max else pct.abs().mean()) for pct in cum_ratio_by_factory.values()
|
||||
],
|
||||
}
|
||||
).sort_values(by="error_pct")
|
||||
)
|
||||
factory_df = factory_df.sort_values(by="error_ratio")
|
||||
factory_df["error_pct"] = factory_df["error_ratio"] * 100
|
||||
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.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"]
|
||||
|
|
@ -966,8 +970,7 @@ class SimulationModel(Model):
|
|||
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
|
||||
# Save histories for inventory, fulfillment pct, unmet backlog
|
||||
inv_path = os.path.join(output_dir, f"inventory_history_{timestamp}.csv")
|
||||
fulfill_path = os.path.join(output_dir, f"fulfill_history_{timestamp}.csv")
|
||||
unmet_path = os.path.join(output_dir, f"unmet_history_{timestamp}.csv")
|
||||
|
|
|
|||
Loading…
Reference in New Issue