qap = Reader(path) # construct the problem Util.get_configuration() # get the best configuration of the ant system runs = [sys.maxsize for i in range(Params.singleton.MAX_RUN)] for t in range(Params.singleton.MAX_TRY): colony = Ants(qap.matrix_A, qap.matrix_B, Params.singleton.nb_ants, qap.size) colony.init_pheromone(1 / (Params.singleton.RHO * qap.size)) run = 0 start = time.time() while not terminal_condition(run, start): construct_solutions(colony) # build the solution for each ant if Params.singleton.lcs_flag: colony.local_search() # apply the local search update_pheromone( colony) # update the pheromone depending on the ant system save_run(run, colony) # Save the current run exit_run(run, colony) # Print the information about the run run += 1 save_best_run() # Save the the run that have the best results exit_trial(t) # Print the statistic about the trial runs = [sys.maxsize for i in range(Params.singleton.MAX_RUN)] get_best_solution_on_instance() # Retrieve the best try of the instance tries.clear()