Commit e1e21676 authored by Tong Li's avatar Tong Li

遗传算法

parent cfcaec50
......@@ -65901,3 +65901,335 @@
[27000-63000]:[11-01 07:30-11-01 17:30] 36000
[113400-149400]:[11-02 07:30-11-02 17:30] 36000
[2025-12-02 19:40:14]
[2025-12-03 10:37:19]
=== Schedule Summary === 0.482097
[2025-12-03 10:37:19] Operation: 1|1|2
[2025-12-03 10:37:19] Makespan: 149400.000000 minutes
[2025-12-03 10:37:19] Total Tardiness: 0.000000 hours
[2025-12-03 10:37:19] Setup Time: 0.000000 minutes
[2025-12-03 10:37:19] Flow Time: 232800.000000 minutes
[2025-12-03 10:37:19] Machine Load Balance: 91.05%
[2025-12-03 10:37:19] -------------------------
[2025-12-03 10:37:19] [27000-63000]:[11-01 07:30-11-01 17:30] Order 1, Machine 3403, Operation 1, Batch 50000.0, processingTime %.1f
[27000-63000]:[11-01 07:30-11-01 17:30] 36000
[2025-12-03 10:37:19] [63000-137400]:[11-01 17:30-11-02 14:10] Order 1, Machine 3243, Operation 2, Batch 50000.0, processingTime %.1f
[63000-99000]:[11-01 17:30-11-02 03:30] 36000
[113400-137400]:[11-02 07:30-11-02 14:10] 24000
[2025-12-03 10:37:19]
[2025-12-03 10:37:19] [27000-149400]:[11-01 07:30-11-02 17:30] Order 2, Machine 2183, Operation 3, Batch 20.0, processingTime %.1f
[27000-63000]:[11-01 07:30-11-01 17:30] 36000
[113400-149400]:[11-02 07:30-11-02 17:30] 36000
[2025-12-03 10:37:19]
[2025-12-03 14:46:43]
=== Schedule Summary === 0.482097
[2025-12-03 14:46:43] Operation: 2|1|1
[2025-12-03 14:46:43] Makespan: 149400.000000 minutes
[2025-12-03 14:46:43] Total Tardiness: 0.000000 hours
[2025-12-03 14:46:43] Setup Time: 0.000000 minutes
[2025-12-03 14:46:43] Flow Time: 232800.000000 minutes
[2025-12-03 14:46:43] Machine Load Balance: 91.05%
[2025-12-03 14:46:43] -------------------------
[2025-12-03 14:46:43] [27000-63000]:[11-01 07:30-11-01 17:30] Order 1, Machine 3402, Operation 1, Batch 50000.0, processingTime %.1f
[27000-63000]:[11-01 07:30-11-01 17:30] 36000
[2025-12-03 14:46:43] [63000-137400]:[11-01 17:30-11-02 14:10] Order 1, Machine 3401, Operation 2, Batch 50000.0, processingTime %.1f
[63000-99000]:[11-01 17:30-11-02 03:30] 36000
[113400-137400]:[11-02 07:30-11-02 14:10] 24000
[2025-12-03 14:46:43]
[2025-12-03 14:46:43] [27000-149400]:[11-01 07:30-11-02 17:30] Order 2, Machine 2183, Operation 3, Batch 20.0, processingTime %.1f
[27000-63000]:[11-01 07:30-11-01 17:30] 36000
[113400-149400]:[11-02 07:30-11-02 17:30] 36000
[2025-12-03 14:46:43]
[2025-12-03 14:48:50]
=== Schedule Summary === 0.482097
[2025-12-03 14:48:50] Operation: 2|1|1
[2025-12-03 14:48:50] Makespan: 322200.000000 minutes
[2025-12-03 14:48:50] Total Tardiness: 0.000000 hours
[2025-12-03 14:48:50] Setup Time: 0.000000 minutes
[2025-12-03 14:48:50] Flow Time: 232800.000000 minutes
[2025-12-03 14:48:50] Machine Load Balance: 97.93%
[2025-12-03 14:48:50] -------------------------
[2025-12-03 14:48:50] [113400-149400]:[11-02 07:30-11-02 17:30] Order 1, Machine 3402, Operation 1, Batch 50000.0, processingTime %.1f
[113400-149400]:[11-02 07:30-11-02 17:30] 36000
[2025-12-03 14:48:50] [149400-223800]:[11-02 17:30-11-03 14:10] Order 1, Machine 3401, Operation 2, Batch 50000.0, processingTime %.1f
[149400-185400]:[11-02 17:30-11-03 03:30] 36000
[199800-223800]:[11-03 07:30-11-03 14:10] 24000
[2025-12-03 14:48:50]
[2025-12-03 14:48:50] [199800-322200]:[11-03 07:30-11-04 17:30] Order 2, Machine 2183, Operation 3, Batch 20.0, processingTime %.1f
[199800-235800]:[11-03 07:30-11-03 17:30] 36000
[286200-322200]:[11-04 07:30-11-04 17:30] 36000
[2025-12-03 14:48:50]
[2025-12-03 15:21:59]
=== Schedule Summary === 0.482097
[2025-12-03 15:21:59] Operation: 1|3|2|1|3
[2025-12-03 15:21:59] Makespan: 149400.000000 minutes
[2025-12-03 15:21:59] Total Tardiness: 0.000000 hours
[2025-12-03 15:21:59] Setup Time: 0.000000 minutes
[2025-12-03 15:21:59] Flow Time: 182400.000000 minutes
[2025-12-03 15:21:59] Machine Load Balance: 91.63%
[2025-12-03 15:21:59] -------------------------
[2025-12-03 15:21:59] [27000-41400]:[11-01 07:30-11-01 11:30] Order 1, Machine 3403, Operation 1, Batch 20000.0, processingTime %.1f
[27000-41400]:[11-01 07:30-11-01 11:30] 14400
[2025-12-03 15:21:59] [41400-65400]:[11-01 11:30-11-01 18:10] Order 1, Machine 3243, Operation 2, Batch 20000.0, processingTime %.1f
[41400-65400]:[11-01 11:30-11-01 18:10] 24000
[2025-12-03 15:21:59]
[2025-12-03 15:21:59] [27000-149400]:[11-01 07:30-11-02 17:30] Order 2, Machine 2183, Operation 3, Batch 20.0, processingTime %.1f
[27000-63000]:[11-01 07:30-11-01 17:30] 36000
[113400-149400]:[11-02 07:30-11-02 17:30] 36000
[2025-12-03 15:21:59]
[2025-12-03 15:21:59] [41400-48600]:[11-01 11:30-11-01 13:30] Order 3, Machine 3403, Operation 4, Batch 10000.0, processingTime %.1f
[41400-48600]:[11-01 11:30-11-01 13:30] 7200
[2025-12-03 15:21:59] [48600-63000]:[11-01 13:30-11-01 17:30] Order 3, Machine 3403, Operation 5, Batch 20000.0, processingTime %.1f
[48600-63000]:[11-01 13:30-11-01 17:30] 14400
[2025-12-03 15:21:59]
[2025-12-03 15:34:36]
=== Schedule Summary === 0.482097
[2025-12-03 15:34:36] Operation: 2|1|3|4|1|3|4
[2025-12-03 15:34:36] Makespan: 149400.000000 minutes
[2025-12-03 15:34:36] Total Tardiness: 0.000000 hours
[2025-12-03 15:34:36] Setup Time: 0.000000 minutes
[2025-12-03 15:34:36] Flow Time: 218400.000000 minutes
[2025-12-03 15:34:36] Machine Load Balance: 92.84%
[2025-12-03 15:34:36] -------------------------
[2025-12-03 15:34:36] [27000-41400]:[11-01 07:30-11-01 11:30] Order 1, Machine 3403, Operation 1, Batch 20000.0, processingTime %.1f
[27000-41400]:[11-01 07:30-11-01 11:30] 14400
[2025-12-03 15:34:36] [41400-65400]:[11-01 11:30-11-01 18:10] Order 1, Machine 3401, Operation 2, Batch 20000.0, processingTime %.1f
[41400-65400]:[11-01 11:30-11-01 18:10] 24000
[2025-12-03 15:34:36]
[2025-12-03 15:34:36] [27000-149400]:[11-01 07:30-11-02 17:30] Order 2, Machine 2183, Operation 3, Batch 20.0, processingTime %.1f
[27000-63000]:[11-01 07:30-11-01 17:30] 36000
[113400-149400]:[11-02 07:30-11-02 17:30] 36000
[2025-12-03 15:34:36]
[2025-12-03 15:34:36] [41400-55800]:[11-01 11:30-11-01 15:30] Order 3, Machine 3403, Operation 4, Batch 20000.0, processingTime %.1f
[41400-55800]:[11-01 11:30-11-01 15:30] 14400
[2025-12-03 15:34:36] [55800-79800]:[11-01 15:30-11-01 22:10] Order 3, Machine 3243, Operation 5, Batch 20000.0, processingTime %.1f
[55800-79800]:[11-01 15:30-11-01 22:10] 24000
[2025-12-03 15:34:36]
[2025-12-03 15:34:36] [55800-63000]:[11-01 15:30-11-01 17:30] Order 4, Machine 3403, Operation 6, Batch 10000.0, processingTime %.1f
[55800-63000]:[11-01 15:30-11-01 17:30] 7200
[2025-12-03 15:34:36] [79800-91800]:[11-01 22:10-11-02 01:30] Order 4, Machine 3243, Operation 7, Batch 10000.0, processingTime %.1f
[79800-91800]:[11-01 22:10-11-02 01:30] 12000
[2025-12-03 15:34:36]
[2025-12-03 15:53:23]
=== Schedule Summary === 0.482097
[2025-12-03 15:53:23] Operation: 2|1|3|4|1|3|4
[2025-12-03 15:53:23] Makespan: 149400.000000 minutes
[2025-12-03 15:53:23] Total Tardiness: 0.000000 hours
[2025-12-03 15:53:23] Setup Time: 0.000000 minutes
[2025-12-03 15:53:23] Flow Time: 218400.000000 minutes
[2025-12-03 15:53:23] Machine Load Balance: 92.84%
[2025-12-03 15:53:23] -------------------------
[2025-12-03 15:53:23] [27000-41400]:[11-01 07:30-11-01 11:30] Order 1, Machine 3403, Operation 1, Batch 20000.0, processingTime %.1f
[27000-41400]:[11-01 07:30-11-01 11:30] 14400
[2025-12-03 15:53:23] [41400-65400]:[11-01 11:30-11-01 18:10] Order 1, Machine 3401, Operation 2, Batch 20000.0, processingTime %.1f
[41400-65400]:[11-01 11:30-11-01 18:10] 24000
[2025-12-03 15:53:23]
[2025-12-03 15:53:23] [27000-149400]:[11-01 07:30-11-02 17:30] Order 2, Machine 2183, Operation 3, Batch 20.0, processingTime %.1f
[27000-63000]:[11-01 07:30-11-01 17:30] 36000
[113400-149400]:[11-02 07:30-11-02 17:30] 36000
[2025-12-03 15:53:23]
[2025-12-03 15:53:23] [41400-48600]:[11-01 11:30-11-01 13:30] Order 3, Machine 3403, Operation 4, Batch 10000.0, processingTime %.1f
[41400-48600]:[11-01 11:30-11-01 13:30] 7200
[2025-12-03 15:53:23] [48600-60600]:[11-01 13:30-11-01 16:50] Order 3, Machine 3243, Operation 5, Batch 10000.0, processingTime %.1f
[48600-60600]:[11-01 13:30-11-01 16:50] 12000
[2025-12-03 15:53:23]
[2025-12-03 15:53:23] [48600-63000]:[11-01 13:30-11-01 17:30] Order 4, Machine 3403, Operation 6, Batch 20000.0, processingTime %.1f
[48600-63000]:[11-01 13:30-11-01 17:30] 14400
[2025-12-03 15:53:23] [63000-87000]:[11-01 17:30-11-02 00:10] Order 4, Machine 3243, Operation 7, Batch 20000.0, processingTime %.1f
[63000-87000]:[11-01 17:30-11-02 00:10] 24000
[2025-12-03 15:53:23]
[2025-12-03 16:23:51]
=== Schedule Summary === 0.482097
[2025-12-03 16:23:51] Operation: 2|1|3|4|1|3|4
[2025-12-03 16:23:51] Makespan: 149400.000000 minutes
[2025-12-03 16:23:51] Total Tardiness: 0.000000 hours
[2025-12-03 16:23:51] Setup Time: 0.000000 minutes
[2025-12-03 16:23:51] Flow Time: 218400.000000 minutes
[2025-12-03 16:23:51] Machine Load Balance: 92.84%
[2025-12-03 16:23:51] -------------------------
[2025-12-03 16:23:51] [27000-41400]:[11-01 07:30-11-01 11:30] Order 1, Machine 3403, Operation 1, Batch 20000.0, processingTime %.1f
[27000-41400]:[11-01 07:30-11-01 11:30] 14400
[2025-12-03 16:23:51] [41400-65400]:[11-01 11:30-11-01 18:10] Order 1, Machine 3401, Operation 2, Batch 20000.0, processingTime %.1f
[41400-65400]:[11-01 11:30-11-01 18:10] 24000
[2025-12-03 16:23:51]
[2025-12-03 16:23:51] [27000-149400]:[11-01 07:30-11-02 17:30] Order 2, Machine 2183, Operation 3, Batch 20.0, processingTime %.1f
[27000-63000]:[11-01 07:30-11-01 17:30] 36000
[113400-149400]:[11-02 07:30-11-02 17:30] 36000
[2025-12-03 16:23:51]
[2025-12-03 16:23:51] [41400-48600]:[11-01 11:30-11-01 13:30] Order 3, Machine 3403, Operation 4, Batch 10000.0, processingTime %.1f
[41400-48600]:[11-01 11:30-11-01 13:30] 7200
[2025-12-03 16:23:51] [48600-60600]:[11-01 13:30-11-01 16:50] Order 3, Machine 3243, Operation 5, Batch 10000.0, processingTime %.1f
[48600-60600]:[11-01 13:30-11-01 16:50] 12000
[2025-12-03 16:23:51]
[2025-12-03 16:23:51] [48600-63000]:[11-01 13:30-11-01 17:30] Order 4, Machine 3403, Operation 6, Batch 20000.0, processingTime %.1f
[48600-63000]:[11-01 13:30-11-01 17:30] 14400
[2025-12-03 16:23:51] [63000-87000]:[11-01 17:30-11-02 00:10] Order 4, Machine 3243, Operation 7, Batch 20000.0, processingTime %.1f
[63000-87000]:[11-01 17:30-11-02 00:10] 24000
[2025-12-03 16:23:51]
[2025-12-03 16:30:20]
=== Schedule Summary === 0.482097
[2025-12-03 16:30:20] Operation: 2|1|3|4|1|3|4
[2025-12-03 16:30:20] Makespan: 149400.000000 minutes
[2025-12-03 16:30:20] Total Tardiness: 0.000000 hours
[2025-12-03 16:30:20] Setup Time: 0.000000 minutes
[2025-12-03 16:30:20] Flow Time: 218400.000000 minutes
[2025-12-03 16:30:20] Machine Load Balance: 92.84%
[2025-12-03 16:30:20] -------------------------
[2025-12-03 16:30:20] [27000-41400]:[11-01 07:30-11-01 11:30] Order 1, Machine 3403, Operation 1, Batch 20000.0, processingTime %.1f
[27000-41400]:[11-01 07:30-11-01 11:30] 14400
[2025-12-03 16:30:20] [41400-65400]:[11-01 11:30-11-01 18:10] Order 1, Machine 3401, Operation 2, Batch 20000.0, processingTime %.1f
[41400-65400]:[11-01 11:30-11-01 18:10] 24000
[2025-12-03 16:30:20]
[2025-12-03 16:30:20] [27000-149400]:[11-01 07:30-11-02 17:30] Order 2, Machine 2183, Operation 3, Batch 20.0, processingTime %.1f
[27000-63000]:[11-01 07:30-11-01 17:30] 36000
[113400-149400]:[11-02 07:30-11-02 17:30] 36000
[2025-12-03 16:30:20]
[2025-12-03 16:30:20] [41400-48600]:[11-01 11:30-11-01 13:30] Order 3, Machine 3403, Operation 4, Batch 10000.0, processingTime %.1f
[41400-48600]:[11-01 11:30-11-01 13:30] 7200
[2025-12-03 16:30:20] [48600-60600]:[11-01 13:30-11-01 16:50] Order 3, Machine 3243, Operation 5, Batch 10000.0, processingTime %.1f
[48600-60600]:[11-01 13:30-11-01 16:50] 12000
[2025-12-03 16:30:20]
[2025-12-03 16:30:20] [48600-63000]:[11-01 13:30-11-01 17:30] Order 4, Machine 3403, Operation 6, Batch 20000.0, processingTime %.1f
[48600-63000]:[11-01 13:30-11-01 17:30] 14400
[2025-12-03 16:30:20] [63000-87000]:[11-01 17:30-11-02 00:10] Order 4, Machine 3243, Operation 7, Batch 20000.0, processingTime %.1f
[63000-87000]:[11-01 17:30-11-02 00:10] 24000
[2025-12-03 16:30:20]
[2025-12-03 16:36:34]
=== Schedule Summary === 0.482097
[2025-12-03 16:36:34] Operation: 1|3|4|1|3|4|2
[2025-12-03 16:36:34] Makespan: 149400.000000 minutes
[2025-12-03 16:36:34] Total Tardiness: 0.000000 hours
[2025-12-03 16:36:34] Setup Time: 0.000000 minutes
[2025-12-03 16:36:34] Flow Time: 218400.000000 minutes
[2025-12-03 16:36:34] Machine Load Balance: 92.84%
[2025-12-03 16:36:34] -------------------------
[2025-12-03 16:36:34] [27000-41400]:[11-01 07:30-11-01 11:30] Order 1, Machine 3403, Operation 1, Batch 20000.0, processingTime %.1f
[27000-41400]:[11-01 07:30-11-01 11:30] 14400
[2025-12-03 16:36:34] [41400-65400]:[11-01 11:30-11-01 18:10] Order 1, Machine 3243, Operation 2, Batch 20000.0, processingTime %.1f
[41400-65400]:[11-01 11:30-11-01 18:10] 24000
[2025-12-03 16:36:34]
[2025-12-03 16:36:34] [27000-149400]:[11-01 07:30-11-02 17:30] Order 2, Machine 2183, Operation 3, Batch 20.0, processingTime %.1f
[27000-63000]:[11-01 07:30-11-01 17:30] 36000
[113400-149400]:[11-02 07:30-11-02 17:30] 36000
[2025-12-03 16:36:34]
[2025-12-03 16:36:34] [41400-48600]:[11-01 11:30-11-01 13:30] Order 3, Machine 3403, Operation 4, Batch 10000.0, processingTime %.1f
[41400-48600]:[11-01 11:30-11-01 13:30] 7200
[2025-12-03 16:36:34] [48600-60600]:[11-01 13:30-11-01 16:50] Order 3, Machine 3401, Operation 5, Batch 10000.0, processingTime %.1f
[48600-60600]:[11-01 13:30-11-01 16:50] 12000
[2025-12-03 16:36:34]
[2025-12-03 16:36:34] [48600-63000]:[11-01 13:30-11-01 17:30] Order 4, Machine 3403, Operation 6, Batch 20000.0, processingTime %.1f
[48600-63000]:[11-01 13:30-11-01 17:30] 14400
[2025-12-03 16:36:34] [63000-87000]:[11-01 17:30-11-02 00:10] Order 4, Machine 3401, Operation 7, Batch 20000.0, processingTime %.1f
[63000-87000]:[11-01 17:30-11-02 00:10] 24000
[2025-12-03 16:36:34]
[2025-12-03 16:48:08]
=== Schedule Summary === 0.482097
[2025-12-03 16:48:08] Operation: 1|3|4|1|3|4|2
[2025-12-03 16:48:08] Makespan: 149400.000000 minutes
[2025-12-03 16:48:08] Total Tardiness: 0.000000 hours
[2025-12-03 16:48:08] Setup Time: 0.000000 minutes
[2025-12-03 16:48:08] Flow Time: 232800.000000 minutes
[2025-12-03 16:48:08] Machine Load Balance: 91.05%
[2025-12-03 16:48:08] -------------------------
[2025-12-03 16:48:08] [27000-41400]:[11-01 07:30-11-01 11:30] Order 1, Machine 3403, Operation 1, Batch 20000.0, processingTime %.1f
[27000-41400]:[11-01 07:30-11-01 11:30] 14400
[2025-12-03 16:48:08] [41400-65400]:[11-01 11:30-11-01 18:10] Order 1, Machine 3243, Operation 2, Batch 20000.0, processingTime %.1f
[41400-65400]:[11-01 11:30-11-01 18:10] 24000
[2025-12-03 16:48:08]
[2025-12-03 16:48:08] [27000-149400]:[11-01 07:30-11-02 17:30] Order 2, Machine 2183, Operation 3, Batch 20.0, processingTime %.1f
[27000-63000]:[11-01 07:30-11-01 17:30] 36000
[113400-149400]:[11-02 07:30-11-02 17:30] 36000
[2025-12-03 16:48:08]
[2025-12-03 16:48:08] [41400-55800]:[11-01 11:30-11-01 15:30] Order 3, Machine 3403, Operation 4, Batch 20000.0, processingTime %.1f
[41400-55800]:[11-01 11:30-11-01 15:30] 14400
[2025-12-03 16:48:08] [65400-89400]:[11-01 18:10-11-02 00:50] Order 3, Machine 3243, Operation 5, Batch 20000.0, processingTime %.1f
[65400-89400]:[11-01 18:10-11-02 00:50] 24000
[2025-12-03 16:48:08]
[2025-12-03 16:48:08] [55800-63000]:[11-01 15:30-11-01 17:30] Order 4, Machine 3403, Operation 6, Batch 10000.0, processingTime %.1f
[55800-63000]:[11-01 15:30-11-01 17:30] 7200
[2025-12-03 16:48:08] [89400-115800]:[11-02 00:50-11-02 08:10] Order 4, Machine 3243, Operation 7, Batch 10000.0, processingTime %.1f
[89400-99000]:[11-02 00:50-11-02 03:30] 9600
[113400-115800]:[11-02 07:30-11-02 08:10] 2400
[2025-12-03 16:48:08]
[2025-12-03 17:40:07]
=== Schedule Summary === 0.482097
[2025-12-03 17:40:07] Operation: 1|3|4|1|3|4|2
[2025-12-03 17:40:07] Makespan: 149400.000000 minutes
[2025-12-03 17:40:07] Total Tardiness: 0.000000 hours
[2025-12-03 17:40:07] Setup Time: 0.000000 minutes
[2025-12-03 17:40:07] Flow Time: 232800.000000 minutes
[2025-12-03 17:40:07] Machine Load Balance: 91.05%
[2025-12-03 17:40:07] -------------------------
[2025-12-03 17:40:07] [27000-41400]:[11-01 07:30-11-01 11:30] Order 1, Machine 3403, Operation 1, Batch 20000.0, processingTime %.1f
[27000-41400]:[11-01 07:30-11-01 11:30] 14400
[2025-12-03 17:40:07] [41400-65400]:[11-01 11:30-11-01 18:10] Order 1, Machine 3243, Operation 2, Batch 20000.0, processingTime %.1f
[41400-65400]:[11-01 11:30-11-01 18:10] 24000
[2025-12-03 17:40:07]
[2025-12-03 17:40:07] [27000-149400]:[11-01 07:30-11-02 17:30] Order 2, Machine 2183, Operation 3, Batch 20.0, processingTime %.1f
[27000-63000]:[11-01 07:30-11-01 17:30] 36000
[113400-149400]:[11-02 07:30-11-02 17:30] 36000
[2025-12-03 17:40:07]
[2025-12-03 17:40:07] [41400-48600]:[11-01 11:30-11-01 13:30] Order 3, Machine 3403, Operation 4, Batch 10000.0, processingTime %.1f
[41400-48600]:[11-01 11:30-11-01 13:30] 7200
[2025-12-03 17:40:07] [65400-77400]:[11-01 18:10-11-01 21:30] Order 3, Machine 3243, Operation 5, Batch 10000.0, processingTime %.1f
[65400-77400]:[11-01 18:10-11-01 21:30] 12000
[2025-12-03 17:40:07]
[2025-12-03 17:40:07] [48600-63000]:[11-01 13:30-11-01 17:30] Order 4, Machine 3403, Operation 6, Batch 20000.0, processingTime %.1f
[48600-63000]:[11-01 13:30-11-01 17:30] 14400
[2025-12-03 17:40:07] [77400-115800]:[11-01 21:30-11-02 08:10] Order 4, Machine 3243, Operation 7, Batch 20000.0, processingTime %.1f
[77400-99000]:[11-01 21:30-11-02 03:30] 21600
[113400-115800]:[11-02 07:30-11-02 08:10] 2400
[2025-12-03 17:40:07]
[2025-12-03 17:59:26]
=== Schedule Summary === 0.482097
[2025-12-03 17:59:26] Operation: 1|3|4|1|3|4|2
[2025-12-03 17:59:26] Makespan: 149400.000000 minutes
[2025-12-03 17:59:26] Total Tardiness: 0.000000 hours
[2025-12-03 17:59:26] Setup Time: 0.000000 minutes
[2025-12-03 17:59:26] Flow Time: 232800.000000 minutes
[2025-12-03 17:59:26] Machine Load Balance: 91.05%
[2025-12-03 17:59:26] -------------------------
[2025-12-03 17:59:26] [27000-41400]:[11-01 07:30-11-01 11:30] Order 1, Machine 3402, Operation 1, Batch 20000.0, processingTime %.1f
[27000-41400]:[11-01 07:30-11-01 11:30] 14400
[2025-12-03 17:59:26] [41400-65400]:[11-01 11:30-11-01 18:10] Order 1, Machine 3401, Operation 2, Batch 20000.0, processingTime %.1f
[41400-65400]:[11-01 11:30-11-01 18:10] 24000
[2025-12-03 17:59:26]
[2025-12-03 17:59:26] [27000-149400]:[11-01 07:30-11-02 17:30] Order 2, Machine 2183, Operation 3, Batch 20.0, processingTime %.1f
[27000-63000]:[11-01 07:30-11-01 17:30] 36000
[113400-149400]:[11-02 07:30-11-02 17:30] 36000
[2025-12-03 17:59:26]
[2025-12-03 17:59:26] [41400-55800]:[11-01 11:30-11-01 15:30] Order 3, Machine 3402, Operation 4, Batch 20000.0, processingTime %.1f
[41400-55800]:[11-01 11:30-11-01 15:30] 14400
[2025-12-03 17:59:26] [65400-89400]:[11-01 18:10-11-02 00:50] Order 3, Machine 3401, Operation 5, Batch 20000.0, processingTime %.1f
[65400-89400]:[11-01 18:10-11-02 00:50] 24000
[2025-12-03 17:59:26]
[2025-12-03 17:59:26] [55800-63000]:[11-01 15:30-11-01 17:30] Order 4, Machine 3402, Operation 6, Batch 10000.0, processingTime %.1f
[55800-63000]:[11-01 15:30-11-01 17:30] 7200
[2025-12-03 17:59:26] [89400-115800]:[11-02 00:50-11-02 08:10] Order 4, Machine 3401, Operation 7, Batch 10000.0, processingTime %.1f
[89400-99000]:[11-02 00:50-11-02 03:30] 9600
[113400-115800]:[11-02 07:30-11-02 08:10] 2400
[2025-12-03 17:59:26]
[2025-12-03 19:02:51]
=== Schedule Summary === 0.482097
[2025-12-03 19:02:51] Operation: 1|4|1|4|2
[2025-12-03 19:02:51] Makespan: 322200.000000 minutes
[2025-12-03 19:02:51] Total Tardiness: 0.000000 hours
[2025-12-03 19:02:51] Setup Time: 0.000000 minutes
[2025-12-03 19:02:51] Flow Time: 326460.000000 minutes
[2025-12-03 19:02:51] Machine Load Balance: 97.27%
[2025-12-03 19:02:51] -------------------------
[2025-12-03 19:02:51] [113400-127800]:[11-02 07:30-11-02 11:30] Order 1, Machine 3402, Operation 1, Batch 20000.0, processingTime %.1f
[113400-127800]:[11-02 07:30-11-02 11:30] 14400
[2025-12-03 19:02:51] [127800-151800]:[11-02 11:30-11-02 18:10] Order 1, Machine 3401, Operation 2, Batch 20000.0, processingTime %.1f
[127800-151800]:[11-02 11:30-11-02 18:10] 24000
[2025-12-03 19:02:51]
[2025-12-03 19:02:51] [199800-322200]:[11-03 07:30-11-04 17:30] Order 2, Machine 2183, Operation 3, Batch 20.0, processingTime %.1f
[199800-235800]:[11-03 07:30-11-03 17:30] 36000
[286200-322200]:[11-04 07:30-11-04 17:30] 36000
[2025-12-03 19:02:51]
[2025-12-03 19:02:51] [127800-221400]:[11-02 11:30-11-03 13:30] Order 4, Machine 3402, Operation 6, Batch 60000.0, processingTime %.1f
[127800-149400]:[11-02 11:30-11-02 17:30] 21600
[199800-221400]:[11-03 07:30-11-03 13:30] 21600
[2025-12-03 19:02:51] [221400-293460]:[11-03 13:30-11-04 09:31] Order 4, Machine 3401, Operation 7, Batch 60000.0, processingTime %.1f
[221400-286140]:[11-03 13:30-11-04 07:29] 64740
[286200-293460]:[11-04 07:30-11-04 09:31] 7260
[2025-12-03 19:02:51]
......@@ -133,8 +133,8 @@ public class ResourceGanttController {
return scheduleChromosomes;
}
@GetMapping("/Move")
public Chromosome Move(String SceneId,int opid,LocalDateTime newStartTime,
@GetMapping("/operationMove")
public Chromosome OperationMove(String SceneId,int opid,LocalDateTime newStartTime,
Long newMachineId) {
// opid=1;
// newStartTime= LocalDateTime.of(2025, 12, 7, 0, 0);
......@@ -146,8 +146,26 @@ public class ResourceGanttController {
// 提取所有场景ID
return scheduleChromosomes;
}
@PostMapping("/operationedit")
public Chromosome editOperation(@RequestParam String SceneId,
@RequestBody Entry operation) {
Chromosome scheduleChromosomes = planResultService.EditOperation(SceneId,operation);
@PostMapping("/SpiltOperation")
// 提取所有场景ID
return scheduleChromosomes;
}
@PostMapping("/changebasetime")
public Chromosome ChangeBaseTime(@RequestParam String SceneId,
@RequestParam LocalDateTime BaseTime) {
Chromosome scheduleChromosomes = planResultService.ChangeBaseTime(SceneId,BaseTime);
// 提取所有场景ID
return scheduleChromosomes;
}
@PostMapping("/operationspilt")
public Chromosome SpiltOperation(@RequestParam String SceneId,
@RequestParam int opid,
@RequestBody List<Double> splitCounts) {
......@@ -165,7 +183,7 @@ public class ResourceGanttController {
// 提取所有场景ID
return scheduleChromosomes;
}
@PostMapping("/delOperation")
@PostMapping("/operationdel")
public Chromosome DelOperation(@RequestParam String SceneId,
@RequestParam int opid) {
opid=1;
......@@ -177,7 +195,7 @@ public class ResourceGanttController {
// 提取所有场景ID
return scheduleChromosomes;
}
@PostMapping("/LockedOperation")
@PostMapping("/operationlocked")
public Chromosome LockedOperation(@RequestParam String SceneId,
@RequestParam int opid,@RequestParam boolean isLocked) {
opid=1;
......@@ -190,6 +208,47 @@ public class ResourceGanttController {
return scheduleChromosomes;
}
@PostMapping("/orderspilt")
public Chromosome SpiltOrder(@RequestParam String SceneId,
@RequestParam String orderid,
@RequestBody List<Double> splitCounts) {
orderid="fcc0892a-0483-4da7-8414-9ce98be36e53";
// newStartTime= LocalDateTime.of(2025, 12, 7, 0, 0);
// newMachineId=3402L;
splitCounts=new ArrayList<>();
splitCounts.add(20000d);
splitCounts.add(20000d);
splitCounts.add(10000d);
SceneId="B571EF6682DB463AB2977B1055A74112";
// 数组第一个是0,为复制
//splitCounts=new ArrayList<>();
// splitCounts.add(0);
// splitCounts.add(50000d);
// 调用 PlanResultService 获取 ScheduleChromosome 列表
Chromosome scheduleChromosomes = planResultService.SpiltOrder(SceneId,orderid,splitCounts.toArray(new Double[0]));
// 提取所有场景ID
return scheduleChromosomes;
}
@PostMapping("/ordermerge")
public Chromosome OrderMerge(@RequestParam String SceneId,
@RequestParam String sourceorderid,
@RequestParam String targetorderid) {
sourceorderid="5be078b725b34ade8b6638f74dad6b10";
targetorderid="2a0f23d2429f4e5da7b3929da75a803d";
SceneId="B571EF6682DB463AB2977B1055A74112";
// 调用 PlanResultService 获取 ScheduleChromosome 列表
Chromosome scheduleChromosomes = planResultService.MergeOrder(SceneId,sourceorderid,targetorderid);
// 提取所有场景ID
return scheduleChromosomes;
}
......
......@@ -65,6 +65,12 @@ public class Entry {
* 可选设备列表
*/
public List<MachineOption> MachineOptions ;
/**
* 选择的设备
*/
public Long SelectMachineID ;
/**
* 前工单ID
*/
......
......@@ -25,5 +25,5 @@ public class Order {
private boolean canSplit = false;
private boolean canInterrupt = false;
private double actualPriority;
private String mainId;
}
\ No newline at end of file
......@@ -152,21 +152,21 @@ public class GeneticAlgorithm {
// decoder.decodeChromosomeWithCache(chromosome, globalOpList, allOperations);
// chromosome.setFitness(fitnessCalc.calculateFitness(chromosome));
// });
population.forEach(chromosome -> {
chromosome.setResult(new ArrayList<>());
// 假设Machine类有拷贝方法,或使用MapStruct等工具进行映射
chromosome.setMachines(ProductionDeepCopyUtil.deepCopyList(machines)); // 简单拷贝,实际可能需要深拷贝
chromosome.setAllOperations(allOperations); // 简单拷贝,实际可能需要深拷贝
chromosome.setGlobalOpList(globalOpList); // 简单拷贝,实际可能需要深拷贝
Chromosome chromosomen= decoder.decodeChromosomeWithCache(chromosome);
if(chromosomen.getFitness()==0) {
chromosomen.setFitness(fitnessCalc.calculateFitness(chromosomen));
}
});
if(population!=null&&population.size()>0) {
population.forEach(chromosome -> {
chromosome.setResult(new ArrayList<>());
// 假设Machine类有拷贝方法,或使用MapStruct等工具进行映射
chromosome.setMachines(ProductionDeepCopyUtil.deepCopyList(machines)); // 简单拷贝,实际可能需要深拷贝
chromosome.setAllOperations(allOperations); // 简单拷贝,实际可能需要深拷贝
chromosome.setGlobalOpList(globalOpList); // 简单拷贝,实际可能需要深拷贝
Chromosome chromosomen = decoder.decodeChromosomeWithCache(chromosome);
if (chromosomen.getFitness() == 0) {
chromosomen.setFitness(fitnessCalc.calculateFitness(chromosomen));
}
});
}
}
}
......@@ -360,6 +360,7 @@ public class GeneticDecoder {
result.setOrderId(operation.getOrderId());
result.setProductId(operation.getProductId());
result.setMachineId(machine.getId());
operation.setSelectMachineID(machine.getId());
result.setQuantity(operation.getQuantity());
result.setStartTime(startTime);
result.setEndTime(endTime);
......
......@@ -381,10 +381,10 @@ public class IdGroupingWithDualSerial {
return newResults;
}
/**
* 添加新数据(支持仅孤立节点的场景
* 添加新数据(按连通性分组
* @param existingResults 已有分组结果
* @param newIdList 新数据的ID列表
* @param newChildIdList 新数据的ChildID列表(允许空值)
* @param newChildIdList 新数据的ChildID列表
* @return 包含新分组的结果列表
*/
public static List<GroupResult> addNewDataWithIsolatedGroup(List<GroupResult> existingResults, List<String> newIdList, List<String> newChildIdList) {
......@@ -396,38 +396,32 @@ public class IdGroupingWithDualSerial {
newChildIdList = new ArrayList<>();
}
// 1. 初始化数据结构
Set<String> allNewNodes = new HashSet<>(newIdList); // 所有新节点
Map<String, String> idToChild = new HashMap<>(); // 临时存储ID与ChildID的映射
// 1. 构建全量节点集合和父子映射
Set<String> allNodes = new HashSet<>();
Map<String, Set<String>> parentToChildren = new HashMap<>();
Map<String, Set<String>> childToParents = new HashMap<>();
// 构建ID→ChildID映射(处理空值)
for (int i = 0; i < newIdList.size(); i++) {
String id = newIdList.get(i);
String parentId = newIdList.get(i);
String childId = i < newChildIdList.size() ? newChildIdList.get(i) : "";
if (id != null && !id.trim().isEmpty()) {
idToChild.put(id, (childId == null ? "" : childId.trim()));
allNewNodes.add(id); // 确保ID被加入
if (!childId.trim().isEmpty()) {
allNewNodes.add(childId.trim()); // 子节点也加入
}
}
}
// 2. 分离孤立节点和关联节点
List<String> isolatedNodes = new ArrayList<>();
List<String> relationNodes = new ArrayList<>();
if (parentId == null || parentId.trim().isEmpty()) {
continue;
}
allNodes.add(parentId);
for (String node : allNewNodes) {
String childId = idToChild.getOrDefault(node, "");
// 孤立节点:无ChildID,且不是任何节点的ChildID
boolean isIsolated = childId.isEmpty() && !idToChild.values().contains(node);
if (isIsolated) {
isolatedNodes.add(node);
} else {
relationNodes.add(node);
if (childId == null || childId.trim().isEmpty()) {
continue;
}
allNodes.add(childId);
parentToChildren.computeIfAbsent(parentId, k -> new HashSet<>()).add(childId);
childToParents.computeIfAbsent(childId, k -> new HashSet<>()).add(parentId);
}
// 2. 识别连通分量(通过DFS)
List<Set<String>> connectedComponents = findConnectedComponents(allNodes, parentToChildren, childToParents);
// 3. 获取现有结果的最大全局序号
int maxGlobalSerial = existingResults.stream()
.flatMap(g -> g.getNodeInfoList().stream())
......@@ -436,19 +430,123 @@ public class IdGroupingWithDualSerial {
.orElse(0);
int[] globalCounter = {maxGlobalSerial + 1};
// 4. 处理关联节点(如果有)
if (!relationNodes.isEmpty()) {
GroupResult relationGroup = createRelationGroup(idToChild, relationNodes, globalCounter);
existingResults.add(relationGroup);
// 4. 为每个连通分量创建独立分组
for (Set<String> component : connectedComponents) {
GroupResult group = createGroupFromComponent(component, parentToChildren, childToParents, globalCounter);
existingResults.add(group);
}
// 5. 处理孤立节点(即使只有孤立节点也创建分组)
for (String isolatedNode : isolatedNodes) {
GroupResult isolatedGroup = createIsolatedGroup(isolatedNode, globalCounter);
existingResults.add(isolatedGroup);
return existingResults;
}
/**
* 识别连通分量(DFS)
*/
private static List<Set<String>> findConnectedComponents(Set<String> allNodes,
Map<String, Set<String>> parentToChildren,
Map<String, Set<String>> childToParents) {
List<Set<String>> components = new ArrayList<>();
Set<String> visited = new HashSet<>();
for (String node : allNodes) {
if (!visited.contains(node)) {
Set<String> component = new HashSet<>();
dfs(node, component, visited, parentToChildren, childToParents);
components.add(component);
}
}
return components;
}
/**
* DFS遍历连通分量
*/
private static void dfs(String node, Set<String> component, Set<String> visited,
Map<String, Set<String>> parentToChildren,
Map<String, Set<String>> childToParents) {
if (visited.contains(node)) {
return;
}
visited.add(node);
component.add(node);
// 遍历子节点
if (parentToChildren.containsKey(node)) {
for (String child : parentToChildren.get(node)) {
dfs(child, component, visited, parentToChildren, childToParents);
}
}
return existingResults;
// 遍历父节点(确保双向连通)
if (childToParents.containsKey(node)) {
for (String parent : childToParents.get(node)) {
dfs(parent, component, visited, parentToChildren, childToParents);
}
}
}
/**
* 从连通分量创建分组
*/
private static GroupResult createGroupFromComponent(Set<String> component,
Map<String, Set<String>> parentToChildren,
Map<String, Set<String>> childToParents,
int[] globalCounter) {
// 识别根节点(无父节点的节点)
List<String> rootNodes = component.stream()
.filter(node -> !childToParents.containsKey(node) || childToParents.get(node).isEmpty())
.collect(Collectors.toList());
if (rootNodes.isEmpty()) {
rootNodes.add(component.iterator().next()); // 兜底:取任意节点作为根
}
// BFS构建节点列表
List<NodeInfo> nodeList = new ArrayList<>();
Map<String, Integer> serialMap = new HashMap<>();
Queue<String> queue = new LinkedList<>(rootNodes);
Set<String> visited = new HashSet<>(rootNodes);
int groupCounter = 1;
// 处理根节点
for (String root : rootNodes) {
serialMap.put(root, globalCounter[0]);
nodeList.add(new NodeInfo(root, globalCounter[0]++, groupCounter++, new ArrayList<>(), new ArrayList<>()));
}
// 处理子节点
while (!queue.isEmpty()) {
String parent = queue.poll();
if (parentToChildren.containsKey(parent)) {
for (String child : parentToChildren.get(parent)) {
if (!component.contains(child) || visited.contains(child)) {
continue;
}
visited.add(child);
// 获取父节点的全局序号列表
List<Integer> parentSerials = childToParents.getOrDefault(child, new HashSet<>()).stream()
.filter(p -> serialMap.containsKey(p))
.map(serialMap::get)
.collect(Collectors.toList());
serialMap.put(child, globalCounter[0]);
nodeList.add(new NodeInfo(child, globalCounter[0]++, groupCounter++, parentSerials, new ArrayList<>()));
queue.add(child);
}
}
}
// 填充子ID列表
for (NodeInfo node : nodeList) {
String originalId = node.getOriginalId();
if (parentToChildren.containsKey(originalId)) {
List<Integer> childSerials = parentToChildren.get(originalId).stream()
.filter(c -> serialMap.containsKey(c))
.map(serialMap::get)
.collect(Collectors.toList());
node.setNewChildIds(childSerials);
}
}
return new GroupResult(nodeList, serialMap);
}
/**
* 创建关联节点的分组(20→21→22)
......
......@@ -10,8 +10,10 @@ import com.aps.entity.Algorithm.ScheduleResultDetail;
import com.aps.entity.basic.Entry;
import com.aps.entity.basic.GlobalParam;
import com.aps.entity.basic.MachineOption;
import com.aps.entity.basic.Order;
import com.aps.service.plan.MachineSchedulerService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.context.annotation.ScopeMetadata;
import javax.xml.transform.Result;
import java.time.LocalDateTime;
......@@ -219,6 +221,225 @@ public class ScheduleOperationService {
redecode(chromosome, chromosome.getBaseTime(), globalParam);
}
public void SpiltOrder(Chromosome chromosome, String orderId,Double[] splitCounts, GlobalParam globalParam)
{
List<Entry> allOperations = chromosome.getAllOperations();
List<Order> orders = chromosome.getOrders();
List<GroupResult> OperatRels = chromosome.getOperatRel();
List<Entry> targetOps = allOperations.stream()
.filter(o -> o.getOrderId().equals(orderId) )
.sorted(Comparator.comparing(Entry::getSequence))
.collect(Collectors.toList());
List<GAScheduleResult> targetSrs = chromosome.getResult().stream()
.filter(o -> o.getOrderId().equals(orderId))
.collect(Collectors.toList());
Order order=orders.stream()
.filter(o -> o.getOrderId().equals(orderId) )
.findFirst()
.orElseThrow(() -> new NoSuchElementException("Order not found: " + orderId));
int maxorderId =OperatRels.size() ;
int maxgroupId =maxorderId ;
//记录新的工序ID和数量
List<Entry> newEntrys=new ArrayList<>();
List<String> newIdList = new ArrayList<>();
List<String> newChildIdList = new ArrayList<>();
for (int i = 1; i < splitCounts.length; i++) {
maxorderId++;
Order neworder = ProductionDeepCopyUtil.deepCopy(order);
neworder.setOrderId(UUID.randomUUID().toString().replace("-", ""));
if(splitCounts[0]!=0&&i==1) {// 数组第一个是0,为复制
order.setQuantity(splitCounts[0]);
}else {
order.setQuantity(splitCounts[i]);
}
neworder.setMainId(order.getOrderId());
orders.add(neworder);
for (Entry entry : targetOps) {
if(splitCounts[0]!=0&&i==1) {// 数组第一个是0,为复制
entry.setQuantity(splitCounts[0]);
}
String newId = UUID.randomUUID().toString().replace("-", "");
Entry newOp = ProductionDeepCopyUtil.deepCopy(entry);
newOp.setExecId(newId);
newOp.setOrderId(neworder.getOrderId());
newOp.setGroupId(maxorderId);
newOp.setQuantity(splitCounts[i]);
newEntrys.add(newOp);
}
}
for (Entry entry : newEntrys) {
if(entry.getNextEntryIds().size()>0)
{
for (Integer id : entry.getNextEntryIds()) {
Entry nextentry= newEntrys.stream()
.filter(t->t.getGroupId()==entry.getGroupId()&&t.getId()==id)
.findFirst()
.orElse(null);
if(nextentry!=null) {
newIdList.add(entry.getExecId());
newChildIdList.add(nextentry.getExecId());
}
}
}else if(entry.getSequence()==1)
{
newIdList.add(entry.getExecId());
newChildIdList.add("");
}
}
// 添加新数据
OperatRels = IdGroupingWithDualSerial.addNewDataWithIsolatedGroup(OperatRels, newIdList, newChildIdList);
chromosome.setOperatRel(OperatRels);
//全局ID
int globalOpId = chromosome.getGlobalOpList().stream()
.mapToInt(GlobalOperationInfo::getGlobalOpId)
.max()
.orElse(0)+1;
for (int i = maxgroupId; i < OperatRels.size(); i++) {
GroupResult groupResult = OperatRels.get(i);
List<NodeInfo> nodeInfoList = groupResult.getNodeInfoList();
// System.out.println("分组" + (i + 1) + "顺序:" + nodeInfoList);
for (NodeInfo nodeInfo : nodeInfoList) {
Entry entry= newEntrys.stream()
.filter(t->t.getExecId().equals(nodeInfo.getOriginalId()))
.findFirst()
.orElse(null);
GAScheduleResult targetSr= targetSrs.stream()
.filter(t->t.getOperationId()==entry.getId())
.findFirst()
.orElse(null);
entry.setId(nodeInfo.getGlobalSerial());
entry.setGroupId(i+1);
entry.setSequence(nodeInfo.getGroupSerial());
entry.setExecId(nodeInfo.getOriginalId());
entry.setPrevEntryIds(nodeInfo.getNewParentIds());
entry.setNextEntryIds(nodeInfo.getNewChildIds());
entry.setMainId("");
entry.setState(2);
//工序基本信息
chromosome.getAllOperations().add(entry);
// 运算的全局变量
GlobalOperationInfo info = new GlobalOperationInfo();
info.setGlobalOpId(globalOpId);
info.setGroupId(entry.getGroupId());
info.setSequence(entry.getSequence());
info.setOp(entry);
chromosome.getGlobalOpList().add(info);
globalOpId++;
List<MachineOption> optionalMachines = entry.getMachineOptions();
OptionalInt index = IntStream.range(0, optionalMachines.size())
.filter(h -> targetSr.getMachineId()==optionalMachines.get(h).getMachineId())
.findFirst();
int machineSeq =index.orElse(0)+1 ;
chromosome.getMachineSelection().add(machineSeq);
}
}
for (Entry entry : targetOps) {
List<Integer> OperationSequencing= chromosome.getOperationSequencing();
OptionalInt OperationIndex = IntStream.range(0, OperationSequencing.size())
.filter(i -> OperationSequencing.get(i).equals(entry.GroupId)) // 过滤出值为1的索引
.skip(entry.Sequence-1) // 跳过第一个匹配项
.findFirst();
int targetOpIndex= OperationIndex.getAsInt()+1;
for (int i = maxgroupId; i < OperatRels.size(); i++) {
chromosome.getOperationSequencing().add(targetOpIndex, i+1);
targetOpIndex++;
}
}
redecode(chromosome, chromosome.getBaseTime(), globalParam);
}
public void MergeOrder(Chromosome chromosome, String sourceorderId,String targetorderId, GlobalParam globalParam) {
List<Entry> allOperations = chromosome.getAllOperations();
List<GlobalOperationInfo> globalOpList= chromosome.getGlobalOpList();
List<Order> orders = chromosome.getOrders();
List<Integer> OperationSequencing= chromosome.getOperationSequencing();
List<GAScheduleResult> ScheduleResults = chromosome.getResult();
Order sourceorder=orders.stream()
.filter(o -> o.getOrderId().equals(sourceorderId) )
.findFirst()
.orElseThrow(() -> new NoSuchElementException("Order not found: " + sourceorderId));
Order targetorder=orders.stream()
.filter(o -> o.getOrderId().equals(targetorderId) )
.findFirst()
.orElseThrow(() -> new NoSuchElementException("Order not found: " + targetorderId));
targetorder.setQuantity(targetorder.getQuantity()+sourceorder.getQuantity());
List<Entry> targetOps = allOperations.stream()
.filter(o -> o.getOrderId().equals(targetorderId) )
.sorted(Comparator.comparing(Entry::getSequence))
.collect(Collectors.toList());
for (Entry entry : targetOps) {
entry.setQuantity(entry.getQuantity()+sourceorder.getQuantity());
}
List<Entry> sourceOps = allOperations.stream()
.filter(o -> o.getOrderId().equals(sourceorderId) )
.sorted(Comparator.comparing(Entry::getSequence))
.collect(Collectors.toList());
int GroupId=0;
for (Entry entry : sourceOps) {
GroupId= entry.GroupId;
OptionalInt index = IntStream.range(0, allOperations.size())
.filter(h -> entry.getId()==allOperations.get(h).getId())
.findFirst();
allOperations.remove(index.orElse(0));
OptionalInt index1 = IntStream.range(0, globalOpList.size())
.filter(h -> entry.getId()==globalOpList.get(h).getOp().getId())
.findFirst();
globalOpList.remove(index1.orElse(0));
chromosome.getMachineSelection().remove(index1.orElse(0));
OptionalInt OperationIndex = IntStream.range(0, OperationSequencing.size())
.filter(i -> OperationSequencing.get(i).equals(entry.GroupId)) // 过滤出值为1的索引
.findFirst();
int targetOpIndex= OperationIndex.getAsInt();
OperationSequencing.remove(targetOpIndex);
OptionalInt OperationIndex1 = IntStream.range(0, ScheduleResults.size())
.filter(i -> ScheduleResults.get(i).getOperationId()==entry.getId()) // 过滤出值为1的索引
.findFirst();
//锁定需要删除
ScheduleResults.remove(OperationIndex1.getAsInt());
}
int i=0;
for (GlobalOperationInfo globalOp : globalOpList) {
globalOp.setGlobalOpId(i);
i++;
}
// chromosome.getOperatRel().remove(GroupId-1);
orders.remove(sourceorder);
redecode(chromosome, chromosome.getBaseTime(), globalParam);
}
public void LockOperation(Chromosome chromosome,int opId, boolean isLocked, GlobalParam globalParam)
{
GAScheduleResult targetResult = chromosome.getResult().stream()
......
......@@ -318,11 +318,24 @@ order.setDueDate(LocalDateTime.of(2025, 12, 1,0,0,0));
}
ScheduleOperationService ScheduleOperation=new ScheduleOperationService();
ScheduleParams param = new ScheduleParams();
param.setBaseTime(LocalDateTime.of(2025, 11, 1, 0, 0, 0));
GlobalParam globalParam=new GlobalParam();
ScheduleOperation.redecode(chromosome,param.getBaseTime(), globalParam);
ScheduleOperation.redecode(chromosome,chromosome.getBaseTime(), globalParam);
return chromosome;
}
public Chromosome ChangeBaseTime(String SceneId,LocalDateTime BaseTime) {
Chromosome chromosome= _sceneService.loadChromosomeFromFile(SceneId);
if (chromosome == null || chromosome.getAllOperations() == null) {
return chromosome; // 直接返回,空值由上层处理
}
chromosome.setBaseTime(BaseTime);
ScheduleOperationService ScheduleOperation=new ScheduleOperationService();
GlobalParam globalParam=new GlobalParam();
ScheduleOperation.redecode(chromosome,chromosome.getBaseTime(), globalParam);
return chromosome;
}
......@@ -372,7 +385,7 @@ order.setDueDate(LocalDateTime.of(2025, 12, 1,0,0,0));
ScheduleOperationService ScheduleOperation=new ScheduleOperationService();
ScheduleOperation.DelOperation(chromosome,opId, globalParam);
WriteScheduleSummary(chromosome);
// WriteScheduleSummary(chromosome);
_sceneService.saveChromosomeToFile(chromosome, SceneId);
return chromosome;
......@@ -389,11 +402,47 @@ order.setDueDate(LocalDateTime.of(2025, 12, 1,0,0,0));
ScheduleOperationService ScheduleOperation=new ScheduleOperationService();
ScheduleOperation.LockOperation(chromosome,opId,isLocked, globalParam);
//WriteScheduleSummary(chromosome);
_sceneService.saveChromosomeToFile(chromosome, SceneId);
return chromosome;
}
public Chromosome SpiltOrder(String SceneId,String orderId,Double[] splitCounts) {
GlobalParam globalParam=new GlobalParam();
Chromosome chromosome= _sceneService.loadChromosomeFromFile(SceneId);
//this.baseTime=param.getBaseTime();
// WriteScheduleSummary(chromosome);
ScheduleOperationService ScheduleOperation=new ScheduleOperationService();
ScheduleOperation.SpiltOrder(chromosome,orderId,splitCounts, globalParam);
WriteScheduleSummary(chromosome);
_sceneService.saveChromosomeToFile(chromosome, SceneId);
return chromosome;
}
public Chromosome MergeOrder(String SceneId,String sourceorderId,String targetorderId) {
GlobalParam globalParam=new GlobalParam();
Chromosome chromosome= _sceneService.loadChromosomeFromFile(SceneId);
//this.baseTime=param.getBaseTime();
// WriteScheduleSummary(chromosome);
ScheduleOperationService ScheduleOperation=new ScheduleOperationService();
ScheduleOperation.MergeOrder(chromosome,sourceorderId,targetorderId, globalParam);
WriteScheduleSummary(chromosome);
// _sceneService.saveChromosomeToFile(chromosome, SceneId);
return chromosome;
}
......@@ -452,6 +501,7 @@ order.setDueDate(LocalDateTime.of(2025, 12, 1,0,0,0));
// 5. 执行调度算法
GeneticAlgorithm scheduler =new GeneticAlgorithm(globalParam,machines,orders,null,machineScheduler); //new GeneticAlgorithm(products, machines, orders, machineScheduler);
Chromosome chromosomes =scheduler.Run(param,entrys);
chromosomes.setScenarioID(SceneId);
chromosomes.setBaseTime(param.getBaseTime());
chromosomes.setOperatRel(entryRel);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment