예제 #1
0
    os.makedirs(bucket_dirname)

    landing_point_manager = PointManager(set(()), set(road_points))

    initial_cuts = Cuts(tree_points_arr, tree_points_kdtree, tree_weights_arr,
                        tree_basins_arr, landing_point_manager)
    initial_landings = Landings(landing_point_manager)

    landing_point_manager.subscribe_active_changes(
        initial_cuts.update_landings)

    for i in range(40):
        initial_landings.add_random_landing()

    initial_solution = Solution()
    initial_solution.add_component(initial_landings)
    initial_solution.add_component(initial_cuts)

    if heuristic_type == "RecordToRecord":
        heuristic = RecordToRecord()
    elif heuristic_type == "SimulatedAnnealing":
        heuristic = SimulatedAnnealing()

    heuristic.configure()

    solver = Solver(heuristic, initial_solution, bucket_dirname)

    final_solution, iteration_fitnesses = solver.solve()
    final_solution_json = final_solution.to_json()

    final_solution_path = os.path.join(