mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-11-24 01:15:12 +03:00
Pick the entrance/exit to an access-restricted zone more intelligently. #574
Instead of just picking the intersectin closest to the origin or destination, calculate the full path length, and take the one with the shortest distance. This fixes some of the weird problems routing around Broadmoor. Regenerate all prebaked data. Also fix the original request for paths involving zones, so tracing it later works.
This commit is contained in:
parent
cb4cd1b13a
commit
a68af804e3
@ -2286,24 +2286,24 @@
|
||||
"compressed_size_bytes": 4372095
|
||||
},
|
||||
"data/system/gb/poundbury/prebaked_results/center/base.bin": {
|
||||
"checksum": "159cd07b441955faea15049a0719918b",
|
||||
"uncompressed_size_bytes": 2834055,
|
||||
"compressed_size_bytes": 832169
|
||||
"checksum": "bac42491b3494e52830da0b934fb2be6",
|
||||
"uncompressed_size_bytes": 2834522,
|
||||
"compressed_size_bytes": 832204
|
||||
},
|
||||
"data/system/gb/poundbury/prebaked_results/center/base_with_bg.bin": {
|
||||
"checksum": "31b0bdd18a0d5a29c772e525fcca3d6a",
|
||||
"uncompressed_size_bytes": 6786336,
|
||||
"compressed_size_bytes": 2205554
|
||||
"checksum": "31747d2feadf64b0870323bcbf3eb77a",
|
||||
"uncompressed_size_bytes": 6786922,
|
||||
"compressed_size_bytes": 2205528
|
||||
},
|
||||
"data/system/gb/poundbury/prebaked_results/center/go_active.bin": {
|
||||
"checksum": "1b0af27d3e279816d39f5b73f9bf4a76",
|
||||
"uncompressed_size_bytes": 2772035,
|
||||
"compressed_size_bytes": 796117
|
||||
"checksum": "e9bb647877f6bbb6d73308421228d9db",
|
||||
"uncompressed_size_bytes": 2771963,
|
||||
"compressed_size_bytes": 795919
|
||||
},
|
||||
"data/system/gb/poundbury/prebaked_results/center/go_active_with_bg.bin": {
|
||||
"checksum": "847a663758fc76221ec26bae6551c4ed",
|
||||
"uncompressed_size_bytes": 6714395,
|
||||
"compressed_size_bytes": 2173020
|
||||
"checksum": "7ec448c981a95f6d8b4b8a98e3944a42",
|
||||
"uncompressed_size_bytes": 6714323,
|
||||
"compressed_size_bytes": 2172962
|
||||
},
|
||||
"data/system/gb/poundbury/scenarios/center/base.bin": {
|
||||
"checksum": "0dc5e7cedeeda0e18704fcf0c9eb8f75",
|
||||
@ -2736,14 +2736,14 @@
|
||||
"compressed_size_bytes": 26933516
|
||||
},
|
||||
"data/system/us/seattle/prebaked_results/arboretum/weekday.bin": {
|
||||
"checksum": "24fe3a9df3610d1db557a4425e3bd3db",
|
||||
"uncompressed_size_bytes": 18358337,
|
||||
"compressed_size_bytes": 6593871
|
||||
"checksum": "1d308cdfa7e4853729274165b8bf3bac",
|
||||
"uncompressed_size_bytes": 18360009,
|
||||
"compressed_size_bytes": 6597446
|
||||
},
|
||||
"data/system/us/seattle/prebaked_results/lakeslice/weekday.bin": {
|
||||
"checksum": "95848187af817d99412a5d9857cb818b",
|
||||
"uncompressed_size_bytes": 64544192,
|
||||
"compressed_size_bytes": 24040105
|
||||
"checksum": "5b2b576cb71fb870bda54cc6e153a41c",
|
||||
"uncompressed_size_bytes": 64596535,
|
||||
"compressed_size_bytes": 24053905
|
||||
},
|
||||
"data/system/us/seattle/prebaked_results/montlake/car vs bike contention.bin": {
|
||||
"checksum": "11d45186274bff88661c3eccb318aed0",
|
||||
@ -2751,14 +2751,14 @@
|
||||
"compressed_size_bytes": 1741
|
||||
},
|
||||
"data/system/us/seattle/prebaked_results/montlake/weekday.bin": {
|
||||
"checksum": "f668cdc23cb8c763ec1a68f5b13ddfa5",
|
||||
"checksum": "06eec80a205a99e1d96da6bd2231c4a5",
|
||||
"uncompressed_size_bytes": 8560028,
|
||||
"compressed_size_bytes": 2955322
|
||||
"compressed_size_bytes": 2955530
|
||||
},
|
||||
"data/system/us/seattle/prebaked_results/phinney/weekday.bin": {
|
||||
"checksum": "e59ef0f759ca536afbd59db14c340f37",
|
||||
"uncompressed_size_bytes": 32583330,
|
||||
"compressed_size_bytes": 12306561
|
||||
"checksum": "271cbd15721101a3dcf6355bf9e9c79c",
|
||||
"uncompressed_size_bytes": 32575127,
|
||||
"compressed_size_bytes": 12305494
|
||||
},
|
||||
"data/system/us/seattle/prebaked_results/qa/weekday.bin": {
|
||||
"checksum": "1f72209378521ff11b9743c740800373",
|
||||
@ -2766,9 +2766,9 @@
|
||||
"compressed_size_bytes": 3184023
|
||||
},
|
||||
"data/system/us/seattle/prebaked_results/rainier_valley/weekday.bin": {
|
||||
"checksum": "e5fc47008c70becca4a13cf6b547a83f",
|
||||
"uncompressed_size_bytes": 13931544,
|
||||
"compressed_size_bytes": 4910521
|
||||
"checksum": "197d0c2b5793e66c6d7d2c09ff740c68",
|
||||
"uncompressed_size_bytes": 13927740,
|
||||
"compressed_size_bytes": 4907841
|
||||
},
|
||||
"data/system/us/seattle/prebaked_results/wallingford/weekday.bin": {
|
||||
"checksum": "790c6bcbaf164983127ed9d4b39c0acc",
|
||||
|
@ -71,18 +71,18 @@ impl Pathfinder {
|
||||
.allow_through_traffic
|
||||
.contains(req.constraints)
|
||||
{
|
||||
let mut borders: Vec<&Intersection> =
|
||||
zone.borders.iter().map(|i| map.get_i(*i)).collect();
|
||||
// TODO Use the CH to pick the lowest overall cost?
|
||||
let pt = req.end.pt(map);
|
||||
borders.sort_by_key(|i| pt.dist_to(i.polygon.center()));
|
||||
|
||||
for i in borders {
|
||||
if let Some(result) = self.pathfind_from_zone(i, req.clone(), zone, map) {
|
||||
return Some(result);
|
||||
// Calculate the entire path using every possible border, then take the one
|
||||
// with the least total distance.
|
||||
// TODO This is slow and doesn't account for the mode-specific cost.
|
||||
let mut paths = Vec::new();
|
||||
for i in &zone.borders {
|
||||
if let Some(result) =
|
||||
self.pathfind_from_zone(map.get_i(*i), req.clone(), zone, map)
|
||||
{
|
||||
paths.push(result);
|
||||
}
|
||||
}
|
||||
return None;
|
||||
return paths.into_iter().min_by_key(|p| p.total_length());
|
||||
}
|
||||
}
|
||||
(None, Some(zone)) => {
|
||||
@ -91,18 +91,18 @@ impl Pathfinder {
|
||||
.allow_through_traffic
|
||||
.contains(req.constraints)
|
||||
{
|
||||
let mut borders: Vec<&Intersection> =
|
||||
zone.borders.iter().map(|i| map.get_i(*i)).collect();
|
||||
// TODO Use the CH to pick the lowest overall cost?
|
||||
let pt = req.start.pt(map);
|
||||
borders.sort_by_key(|i| pt.dist_to(i.polygon.center()));
|
||||
|
||||
for i in borders {
|
||||
if let Some(result) = self.pathfind_to_zone(i, req.clone(), zone, map) {
|
||||
return Some(result);
|
||||
// Calculate the entire path using every possible border, then take the one
|
||||
// with the least total distance.
|
||||
// TODO This is slow and doesn't account for the mode-specific cost.
|
||||
let mut paths = Vec::new();
|
||||
for i in &zone.borders {
|
||||
if let Some(result) =
|
||||
self.pathfind_to_zone(map.get_i(*i), req.clone(), zone, map)
|
||||
{
|
||||
paths.push(result);
|
||||
}
|
||||
}
|
||||
return None;
|
||||
return paths.into_iter().min_by_key(|p| p.total_length());
|
||||
}
|
||||
}
|
||||
(None, None) => {}
|
||||
@ -225,6 +225,7 @@ impl Pathfinder {
|
||||
},
|
||||
constraints: req.constraints,
|
||||
};
|
||||
let orig_req = req.clone();
|
||||
req.start = if map.get_l(dst).src_i == i.id {
|
||||
Position::start(dst)
|
||||
} else {
|
||||
@ -245,12 +246,13 @@ impl Pathfinder {
|
||||
};
|
||||
interior_path.extend(main_path);
|
||||
let steps = walking_path_to_steps(interior_path, map);
|
||||
return Some(Path::new(map, steps, req, Vec::new()));
|
||||
return Some(Path::new(map, steps, orig_req, Vec::new()));
|
||||
}
|
||||
|
||||
let mut interior_path = zone.pathfind(interior_req, map)?;
|
||||
let main_path = self.simple_pathfind(&req, map.routing_params(), map)?;
|
||||
interior_path.append(main_path, map);
|
||||
interior_path.orig_req = orig_req;
|
||||
Some(interior_path)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user