@@ -0,0 +1,3158 @@
+package com.conveyal.r5.analyst;%0A%0Aimport com.conveyal.r5.analyst.cluster.AnalystClusterRequest;%0Aimport com.conveyal.r5.analyst.cluster.AnalystWorker;%0Aimport com.conveyal.r5.analyst.cluster.GenericClusterRequest;%0Aimport com.conveyal.r5.analyst.cluster.TaskStatistics;%0Aimport com.conveyal.r5.analyst.scenario.Scenario;%0Aimport com.conveyal.r5.api.util.LegMode;%0Aimport com.conveyal.r5.api.util.TransitModes;%0Aimport com.conveyal.r5.common.JsonUtilities;%0Aimport com.conveyal.r5.profile.ProfileRequest;%0Aimport com.conveyal.r5.profile.RepeatedRaptorProfileRouter;%0Aimport com.conveyal.r5.profile.StreetMode;%0Aimport com.conveyal.r5.streets.LinkedPointSet;%0Aimport com.conveyal.r5.transit.TransportNetwork;%0Aimport com.fasterxml.jackson.databind.DeserializationFeature;%0Aimport com.fasterxml.jackson.databind.ObjectMapper;%0A%0Aimport java.io.BufferedInputStream;%0Aimport java.io.FileInputStream;%0Aimport java.io.FileNotFoundException;%0Aimport java.io.InputStream;%0Aimport java.time.LocalDate;%0Aimport java.util.EnumSet;%0A%0A/**%0A * This class can be used to find errors in scenarios. IT IS USED FOR DEBUGGING ONLY.%0A * It creates a minimal request, loads up the specified network and scenario from files, applies the scenario,%0A * and runs a search.%0A * It is useful when the error is happening on a network and scenario that are already present on the hosted%0A * analysis software. The network and scenario can be downloaded from S3 and tested together.%0A */%0Apublic class ScenarioDebugger %7B%0A%0A    public static void main (String%5B%5D args) %7B%0A        TaskStatistics taskStats = new TaskStatistics();%0A        try %7B%0A            JsonUtilities.objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);%0A            InputStream scenarioInput = new FileInputStream(%22/Users/abyrd/r5nl/scenario.json%22);%0A            Scenario scenario = JsonUtilities.objectMapper.readValue(scenarioInput, Scenario.class);%0A            scenarioInput.close();%0A            InputStream networkInput = new FileInputStream(%22/Users/abyrd/r5nl/network.dat%22);%0A            TransportNetwork network = TransportNetwork.read(networkInput);%0A            networkInput.close();%0A            AnalystClusterRequest clusterRequest = new AnalystClusterRequest();%0A            clusterRequest.profileRequest = new ProfileRequest();%0A            clusterRequest.profileRequest.scenario = scenario;%0A            PointSet targets = new FreeFormPointSet(0);%0A            LinkedPointSet linkedTargets = targets.link(network.streetLayer, StreetMode.WALK);%0A            clusterRequest.profileRequest.accessModes = EnumSet.of(LegMode.WALK);%0A            clusterRequest.profileRequest.transitModes = EnumSet.of(TransitModes.BUS);%0A            clusterRequest.profileRequest.fromTime = 1000;%0A            clusterRequest.profileRequest.toTime = 2000;%0A            clusterRequest.profileRequest.date = LocalDate.now();%0A            network = network.applyScenario(clusterRequest.profileRequest.scenario);%0A            RepeatedRaptorProfileRouter rrpr = new RepeatedRaptorProfileRouter(network, clusterRequest, linkedTargets, taskStats);%0A            rrpr.route();%0A        %7D catch (Exception e) %7B%0A            e.printStackTrace();%0A        %7D%0A    %7D%0A%7D%0A

add scenario debugger class to help debug broken scenarios