def setUp(self): self.config = import_test_configuration( config_file='Settings/UnitTestSettings.ini') self.sumo_cmd = set_sumo(self.config['gui'], self.config['sumocfg_file_name'], self.config['max_steps']) self.model_path_south, self.plot_path = set_test_path( self.config['models_path_name'] + "/South", self.config['model_to_test']) self.model_path_duxbury, self.plot_path = set_test_path( self.config['models_path_name'] + "/Duxbury", self.config['model_to_test']) self.Model_South = TestModel(self.config['num_states'], self.model_path_south) self.Model_Duxbury = TestModel(self.config['num_states'], self.model_path_duxbury) self.TrafficGen = MockGenerator(self.config['max_steps'], self.config['n_cars_generated'], self.config['episode_seed']) self.Simulation = Simulation( self.Model_South, self.Model_Duxbury, self.TrafficGen, self.sumo_cmd, self.config['max_steps'], self.config['green_duration'], self.config['yellow_duration'], self.config['num_states'], self.config['num_actions'], self.config['actions_file_name'], self.config['use_automatic_controller']) self.plot_path = 'Display_Data/Automatic'
from Common.Model import TrainModel from Common.Memory import Memory from Common.VehicleGenerator import VehicleGenerator, MockGenerator, RealWorldGenerator from Common.MongoConnection import MongoDBConnect # The entry point of the file. # # Once the file is executed it will run from this point. if __name__ == "__main__": # Configuration object used to setup simulation properties. config = import_train_configuration( config_file='Settings/TrainSettings.ini') # Sumo cmd object passed to the Simulation object. sumo_cmd = set_sumo(config['gui'], config['sumocfg_file_name'], config['max_steps']) plot_path = set_train_path(config['models_path_name']) plot_path_south = set_train_path(config['models_path_name'] + "/South") plot_path_duxbury = set_train_path(config['models_path_name'] + "/Duxbury") Model_South = TrainModel(config['num_layers'], config['width_layers'], config['batch_size'], config['learning_rate'], config['num_states'], config['num_actions']) Model_Duxbury = TrainModel(config['num_layers'], config['width_layers'], config['batch_size'], config['learning_rate'], config['num_states'], config['num_actions']) if config['use_mock_traffic']: