diff --git a/map_model/src/make/parking_blackholes.rs b/map_model/src/make/parking_blackholes.rs index e8112b5ca1..bc807f82b2 100644 --- a/map_model/src/make/parking_blackholes.rs +++ b/map_model/src/make/parking_blackholes.rs @@ -1,4 +1,4 @@ -use crate::{IntersectionType, LaneID, Map}; +use crate::{LaneID, Map}; use abstutil::Timer; use petgraph::graphmap::DiGraphMap; use std::collections::{HashSet, VecDeque}; @@ -30,17 +30,16 @@ pub fn redirect_parking_blackholes(map: &Map, timer: &mut Timer) -> Vec<(LaneID, continue; } - // Search backwards for the nearest driving lane belonging to largest_group. - if let Some(redirect) = reverse_flood(map, l.id, &largest_group) { + // Search forwards and backwards for the nearest driving lane belonging to largest_group. + if let Some(redirect) = bidi_flood(map, l.id, &largest_group) { redirects.push((l.id, redirect)); } else { - // If the lane starts at a border, totally expected to have no possible redirect. - if map.get_i(l.src_i).intersection_type != IntersectionType::Border { - timer.warn(format!( - "{} is a parking blackhole with no reasonable redirect!", - l.id - )); - } + // TODO Make this an error after dealing with places like Austin without much parking + // in the first place. + timer.warn(format!( + "{} is a parking blackhole with no reasonable redirect!", + l.id + )); } } timer.note(format!( @@ -50,7 +49,7 @@ pub fn redirect_parking_blackholes(map: &Map, timer: &mut Timer) -> Vec<(LaneID, redirects } -fn reverse_flood(map: &Map, start: LaneID, largest_group: &HashSet) -> Option { +fn bidi_flood(map: &Map, start: LaneID, largest_group: &HashSet) -> Option { let mut queue = VecDeque::new(); queue.push_back(start); let mut visisted = HashSet::new(); @@ -69,6 +68,11 @@ fn reverse_flood(map: &Map, start: LaneID, largest_group: &HashSet) -> O queue.push_back(turn.id.src); } } + for turn in map.get_turns_from_lane(current) { + if map.is_turn_allowed(turn.id) { + queue.push_back(turn.id.dst); + } + } } None } diff --git a/sim/src/trips.rs b/sim/src/trips.rs index 1f9ef12ab3..090812c177 100644 --- a/sim/src/trips.rs +++ b/sim/src/trips.rs @@ -150,8 +150,8 @@ impl TripManager { p } else { println!( - "Aborting a trip because no path for the car portion! {:?} to {:?}", - start, end + "Aborting {} at {} because no path for the car portion! {:?} to {:?}", + trip.id, now, start, end ); self.unfinished_trips -= 1; trip.aborted = true; @@ -202,8 +202,8 @@ impl TripManager { p } else { println!( - "Aborting a trip because no path for the bike portion! {:?} to {:?}", - driving_pos, end + "Aborting {} at {} because no path for the bike portion! {:?} to {:?}", + trip.id, now, driving_pos, end ); self.unfinished_trips -= 1; trip.aborted = true; @@ -351,8 +351,8 @@ impl TripManager { _ => { // TODO Should be unreachable println!( - "At {}: Aborting trip {}, because {} couldn't find parking and got stuck", - now, trip.id, car + "Aborting {} at {} because {} couldn't find parking and got stuck", + trip.id, now, car ); self.unfinished_trips -= 1; trip.aborted = true; @@ -503,8 +503,8 @@ impl Trip { p } else { println!( - "Aborting a trip because no path for the walking portion! {:?} to {:?}", - start, walk_to + "Aborting {} at {} because no path for the walking portion! {:?} to {:?}", + self.id, now, start, walk_to ); return false; };