log_routes_folder = main_folder + 'logs/routes/' log_histories_folder = main_folder + 'logs/histories/' makedirs(log_measurements_folder, exist_ok=True) makedirs(log_routes_folder, exist_ok=True) makedirs(log_histories_folder, exist_ok=True) # Simulation object sim = Simulator(net_path, fleet_path, measurements_path, routes_path, history_path, mat_path, 5., main_folder=main_folder, std_factor=std_factor) # Drop time windows and save sim.network.drop_time_windows(filepath=sim.network_path) # Dispatcher to optimize dispatcher = Dispatcher.Dispatcher(sim.network_path, sim.fleet_path, sim.measurements_path, sim.routes_path, onGA_hyper_parameters=onGA_hyper_parameters) # Start loop non_altered = 0 while not sim.done(): if non_altered < keep: non_altered += 1 else: sim.disturb_network() non_altered = 0 sim.forward_fleet() sim.save_history() # Time when everything occurs log_time = datetime.today().strftime('%Y_%m_%d-%H_%M_%S')
MUTPB=0.6, weights=(0.1 / 2.218, 1. / 0.4364, 1. / 100, 1. / 500, 1.), K1=100000, K2=200000, keep_best=1, tournament_size=3, r=2, alpha_up=soc_policy[1], algorithm_name='onGA', crossover_repeat=1, mutation_repeat=1) dispatcher = Dispatcher.Dispatcher( net_path, fleet_path, measurements_path, routes_path, onGA_hyper_parameters=onGA_hyper_parameters) dispatcher.update() cp_info = dispatcher.synchronization() routes_from_critical_points = {} for id_ev in cp_info.keys(): r = dispatcher.routes[id_ev] j_critical = cp_info[id_ev][0] x1_0 = cp_info[id_ev][1] x2_0 = cp_info[id_ev][2] x3_0 = cp_info[id_ev][3] ev = dispatcher.fleet.vehicles[id_ev] ev.current_max_tour_duration = ev.max_tour_duration + dispatcher.depart_info[