From d54877f5d884b37ebbff6d9151f76d00911fc10c Mon Sep 17 00:00:00 2001 From: Thibaut Dubernet Date: Thu, 18 Apr 2024 13:33:59 +0200 Subject: [PATCH] use the monomodal version of turn restrictions in SpeedyGraphBuilder --- .../core/router/speedy/SpeedyGraphBuilder.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/matsim/src/main/java/org/matsim/core/router/speedy/SpeedyGraphBuilder.java b/matsim/src/main/java/org/matsim/core/router/speedy/SpeedyGraphBuilder.java index 89aa6a863f0..01d401683fb 100644 --- a/matsim/src/main/java/org/matsim/core/router/speedy/SpeedyGraphBuilder.java +++ b/matsim/src/main/java/org/matsim/core/router/speedy/SpeedyGraphBuilder.java @@ -9,6 +9,7 @@ import java.util.ArrayList; import java.util.Arrays; +import java.util.Collection; import java.util.HashMap; import java.util.HashSet; import java.util.List; @@ -31,12 +32,12 @@ public class SpeedyGraphBuilder { @Deprecated // use build-method with additional mode argument public static SpeedyGraph build(Network network) { - return build(network, "nothing"); + return build(network); } public static SpeedyGraph build(Network network, String mode) { if (hasTurnRestrictions(network)) { - return new SpeedyGraphBuilder().buildWithTurnRestrictions(network, mode); + return new SpeedyGraphBuilder().buildWithTurnRestrictions(network); } return new SpeedyGraphBuilder().buildWithoutTurnRestrictions(network); } @@ -50,7 +51,7 @@ private static boolean hasTurnRestrictions(Network network) { return false; } - private SpeedyGraph buildWithTurnRestrictions(Network network, String mode) { + private SpeedyGraph buildWithTurnRestrictions(Network network) { /* * The implementation follows the algorithm developed by * Marcel Rieser (Simunto) and Hannes Rewald (Volkswagen Group) @@ -85,7 +86,7 @@ private SpeedyGraph buildWithTurnRestrictions(Network network, String mode) { if (disallowedNextLinks == null) { continue; } - List>> turnRestrictions = disallowedNextLinks.getDisallowedLinkSequences(mode); + Collection>> turnRestrictions = disallowedNextLinks.getMergedDisallowedLinkSequences(); if (turnRestrictions == null || turnRestrictions.isEmpty()) { continue; } @@ -139,15 +140,15 @@ private SpeedyGraph buildWithTurnRestrictions(Network network, String mode) { return new SpeedyGraph(this.nodeData, this.linkData, this.nodes, this.links); } - private ColoredLink applyTurnRestriction(TurnRestrictionsContext context, List>> restrictions, Link startingLink) { + private ColoredLink applyTurnRestriction(TurnRestrictionsContext context, Collection>> restrictions, Link startingLink) { return this.applyTurnRestriction(context, restrictions, startingLink, null); } - private void applyTurnRestriction(TurnRestrictionsContext context, List>> restrictions, ColoredLink startingLink) { + private void applyTurnRestriction(TurnRestrictionsContext context, Collection>> restrictions, ColoredLink startingLink) { this.applyTurnRestriction(context, restrictions, null, startingLink); } - private ColoredLink applyTurnRestriction(TurnRestrictionsContext context, List>> restrictions, Link startingLink, ColoredLink coloredStartingLink) { + private ColoredLink applyTurnRestriction(TurnRestrictionsContext context, Collection>> restrictions, Link startingLink, ColoredLink coloredStartingLink) { Set affectedNodes = new HashSet<>(); Set affectedColoredNodes = new HashSet<>(); Set affectedLinks = new HashSet<>();