def __init__(self, simulator, sim_params): """Instantiate a Flow kernel object. Parameters ---------- simulator : str simulator type, must be one of {"traci"} sim_params : flow.core.params.SimParams simulation-specific parameters Raises ------ ValueError if the specified input simulator is not a valid type """ self.kernel_api = None if simulator == "traci": self.simulation = TraCISimulation(self) self.scenario = TraCIScenario(self) self.vehicle = KernelVehicle(self, sim_params) self.traffic_light = TraCITrafficLight(self) else: raise ValueError('Simulator type "{}" is not valid.'. format(simulator))
def __init__(self, simulator, sim_params): """Instantiate a Flow kernel object. Parameters ---------- simulator : str simulator type, must be one of {"traci"} sim_params : flow.core.params.SimParams simulation-specific parameters Raises ------ flow.utils.exceptions.FatalFlowError if the specified input simulator is not a valid type """ self.kernel_api = None if simulator == "traci": self.simulation = TraCISimulation(self) self.network = TraCIKernelNetwork(self, sim_params) self.vehicle = TraCIVehicle(self, sim_params) self.traffic_light = TraCITrafficLight(self) elif simulator == 'aimsun': self.simulation = AimsunKernelSimulation(self) self.network = AimsunKernelNetwork(self, sim_params) self.vehicle = AimsunKernelVehicle(self, sim_params) self.traffic_light = AimsunKernelTrafficLight(self) else: raise FatalFlowError( 'Simulator type "{}" is not valid.'.format(simulator))
def __init__(self, simulator, sim_params, observation_list=None, monitor_rl=False): """Instantiate a Flow kernel object. Parameters ---------- simulator : str simulator type, must be one of {"traci"} sim_params : flow.core.params.SimParams simulation-specific parameters observation_list : list optional arguments to be specified when certain observations wish to be monitored monitor_rl : bool Enable/Disable subscribing to RL vehicles only Raises ------ flow.utils.exceptions.FatalFlowError if the specified input simulator is not a valid type """ self.kernel_api = None if simulator == "traci": self.simulation = TraCISimulation(self) self.scenario = TraCIScenario(self, sim_params) if observation_list: self.vehicle = TraCIVehicle(self, sim_params=sim_params, observation_list=observation_list, monitor_rl=monitor_rl) else: self.vehicle = TraCIVehicle(self, sim_params=sim_params, monitor_rl=monitor_rl) self.traffic_light = TraCITrafficLight(self) elif simulator == 'aimsun': self.simulation = AimsunKernelSimulation(self) self.scenario = AimsunKernelScenario(self, sim_params) self.vehicle = AimsunKernelVehicle(self, sim_params) self.traffic_light = AimsunKernelTrafficLight(self) else: raise FatalFlowError( 'Simulator type "{}" is not valid.'.format(simulator))