Commit cfcaec50 authored by Tong Li's avatar Tong Li

遗传算法

parent 79e47803
...@@ -65568,3 +65568,336 @@ ...@@ -65568,3 +65568,336 @@
[22480-22800]:[10-16 14:40-10-16 20:00] 时长320分钟 [22480-22800]:[10-16 14:40-10-16 20:00] 时长320分钟
[23520-24000]:[10-17 08:00-10-17 16:00] 时长480分钟 [23520-24000]:[10-17 08:00-10-17 16:00] 时长480分钟
[2025-11-28 09:25:03] [2025-11-28 09:25:03]
[2025-12-02 09:04:16]
=== Schedule Summary === 0.482097
[2025-12-02 09:04:16] Operation: 2|1|1
[2025-12-02 09:04:16] Makespan: 149400.000000 minutes
[2025-12-02 09:04:16] Total Tardiness: 0.000000 hours
[2025-12-02 09:04:16] Setup Time: 0.000000 minutes
[2025-12-02 09:04:16] Flow Time: 232800.000000 minutes
[2025-12-02 09:04:16] Machine Load Balance: 91.05%
[2025-12-02 09:04:16] -------------------------
[2025-12-02 09:17:48]
=== Schedule Summary === 0.482097
[2025-12-02 09:17:48] Operation: 2|1|1
[2025-12-02 09:17:48] Makespan: 149400.000000 minutes
[2025-12-02 09:17:48] Total Tardiness: 0.000000 hours
[2025-12-02 09:17:48] Setup Time: 0.000000 minutes
[2025-12-02 09:17:48] Flow Time: 232800.000000 minutes
[2025-12-02 09:17:48] Machine Load Balance: 91.05%
[2025-12-02 09:17:48] -------------------------
[2025-12-02 09:20:58]
=== Schedule Summary === 0.482097
[2025-12-02 09:20:58] Operation: 2|1|1
[2025-12-02 09:20:58] Makespan: 149400.000000 minutes
[2025-12-02 09:20:58] Total Tardiness: 0.000000 hours
[2025-12-02 09:20:58] Setup Time: 0.000000 minutes
[2025-12-02 09:20:58] Flow Time: 232800.000000 minutes
[2025-12-02 09:20:58] Machine Load Balance: 91.05%
[2025-12-02 09:20:58] -------------------------
[2025-12-02 09:25:21]
=== Schedule Summary === 0.482097
[2025-12-02 09:25:21] Operation: 2|1|1
[2025-12-02 09:25:21] Makespan: 149400.000000 minutes
[2025-12-02 09:25:21] Total Tardiness: 0.000000 hours
[2025-12-02 09:25:21] Setup Time: 0.000000 minutes
[2025-12-02 09:25:22] Flow Time: 232800.000000 minutes
[2025-12-02 09:25:22] Machine Load Balance: 91.05%
[2025-12-02 09:25:22] -------------------------
[2025-12-02 09:25:22] [27000-63000]:[10-19 18:00-11-13 18:00] Order 1, Machine 3403, Operation 1, Batch 50000.0, processingTime %.1f
[27000-63000]:[10-19 18:00-11-13 18:00] 36000
[2025-12-02 09:25:22] [63000-137400]:[11-13 18:00-01-04 10:00] Order 1, Machine 3243, Operation 2, Batch 50000.0, processingTime %.1f
[63000-99000]:[11-13 18:00-12-08 18:00] 36000
[113400-137400]:[12-18 18:00-01-04 10:00] 24000
[2025-12-02 09:25:22]
[2025-12-02 09:25:22] [27000-149400]:[10-19 18:00-01-12 18:00] Order 2, Machine 2183, Operation 3, Batch 20.0, processingTime %.1f
[27000-63000]:[10-19 18:00-11-13 18:00] 36000
[113400-149400]:[12-18 18:00-01-12 18:00] 36000
[2025-12-02 09:25:22]
[2025-12-02 09:33:47]
=== Schedule Summary === 0.482097
[2025-12-02 09:33:47] Operation: 2|1|1
[2025-12-02 09:33:47] Makespan: 149400.000000 minutes
[2025-12-02 09:33:47] Total Tardiness: 0.000000 hours
[2025-12-02 09:33:47] Setup Time: 0.000000 minutes
[2025-12-02 09:33:47] Flow Time: 232800.000000 minutes
[2025-12-02 09:33:47] Machine Load Balance: 91.05%
[2025-12-02 09:33:47] -------------------------
[2025-12-02 09:33:47] [27000-63000]:[10-19 18:00-11-13 18:00] Order 1, Machine 3403, Operation 1, Batch 50000.0, processingTime %.1f
[27000-63000]:[10-19 18:00-11-13 18:00] 36000
[2025-12-02 09:33:47] [63000-137400]:[11-13 18:00-01-04 10:00] Order 1, Machine 3243, Operation 2, Batch 50000.0, processingTime %.1f
[63000-99000]:[11-13 18:00-12-08 18:00] 36000
[113400-137400]:[12-18 18:00-01-04 10:00] 24000
[2025-12-02 09:33:47]
[2025-12-02 09:33:47] [27000-149400]:[10-19 18:00-01-12 18:00] Order 2, Machine 2183, Operation 3, Batch 20.0, processingTime %.1f
[27000-63000]:[10-19 18:00-11-13 18:00] 36000
[113400-149400]:[12-18 18:00-01-12 18:00] 36000
[2025-12-02 09:33:47]
[2025-12-02 09:37:24]
=== Schedule Summary === 0.482097
[2025-12-02 09:37:24] Operation: 2|1|1
[2025-12-02 09:37:24] Makespan: 149400.000000 minutes
[2025-12-02 09:37:24] Total Tardiness: 0.000000 hours
[2025-12-02 09:37:24] Setup Time: 0.000000 minutes
[2025-12-02 09:37:24] Flow Time: 232800.000000 minutes
[2025-12-02 09:37:24] Machine Load Balance: 91.05%
[2025-12-02 09:37:24] -------------------------
[2025-12-02 09:37:24] [27000-63000]:[10-19 18:00-11-13 18:00] Order 1, Machine 3403, Operation 1, Batch 50000.0, processingTime %.1f
[27000-63000]:[10-19 18:00-11-13 18:00] 36000
[2025-12-02 09:37:24] [63000-137400]:[11-13 18:00-01-04 10:00] Order 1, Machine 3243, Operation 2, Batch 50000.0, processingTime %.1f
[63000-99000]:[11-13 18:00-12-08 18:00] 36000
[113400-137400]:[12-18 18:00-01-04 10:00] 24000
[2025-12-02 09:37:24]
[2025-12-02 09:37:24] [27000-149400]:[10-19 18:00-01-12 18:00] Order 2, Machine 2183, Operation 3, Batch 20.0, processingTime %.1f
[27000-63000]:[10-19 18:00-11-13 18:00] 36000
[113400-149400]:[12-18 18:00-01-12 18:00] 36000
[2025-12-02 09:37:24]
[2025-12-02 09:49:24]
=== Schedule Summary === 0.482097
[2025-12-02 09:49:24] Operation: 2|1|1
[2025-12-02 09:49:24] Makespan: 149400.000000 minutes
[2025-12-02 09:49:24] Total Tardiness: 0.000000 hours
[2025-12-02 09:49:24] Setup Time: 0.000000 minutes
[2025-12-02 09:49:24] Flow Time: 232800.000000 minutes
[2025-12-02 09:49:24] Machine Load Balance: 91.05%
[2025-12-02 09:49:24] -------------------------
[2025-12-02 09:49:24] [27000-63000]:[10-19 18:00-11-13 18:00] Order 1, Machine 3403, Operation 1, Batch 50000.0, processingTime %.1f
[27000-63000]:[10-19 18:00-11-13 18:00] 36000
[2025-12-02 09:49:24] [63000-137400]:[11-13 18:00-01-04 10:00] Order 1, Machine 3243, Operation 2, Batch 50000.0, processingTime %.1f
[63000-99000]:[11-13 18:00-12-08 18:00] 36000
[113400-137400]:[12-18 18:00-01-04 10:00] 24000
[2025-12-02 09:49:24]
[2025-12-02 09:49:24] [27000-149400]:[10-19 18:00-01-12 18:00] Order 2, Machine 2183, Operation 3, Batch 20.0, processingTime %.1f
[27000-63000]:[10-19 18:00-11-13 18:00] 36000
[113400-149400]:[12-18 18:00-01-12 18:00] 36000
[2025-12-02 09:49:24]
[2025-12-02 09:52:15]
=== Schedule Summary === 0.482097
[2025-12-02 09:52:15] Operation: 2|1|1
[2025-12-02 09:52:15] Makespan: 3319860.000000 minutes
[2025-12-02 09:52:15] Total Tardiness: 0.000000 hours
[2025-12-02 09:52:15] Setup Time: 0.000000 minutes
[2025-12-02 09:52:15] Flow Time: 218460.000000 minutes
[2025-12-02 09:52:15] Machine Load Balance: 99.98%
[2025-12-02 09:52:15] -------------------------
[2025-12-02 09:52:15] [3223800-3259800]:[11-17 18:00-12-12 18:00] Order 1, Machine 3402, Operation 1, Batch 50000.0, processingTime %.1f
[3223800-3259800]:[11-17 18:00-12-12 18:00] 36000
[2025-12-02 09:52:15] [3259800-3319860]:[12-12 18:00-01-23 11:00] Order 1, Machine 3243, Operation 2, Batch 50000.0, processingTime %.1f
[3259800-3310140]:[12-12 18:00-01-16 17:00] 50340
[3310200-3319860]:[01-16 18:00-01-23 11:00] 9660
[2025-12-02 09:52:15]
[2025-12-02 09:52:15] [27000-149400]:[10-19 18:00-01-12 18:00] Order 2, Machine 2183, Operation 3, Batch 20.0, processingTime %.1f
[27000-63000]:[10-19 18:00-11-13 18:00] 36000
[113400-149400]:[12-18 18:00-01-12 18:00] 36000
[2025-12-02 09:52:15]
[2025-12-02 09:58:49]
=== Schedule Summary === 0.482097
[2025-12-02 09:58:49] Operation: 2|1|1
[2025-12-02 09:58:49] Makespan: 149400.000000 minutes
[2025-12-02 09:58:49] Total Tardiness: 0.000000 hours
[2025-12-02 09:58:49] Setup Time: 0.000000 minutes
[2025-12-02 09:58:49] Flow Time: 232800.000000 minutes
[2025-12-02 09:58:49] Machine Load Balance: 91.05%
[2025-12-02 09:58:49] -------------------------
[2025-12-02 09:58:49] [27000-63000]:[10-19 18:00-11-13 18:00] Order 1, Machine 3403, Operation 1, Batch 50000.0, processingTime %.1f
[27000-63000]:[10-19 18:00-11-13 18:00] 36000
[2025-12-02 09:58:49] [63000-137400]:[11-13 18:00-01-04 10:00] Order 1, Machine 3243, Operation 2, Batch 50000.0, processingTime %.1f
[63000-99000]:[11-13 18:00-12-08 18:00] 36000
[113400-137400]:[12-18 18:00-01-04 10:00] 24000
[2025-12-02 09:58:49]
[2025-12-02 09:58:49] [27000-149400]:[10-19 18:00-01-12 18:00] Order 2, Machine 2183, Operation 3, Batch 20.0, processingTime %.1f
[27000-63000]:[10-19 18:00-11-13 18:00] 36000
[113400-149400]:[12-18 18:00-01-12 18:00] 36000
[2025-12-02 09:58:49]
[2025-12-02 10:11:01]
=== Schedule Summary === 0.482097
[2025-12-02 10:11:01] Operation: 2|1|1
[2025-12-02 10:11:01] Makespan: 3319860.000000 minutes
[2025-12-02 10:11:01] Total Tardiness: 0.000000 hours
[2025-12-02 10:11:01] Setup Time: 0.000000 minutes
[2025-12-02 10:11:01] Flow Time: 218460.000000 minutes
[2025-12-02 10:11:01] Machine Load Balance: 99.98%
[2025-12-02 10:11:01] -------------------------
[2025-12-02 10:11:01] [3223800-3259800]:[11-17 18:00-12-12 18:00] Order 1, Machine 3402, Operation 1, Batch 50000.0, processingTime %.1f
[3223800-3259800]:[11-17 18:00-12-12 18:00] 36000
[2025-12-02 10:11:01] [3259800-3319860]:[12-12 18:00-01-23 11:00] Order 1, Machine 3243, Operation 2, Batch 50000.0, processingTime %.1f
[3259800-3310140]:[12-12 18:00-01-16 17:00] 50340
[3310200-3319860]:[01-16 18:00-01-23 11:00] 9660
[2025-12-02 10:11:01]
[2025-12-02 10:11:01] [27000-149400]:[10-19 18:00-01-12 18:00] Order 2, Machine 2183, Operation 3, Batch 20.0, processingTime %.1f
[27000-63000]:[10-19 18:00-11-13 18:00] 36000
[113400-149400]:[12-18 18:00-01-12 18:00] 36000
[2025-12-02 10:11:01]
[2025-12-02 10:17:34]
=== Schedule Summary === 0.482097
[2025-12-02 10:17:34] Operation: 2|1|1
[2025-12-02 10:17:34] Makespan: 149400.000000 minutes
[2025-12-02 10:17:34] Total Tardiness: 0.000000 hours
[2025-12-02 10:17:34] Setup Time: 0.000000 minutes
[2025-12-02 10:17:34] Flow Time: 232800.000000 minutes
[2025-12-02 10:17:34] Machine Load Balance: 91.05%
[2025-12-02 10:17:34] -------------------------
[2025-12-02 10:17:34] [27000-63000]:[10-01 07:30-10-01 17:30] Order 1, Machine 3403, Operation 1, Batch 50000.0, processingTime %.1f
[27000-63000]:[10-01 07:30-10-01 17:30] 36000
[2025-12-02 10:17:34] [63000-137400]:[10-01 17:30-10-02 14:10] Order 1, Machine 3243, Operation 2, Batch 50000.0, processingTime %.1f
[63000-99000]:[10-01 17:30-10-02 03:30] 36000
[113400-137400]:[10-02 07:30-10-02 14:10] 24000
[2025-12-02 10:17:34]
[2025-12-02 10:17:34] [27000-149400]:[10-01 07:30-10-02 17:30] Order 2, Machine 2183, Operation 3, Batch 20.0, processingTime %.1f
[27000-63000]:[10-01 07:30-10-01 17:30] 36000
[113400-149400]:[10-02 07:30-10-02 17:30] 36000
[2025-12-02 10:17:34]
[2025-12-02 10:18:35]
=== Schedule Summary === 0.482097
[2025-12-02 10:18:35] Operation: 2|1|1
[2025-12-02 10:18:35] Makespan: 3247800.000000 minutes
[2025-12-02 10:18:35] Total Tardiness: 0.000000 hours
[2025-12-02 10:18:35] Setup Time: 0.000000 minutes
[2025-12-02 10:18:35] Flow Time: 232800.000000 minutes
[2025-12-02 10:18:35] Machine Load Balance: 99.98%
[2025-12-02 10:18:35] -------------------------
[2025-12-02 10:18:35] [3137400-3173400]:[11-06 07:30-11-06 17:30] Order 1, Machine 3402, Operation 1, Batch 50000.0, processingTime %.1f
[3137400-3173400]:[11-06 07:30-11-06 17:30] 36000
[2025-12-02 10:18:35] [3173400-3247800]:[11-06 17:30-11-07 14:10] Order 1, Machine 3243, Operation 2, Batch 50000.0, processingTime %.1f
[3173400-3209400]:[11-06 17:30-11-07 03:30] 36000
[3223800-3247800]:[11-07 07:30-11-07 14:10] 24000
[2025-12-02 10:18:35]
[2025-12-02 10:18:35] [27000-149400]:[10-01 07:30-10-02 17:30] Order 2, Machine 2183, Operation 3, Batch 20.0, processingTime %.1f
[27000-63000]:[10-01 07:30-10-01 17:30] 36000
[113400-149400]:[10-02 07:30-10-02 17:30] 36000
[2025-12-02 10:18:35]
[2025-12-02 10:24:35]
=== Schedule Summary === 0.482097
[2025-12-02 10:24:35] Operation: 2|1|1
[2025-12-02 10:24:35] Makespan: 149400.000000 minutes
[2025-12-02 10:24:35] Total Tardiness: 0.000000 hours
[2025-12-02 10:24:35] Setup Time: 0.000000 minutes
[2025-12-02 10:24:35] Flow Time: 232800.000000 minutes
[2025-12-02 10:24:35] Machine Load Balance: 91.05%
[2025-12-02 10:24:35] -------------------------
[2025-12-02 10:24:35] [27000-63000]:[10-01 07:30-10-01 17:30] Order 1, Machine 3403, Operation 1, Batch 50000.0, processingTime %.1f
[27000-63000]:[10-01 07:30-10-01 17:30] 36000
[2025-12-02 10:24:35] [63000-137400]:[10-01 17:30-10-02 14:10] Order 1, Machine 3243, Operation 2, Batch 50000.0, processingTime %.1f
[63000-99000]:[10-01 17:30-10-02 03:30] 36000
[113400-137400]:[10-02 07:30-10-02 14:10] 24000
[2025-12-02 10:24:35]
[2025-12-02 10:24:35] [27000-149400]:[10-01 07:30-10-02 17:30] Order 2, Machine 2183, Operation 3, Batch 20.0, processingTime %.1f
[27000-63000]:[10-01 07:30-10-01 17:30] 36000
[113400-149400]:[10-02 07:30-10-02 17:30] 36000
[2025-12-02 10:24:35]
[2025-12-02 10:24:54]
=== Schedule Summary === 0.482097
[2025-12-02 10:24:54] Operation: 2|1|1
[2025-12-02 10:24:54] Makespan: 3247800.000000 minutes
[2025-12-02 10:24:54] Total Tardiness: 0.000000 hours
[2025-12-02 10:24:54] Setup Time: 0.000000 minutes
[2025-12-02 10:24:54] Flow Time: 232800.000000 minutes
[2025-12-02 10:24:54] Machine Load Balance: 99.98%
[2025-12-02 10:24:54] -------------------------
[2025-12-02 10:24:54] [3137400-3173400]:[11-06 07:30-11-06 17:30] Order 1, Machine 3402, Operation 1, Batch 50000.0, processingTime %.1f
[3137400-3173400]:[11-06 07:30-11-06 17:30] 36000
[2025-12-02 10:24:54] [3173400-3247800]:[11-06 17:30-11-07 14:10] Order 1, Machine 3243, Operation 2, Batch 50000.0, processingTime %.1f
[3173400-3209400]:[11-06 17:30-11-07 03:30] 36000
[3223800-3247800]:[11-07 07:30-11-07 14:10] 24000
[2025-12-02 10:24:54]
[2025-12-02 10:24:54] [27000-149400]:[10-01 07:30-10-02 17:30] Order 2, Machine 2183, Operation 3, Batch 20.0, processingTime %.1f
[27000-63000]:[10-01 07:30-10-01 17:30] 36000
[113400-149400]:[10-02 07:30-10-02 17:30] 36000
[2025-12-02 10:24:54]
[2025-12-02 10:28:00]
=== Schedule Summary === 0.482097
[2025-12-02 10:28:00] Operation: 2|1|1
[2025-12-02 10:28:00] Makespan: 149400.000000 minutes
[2025-12-02 10:28:00] Total Tardiness: 0.000000 hours
[2025-12-02 10:28:00] Setup Time: 0.000000 minutes
[2025-12-02 10:28:00] Flow Time: 232800.000000 minutes
[2025-12-02 10:28:00] Machine Load Balance: 91.05%
[2025-12-02 10:28:00] -------------------------
[2025-12-02 10:28:05] [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-02 10:28:05] [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-02 10:28:05]
[2025-12-02 10:28:05] [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-02 10:28:05]
[2025-12-02 10:28:11]
=== Schedule Summary === 0.482097
[2025-12-02 10:28:11] Operation: 2|1|1
[2025-12-02 10:28:11] Makespan: 3247800.000000 minutes
[2025-12-02 10:28:11] Total Tardiness: 0.000000 hours
[2025-12-02 10:28:11] Setup Time: 0.000000 minutes
[2025-12-02 10:28:11] Flow Time: 232800.000000 minutes
[2025-12-02 10:28:11] Machine Load Balance: 99.98%
[2025-12-02 10:28:11] -------------------------
[2025-12-02 10:28:11] [3137400-3173400]:[12-07 07:30-12-07 17:30] Order 1, Machine 3402, Operation 1, Batch 50000.0, processingTime %.1f
[3137400-3173400]:[12-07 07:30-12-07 17:30] 36000
[2025-12-02 10:28:11] [3173400-3247800]:[12-07 17:30-12-08 14:10] Order 1, Machine 3243, Operation 2, Batch 50000.0, processingTime %.1f
[3173400-3209400]:[12-07 17:30-12-08 03:30] 36000
[3223800-3247800]:[12-08 07:30-12-08 14:10] 24000
[2025-12-02 10:28:11]
[2025-12-02 10:28:11] [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-02 10:28:11]
[2025-12-02 11:30:27]
=== Schedule Summary === 0.482097
[2025-12-02 11:30:27] Operation: 2|1|1
[2025-12-02 11:30:27] Makespan: 149400.000000 minutes
[2025-12-02 11:30:27] Total Tardiness: 0.000000 hours
[2025-12-02 11:30:27] Setup Time: 0.000000 minutes
[2025-12-02 11:30:27] Flow Time: 232800.000000 minutes
[2025-12-02 11:30:27] Machine Load Balance: 91.05%
[2025-12-02 11:30:27] -------------------------
[2025-12-02 11:30:27] [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-02 11:30:27] [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-02 11:30:27]
[2025-12-02 11:30:27] [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-02 11:30:27]
[2025-12-02 11:30:27]
=== Schedule Summary === 0.482097
[2025-12-02 11:30:27] Operation: 2|1|1
[2025-12-02 11:30:27] Makespan: 3247800.000000 minutes
[2025-12-02 11:30:27] Total Tardiness: 0.000000 hours
[2025-12-02 11:30:27] Setup Time: 0.000000 minutes
[2025-12-02 11:30:27] Flow Time: 232800.000000 minutes
[2025-12-02 11:30:27] Machine Load Balance: 99.98%
[2025-12-02 11:30:27] -------------------------
[2025-12-02 11:30:27] [3137400-3173400]:[12-07 07:30-12-07 17:30] Order 1, Machine 3402, Operation 1, Batch 50000.0, processingTime %.1f
[3137400-3173400]:[12-07 07:30-12-07 17:30] 36000
[2025-12-02 11:30:27] [3173400-3247800]:[12-07 17:30-12-08 14:10] Order 1, Machine 3243, Operation 2, Batch 50000.0, processingTime %.1f
[3173400-3209400]:[12-07 17:30-12-08 03:30] 36000
[3223800-3247800]:[12-08 07:30-12-08 14:10] 24000
[2025-12-02 11:30:27]
[2025-12-02 11:30:27] [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-02 11:30:27]
[2025-12-02 19:40:14]
=== Schedule Summary === 0.482097
[2025-12-02 19:40:14] Operation: 2|1|1|1
[2025-12-02 19:40:14] Makespan: 149400.000000 minutes
[2025-12-02 19:40:14] Total Tardiness: 0.000000 hours
[2025-12-02 19:40:14] Setup Time: 0.000000 minutes
[2025-12-02 19:40:14] Flow Time: 232800.000000 minutes
[2025-12-02 19:40:14] Machine Load Balance: 91.05%
[2025-12-02 19:40:14] -------------------------
[2025-12-02 19:40:14] [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-02 19:40:14] [41400-115800]:[11-01 11:30-11-02 08:10] Order 1, Machine 3243, Operation 2, Batch 50000.0, processingTime %.1f
[41400-99000]:[11-01 11:30-11-02 03:30] 57600
[113400-115800]:[11-02 07:30-11-02 08:10] 2400
[2025-12-02 19:40:14] [41400-63000]:[11-01 11:30-11-01 17:30] Order 1, Machine 3403, Operation 4, Batch 30000.0, processingTime %.1f
[41400-63000]:[11-01 11:30-11-01 17:30] 21600
[2025-12-02 19:40:14]
[2025-12-02 19:40:14] [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-02 19:40:14]
...@@ -15,13 +15,11 @@ import io.swagger.v3.oas.annotations.tags.Tag; ...@@ -15,13 +15,11 @@ import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.temporal.ChronoUnit;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -136,14 +134,64 @@ public class ResourceGanttController { ...@@ -136,14 +134,64 @@ public class ResourceGanttController {
} }
@GetMapping("/Move") @GetMapping("/Move")
public Chromosome Move(String SceneId,int opid,LocalDateTime newStartTime,
Long newMachineId) {
// opid=1;
// newStartTime= LocalDateTime.of(2025, 12, 7, 0, 0);
// newMachineId=3402L;
// SceneId="B571EF6682DB463AB2977B1055A74112";
// 调用 PlanResultService 获取 ScheduleChromosome 列表
Chromosome scheduleChromosomes = planResultService.Move(SceneId,opid,newStartTime,newMachineId);
// 提取所有场景ID
return scheduleChromosomes;
}
@PostMapping("/SpiltOperation")
public Chromosome SpiltOperation(@RequestParam String SceneId,
@RequestParam int opid,
@RequestBody List<Double> splitCounts) {
opid=1;
// newStartTime= LocalDateTime.of(2025, 12, 7, 0, 0);
// newMachineId=3402L;
splitCounts=new ArrayList<>();
splitCounts.add(20000d);
splitCounts.add(30000d);
SceneId="B571EF6682DB463AB2977B1055A74112";
public Chromosome Move() {
// 调用 PlanResultService 获取 ScheduleChromosome 列表 // 调用 PlanResultService 获取 ScheduleChromosome 列表
Chromosome scheduleChromosomes = planResultService.Move("B571EF6682DB463AB2977B1055A74112"); Chromosome scheduleChromosomes = planResultService.SpiltOperation(SceneId,opid,splitCounts.toArray(new Double[0]));
// 提取所有场景ID // 提取所有场景ID
return scheduleChromosomes; return scheduleChromosomes;
} }
@PostMapping("/delOperation")
public Chromosome DelOperation(@RequestParam String SceneId,
@RequestParam int opid) {
opid=1;
SceneId="B571EF6682DB463AB2977B1055A74112";
// 调用 PlanResultService 获取 ScheduleChromosome 列表
Chromosome scheduleChromosomes = planResultService.DelOperation(SceneId,opid);
// 提取所有场景ID
return scheduleChromosomes;
}
@PostMapping("/LockedOperation")
public Chromosome LockedOperation(@RequestParam String SceneId,
@RequestParam int opid,@RequestParam boolean isLocked) {
opid=1;
SceneId="B571EF6682DB463AB2977B1055A74112";
// 调用 PlanResultService 获取 ScheduleChromosome 列表
Chromosome scheduleChromosomes = planResultService.LockOperation(SceneId,opid,isLocked);
// 提取所有场景ID
return scheduleChromosomes;
}
/** /**
* 将 ScheduleChromosome 转换为 ResourceGanttVO 列表 * 将 ScheduleChromosome 转换为 ResourceGanttVO 列表
......
...@@ -27,7 +27,8 @@ public class GAScheduleResult { ...@@ -27,7 +27,8 @@ public class GAScheduleResult {
private double Quantity; // 批次大小(订单可拆分) private double Quantity; // 批次大小(订单可拆分)
private List<ScheduleResultDetail> GeneDetails; // 时间详情 private List<ScheduleResultDetail> GeneDetails; // 时间详情
private int designatedStartTime = -1; // 设计开始时间(默认-1) private int designatedStartTime = -1; // 设计开始时间(默认-1)
private int forcedMachineId = -1; // 强制分配的设备ID(-1表示无强制) private Long forcedMachineId =-1L; // 强制分配的设备ID(-1表示无强制)
private boolean IsLocked=false;
private double OneTime; // 单件工时 private double OneTime; // 单件工时
private double ProcessingTime; // 绝对处理时间(分钟) private double ProcessingTime; // 绝对处理时间(分钟)
private int ChangeoverTime; private int ChangeoverTime;
......
...@@ -25,15 +25,26 @@ public class Entry { ...@@ -25,15 +25,26 @@ public class Entry {
public int GroupId ; public int GroupId ;
/** /**
* 所属组ID 需要按照前后顺序生产的工单给一组 * 原订单ID
*/ */
public String OrderId ; public String OrderId ;
private Long routingDetailId;
private Long taskSeq;
private String routingDetailName;
private String productId; private String productId;
/** /**
* 工单ID * 工单ID
*/ */
public String ExecId ; public String ExecId ;
/**
* 工单ID
*/
public String MainId;
/** /**
* 离散参数 * 离散参数
*/ */
...@@ -64,6 +75,11 @@ public class Entry { ...@@ -64,6 +75,11 @@ public class Entry {
*/ */
public List<Integer> NextEntryIds ;//后工序 public List<Integer> NextEntryIds ;//后工序
/**
* 数据状态 1 拆分 2 新建
*/
public Integer state ;
/** /**
* 是否可中断,间缝插针 * 是否可中断,间缝插针
*/ */
......
...@@ -131,7 +131,7 @@ public class GeneticAlgorithm { ...@@ -131,7 +131,7 @@ public class GeneticAlgorithm {
break; break;
} }
} }
best.setBaseTime(param.getBaseTime());
best.setInitMachines(ProductionDeepCopyUtil.deepCopyList(machines)); best.setInitMachines(ProductionDeepCopyUtil.deepCopyList(machines));
best.setOrders(orders); best.setOrders(orders);
// 步骤3:返回最优解 // 步骤3:返回最优解
......
...@@ -168,6 +168,16 @@ public class GeneticDecoder { ...@@ -168,6 +168,16 @@ public class GeneticDecoder {
Entry currentOp = orderOps.get(scheduledCount); Entry currentOp = orderOps.get(scheduledCount);
int opSequence = currentOp.getSequence(); int opSequence = currentOp.getSequence();
GAScheduleResult existingResult = chromosome.getResultOld().stream()
.filter(r-> r.getOperationId() == currentOp.Id)
.findFirst().orElse(null);
if(existingResult!=null) {
if(existingResult.isIsLocked())
{
continue;
}
}
// 从映射表中获取机器和加工时间 // 从映射表中获取机器和加工时间
OpMachine machineOption=opMachineMap.stream() OpMachine machineOption=opMachineMap.stream()
.filter(m -> m.getGroupId() == groupId&&m.getSequence()==opSequence) .filter(m -> m.getGroupId() == groupId&&m.getSequence()==opSequence)
...@@ -356,6 +366,7 @@ public class GeneticDecoder { ...@@ -356,6 +366,7 @@ public class GeneticDecoder {
result.setTeardownTime(teardownTime); result.setTeardownTime(teardownTime);
if(existingResult!=null) { if(existingResult!=null) {
result.setDesignatedStartTime(existingResult.getDesignatedStartTime()); result.setDesignatedStartTime(existingResult.getDesignatedStartTime());
} }
result.setOneTime(processingTime); result.setOneTime(processingTime);
......
...@@ -215,7 +215,7 @@ public class IdGroupingWithDualSerial { ...@@ -215,7 +215,7 @@ public class IdGroupingWithDualSerial {
* @return 更新后的结果 * @return 更新后的结果
*/ */
public static List<GroupResult> addNode(List<GroupResult> existingResults, int targetGroupIndex, public static List<GroupResult> addNode(List<GroupResult> existingResults, int targetGroupIndex,
String newId, List<Integer> newParentIds, List<Integer> newChildIds) { String newId, List<Integer> newParentIds, List<Integer> newChildIds,String insertAfterOriginalId) {
// 1. 空值安全检查 // 1. 空值安全检查
if (existingResults == null || existingResults.isEmpty() || targetGroupIndex < 0 || targetGroupIndex >= existingResults.size()) { if (existingResults == null || existingResults.isEmpty() || targetGroupIndex < 0 || targetGroupIndex >= existingResults.size()) {
throw new IllegalArgumentException("无效的现有结果或目标分组索引"); throw new IllegalArgumentException("无效的现有结果或目标分组索引");
...@@ -244,12 +244,26 @@ public class IdGroupingWithDualSerial { ...@@ -244,12 +244,26 @@ public class IdGroupingWithDualSerial {
newGlobalSerial++; newGlobalSerial++;
} }
// 5. 找到新节点的插入位置(父节点之后)
// 5. 找到插入位置:优先插入到指定节点之后,否则插入到父节点之后
int insertIndex = 0; int insertIndex = 0;
for (int i = 0; i < nodeList.size(); i++) { // 定位要插入到其后的节点(如"20")
NodeInfo node = nodeList.get(i); if (insertAfterOriginalId != null && !insertAfterOriginalId.trim().isEmpty()) {
if (newParentIds.contains(node.getGlobalSerial())) { for (int i = 0; i < nodeList.size(); i++) {
insertIndex = i + 1; // 插入到最后一个父节点之后 NodeInfo node = nodeList.get(i);
if (insertAfterOriginalId.equals(node.getOriginalId())) {
insertIndex = i + 1; // 插入到指定节点之后
break;
}
}
}
// 若未找到指定节点,回退到父节点之后的逻辑
if (insertIndex == 0) {
for (int i = 0; i < nodeList.size(); i++) {
NodeInfo node = nodeList.get(i);
if (newParentIds.contains(node.getGlobalSerial())) {
insertIndex = i + 1;
}
} }
} }
...@@ -528,7 +542,7 @@ public class IdGroupingWithDualSerial { ...@@ -528,7 +542,7 @@ public class IdGroupingWithDualSerial {
int targetGroupIndex = 1; // 分组2的索引 int targetGroupIndex = 1; // 分组2的索引
// 添加新节点 // 添加新节点
results = addNode(results, targetGroupIndex, newId, newParentIds, newChildIds); results = addNode(results, targetGroupIndex, newId, newParentIds, newChildIds,"");
List<String> newIdList = Arrays.asList("20", "21", "24"); List<String> newIdList = Arrays.asList("20", "21", "24");
...@@ -540,6 +554,7 @@ public class IdGroupingWithDualSerial { ...@@ -540,6 +554,7 @@ public class IdGroupingWithDualSerial {
results = deleteNodeByGlobalSerial(results, 13); results = deleteNodeByGlobalSerial(results, 13);
// 输出结果 // 输出结果
for (int i = 0; i < results.size(); i++) { for (int i = 0; i < results.size(); i++) {
GroupResult groupResult = results.get(i); GroupResult groupResult = results.get(i);
......
...@@ -4,17 +4,20 @@ import com.aps.common.util.ProductionDeepCopyUtil; ...@@ -4,17 +4,20 @@ import com.aps.common.util.ProductionDeepCopyUtil;
import com.aps.entity.Algorithm.Chromosome; import com.aps.entity.Algorithm.Chromosome;
import com.aps.entity.Algorithm.GAScheduleResult; import com.aps.entity.Algorithm.GAScheduleResult;
import com.aps.entity.Algorithm.GlobalOperationInfo; import com.aps.entity.Algorithm.GlobalOperationInfo;
import com.aps.entity.Algorithm.IDAndChildID.GroupResult;
import com.aps.entity.Algorithm.IDAndChildID.NodeInfo;
import com.aps.entity.Algorithm.ScheduleResultDetail;
import com.aps.entity.basic.Entry; import com.aps.entity.basic.Entry;
import com.aps.entity.basic.GlobalParam; import com.aps.entity.basic.GlobalParam;
import com.aps.entity.basic.MachineOption; import com.aps.entity.basic.MachineOption;
import com.aps.service.plan.MachineSchedulerService; import com.aps.service.plan.MachineSchedulerService;
import org.apache.commons.lang3.StringUtils;
import javax.xml.transform.Result; import javax.xml.transform.Result;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List; import java.util.*;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.IntStream;
/** /**
* 作者:佟礼 * 作者:佟礼
...@@ -27,11 +30,10 @@ public class ScheduleOperationService { ...@@ -27,11 +30,10 @@ public class ScheduleOperationService {
* @param opId 工序ID * @param opId 工序ID
* @param newStartTime 新开始时间 * @param newStartTime 新开始时间
* @param newMachineId 新设备ID * @param newMachineId 新设备ID
* @param baseTime 基准时间
*/ */
public void moveOperation(Chromosome chromosome, int opId, int newStartTime, public void moveOperation(Chromosome chromosome, int opId, int newStartTime,
int newMachineId, LocalDateTime baseTime, GlobalParam globalParam) { Long newMachineId, GlobalParam globalParam) {
List<Entry> allOperations=chromosome.getAllOperations(); List<Entry> allOperations = chromosome.getAllOperations();
// 获取目标结果和工序 // 获取目标结果和工序
GAScheduleResult targetResult = chromosome.getResult().stream() GAScheduleResult targetResult = chromosome.getResult().stream()
.filter(r -> r.getOperationId() == opId) .filter(r -> r.getOperationId() == opId)
...@@ -48,8 +50,7 @@ public class ScheduleOperationService { ...@@ -48,8 +50,7 @@ public class ScheduleOperationService {
.collect(Collectors.toList()) .collect(Collectors.toList())
.indexOf(newMachineId) + 1; .indexOf(newMachineId) + 1;
if(machineOptionIndex==0) if (machineOptionIndex == 0) {
{
throw new NoSuchElementException("Machine not found: " + newMachineId); throw new NoSuchElementException("Machine not found: " + newMachineId);
} }
...@@ -65,9 +66,6 @@ public class ScheduleOperationService { ...@@ -65,9 +66,6 @@ public class ScheduleOperationService {
.orElseThrow(() -> new NoSuchElementException("Global operation not found: " + opId)); .orElseThrow(() -> new NoSuchElementException("Global operation not found: " + opId));
chromosome.getMachineSelection().set(globalOpIndex, machineOptionIndex); chromosome.getMachineSelection().set(globalOpIndex, machineOptionIndex);
// 生成新的工序顺序 // 生成新的工序顺序
...@@ -91,19 +89,271 @@ public class ScheduleOperationService { ...@@ -91,19 +89,271 @@ public class ScheduleOperationService {
.collect(Collectors.toList()); .collect(Collectors.toList());
chromosome.setOperationSequencing(operationSequencing); chromosome.setOperationSequencing(operationSequencing);
// 重新解码
redecode(chromosome, chromosome.getBaseTime(), globalParam);
}
public void SpiltOperation(Chromosome chromosome, int opId,Double[] splitCounts, GlobalParam globalParam)
{
List<Entry> allOperations = chromosome.getAllOperations();
List<GroupResult> OperatRels = chromosome.getOperatRel();
Entry targetOp = allOperations.stream()
.filter(o -> o.getId() == opId)
.findFirst()
.orElseThrow(() -> new NoSuchElementException("Operation not found: " + opId));
GAScheduleResult targetSr = chromosome.getResult().stream()
.filter(o -> o.getOperationId() == opId)
.findFirst()
.orElseThrow(() -> new NoSuchElementException("Operation not found: " + opId));
// 找到原来的组和父子级
GroupResult groupResult = OperatRels.get(targetOp.GroupId-1);
List<NodeInfo> nodeInfoList = groupResult.getNodeInfoList();
NodeInfo Oprel = nodeInfoList.stream()
.filter(o -> o.getGlobalSerial() == opId)
.findFirst()
.orElseThrow(() -> new NoSuchElementException("Operation not found: " + opId));
int targetGroupIndex = targetOp.GroupId - 1;
List<Integer> newParentIds = Oprel.getNewParentIds();
List<Integer> newChildIds = Oprel.getNewChildIds();
//记录新的工序ID和数量
Map<String,Double> newids=new HashMap<>();
String MainId = UUID.randomUUID().toString().replace("-", "");
for (int i=0;i<splitCounts.length;i++) {
String newId = UUID.randomUUID().toString().replace("-", "");
if (i == 0) {
newids.put(targetOp.ExecId, splitCounts[i]);
} else {
newids.put(newId, splitCounts[i]);
// 添加新节点
OperatRels = IdGroupingWithDualSerial.addNode(OperatRels, targetGroupIndex, newId, newParentIds, newChildIds,targetOp.getExecId());
}
}
chromosome.setOperatRel(OperatRels);
//当前组的
groupResult = OperatRels.get(targetGroupIndex);
nodeInfoList = groupResult.getNodeInfoList();
//全局ID
int globalOpId = chromosome.getGlobalOpList().stream()
.mapToInt(GlobalOperationInfo::getGlobalOpId)
.max()
.orElse(0)+1;
//找到原工序用的设备序号
List<MachineOption> optionalMachines = targetOp.getMachineOptions();
OptionalInt index = IntStream.range(0, optionalMachines.size())
.filter(i -> targetSr.getMachineId()==optionalMachines.get(i).getMachineId())
.findFirst();
int machineSeq =index.orElse(0)+1 ;
List<Integer> OperationSequencing= chromosome.getOperationSequencing();
OptionalInt OperationIndex = IntStream.range(0, OperationSequencing.size())
.filter(i -> OperationSequencing.get(i).equals(targetOp.GroupId)) // 过滤出值为1的索引
.skip(targetOp.Sequence-1) // 跳过第一个匹配项
.findFirst(); // 取第二个匹配项
int targetOpIndex= OperationIndex.getAsInt()+1;
for (NodeInfo nodeInfo : nodeInfoList) {
Entry entry = allOperations.stream()
.filter(o -> o.getId() == nodeInfo.getGlobalSerial())
.findFirst()
.orElse(null);
if(entry!=null)
{
//存在则修改顺和前后序
entry.setSequence(nodeInfo.getGroupSerial());
entry.setPrevEntryIds(nodeInfo.getNewParentIds());
entry.setNextEntryIds(nodeInfo.getNewChildIds());
GlobalOperationInfo info= chromosome.getGlobalOpList().stream()
.filter(t->t.getOp().getId()==entry.getId())
.findFirst()
.orElse(null);
if(info!=null) {
info.setSequence(nodeInfo.getGroupSerial());
}
if(entry.getId()==targetOp.getId())
{
entry.setMainId(MainId);
entry.setState(1);
entry.setQuantity(newids.get(nodeInfo.getOriginalId()));
}
}else {
//不存在创建新的
Entry newOp = ProductionDeepCopyUtil.deepCopy(targetOp);
newOp.setId(nodeInfo.getGlobalSerial());
newOp.setSequence(nodeInfo.getGroupSerial());
newOp.setExecId(nodeInfo.getOriginalId());
newOp.setPrevEntryIds(nodeInfo.getNewParentIds());
newOp.setNextEntryIds(nodeInfo.getNewChildIds());
newOp.setQuantity(newids.get(nodeInfo.getOriginalId()));
newOp.setMainId(MainId);
newOp.setState(2);
//工序基本信息
chromosome.getAllOperations().add(newOp);
// 运算的全局变量
GlobalOperationInfo info = new GlobalOperationInfo();
info.setGlobalOpId(globalOpId);
info.setGroupId(newOp.getGroupId());
info.setSequence(newOp.getSequence());
info.setOp(newOp);
chromosome.getGlobalOpList().add(info);
globalOpId++;
//排产的机器选择部分
chromosome.getMachineSelection().add(machineSeq);
chromosome.getOperationSequencing().add(targetOpIndex,newOp.getGroupId());
targetOpIndex++;
}
}
redecode(chromosome, chromosome.getBaseTime(), globalParam);
}
public void LockOperation(Chromosome chromosome,int opId, boolean isLocked, GlobalParam globalParam)
{
GAScheduleResult targetResult = chromosome.getResult().stream()
.filter(r -> r.getOperationId() == opId)
.findFirst()
.orElseThrow(() -> new NoSuchElementException("Operation not found: " + opId));
targetResult.setIsLocked(isLocked);
// 若解锁,重新解码受影响工序
if (!isLocked)
{
redecode(chromosome, chromosome.getBaseTime(), globalParam);
}
}
public void DelOperation(Chromosome chromosome, int opId, GlobalParam globalParam) {
List<Entry> allOperations = chromosome.getAllOperations();
List<GroupResult> OperatRels = chromosome.getOperatRel();
OperatRels = IdGroupingWithDualSerial.deleteNodeByGlobalSerial(OperatRels, opId);
chromosome.setOperatRel(OperatRels);
Entry targetOp = allOperations.stream()
.filter(o -> o.getId() == opId)
.findFirst()
.orElseThrow(() -> new NoSuchElementException("Operation not found: " + opId));
List<Entry> entrys = allOperations.stream()
.filter(o -> o.GroupId == targetOp.GroupId)
.collect(Collectors.toList());
//当前组的
GroupResult groupResult = OperatRels.get(targetOp.GroupId-1);
List<NodeInfo> nodeInfoList = groupResult.getNodeInfoList();
nodeInfoList = groupResult.getNodeInfoList();
for (Entry entry : entrys) {
NodeInfo node = nodeInfoList.stream()
.filter(o -> o.getGlobalSerial() == entry.getId())
.findFirst()
.orElse(null);
if(node!=null)
{
entry.setSequence(node.getGroupSerial());
entry.setPrevEntryIds(node.getNewParentIds());
entry.setNextEntryIds(node.getNewChildIds());
GlobalOperationInfo info= chromosome.getGlobalOpList().stream()
.filter(t->t.getOp().getId()==entry.getId())
.findFirst()
.orElse(null);
if(info!=null) {
info.setSequence(node.getGroupSerial());
}
}else {
if(StringUtils.isBlank(entry.getMainId())) {
//拆分的工序数量补齐到其他的
Entry main = entrys.stream().
filter(t -> t.MainId == entry.getMainId())
.findFirst()
.orElse(null);
if (main != null) {
main.setQuantity(main.getQuantity() + entry.getQuantity());
}
}
}
}
List<Integer> OperationSequencing= chromosome.getOperationSequencing();
OptionalInt OperationIndex = IntStream.range(0, OperationSequencing.size())
.filter(i -> OperationSequencing.get(i).equals(targetOp.GroupId)) // 过滤出值为1的索引
.skip(targetOp.Sequence-1) // 跳过第一个匹配项
.findFirst();
chromosome.getOperationSequencing().remove(OperationIndex.getAsInt());
List<GlobalOperationInfo> globalOpList = chromosome.getGlobalOpList();
// 优化解码 int globalOpIndex = IntStream.range(0, globalOpList.size())
.filter(i -> globalOpList.get(i).getOp().getId() == opId)
.findFirst()
.orElseThrow(() -> new NoSuchElementException("Global operation not found: " + opId));
chromosome.getMachineSelection().remove(globalOpIndex);
globalOpList.remove(globalOpIndex);
List<Entry> operations = chromosome.getAllOperations();
IntStream.range(0, operations.size())
.filter(i -> operations.get(i).getId() == opId)
.findFirst()
.ifPresent(operations::remove);
List<GAScheduleResult> results = chromosome.getResult();
IntStream.range(0, results.size())
.filter(i -> results.get(i).getOperationId() == opId)
.findFirst()
.ifPresent(results::remove);
redecode(chromosome, chromosome.getBaseTime(), globalParam);
}
/**
* 重新解码
* @param chromosome 原方案
* @param baseTime 基础时间
* @param globalParam 全局参数
*/
public void redecode(Chromosome chromosome,LocalDateTime baseTime, GlobalParam globalParam)
{
MachineSchedulerService machineScheduler = new MachineSchedulerService(baseTime); MachineSchedulerService machineScheduler = new MachineSchedulerService(baseTime);
GeneticDecoder decoder = new GeneticDecoder(globalParam,baseTime, chromosome.getInitMachines(), GeneticDecoder decoder = new GeneticDecoder(globalParam,baseTime, chromosome.getInitMachines(),
chromosome.getOrders(), null, machineScheduler); chromosome.getOrders(), null, machineScheduler);
chromosome.setMachines(chromosome.getInitMachines()); chromosome.setMachines(chromosome.getInitMachines());
chromosome.setResultOld(ProductionDeepCopyUtil.deepCopyList(chromosome.getResult())); chromosome.setResultOld(ProductionDeepCopyUtil.deepCopyList(chromosome.getResult()));
chromosome.getResult().clear(); chromosome.getResult().clear();
List<GAScheduleResult> Resultlock= chromosome.getResult().stream()
.filter(o -> o.isIsLocked() == true)
.collect(Collectors.toList());
chromosome.setResult(ProductionDeepCopyUtil.deepCopyList(Resultlock));
decoder.decode(chromosome); decoder.decode(chromosome);
if(chromosome.getFitness()==0) { if(chromosome.getFitness()==0) {
FitnessCalculator fitnessCalc = new FitnessCalculator(); FitnessCalculator fitnessCalc = new FitnessCalculator();
chromosome.setFitness(fitnessCalc.calculateFitness(chromosome)); chromosome.setFitness(fitnessCalc.calculateFitness(chromosome));
} }
} }
} }
...@@ -30,6 +30,7 @@ import java.time.format.DateTimeFormatter; ...@@ -30,6 +30,7 @@ import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit; import java.time.temporal.ChronoUnit;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.IntStream;
@Service @Service
public class PlanResultService { public class PlanResultService {
...@@ -65,7 +66,7 @@ public class PlanResultService { ...@@ -65,7 +66,7 @@ public class PlanResultService {
@Autowired @Autowired
private ProdOrderProcessService _prodOrderProcessService; private ProdOrderProcessService _prodOrderProcessService;
private final LocalDateTime baseTime = LocalDateTime.of(2025, 10, 1, 0, 0, 0); private LocalDateTime baseTime = LocalDateTime.of(2025, 11, 1, 0, 0, 0);
public List<ScheduleChromosome> execute() { public List<ScheduleChromosome> execute() {
try { try {
...@@ -228,7 +229,7 @@ order.setDueDate(LocalDateTime.of(2025, 12, 1,0,0,0)); ...@@ -228,7 +229,7 @@ order.setDueDate(LocalDateTime.of(2025, 12, 1,0,0,0));
WriteScheduleSummary(Chromosomes); WriteScheduleSummary(Chromosomes);
ScheduleOperationService ScheduleOperation=new ScheduleOperationService(); ScheduleOperationService ScheduleOperation=new ScheduleOperationService();
LocalDateTime ds= LocalDateTime.of(2025, 12, 7, 23, 59); LocalDateTime ds= LocalDateTime.of(2025, 12, 7, 23, 59);
ScheduleOperation.moveOperation(Chromosomes,3, (int)ChronoUnit.SECONDS.between(param.getBaseTime(), ds),2,param.getBaseTime(), globalParam); // ScheduleOperation.moveOperation(Chromosomes,3, (int)ChronoUnit.SECONDS.between(param.getBaseTime(), ds),(Long)2,param.getBaseTime(), globalParam);
WriteScheduleSummary(Chromosomes); WriteScheduleSummary(Chromosomes);
return Chromosomes; return Chromosomes;
...@@ -296,24 +297,112 @@ order.setDueDate(LocalDateTime.of(2025, 12, 1,0,0,0)); ...@@ -296,24 +297,112 @@ order.setDueDate(LocalDateTime.of(2025, 12, 1,0,0,0));
throw new RuntimeException("调度执行失败", e); throw new RuntimeException("调度执行失败", e);
} }
} }
public Chromosome Move(String SceneId) {
public Chromosome EditOperation(String SceneId,Entry operation) {
Chromosome chromosome= _sceneService.loadChromosomeFromFile(SceneId);
if (chromosome == null || chromosome.getAllOperations() == null) {
return chromosome; // 直接返回,空值由上层处理
}
List<Entry> operations = chromosome.getAllOperations();
// 直接查找匹配元素的索引(避免先找元素再查索引的冗余)
int position = IntStream.range(0, operations.size())
.filter(i -> {
Entry t = operations.get(i);
return t.getId()==operation.getId();
})
.findFirst()
.orElse(-1);
// 索引有效时替换
if (position != -1) {
operations.set(position, operation);
}
ScheduleOperationService ScheduleOperation=new ScheduleOperationService();
ScheduleParams param = new ScheduleParams(); ScheduleParams param = new ScheduleParams();
param.setBaseTime(LocalDateTime.of(2025, 11, 1, 0, 0, 0)); param.setBaseTime(LocalDateTime.of(2025, 11, 1, 0, 0, 0));
GlobalParam globalParam=new GlobalParam();
ScheduleOperation.redecode(chromosome,param.getBaseTime(), globalParam);
return chromosome;
}
public Chromosome Move(String SceneId,int opId, LocalDateTime newStartTime,
Long newMachineId) {
GlobalParam globalParam=new GlobalParam(); GlobalParam globalParam=new GlobalParam();
Chromosome chromosome= _sceneService.loadChromosomeFromFile(SceneId); Chromosome chromosome= _sceneService.loadChromosomeFromFile(SceneId);
// WriteScheduleSummary(chromosome);
ScheduleOperationService ScheduleOperation=new ScheduleOperationService();
ScheduleOperation.moveOperation(chromosome,opId, (int)ChronoUnit.SECONDS.between(chromosome.getBaseTime(), newStartTime),newMachineId, globalParam);
// WriteScheduleSummary(chromosome);
_sceneService.saveChromosomeToFile(chromosome, SceneId);
return chromosome;
}
public Chromosome SpiltOperation(String SceneId,int opId,Double[] splitCounts) {
GlobalParam globalParam=new GlobalParam();
Chromosome chromosome= _sceneService.loadChromosomeFromFile(SceneId);
//this.baseTime=param.getBaseTime();
// WriteScheduleSummary(chromosome);
ScheduleOperationService ScheduleOperation=new ScheduleOperationService();
ScheduleOperation.SpiltOperation(chromosome,opId,splitCounts, globalParam);
WriteScheduleSummary(chromosome); WriteScheduleSummary(chromosome);
_sceneService.saveChromosomeToFile(chromosome, SceneId);
return chromosome;
}
public Chromosome DelOperation(String SceneId,int opId) {
GlobalParam globalParam=new GlobalParam();
Chromosome chromosome= _sceneService.loadChromosomeFromFile(SceneId);
//this.baseTime=param.getBaseTime();
// WriteScheduleSummary(chromosome);
ScheduleOperationService ScheduleOperation=new ScheduleOperationService();
ScheduleOperation.DelOperation(chromosome,opId, globalParam);
WriteScheduleSummary(chromosome);
_sceneService.saveChromosomeToFile(chromosome, SceneId);
return chromosome;
}
public Chromosome LockOperation(String SceneId,int opId,boolean isLocked) {
GlobalParam globalParam=new GlobalParam();
Chromosome chromosome= _sceneService.loadChromosomeFromFile(SceneId);
//this.baseTime=param.getBaseTime();
// WriteScheduleSummary(chromosome);
ScheduleOperationService ScheduleOperation=new ScheduleOperationService(); ScheduleOperationService ScheduleOperation=new ScheduleOperationService();
LocalDateTime ds= LocalDateTime.of(2025, 12, 7, 23, 59);
ScheduleOperation.moveOperation(chromosome,2, (int)ChronoUnit.SECONDS.between(param.getBaseTime(), ds),2,param.getBaseTime(), globalParam); ScheduleOperation.LockOperation(chromosome,opId,isLocked, globalParam);
WriteScheduleSummary(chromosome); WriteScheduleSummary(chromosome);
// _sceneService.saveChromosomeToFile(chromosome, SceneId); _sceneService.saveChromosomeToFile(chromosome, SceneId);
return chromosome; return chromosome;
} }
public Chromosome schedule(String SceneId) {
public Chromosome schedule(String SceneId) {
try { try {
ScheduleParams param = new ScheduleParams(); ScheduleParams param = new ScheduleParams();
...@@ -400,11 +489,9 @@ order.setDueDate(LocalDateTime.of(2025, 12, 1,0,0,0)); ...@@ -400,11 +489,9 @@ order.setDueDate(LocalDateTime.of(2025, 12, 1,0,0,0));
.collect(Collectors.toList()); .collect(Collectors.toList());
for (GAScheduleResult job : sortedJobs) { for (GAScheduleResult job : sortedJobs) {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append(String.format( sb.append(String.format(
"[%d-%d]:[%s-%s] Order %d, Machine %d, Operation %d, Batch %d, processingTime %d", "[%d-%d]:[%s-%s] Order %d, Machine %d, Operation %d, Batch %.1f, processingTime %%.1f",
job.getStartTime(), job.getStartTime(),
job.getEndTime(), job.getEndTime(),
ConvertTime(job.getStartTime()), ConvertTime(job.getStartTime()),
...@@ -436,7 +523,7 @@ order.setDueDate(LocalDateTime.of(2025, 12, 1,0,0,0)); ...@@ -436,7 +523,7 @@ order.setDueDate(LocalDateTime.of(2025, 12, 1,0,0,0));
} }
} }
private String ConvertTime(int minute) { private String ConvertTime(int minute) {
return baseTime.plusMinutes(minute).format(java.time.format.DateTimeFormatter.ofPattern("MM-dd HH:mm")); return baseTime.plusSeconds(minute).format(java.time.format.DateTimeFormatter.ofPattern("MM-dd HH:mm"));
} }
/** /**
...@@ -666,6 +753,9 @@ order.setDueDate(LocalDateTime.of(2025, 12, 1,0,0,0)); ...@@ -666,6 +753,9 @@ order.setDueDate(LocalDateTime.of(2025, 12, 1,0,0,0));
{ {
entry.setOrderId(op.getOrderId()); entry.setOrderId(op.getOrderId());
entry.setQuantity(op.getPlanQty()); entry.setQuantity(op.getPlanQty());
entry.setRoutingDetailId(op.getRoutingDetailId());
entry.setTaskSeq(op.getTaskSeq());
entry.setRoutingDetailName(op.getRoutingDetailName());
ProdLaunchOrder order = ProdLaunchOrders.stream() ProdLaunchOrder order = ProdLaunchOrders.stream()
.filter(t -> t.getOrderId().equals(op.getOrderId())) .filter(t -> t.getOrderId().equals(op.getOrderId()))
.findFirst().orElse(null); .findFirst().orElse(null);
...@@ -681,8 +771,10 @@ order.setDueDate(LocalDateTime.of(2025, 12, 1,0,0,0)); ...@@ -681,8 +771,10 @@ order.setDueDate(LocalDateTime.of(2025, 12, 1,0,0,0));
MachineOption mo = new MachineOption(); MachineOption mo = new MachineOption();
mo.setMachineId(e.getEquipId()); mo.setMachineId(e.getEquipId());
mo.setProcessingTime(e.getSpeed()); mo.setProcessingTime(e.getSpeed());
// mo.setContantTime(op.getConstTime()); mo.setContantTime(op.getConstTime());
// mo.setTeardownTime(op.getPostprocessingTime()); mo.setSetupTime(op.getChangeLineTime());
mo.setTeardownTime(op.getPostprocessingTime());
mo.setPreTime(e.getSetupTime());
mos.add(mo); mos.add(mo);
} }
......
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