Skip to content

Commit

Permalink
Merge pull request #3401 from matsim-org/mode-restriction-update
Browse files Browse the repository at this point in the history
move network consistency check to PrepareForSimImpl
  • Loading branch information
paulheinr authored Aug 9, 2024
2 parents a455df3 + cda5767 commit 4c42086
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public class NetworkRoutingProvider implements Provider<RoutingModule>{
private static final Logger log = LogManager.getLogger( NetworkRoutingProvider.class ) ;

private final String routingMode;
private boolean alreadyCheckedConsistency = false;

@Inject Map<String, TravelTime> travelTimes;
@Inject Map<String, TravelDisutilityFactory> travelDisutilityFactories;
Expand Down Expand Up @@ -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);
Expand All @@ -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;
}
}

0 comments on commit 4c42086

Please sign in to comment.