Example #1
0
        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')

            # Log measurements
            if log_online:
                log_measurements_path = log_measurements_folder + log_time + '.xml'
                Dispatcher.write_measurements(log_measurements_path, sim.measurements)

            # Optimize
            dispatcher.update()
            dispatcher.optimize_online(exec_time_filepath=exec_time_path)

            # Log routes after optimization
            if log_online:
                log_routes_path = log_routes_folder + log_time + '.xml'
                Dispatcher.write_routes(log_routes_path, dispatcher.routes, dispatcher.depart_info)
Example #2
0
 def write_measurements(self):
     Dispatcher.write_measurements(self.measurements_path,
                                   self.measurements,
                                   write_pretty=False)