def traffic() -> Traffic: car1 = TrafficActor( name="car", speed=Distribution(sigma=0.2, mean=1.0), ) car2 = TrafficActor( name="car", speed=Distribution(sigma=0.2, mean=0.8), lane_changing_model=LaneChangingModel(impatience=1, cooperative=0.25), junction_model=JunctionModel(drive_after_yellow_time=1.0, impatience=0.5), ) return Traffic( flows=[ Flow( route=Route( begin=(f"edge-{r[0]}", 0, 30), end=(f"edge-{r[1]}", 0, -30) ), rate=1.0, actors={ car1: 0.5, car2: 0.5, }, ) for r in [("west-WE", "east-WE"), ("east-EW", "west-EW")] ] )
begin=("edge1", 0, 10), via=("edge0",), end=("edge1", (0, 1, 2), 10) ), num_laps=1, ), ], overwrite=True, ) print(f"generate lap mission finished") # generate social agent routes impatient_car = TrafficActor( name="car", speed=Distribution(sigma=0.2, mean=0.5), lane_changing_model=LaneChangingModel(impatience=1, cooperative=0.25), junction_model=JunctionModel( drive_after_red_time=1.5, drive_after_yellow_time=1.0, impatience=1.0 ), ) patient_car = TrafficActor( name="car", speed=Distribution(sigma=0.2, mean=0.5), lane_changing_model=LaneChangingModel(impatience=0, cooperative=0.5), junction_model=JunctionModel(drive_after_yellow_time=1.0, impatience=0.5), ) car_type = patient_car car_name = "patient_car"
} depart_speed = "max" # sets to max social_vehicles = { "default": TrafficActor( name="default", accel=3.0, decel=7.5, tau=1.0, depart_speed=depart_speed, min_gap=Distribution(mean=2.5, sigma=0.05), speed=Distribution(mean=1.0, sigma=0.05), imperfection=Distribution(mean=0.5, sigma=0.05), vehicle_type="passenger", lane_changing_model=LaneChangingModel(), junction_model=JunctionModel(), ), "aggressive": TrafficActor( name="aggressive", accel=10.0, decel=10.0, tau=0.5, depart_speed=depart_speed, min_gap=Distribution(mean=1.0, sigma=0.1), speed=Distribution(mean=1.5, sigma=0.1), imperfection=Distribution(mean=0.1, sigma=0.1), vehicle_type="passenger", lane_changing_model=LaneChangingModel( strategic=10,
Traffic, TrafficActor, ) social_vehicle_num = 100 ego_missions = [ Mission( route=Route(begin=("edge-south-SN", 1, 10), end=("edge-north-SN", 1, 8)), ), ] stright_traffic_actor = TrafficActor( name="car", speed=Distribution(sigma=0.2, mean=1), lane_changing_model=LaneChangingModel(impatience=0), junction_model=JunctionModel( drive_after_red_time=1.5, drive_after_yellow_time=1.0, impatience=0.5 ), ) scenario = Scenario( traffic={ "basic": Traffic( flows=[ Flow( route=RandomRoute(), rate=1, actors={stright_traffic_actor: 1.0}, ) for i in range(social_vehicle_num) ]