Option A: filter out rat-runs using perimeter roads. #839

This commit is contained in:
Dustin Carlino 2022-03-04 14:02:26 +00:00
parent c414b1b447
commit 04c3add1b6

View File

@ -58,7 +58,7 @@ pub fn find_rat_runs(app: &App, neighborhood: &Neighborhood, timer: &mut Timer)
let mut params = map.routing_params().clone(); let mut params = map.routing_params().clone();
modal_filters.update_routing_params(&mut params); modal_filters.update_routing_params(&mut params);
let paths: Vec<Path> = timer let mut paths: Vec<Path> = timer
.parallelize( .parallelize(
"calculate paths between entrances and exits", "calculate paths between entrances and exits",
requests, requests,
@ -68,6 +68,18 @@ pub fn find_rat_runs(app: &App, neighborhood: &Neighborhood, timer: &mut Timer)
.flatten() .flatten()
.collect(); .collect();
// Some paths dip out of the neighborhood. Even though the entrance and exit is in the same
// cell, the optimal path is to use a boundary road. Filter those out.
paths.retain(|path| {
path.get_steps().iter().all(|step| {
if let PathStep::Lane(l) = step {
neighborhood.orig_perimeter.interior.contains(&l.road)
} else {
true
}
})
});
// TODO Rank the likeliness of each rat run by // TODO Rank the likeliness of each rat run by
// 1) Calculating a path between similar start/endpoints -- travelling along the perimeter, // 1) Calculating a path between similar start/endpoints -- travelling along the perimeter,
// starting and ending on a specific road that makes sense. (We have to pick the 'direction' // starting and ending on a specific road that makes sense. (We have to pick the 'direction'