示例#1
0
    def setUp(self):
        vehicles = VehicleParams()
        vehicles.add("rl", acceleration_controller=(RLController, {}),
                     num_vehicles=1)
        vehicles.add("human", acceleration_controller=(IDMController, {}),
                     num_vehicles=1)

        self.sim_params = SumoParams()
        self.network = HighwayRampsNetwork(
            name="test_merge",
            vehicles=vehicles,
            net_params=NetParams(additional_params=HIGHWAY_PARAMS.copy()),
        )
        self.env_params = EnvParams(
            additional_params={
                'max_accel': 1, 'max_decel': 1, "target_velocity": 25
            }
        )
示例#2
0
# number of steps per rollout
HORIZON = 1500
# number of parallel workers
N_CPUS = 11

# inflow rate on the highway in vehicles per hour
HIGHWAY_INFLOW_RATE = 4000
# inflow rate on each on-ramp in vehicles per hour
ON_RAMPS_INFLOW_RATE = 450
# percentage of autonomous vehicles compared to human vehicles on highway
PENETRATION_RATE = 20


# SET UP PARAMETERS FOR THE NETWORK

additional_net_params = ADDITIONAL_NET_PARAMS.copy()
additional_net_params.update({
    # lengths of highway, on-ramps and off-ramps respectively
    "highway_length": 1500,
    "on_ramps_length": 250,
    "off_ramps_length": 250,
    # number of lanes on highway, on-ramps and off-ramps respectively
    "highway_lanes": 3,
    "on_ramps_lanes": 1,
    "off_ramps_lanes": 1,
    # speed limit on highway, on-ramps and off-ramps respectively
    "highway_speed": 30,
    "on_ramps_speed": 20,
    "off_ramps_speed": 20,
    # positions of the on-ramps
    "on_ramps_pos": [500],