コード例 #1
0
ファイル: main.py プロジェクト: timmyhussain/cs230
@author: user
"""
from simulation import Simulation, TestSimulation
from generator import TrafficGenerator
from model import Model, TestModel
from memory import Memory
from visualization import Visualization
from utils import import_train_configuration, set_sumo, set_test_path
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import os

#%%
if __name__ == "__main__":
    config = import_train_configuration(config_file="training_settings.ini")
    sumo_cmd = set_sumo(False, config['sumocfg_file_name'],
                        config['max_steps'])

    TrafficGen = TrafficGenerator(config['max_steps'],
                                  config['n_cars_generated'])

    model = Model(config['num_layers'], config['width_layers'],
                  config['num_states'], config['num_actions'],
                  config['batch_size'], config['learning_rate'])

    memory = Memory(config['memory_size_max'])

    viz = Visualization(config['models_path_name'], dpi=96)

    sim = Simulation(TrafficGen, model, memory, config['gamma'],
コード例 #2
0
    @property
    def reward_store(self):
        return self._reward_store

    @property
    def cumulative_wait_store(self):
        return self._cumulative_wait_store

    @property
    def avg_queue_length_store(self):
        return self._avg_queue_length_store


if __name__ == "__main__":

    config = import_train_configuration(
        config_file='settings/training_settings.ini')
    sumo_cmd = set_sumo(config['gui'], config['simulation_folder'],
                        config['sumocfg_file_name'], config['max_steps'])
    path = set_train_path(config['models_path_name'])

    Model = TrainModel(config['num_layers'],
                       config['width_layers'],
                       config['batch_size'],
                       config['learning_rate'],
                       input_dim=config['num_states'],
                       output_dim=config['num_actions'])

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

    Traffic_Generator = Traffic_Generator(config["flow_file"],
                                          config["route_file"],