Udpate planner

This commit is contained in:
Victor Shcherb 2020-05-16 20:15:16 +02:00
parent 15ce3fa998
commit 0d96394a0e

View file

@ -709,6 +709,9 @@ public class TransportRoutePlanner {
public Map<TransportStop, List<TransportRoute>> missingStopsCache = new HashMap<TransportStop, List<TransportRoute>>(); public Map<TransportStop, List<TransportRoute>> missingStopsCache = new HashMap<TransportStop, List<TransportRoute>>();
public TLongObjectHashMap<List<TransportRouteSegment>> quadTree; public TLongObjectHashMap<List<TransportRouteSegment>> quadTree;
// Here we don't limit files by bbox, so it could be an issue while searching for multiple unused files
// Incomplete routes usually don't need more files than around Max-BBOX of start/end,
// so here an improvement could be introduced
public final Map<BinaryMapIndexReader, TIntObjectHashMap<TransportRoute>> routeMap = public final Map<BinaryMapIndexReader, TIntObjectHashMap<TransportRoute>> routeMap =
new LinkedHashMap<BinaryMapIndexReader, TIntObjectHashMap<TransportRoute>>(); new LinkedHashMap<BinaryMapIndexReader, TIntObjectHashMap<TransportRoute>>();
@ -834,7 +837,7 @@ public class TransportRoutePlanner {
} }
} }
} }
//there should go stops with complete routes: // There should go stops with complete routes:
loadTransportSegments(loadedTransportStops.valueCollection(), lst); loadTransportSegments(loadedTransportStops.valueCollection(), lst);
readTime += System.nanoTime() - nanoTime; readTime += System.nanoTime() - nanoTime;
@ -1101,7 +1104,7 @@ public class TransportRoutePlanner {
private LinkedList<List<TransportStop>> parseRoutePartsToSegments(List<TransportRoute> routeParts) { private LinkedList<List<TransportStop>> parseRoutePartsToSegments(List<TransportRoute> routeParts) {
LinkedList<List<TransportStop>> segs = new LinkedList<List<TransportStop>>(); LinkedList<List<TransportStop>> segs = new LinkedList<List<TransportStop>>();
// here we assume that missing stops come in pairs <A, B, C, MISSING, MISSING, D, E...> // here we assume that missing stops come in pairs <A, B, C, MISSING, MISSING, D, E...>
// TODO check generation that are doubles // we don't add segments with 1 stop cause they are irrelevant further
for (TransportRoute part : routeParts) { for (TransportRoute part : routeParts) {
List<TransportStop> newSeg = new ArrayList<TransportStop>(); List<TransportStop> newSeg = new ArrayList<TransportStop>();
for (TransportStop s : part.getForwardStops()) { for (TransportStop s : part.getForwardStops()) {
@ -1122,8 +1125,8 @@ public class TransportRoutePlanner {
private List<TransportRoute> findIncompleteRouteParts(TransportRoute baseRoute) throws IOException { private List<TransportRoute> findIncompleteRouteParts(TransportRoute baseRoute) throws IOException {
List<TransportRoute> allRoutes = null; List<TransportRoute> allRoutes = null;
// TODO completely irrelevant always reiteration over all maps (especially not in bbox of the route probabl)
for (BinaryMapIndexReader bmir : routeMap.keySet()) { for (BinaryMapIndexReader bmir : routeMap.keySet()) {
// here we could limit routeMap indexes by only certain bbox around start / end (check comment on field)
IncompleteTransportRoute ptr = bmir.getIncompleteTransportRoutes().get(baseRoute.getId()); IncompleteTransportRoute ptr = bmir.getIncompleteTransportRoutes().get(baseRoute.getId());
if (ptr != null) { if (ptr != null) {
TIntArrayList lst = new TIntArrayList(); TIntArrayList lst = new TIntArrayList();