| | |
| | | resolvedPolicy == null ? null : resolvedPolicy.getDefaultProfileCode(), |
| | | elapsedMillis(totalStartNs)); |
| | | StationPathRuntimeSnapshot runtimeSnapshot = loadStationPathRuntimeSnapshot(currentTaskNo); |
| | | List<NavigateNode> shortFallbackPath = buildRerouteShortFallbackPath( |
| | | startStationId, |
| | | endStationId, |
| | | currentTaskNo, |
| | | resolvedPolicy, |
| | | runtimeSnapshot |
| | | ); |
| | | StationPathSearchContext context = buildStationPathSearchContext( |
| | | startStationId, |
| | | endStationId, |
| | |
| | | runtimeSnapshot |
| | | ); |
| | | if (context.allList.isEmpty()) { |
| | | log.warn("站点路径候选计算结束,原因=empty_search_context,startStationId={},endStationId={},taskNo={},totalCostMs={}", |
| | | startStationId, endStationId, currentTaskNo, elapsedMillis(totalStartNs)); |
| | | return new ArrayList<>(); |
| | | List<List<NavigateNode>> fallbackCandidateList = normalizeCandidatePaths(Collections.singletonList(shortFallbackPath)); |
| | | log.warn("站点路径候选计算结束,原因=empty_search_context,startStationId={},endStationId={},taskNo={},fallbackCandidateCount={},fallbackPath={},totalCostMs={}", |
| | | startStationId, |
| | | endStationId, |
| | | currentTaskNo, |
| | | fallbackCandidateList.size(), |
| | | JSON.toJSONString(extractStationIdList(shortFallbackPath)), |
| | | elapsedMillis(totalStartNs)); |
| | | return fallbackCandidateList; |
| | | } |
| | | |
| | | long orderStartNs = System.nanoTime(); |
| | |
| | | endStationId, |
| | | runtimeSnapshot |
| | | ); |
| | | List<List<NavigateNode>> normalizedPathList = normalizeCandidatePaths(orderedPathList); |
| | | log.info("站点路径候选计算结束,startStationId={},endStationId={},taskNo={},rawCandidateCount={},orderedPathCount={},normalizedPathCount={},orderCostMs={},totalCostMs={}", |
| | | List<List<NavigateNode>> candidatePathList = appendShortFallbackCandidate(orderedPathList, shortFallbackPath); |
| | | List<List<NavigateNode>> normalizedPathList = normalizeCandidatePaths(candidatePathList); |
| | | log.info("站点路径候选计算结束,startStationId={},endStationId={},taskNo={},rawCandidateCount={},orderedPathCount={},fallbackPathLen={},normalizedPathCount={},orderCostMs={},totalCostMs={}", |
| | | startStationId, |
| | | endStationId, |
| | | currentTaskNo, |
| | | context.allList.size(), |
| | | orderedPathList == null ? null : orderedPathList.size(), |
| | | shortFallbackPath == null ? 0 : shortFallbackPath.size(), |
| | | normalizedPathList.size(), |
| | | elapsedMillis(orderStartNs), |
| | | elapsedMillis(totalStartNs)); |
| | |
| | | return DirectPathSearchResult.empty(includeWaypoint, includeSoftPreference); |
| | | } |
| | | |
| | | private List<NavigateNode> buildRerouteShortFallbackPath(Integer startStationId, |
| | | Integer endStationId, |
| | | Integer currentTaskNo, |
| | | StationPathResolvedPolicy resolvedPolicy, |
| | | StationPathRuntimeSnapshot runtimeSnapshot) { |
| | | long startNs = System.nanoTime(); |
| | | try { |
| | | List<NavigateNode> path = findStationDirectPath( |
| | | startStationId, |
| | | endStationId, |
| | | currentTaskNo, |
| | | 0.0d, |
| | | StationPathCalcMode.OPTIMAL, |
| | | resolvedPolicy, |
| | | runtimeSnapshot |
| | | ); |
| | | List<NavigateNode> normalizedPath = normalizeStationPath(path); |
| | | log.info("站点路径堵塞重规划短路径保底计算完成,startStationId={},endStationId={},taskNo={},pathLen={},path={},costMs={}", |
| | | startStationId, |
| | | endStationId, |
| | | currentTaskNo, |
| | | normalizedPath.size(), |
| | | JSON.toJSONString(extractStationIdList(normalizedPath)), |
| | | elapsedMillis(startNs)); |
| | | return normalizedPath; |
| | | } catch (Exception e) { |
| | | log.warn("站点路径堵塞重规划短路径保底计算失败,startStationId={},endStationId={},taskNo={},costMs={},error={}", |
| | | startStationId, |
| | | endStationId, |
| | | currentTaskNo, |
| | | elapsedMillis(startNs), |
| | | e.toString()); |
| | | return new ArrayList<>(); |
| | | } |
| | | } |
| | | |
| | | private List<List<NavigateNode>> appendShortFallbackCandidate(List<List<NavigateNode>> orderedPathList, |
| | | List<NavigateNode> shortFallbackPath) { |
| | | List<List<NavigateNode>> candidatePathList = new ArrayList<>(); |
| | | if (orderedPathList != null && !orderedPathList.isEmpty()) { |
| | | candidatePathList.addAll(orderedPathList); |
| | | } |
| | | if (shortFallbackPath != null && !shortFallbackPath.isEmpty()) { |
| | | candidatePathList.add(shortFallbackPath); |
| | | } |
| | | return candidatePathList; |
| | | } |
| | | |
| | | private List<NavigateNode> searchDirectPath(DirectStationPathContext context, |
| | | boolean includeWaypoint, |
| | | boolean includeSoftPreference) { |