示例#1
0
    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'
示例#2
0
    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']:
        TrafficGen = MockGenerator(config['max_steps'],
                                   config['n_cars_generated'],
                                   config['episode_seed'])
    else:
        pass

    Memory_South = Memory(config['memory_size_max'], config['memory_size_min'])

    Memory_Duxbury = Memory(config['memory_size_max'],
                            config['memory_size_min'])
    # Visualization object created to export the data from the simulation.
    Visualization = Visualization(plot_path, dpi=300)

    # Simulation object used to run the simulation with the given configuration properties.
    Simulation = Simulation(Model_South, Model_Duxbury, Memory_South,
                            Memory_Duxbury, TrafficGen, sumo_cmd,
                            config['gamma'], config['max_steps'],