mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-12-25 23:43:25 +03:00
remove the tiny fraction of people with non-continuous schedules from
the PSRC scenarios
This commit is contained in:
parent
0f2962094f
commit
a39d19f36a
@ -227,16 +227,16 @@ e27d41c916a721b330459ce85a114dbc data/system/maps/23rd.bin
|
|||||||
cc45f42cb24cad1cfdbf5ed7a0cb86d4 data/system/synthetic_maps/signal_double.json
|
cc45f42cb24cad1cfdbf5ed7a0cb86d4 data/system/synthetic_maps/signal_double.json
|
||||||
8b949cc34d9a27ace0bd8ecde55a9520 data/system/synthetic_maps/signal_single.json
|
8b949cc34d9a27ace0bd8ecde55a9520 data/system/synthetic_maps/signal_single.json
|
||||||
1cd7be125e1d992613ed3a41e8b25b6a data/system/synthetic_maps/signal_fan_in.json
|
1cd7be125e1d992613ed3a41e8b25b6a data/system/synthetic_maps/signal_fan_in.json
|
||||||
6c9b30455f3dfd3254b3d5a475e91be2 data/system/scenarios/ballard/weekday.bin
|
e6e6a0d69e999d13914d038182a610df data/system/scenarios/ballard/weekday.bin
|
||||||
2dfeaa7c30c3105adf167745b3f3330b data/system/scenarios/intl_district/weekday.bin
|
90a2f56be7381f7cb7d6fe581ccbd71c data/system/scenarios/intl_district/weekday.bin
|
||||||
6294bf8d76d961ac8077a26c1d9179bf data/system/scenarios/23rd/weekday.bin
|
06e5969553aac31397fb82a46d965218 data/system/scenarios/23rd/weekday.bin
|
||||||
046bce26acff5af88d5d9547be283be3 data/system/scenarios/lakeslice/weekday.bin
|
55e34b7ad84ba414d7a727105b2a4214 data/system/scenarios/lakeslice/weekday.bin
|
||||||
a28e4686333d487675de552ddb844faa data/system/scenarios/downtown/weekday.bin
|
c13a214eeac17fe005531e9d2b820371 data/system/scenarios/downtown/weekday.bin
|
||||||
204aeee7180e706e67fa02ecd52b39de data/system/scenarios/huge_seattle/weekday.bin
|
23484818ce17120fd059fc8e12590487 data/system/scenarios/huge_seattle/weekday.bin
|
||||||
f9131af5abeed9ae37e5ee0ca17ebf13 data/system/scenarios/caphill/weekday.bin
|
ce9000d9f0fb5e80f87580808641f5e0 data/system/scenarios/caphill/weekday.bin
|
||||||
584cb9b1c40dbb3cc45155669efa0c81 data/system/scenarios/montlake/weekday.bin
|
06552edb374a27ac8cbf84e0bde83cac data/system/scenarios/montlake/weekday.bin
|
||||||
ae0946df6ab1edf0ca3b6959093e27d3 data/system/prebaked_results/signal_single/tutorial lvl1.bin
|
ae0946df6ab1edf0ca3b6959093e27d3 data/system/prebaked_results/signal_single/tutorial lvl1.bin
|
||||||
1d0772af01ceea5d1f28e586b227597e data/system/prebaked_results/signal_single/tutorial lvl2.bin
|
1d0772af01ceea5d1f28e586b227597e data/system/prebaked_results/signal_single/tutorial lvl2.bin
|
||||||
fcc727e48613c12ab336847b81a43bf4 data/system/prebaked_results/montlake/car vs bike contention.bin
|
fcc727e48613c12ab336847b81a43bf4 data/system/prebaked_results/montlake/car vs bike contention.bin
|
||||||
566bf2cb2d7017c069be1274140fa928 data/system/prebaked_results/montlake/weekday.bin
|
a8ae974a16816f4a74b7d87d155fee83 data/system/prebaked_results/montlake/weekday.bin
|
||||||
560083ca84a7367a4bc11a320655206b data/system/prebaked_results/montlake/car vs bus contention.bin
|
560083ca84a7367a4bc11a320655206b data/system/prebaked_results/montlake/car vs bus contention.bin
|
||||||
|
@ -302,4 +302,5 @@ pub fn trips_to_scenario(map: &Map, timer: &mut Timer) -> Scenario {
|
|||||||
people,
|
people,
|
||||||
only_seed_buses: None,
|
only_seed_buses: None,
|
||||||
}
|
}
|
||||||
|
.remove_weird_schedules(map)
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ use crate::{
|
|||||||
DrivingGoal, ParkingSpot, PersonID, SidewalkPOI, SidewalkSpot, Sim, TripEndpoint, TripSpec,
|
DrivingGoal, ParkingSpot, PersonID, SidewalkPOI, SidewalkSpot, Sim, TripEndpoint, TripSpec,
|
||||||
VehicleSpec, VehicleType, BIKE_LENGTH, MAX_CAR_LENGTH, MIN_CAR_LENGTH,
|
VehicleSpec, VehicleType, BIKE_LENGTH, MAX_CAR_LENGTH, MIN_CAR_LENGTH,
|
||||||
};
|
};
|
||||||
use abstutil::{MultiMap, Timer};
|
use abstutil::{prettyprint_usize, MultiMap, Timer};
|
||||||
use geom::{Distance, Duration, Speed, Time};
|
use geom::{Distance, Duration, Speed, Time};
|
||||||
use map_model::{
|
use map_model::{
|
||||||
BuildingID, BusRouteID, BusStopID, IntersectionID, Map, PathConstraints, Position, RoadID,
|
BuildingID, BusRouteID, BusStopID, IntersectionID, Map, PathConstraints, Position, RoadID,
|
||||||
@ -68,8 +68,6 @@ impl Scenario {
|
|||||||
|
|
||||||
timer.start(format!("Instantiating {}", self.scenario_name));
|
timer.start(format!("Instantiating {}", self.scenario_name));
|
||||||
|
|
||||||
self.validate(map, timer);
|
|
||||||
|
|
||||||
if let Some(ref routes) = self.only_seed_buses {
|
if let Some(ref routes) = self.only_seed_buses {
|
||||||
for route in map.get_all_bus_routes() {
|
for route in map.get_all_bus_routes() {
|
||||||
if routes.contains(&route.name) {
|
if routes.contains(&route.name) {
|
||||||
@ -213,11 +211,11 @@ impl Scenario {
|
|||||||
per_bldg
|
per_bldg
|
||||||
}
|
}
|
||||||
|
|
||||||
fn validate(&self, map: &Map, timer: &mut Timer) {
|
pub fn remove_weird_schedules(mut self, map: &Map) -> Scenario {
|
||||||
timer.start_iter("verifying people's trips", self.people.len());
|
let orig = self.people.len();
|
||||||
for person in &self.people {
|
self.people.retain(|person| {
|
||||||
timer.next();
|
|
||||||
// Verify that the trip start/endpoints of each person match up
|
// Verify that the trip start/endpoints of each person match up
|
||||||
|
let mut ok = true;
|
||||||
for pair in person.trips.iter().zip(person.trips.iter().skip(1)) {
|
for pair in person.trips.iter().zip(person.trips.iter().skip(1)) {
|
||||||
// Once off-map, re-enter via any border node.
|
// Once off-map, re-enter via any border node.
|
||||||
let end_bldg = match pair.0.trip.end() {
|
let end_bldg = match pair.0.trip.end() {
|
||||||
@ -229,13 +227,26 @@ impl Scenario {
|
|||||||
TripEndpoint::Border(_) => None,
|
TripEndpoint::Border(_) => None,
|
||||||
};
|
};
|
||||||
if end_bldg != start_bldg {
|
if end_bldg != start_bldg {
|
||||||
|
ok = false;
|
||||||
println!(
|
println!(
|
||||||
"{} {:?} warps between some trips, from {:?} to {:?}",
|
"{:?} warps between some trips, from {:?} to {:?}",
|
||||||
person.id, person.orig_id, end_bldg, start_bldg
|
person.orig_id, end_bldg, start_bldg
|
||||||
);
|
);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
ok
|
||||||
|
});
|
||||||
|
println!(
|
||||||
|
"{} of {} people have nonsense schedules",
|
||||||
|
prettyprint_usize(orig - self.people.len()),
|
||||||
|
prettyprint_usize(orig)
|
||||||
|
);
|
||||||
|
// Fix up IDs
|
||||||
|
for (idx, person) in self.people.iter_mut().enumerate() {
|
||||||
|
person.id = PersonID(idx);
|
||||||
}
|
}
|
||||||
|
self
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user