diff --git a/matsim/src/main/java/org/matsim/core/router/NetworkRoutingProvider.java b/matsim/src/main/java/org/matsim/core/router/NetworkRoutingProvider.java index a6c00d06942..7b874593fa1 100644 --- a/matsim/src/main/java/org/matsim/core/router/NetworkRoutingProvider.java +++ b/matsim/src/main/java/org/matsim/core/router/NetworkRoutingProvider.java @@ -46,6 +46,7 @@ public class NetworkRoutingProvider implements Provider{ private static final Logger log = LogManager.getLogger( NetworkRoutingProvider.class ) ; private final String routingMode; + private boolean alreadyCheckedConsistency = false; @Inject Map travelTimes; @Inject Map travelDisutilityFactories; @@ -142,6 +143,12 @@ private void checkNetwork(Network filteredNetwork) { return; } + if(alreadyCheckedConsistency){ + return; + } + + log.info("Checking network for mode '{}' for consistency...", mode); + int nLinks = filteredNetwork.getLinks().size(); int nNodes = filteredNetwork.getNodes().size(); new NetworkCleaner().run(filteredNetwork); @@ -153,5 +160,7 @@ private void checkNetwork(Network filteredNetwork) { "\n If this network topology is intended, set the routing config parameter 'networkRouteConsistencyCheck' to 'disable'."); throw new RuntimeException(errorMessage); } + + alreadyCheckedConsistency = true; } }