From c6c7cb47f1609c8c8b1ec77a04caf3adc50aac1c Mon Sep 17 00:00:00 2001 From: weixin_46229132 Date: Sat, 5 Apr 2025 10:36:03 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B7=91=E5=AE=8C100=5F100=5F6=E7=9A=84?= =?UTF-8?q?=E5=AE=9E=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GA/main_parallel.py | 4 +- GA/sa_finetune.py | 4 +- params_100_100_6.yml | 2 +- solutions/dqn_params_100_100_6.json | 74 ---------------- solutions/finetune_params_100_100_6.json | 63 ++++++++++++++ solutions/greedy_params_100_100_6.json | 50 ++++------- .../trav_ga_params_100_100_6_parallel.json | 85 ++++++++----------- visualization.py | 2 +- 8 files changed, 123 insertions(+), 161 deletions(-) delete mode 100644 solutions/dqn_params_100_100_6.json create mode 100644 solutions/finetune_params_100_100_6.json diff --git a/GA/main_parallel.py b/GA/main_parallel.py index 026f0cf..f59df73 100644 --- a/GA/main_parallel.py +++ b/GA/main_parallel.py @@ -30,8 +30,8 @@ if __name__ == "__main__": # 重要:在 Windows 上必须加这一行 # --------------------------- # 需要修改的超参数 # --------------------------- - R = 10 - C = 10 + R = 7 + C = 7 params_file = 'params_100_100_6' batch_size = 60 # 控制一次最多并行多少个任务 diff --git a/GA/sa_finetune.py b/GA/sa_finetune.py index 5452018..da3c217 100644 --- a/GA/sa_finetune.py +++ b/GA/sa_finetune.py @@ -225,8 +225,8 @@ if __name__ == "__main__": # --------------------------- # 需要修改的超参数 # --------------------------- - solution_path = r"solutions\trav_ga_params_50_50_3_parallel.json" - params_file = r"params_50_50_3" + solution_path = r"solutions\trav_ga_params_100_100_6_parallel.json" + params_file = r"params_100_100_6" max_iterations=10000 initial_temp=100 cooling_rate=0.95 diff --git a/params_100_100_6.yml b/params_100_100_6.yml index 48b07dd..6d7d495 100644 --- a/params_100_100_6.yml +++ b/params_100_100_6.yml @@ -13,4 +13,4 @@ bs_time_factor : 5 # 机巢上每张照片计算时间 flight_energy_factor : 0.05 # 单位:分钟/张 comp_energy_factor : 0.05 # TODO 计算能耗需要重新估计 trans_energy_factor : 0.0025 -battery_energy_capacity : 20 # 无人机只进行飞行,续航为30分钟 \ No newline at end of file +battery_energy_capacity : 30 # 无人机只进行飞行,续航为30分钟 \ No newline at end of file diff --git a/solutions/dqn_params_100_100_6.json b/solutions/dqn_params_100_100_6.json deleted file mode 100644 index 5da2434..0000000 --- a/solutions/dqn_params_100_100_6.json +++ /dev/null @@ -1,74 +0,0 @@ -{ - "best_time": 19557.574055662244, - "row_cuts": [ - 0, - 0.2, - 0.5, - 0.7, - 1 - ], - "col_cuts": [ - 0, - 0.1, - 0.19, - 0.3, - 0.4, - 0.5, - 0.6, - 0.7, - 0.8, - 0.9, - 1 - ], - "best_path": [ - 0, - 17, - 10, - 9, - 8, - 7, - 6, - 5, - 0, - 28, - 29, - 30, - 19, - 20, - 18, - 16, - 43, - 27, - 40, - 39, - 38, - 37, - 36, - 26, - 45, - 14, - 13, - 12, - 11, - 22, - 21, - 23, - 24, - 41, - 25, - 44, - 34, - 35, - 33, - 32, - 31, - 42, - 15, - 4, - 3, - 2, - 1, - 0 - ], - "timestamp": "2025-04-04 10:47:47" -} \ No newline at end of file diff --git a/solutions/finetune_params_100_100_6.json b/solutions/finetune_params_100_100_6.json new file mode 100644 index 0000000..da76ccd --- /dev/null +++ b/solutions/finetune_params_100_100_6.json @@ -0,0 +1,63 @@ +{ + "row_boundaries": [ + 0.0, + 0.24000000000000005, + 0.41000000000000003, + 0.63, + 0.8, + 1.0 + ], + "col_boundaries": [ + 0.0, + 0.18, + 0.39, + 0.51, + 0.69, + 0.77, + 1.0 + ], + "car_paths": [ + [ + 29, + 28, + 27, + 26, + 20, + 14 + ], + [ + 12, + 6, + 0, + 1 + ], + [ + 13, + 7, + 2, + 3, + 9 + ], + [ + 22, + 21, + 23, + 17, + 16, + 15 + ], + [ + 8, + 11, + 5, + 4, + 10 + ], + [ + 19, + 24, + 25, + 18 + ] + ] +} \ No newline at end of file diff --git a/solutions/greedy_params_100_100_6.json b/solutions/greedy_params_100_100_6.json index af22109..f013327 100644 --- a/solutions/greedy_params_100_100_6.json +++ b/solutions/greedy_params_100_100_6.json @@ -10,12 +10,10 @@ ], "col_boundaries": [ 0, - 0.1504, - 0.3008, + 0.22560000000000002, 0.45120000000000005, - 0.6016, - 0.752, - 0.9024, + 0.6768000000000001, + 0.9024000000000001, 1 ], "car_paths": [ @@ -24,54 +22,42 @@ 1, 2, 3, - 4, - 5, - 6 + 4 ], [ + 5, + 6, 7, 8, - 9, + 9 + ], + [ 10, 11, 12, - 13 + 13, + 14 ], [ - 14, 15, 16, 17, 18, - 19, - 20 + 19 ], [ + 20, 21, 22, 23, - 24, + 24 + ], + [ 25, 26, - 27 - ], - [ + 27, 28, - 29, - 30, - 31, - 32, - 33, - 34 - ], - [ - 35, - 36, - 37, - 38, - 39, - 40, - 41 + 29 ] ] } \ No newline at end of file diff --git a/solutions/trav_ga_params_100_100_6_parallel.json b/solutions/trav_ga_params_100_100_6_parallel.json index d16466d..84575db 100644 --- a/solutions/trav_ga_params_100_100_6_parallel.json +++ b/solutions/trav_ga_params_100_100_6_parallel.json @@ -2,75 +2,62 @@ "row_boundaries": [ 0.0, 0.2, - 0.5, - 0.7, + 0.4, + 0.6, + 0.8, 1.0 ], "col_boundaries": [ 0.0, - 0.1, 0.2, - 0.3, 0.4, 0.5, - 0.6, 0.7, 0.8, - 0.9, 1.0 ], "car_paths": [ [ - 16, - 9, - 8, - 7, - 6, - 5, - 4 - ], - [ - 27, - 28, 29, - 18, - 19, - 17, - 15 + 28, + 27, + 26, + 20, + 14 ], [ - 26, - 39, - 38, - 37, - 36, - 35, - 25 + 12, + 6, + 0, + 1 ], [ 13, - 12, - 11, - 10, - 21, - 20, - 22, - 23 - ], - [ - 24, - 33, - 34, - 32, - 31, - 30 - ], - [ - 14, - 3, + 7, 2, - 1, - 0 + 3, + 9 + ], + [ + 22, + 21, + 23, + 17, + 16, + 15 + ], + [ + 8, + 11, + 5, + 4, + 10 + ], + [ + 19, + 24, + 25, + 18 ] ] } \ No newline at end of file diff --git a/visualization.py b/visualization.py index 7ac0434..e183909 100644 --- a/visualization.py +++ b/visualization.py @@ -200,7 +200,7 @@ if __name__ == "__main__": # 需要修改的超参数 # --------------------------- params_file = 'params_100_100_6' - solution_file = r'solutions\trav_ga_params_100_100_6_parallel.json' + solution_file = r'solutions\greedy_params_100_100_6.json' with open(params_file + '.yml', 'r', encoding='utf-8') as file: params = yaml.safe_load(file)