From c8cf4857a0e93da3e4a3ead8ea04c7a490d3d803 Mon Sep 17 00:00:00 2001 From: Hgq <2757430053@qq.com> Date: Tue, 9 Dec 2025 17:16:47 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86=E8=AF=84=E4=BB=B7?= =?UTF-8?q?=E6=8C=87=E6=A0=87=EF=BC=8C=E9=81=BF=E5=85=8D=E5=94=AF=E4=B8=80?= =?UTF-8?q?=E8=A7=A3=E6=97=B6=EF=BC=8C=E5=8F=91=E7=94=9F=E9=99=A40?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data_structures.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/data_structures.py b/data_structures.py index 01cbf01..01f1651 100644 --- a/data_structures.py +++ b/data_structures.py @@ -116,6 +116,12 @@ class DataStructures: :return: 评价指标值 """ cost, tardiness = objectives - cost_ratio = cost/(max_cost - optimal_cost) - tardiness_ratio = tardiness/( max_tardiness - optimal_tardiness) + if max_cost - optimal_cost == 0: + cost_ratio = 0 + else: + cost_ratio = cost/(max_cost - optimal_cost) + if max_tardiness - optimal_tardiness == 0: + tardiness_ratio = 0 + else: + tardiness_ratio = tardiness/( max_tardiness - optimal_tardiness) return cost_ratio + tardiness_ratio \ No newline at end of file