def figure_eight_example(render=None): """Perform a simulation of vehicles on a figure eight. Parameters ---------- render: bool, optional specifies whether to use the gui during execution Returns ------- exp: flow.core.experiment.Experiment A non-rl experiment demonstrating the performance of human-driven vehicles on a figure eight. """ sim_params = AimsunParams(sim_step=0.5, render=False, emission_path='data') if render is not None: sim_params.render = render vehicles = VehicleParams() vehicles.add(veh_id="human", acceleration_controller=(IDMController, {}), num_vehicles=14) env_params = EnvParams() net_params = NetParams(additional_params=ADDITIONAL_NET_PARAMS.copy()) scenario = Figure8Scenario(name="figure8", vehicles=vehicles, net_params=net_params) env = TestEnv(env_params, sim_params, scenario, simulator='aimsun') return Experiment(env)
def figure_eight_example(render=None): """ Perform a simulation of vehicles on a figure eight. Parameters ---------- render: bool, optional specifies whether to use the gui during execution Returns ------- exp: flow.core.experiment.Experiment A non-rl experiment demonstrating the performance of human-driven vehicles on a figure eight. """ sim_params = SumoParams(render=True) if render is not None: sim_params.render = render vehicles = VehicleParams() vehicles.add( veh_id="idm", acceleration_controller=(IDMController, {}), lane_change_controller=(StaticLaneChanger, {}), routing_controller=(ContinuousRouter, {}), car_following_params=SumoCarFollowingParams( speed_mode="obey_safe_speed", decel=1.5, ), initial_speed=0, num_vehicles=14) env_params = EnvParams(additional_params=ADDITIONAL_ENV_PARAMS) additional_net_params = ADDITIONAL_NET_PARAMS.copy() net_params = NetParams(additional_params=additional_net_params) scenario = Figure8Scenario( name="figure8", vehicles=vehicles, net_params=net_params) env = AccelEnv(env_params, sim_params, scenario) return Experiment(env)
def figure_eight_example(render=None): """ Perform a simulation of vehicles on a figure eight. Parameters ---------- render: bool, optional specifies whether to use sumo's gui during execution Returns ------- exp: flow.core.SumoExperiment type A non-rl experiment demonstrating the performance of human-driven vehicles on a figure eight. """ sumo_params = SumoParams(render=True) if render is not None: sumo_params.render = render vehicles = Vehicles() vehicles.add(veh_id="idm", acceleration_controller=(IDMController, {}), lane_change_controller=(StaticLaneChanger, {}), routing_controller=(ContinuousRouter, {}), speed_mode="no_collide", initial_speed=0, num_vehicles=14) env_params = EnvParams(additional_params=ADDITIONAL_ENV_PARAMS) additional_net_params = ADDITIONAL_NET_PARAMS.copy() net_params = NetParams(no_internal_links=False, additional_params=additional_net_params) scenario = Figure8Scenario(name="figure8", vehicles=vehicles, net_params=net_params) env = AccelEnv(env_params, sumo_params, scenario) return SumoExperiment(env, scenario)
# environment related parameters (see flow.core.params.EnvParams) env=EnvParams( horizon=HORIZON, additional_params={ 'target_velocity': 20, 'max_accel': 3, 'max_decel': 3, 'sort_vehicles': False }, ), # network-related parameters (see flow.core.params.NetParams and the # scenario's documentation or ADDITIONAL_NET_PARAMS component) net=NetParams( no_internal_links=False, additional_params=ADDITIONAL_NET_PARAMS.copy(), ), # vehicles to be placed in the network at the start of a rollout (see # flow.core.vehicles.Vehicles) veh=vehicles, # parameters specifying the positioning of vehicles upon initialization/ # reset (see flow.core.params.InitialConfig) initial=InitialConfig(), ) def setup_exps(): alg_run = 'PPO'
), # environment related parameters (see flow.core.params.EnvParams) env=EnvParams( horizon=HORIZON, additional_params={ 'target_velocity': 20, 'max_accel': 3, 'max_decel': 3, 'sort_vehicles': False }, ), # network-related parameters (see flow.core.params.NetParams and the # scenario's documentation or ADDITIONAL_NET_PARAMS component) net=NetParams(additional_params=ADDITIONAL_NET_PARAMS.copy(), ), # vehicles to be placed in the network at the start of a rollout (see # flow.core.params.VehicleParams) veh=vehicles, # parameters specifying the positioning of vehicles upon initialization/ # reset (see flow.core.params.InitialConfig) initial=InitialConfig(), ) def setup_exps(): """Return the relevant components of an RLlib experiment. Returns