input_tours_for_drones = 20 len_input_tours_for_drones = 7 aoi = utility.build_random_aoi(width_area, height_area, n_target, n_depots, hovering_time=5, seed=seed) depots = aoi.depots depot_first_drone = depots[0] tours_first_drone=[build_random_tour(aoi,depot_first_drone,np.random.randint(len_input_tours_for_drones - 5,len_input_tours_for_drones + 5)) for i in range(input_tours_for_drones)] depot_second_drone = depots[1] tours_second_drone=[build_random_tour(aoi,depot_second_drone,np.random.randint(len_input_tours_for_drones-5, len_input_tours_for_drones + 5)) for i in range(input_tours_for_drones)] uavs_to_tours = {drones[0]: tours_first_drone, drones[1]: tours_second_drone model = TotalCoverageModel(aoi, uavs_to_tours, max_rounds, debug=False) model.build() model.optimize() mrs = model.solution assert mrs is not None, "optimal solution not found" print("TC-OPT covers", mrs.coverage_score(), "targets using", mrs.max_rounds, "rounds") mrs.plot("TC-OPT") # for big istances (over 200/300 points) remove this plot mrs.plot_cumulative_coverage_for_round("TC-OPT") 以上为用Gurobi求解最优解问题,请解释如下两个问题: (1)如何选择input_tours_for_drones和len_input_tours_for_drones的值? (2)此程序在运行时如何调参?
时间: 2023-10-09 18:08:17 浏览: 80
webtours_login_success.jmx
(1) input_tours_for_drones和len_input_tours_for_drones的值需要根据实际问题进行调整。其中,input_tours_for_drones表示每个无人机需要完成的巡航任务数量,len_input_tours_for_drones表示每个巡航任务需要经过的目标数量。如果有更多的目标需要被覆盖,就需要增加input_tours_for_drones和len_input_tours_for_drones的值,以便增加巡航次数和目标数量,从而提高覆盖率和效率。
(2) 这个程序使用Gurobi进行求解,Gurobi是一个商业数学规划软件,有很多参数可以调整以优化求解结果。可以通过修改参数来控制求解器的行为,例如设置求解时间限制,选择求解算法,调整优化目标等等。在此程序中,可以通过修改max_rounds参数来控制最大巡航轮数,从而控制求解器的运行时间。同时,可以设置debug参数来查看求解器的详细输出信息,以便进行调试。
阅读全文