Hardcode infinite parking option for a few maps. #688

This is an interim option until we decide whether this setting belongs
on the map, the scenario, or something else.
This commit is contained in:
Dustin Carlino 2021-07-13 09:02:39 -07:00
parent f35538b460
commit 3d5955c2b6
4 changed files with 28 additions and 27 deletions

View File

@ -4056,9 +4056,9 @@
"compressed_size_bytes": 21921532
},
"data/system/us/seattle/prebaked_results/arboretum/weekday.bin": {
"checksum": "023b39b0674a829511147fc5612fe708",
"uncompressed_size_bytes": 19773103,
"compressed_size_bytes": 8190644
"checksum": "dc15a04e70904732702d01231f4afeb0",
"uncompressed_size_bytes": 17124971,
"compressed_size_bytes": 6651447
},
"data/system/us/seattle/prebaked_results/greenlake/weekday.bin": {
"checksum": "69a925c1a2727fb00076db5ca350775b",

View File

@ -23,7 +23,7 @@ pub fn prebake_all() {
&mut timer,
);
// Don't record a summary for this
prebake(&map, scenario, None, &mut timer);
prebake(&map, scenario, &mut timer);
}
}
@ -41,22 +41,19 @@ pub fn prebake_all() {
let map = map_model::Map::load_synchronously(name.path(), &mut timer);
let scenario: Scenario =
abstio::read_binary(abstio::path_scenario(map.get_name(), "weekday"), &mut timer);
summaries.push(prebake(&map, scenario, None, &mut timer));
summaries.push(prebake(&map, scenario, &mut timer));
}
let pbury_map = map_model::Map::load_synchronously(
MapName::new("gb", "poundbury", "center").path(),
&mut timer,
);
for scenario_name in ["base", "go_active", "base_with_bg", "go_active_with_bg"] {
let map = map_model::Map::load_synchronously(
MapName::new("gb", "poundbury", "center").path(),
&mut timer,
);
let scenario: Scenario = abstio::read_binary(
abstio::path_scenario(map.get_name(), scenario_name),
abstio::path_scenario(pbury_map.get_name(), scenario_name),
&mut timer,
);
let mut opts = SimOptions::new("prebaked");
opts.alerts = AlertHandler::Silence;
opts.infinite_parking = true;
summaries.push(prebake(&map, scenario, Some(opts), &mut timer));
summaries.push(prebake(&pbury_map, scenario, &mut timer));
}
// Assume this is being run from the 'game' directory. This other tests directory is the most
@ -67,23 +64,15 @@ pub fn prebake_all() {
);
}
fn prebake(
map: &Map,
scenario: Scenario,
opts: Option<SimOptions>,
timer: &mut Timer,
) -> PrebakeSummary {
fn prebake(map: &Map, scenario: Scenario, timer: &mut Timer) -> PrebakeSummary {
timer.start(format!(
"prebake for {} / {}",
scenario.map_name.describe(),
scenario.scenario_name
));
let opts = opts.unwrap_or_else(|| {
let mut opts = SimOptions::new("prebaked");
opts.alerts = AlertHandler::Silence;
opts
});
let mut opts = SimOptions::new("prebaked");
opts.alerts = AlertHandler::Silence;
let mut sim = Sim::new(map, opts);
// Bit of an abuse of this, but just need to fix the rng seed.
let mut rng = SimFlags::for_test("prebaked").make_rng();

View File

@ -101,6 +101,8 @@ pub struct SimOptions {
pub alerts: AlertHandler,
/// Ignore parking data in the map and instead treat every building as if it has unlimited
/// capacity for vehicles.
///
/// Two maps always have this hardcoded on -- the Arboretum and Poundbury.
pub infinite_parking: bool,
/// Allow all agents to immediately proceed into an intersection, even if they'd hit another
/// agent. Obviously this destroys realism of the simulation, but can be used to debug
@ -185,9 +187,19 @@ impl SimOptions {
// Setup
impl Sim {
pub fn new(map: &Map, opts: SimOptions) -> Sim {
pub fn new(map: &Map, mut opts: SimOptions) -> Sim {
let mut timer = Timer::new("create blank sim");
let mut scheduler = Scheduler::new();
// Always disable parking for two maps. See
// https://github.com/a-b-street/abstreet/issues/688 for discussion of how to set this
// properly.
if map.get_name() == &MapName::seattle("arboretum")
|| map.get_name() == &MapName::new("gb", "poundbury", "center")
{
opts.infinite_parking = true;
}
Sim {
driving: DrivingSimState::new(map, &opts),
parking: ParkingSimState::new(map, opts.infinite_parking, &mut timer),

View File

@ -4,7 +4,7 @@
"scenario": "weekday",
"finished_trips": 76618,
"cancelled_trips": 0,
"total_trip_duration_seconds": 66120160.662800334
"total_trip_duration_seconds": 45404132.578600295
},
{
"map": "greenlake (in seattle (us))",