优化车辆段路径搜索

This commit is contained in:
xiazengbin 2021-12-09 14:29:24 +08:00
parent ce26b80e6a
commit 3ebab8ed31

View File

@ -100,7 +100,7 @@ public class SimulationBuilder {
// 停车轨到转换轨 // 停车轨到转换轨
secs.forEach(parkSec -> { secs.forEach(parkSec -> {
final String rpKey = RoutePath.buildKey(parkSec, transSec); final String rpKey = RoutePath.buildKey(parkSec, transSec);
List<RoutePath> nrp = tryFindRoutePathForOutByDirection(parkSec, transSec, 20); List<RoutePath> nrp = tryFindRoutePathForOutByDirection(parkSec, transSec, 5);
List<RoutePath> srp = srps.get(rpKey); List<RoutePath> srp = srps.get(rpKey);
if (null == srp) { if (null == srp) {
srp = new ArrayList<RoutePath>(); srp = new ArrayList<RoutePath>();
@ -113,7 +113,7 @@ public class SimulationBuilder {
// 转换轨到停车轨 // 转换轨到停车轨
secs.forEach(parkSec -> { secs.forEach(parkSec -> {
final String rpKey = RoutePath.buildKey(transSec, parkSec); final String rpKey = RoutePath.buildKey(transSec, parkSec);
List<RoutePath> nrp = tryFindRoutePathByDirection(transSec, parkSec, 20); List<RoutePath> nrp = tryFindRoutePathByDirection(transSec, parkSec, 1);
List<RoutePath> srp = srps.get(rpKey); List<RoutePath> srp = srps.get(rpKey);
if (null == srp) { if (null == srp) {
srp = new ArrayList<RoutePath>(); srp = new ArrayList<RoutePath>();
@ -135,7 +135,7 @@ public class SimulationBuilder {
* 当方向未知时起点终点不变不同方向搜索route path * 当方向未知时起点终点不变不同方向搜索route path
*/ */
private static List<RoutePath> tryFindRoutePathForOutByDirection(Section start, Section end, int iterTimes) { private static List<RoutePath> tryFindRoutePathForOutByDirection(Section start, Section end, int iterTimes) {
List<RoutePath> r = tryFindRoutePathByDirection(start, end, iterTimes); List<RoutePath> r = tryFindRoutePathByDirection(start, end, iterTimes);
if (r.size() == 2) { if (r.size() == 2) {
return r.stream().sorted((RoutePath r1, RoutePath r2) -> { return r.stream().sorted((RoutePath r1, RoutePath r2) -> {
return r1.getSignalList().size() - r2.getSignalList().size(); return r1.getSignalList().size() - r2.getSignalList().size();
@ -143,7 +143,7 @@ public class SimulationBuilder {
} else if (r.size() > 2) { } else if (r.size() > 2) {
log.warn("获取车辆段从停车轨到转换轨的路径, routeKey = {} , 路径数量大于2异常 "); log.warn("获取车辆段从停车轨到转换轨的路径, routeKey = {} , 路径数量大于2异常 ");
} }
return r; return r;
} }