// We consider a highway network with an upstream merging lane producing// shockwavesadditional_net_params = ADDITIONAL_NET_PARAMS.copy()
additional_net_params["merge_lanes"] = 1
additional_net_params["highway_lanes"] = 1
additional_net_params["pre_merge_length"] = 500// RL vehicles constitute 5% of the total number of vehicles
vehicles = Vehicles()
vehicles.add(veh_id="human",
acceleration_controller=(SumoCarFollowingController, {}),
speed_mode=9,
num_vehicles=5)
// Vehicles are introduced from both sides of merge, with RL vehicles// entering from the highway portion as well
inflow = InFlows()
inflow.add(veh_type="human", edge="inflow_highway",
vehs_per_hour=FLOW_RATE,
departLane="free", departSpeed=10)
inflow.add(veh_type="human", edge="inflow_merge", vehs_per_hour=100,
departLane="free", departSpeed=7.5)
sumo_params = SumoParams(
restart_instance=True,
sim_step=0.5, // time step decreased to prevent occasional crashes
render=render,
)
env_params = EnvParams(
horizon=HORIZON,
sims_per_step=5, // value raised to ensure sec/step match experiment
warmup_steps=0,
evaluate=True, // Set to True to evaluate traffic metric performance
additional_params={
"max_accel": 1.5,
"max_decel": 1.5,
"target_velocity": 20,
"num_rl": NUM_RL,
},
)
initial_config = InitialConfig()
net_params = NetParams(
inflows=inflow,
no_internal_links=False,
additional_params=additional_net_params,
)
scenario = MergeScenario(name="merge",
vehicles=vehicles,
net_params=net_params,
After Change
env_params = flow_params["env"]
net_params = flow_params["net"]
initial_config = flow_params.get("initial", InitialConfig())
traffic_lights = flow_params.get("tls", TrafficLights())// modify the rendering to match what is requested
sumo_params.render = render