Skip to content

Commit

Permalink
fix tests by disabling net consistency check
Browse files Browse the repository at this point in the history
  • Loading branch information
paulheinr committed Jul 25, 2024
1 parent a09c238 commit a47063e
Show file tree
Hide file tree
Showing 36 changed files with 104 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.matsim.api.core.v01.network.Node;
import org.matsim.core.config.Config;
import org.matsim.core.config.ConfigUtils;
import org.matsim.core.config.groups.RoutingConfigGroup;
import org.matsim.core.population.routes.NetworkRoute;
import org.matsim.core.population.routes.RouteUtils;
import org.matsim.core.scenario.MutableScenario;
Expand Down Expand Up @@ -100,6 +101,7 @@
public Fixture() {
this.config = ConfigUtils.createConfig();
this.config.transit().setUseTransit(true);
config.routing().setNetworkRouteConsistencyCheck(RoutingConfigGroup.NetworkRouteConsistencyCheck.disable);

ScenarioBuilder scBuilder = new ScenarioBuilder(config) ;
this.scenario = (MutableScenario) scBuilder.build() ;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import org.matsim.core.config.Config;
import org.matsim.core.config.ConfigUtils;
import org.matsim.core.config.groups.LinkStatsConfigGroup;
import org.matsim.core.config.groups.RoutingConfigGroup;
import org.matsim.core.controler.*;
import org.matsim.core.controler.AbstractModule;
import org.matsim.core.controler.Injector;
Expand Down Expand Up @@ -352,6 +353,7 @@ void testReset_CorrectlyExecuted() throws IOException {
config.controller().setFirstIteration(0);
config.controller().setLastIteration(7);
config.controller().setWritePlansInterval(0);
config.routing().setNetworkRouteConsistencyCheck(RoutingConfigGroup.NetworkRouteConsistencyCheck.disable);
LinkStatsConfigGroup lsConfig = config.linkStats();

lsConfig.setWriteLinkStatsInterval(3);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import org.matsim.api.core.v01.population.Population;
import org.matsim.api.core.v01.population.PopulationFactory;
import org.matsim.core.config.Config;
import org.matsim.core.config.groups.RoutingConfigGroup;
import org.matsim.core.config.groups.ScoringConfigGroup.ActivityParams;
import org.matsim.core.config.groups.ReplanningConfigGroup.StrategySettings;
import org.matsim.core.population.routes.NetworkRoute;
Expand Down Expand Up @@ -68,6 +69,7 @@ public class TransitControlerIntegrationTest {
@Test
void testTransitRouteCopy() {
Config config = utils.loadConfig((String)null);
config.routing().setNetworkRouteConsistencyCheck(RoutingConfigGroup.NetworkRouteConsistencyCheck.disable);
config.transit().setUseTransit(true);
MutableScenario scenario = (MutableScenario) ScenarioUtils.createScenario(config);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
import org.matsim.core.api.experimental.events.TeleportationArrivalEvent;
import org.matsim.core.config.Config;
import org.matsim.core.config.ConfigUtils;
import org.matsim.core.config.groups.RoutingConfigGroup;
import org.matsim.core.controler.PrepareForSimUtils;
import org.matsim.core.events.EventsUtils;
import org.matsim.core.events.handler.BasicEventHandler;
Expand Down Expand Up @@ -990,6 +991,7 @@ public static final class Fixture {
public Fixture() {
this.scenario = ScenarioUtils.createScenario(ConfigUtils.createConfig());
this.config = scenario.getConfig();
config.routing().setNetworkRouteConsistencyCheck(RoutingConfigGroup.NetworkRouteConsistencyCheck.disable);


/* build network */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import org.matsim.core.api.experimental.events.EventsManager;
import org.matsim.core.config.Config;
import org.matsim.core.config.ConfigUtils;
import org.matsim.core.config.groups.RoutingConfigGroup;
import org.matsim.core.events.EventsUtils;
import org.matsim.core.network.NetworkUtils;
import org.matsim.core.population.PersonUtils;
Expand Down Expand Up @@ -169,6 +170,7 @@ void testStorageCapacityDownscaling() {
void testStorageCapacityWithDifferentPCUs() {
ScenarioImporter.flush();
Config config = ConfigUtils.createConfig();
config.routing().setNetworkRouteConsistencyCheck(RoutingConfigGroup.NetworkRouteConsistencyCheck.disable);
config.hermes().setStuckTime(Integer.MAX_VALUE);
Scenario scenario = ScenarioUtils.createScenario(config);
var links = generateNetwork(scenario.getNetwork());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import org.matsim.api.core.v01.population.*;
import org.matsim.core.api.experimental.events.EventsManager;
import org.matsim.core.config.Config;
import org.matsim.core.config.groups.RoutingConfigGroup;
import org.matsim.core.controler.PrepareForSimUtils;
import org.matsim.core.events.EventsUtils;
import org.matsim.core.population.PopulationUtils;
Expand Down Expand Up @@ -230,6 +231,7 @@ private Scenario loadScenario() {
// (0)-----link1-----(1)-----link2-----(2)-----link3-----(3)-----link4-----(4)

Config config = testUtils.loadConfig((String) null);
config.routing().setNetworkRouteConsistencyCheck(RoutingConfigGroup.NetworkRouteConsistencyCheck.disable);
Scenario scenario = (ScenarioUtils.createScenario(config));

Network network = (Network) scenario.getNetwork();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
import org.matsim.core.api.experimental.events.EventsManager;
import org.matsim.core.config.Config;
import org.matsim.core.config.ConfigUtils;
import org.matsim.core.config.groups.RoutingConfigGroup;
import org.matsim.core.config.groups.ScoringConfigGroup.ActivityParams;
import org.matsim.core.controler.AbstractModule;
import org.matsim.core.controler.Controler;
Expand Down Expand Up @@ -213,7 +214,7 @@ void testRoutingVsSimulation() {
@Test
void testRoutingVsSimulationFullStack() {
Config config = ConfigUtils.createConfig();

config.routing().setNetworkRouteConsistencyCheck(RoutingConfigGroup.NetworkRouteConsistencyCheck.disable);
config.controller().setOverwriteFileSetting(OverwriteFileSetting.deleteDirectoryIfExists);
config.controller().setLastIteration(0);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import org.matsim.core.api.experimental.events.EventsManager;
import org.matsim.core.config.Config;
import org.matsim.core.config.ConfigUtils;
import org.matsim.core.config.groups.RoutingConfigGroup;
import org.matsim.core.config.groups.ScoringConfigGroup;
import org.matsim.core.config.groups.QSimConfigGroup.NodeTransition;
import org.matsim.core.controler.OutputDirectoryHierarchy.OverwriteFileSetting;
Expand Down Expand Up @@ -633,9 +634,11 @@ static Scenario createMergeScenario() {
config.controller().setLastIteration(0);
config.qsim().setStuckTime(24*3600);
config.qsim().setRemoveStuckVehicles(false);
config.routing().setNetworkRouteConsistencyCheck(RoutingConfigGroup.NetworkRouteConsistencyCheck.disable);
ScoringConfigGroup.ActivityParams dummyAct = new ScoringConfigGroup.ActivityParams("dummy");
dummyAct.setTypicalDuration(12 * 3600);
config.scoring().addActivityParams(dummyAct);
config.routing().setNetworkRouteConsistencyCheck(RoutingConfigGroup.NetworkRouteConsistencyCheck.disable);

Scenario scenario = ScenarioUtils.createScenario(config);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
import org.matsim.core.config.ConfigUtils;
import org.matsim.core.config.groups.QSimConfigGroup;
import org.matsim.core.config.groups.QSimConfigGroup.TrafficDynamics;
import org.matsim.core.config.groups.RoutingConfigGroup;
import org.matsim.core.controler.PrepareForSimUtils;
import org.matsim.core.events.EventsUtils;
import org.matsim.core.events.ParallelEventsManager;
Expand Down Expand Up @@ -1806,6 +1807,8 @@ public Fixture(boolean isUsingFastCapacityUpdate, int numberOfThreads) {
this.config.qsim().setUsingFastCapacityUpdate(isUsingFastCapacityUpdate);
this.config.qsim().setNumberOfThreads(numberOfThreads);

config.routing().setNetworkRouteConsistencyCheck(RoutingConfigGroup.NetworkRouteConsistencyCheck.disable);

/* build network */
this.network = this.scenario.getNetwork();
this.network.setCapacityPeriod(Time.parseTime("1:00:00"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import org.matsim.api.core.v01.population.PopulationFactory;
import org.matsim.core.config.Config;
import org.matsim.core.config.ConfigUtils;
import org.matsim.core.config.groups.RoutingConfigGroup;
import org.matsim.core.config.groups.ScoringConfigGroup.ActivityParams;
import org.matsim.core.config.groups.ReplanningConfigGroup.StrategySettings;
import org.matsim.core.controler.AbstractModule;
Expand All @@ -64,6 +65,7 @@ final void test() {
config.controller().setOutputDirectory( utils.getOutputDirectory() );
config.controller().setOverwriteFileSetting( OverwriteFileSetting.deleteDirectoryIfExists );
config.controller().setLastIteration(0);
config.routing().setNetworkRouteConsistencyCheck(RoutingConfigGroup.NetworkRouteConsistencyCheck.disable);

ActivityParams params = new ActivityParams("dummy" ) ;
config.scoring().addActivityParams(params);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import org.matsim.api.core.v01.population.*;
import org.matsim.core.config.Config;
import org.matsim.core.config.ConfigUtils;
import org.matsim.core.config.groups.RoutingConfigGroup;
import org.matsim.core.config.groups.ScoringConfigGroup.ActivityParams;
import org.matsim.core.config.groups.QSimConfigGroup;
import org.matsim.core.config.groups.QSimConfigGroup.VehiclesSource;
Expand Down Expand Up @@ -94,6 +95,7 @@ void main(VehiclesSource vehiclesSource, boolean usingPersonIdForMissingVehicleI
createPlans(vehiclesSource, providingVehiclesInPerson);

Config config = scenario.getConfig();
config.routing().setNetworkRouteConsistencyCheck(RoutingConfigGroup.NetworkRouteConsistencyCheck.disable);
config.qsim().setFlowCapFactor(1.0);
config.qsim().setStorageCapFactor(1.0);
config.qsim().setMainModes(Arrays.asList(transportModes));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import org.matsim.core.api.experimental.events.VehicleDepartsAtFacilityEvent;
import org.matsim.core.config.Config;
import org.matsim.core.config.ConfigUtils;
import org.matsim.core.config.groups.RoutingConfigGroup;
import org.matsim.core.controler.PrepareForSimUtils;
import org.matsim.core.events.EventsUtils;
import org.matsim.core.mobsim.qsim.QSimBuilder;
Expand Down Expand Up @@ -425,7 +426,8 @@ private static class Fixture {
public Fixture() throws SAXException, ParserConfigurationException, IOException {
// setup: config
final Config config = ConfigUtils.createConfig();
config.transit().setUseTransit(true);
config.transit().setUseTransit(true);
config.routing().setNetworkRouteConsistencyCheck(RoutingConfigGroup.NetworkRouteConsistencyCheck.disable);
config.qsim().setEndTime(8.0*3600);

this.scenario = (MutableScenario) ScenarioUtils.createScenario(config);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@
import org.matsim.api.core.v01.population.Plan;
import org.matsim.api.core.v01.population.PopulationFactory;
import org.matsim.core.api.experimental.events.EventsManager;
import org.matsim.core.config.Config;
import org.matsim.core.config.ConfigUtils;
import org.matsim.core.config.groups.RoutingConfigGroup;
import org.matsim.core.controler.PrepareForSimUtils;
import org.matsim.core.events.EventsUtils;
import org.matsim.core.mobsim.qsim.QSim;
Expand All @@ -65,7 +67,9 @@ public class TransitAgentTest {

@Test
void testAcceptLineRoute() {
MutableScenario scenario = (MutableScenario) ScenarioUtils.createScenario(ConfigUtils.createConfig());
Config config = ConfigUtils.createConfig();
config.routing().setNetworkRouteConsistencyCheck(RoutingConfigGroup.NetworkRouteConsistencyCheck.disable);
MutableScenario scenario = (MutableScenario) ScenarioUtils.createScenario(config);

Network network = (Network) scenario.getNetwork();
Node node1 = NetworkUtils.createAndAddNode(network, Id.create("1", Node.class), new Coord((double) 0, (double) 0));
Expand Down Expand Up @@ -117,7 +121,9 @@ void testAcceptLineRoute() {

@Test
void testArriveAtStop() {
MutableScenario scenario = (MutableScenario) ScenarioUtils.createScenario(ConfigUtils.createConfig());
Config config = ConfigUtils.createConfig();
config.routing().setNetworkRouteConsistencyCheck(RoutingConfigGroup.NetworkRouteConsistencyCheck.disable);
MutableScenario scenario = (MutableScenario) ScenarioUtils.createScenario(config);

Network network = (Network) scenario.getNetwork();
Node node1 = NetworkUtils.createAndAddNode(network, Id.create("1", Node.class), new Coord((double) 0, (double) 0));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
import org.matsim.core.config.Config;
import org.matsim.core.config.ConfigUtils;
import org.matsim.core.config.groups.ExternalMobimConfigGroup;
import org.matsim.core.config.groups.RoutingConfigGroup;
import org.matsim.core.controler.PrepareForSimUtils;
import org.matsim.core.events.EventsUtils;
import org.matsim.core.events.handler.BasicEventHandler;
Expand Down Expand Up @@ -631,6 +632,7 @@ protected SpyHandleStopData(final TransitStopFacility stopFacility, final double
@Test
void testStartAndEndTime() {
final Config config = ConfigUtils.createConfig();
config.routing().setNetworkRouteConsistencyCheck(RoutingConfigGroup.NetworkRouteConsistencyCheck.disable);
config.transit().setUseTransit(true);

MutableScenario scenario = (MutableScenario) ScenarioUtils.createScenario(config);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import org.matsim.core.config.Config;
import org.matsim.core.config.ConfigUtils;
import org.matsim.core.config.groups.QSimConfigGroup.VehiclesSource;
import org.matsim.core.config.groups.RoutingConfigGroup;
import org.matsim.core.controler.PrepareForSimUtils;
import org.matsim.core.events.EventsUtils;
import org.matsim.core.mobsim.qsim.QSimBuilder;
Expand Down Expand Up @@ -147,6 +148,7 @@ public PseudoInputs(String travelMode) {
config=ConfigUtils.createConfig();
this.scenario = ScenarioUtils.loadScenario(config);
config.qsim().setMainModes(Arrays.asList(travelMode));
config.routing().setNetworkRouteConsistencyCheck(RoutingConfigGroup.NetworkRouteConsistencyCheck.disable);

//following is necessary for mixed traffic, providing a route was obstructing
// the requirement of these which might be all right in some cases. Amit Jan'18
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import org.matsim.core.api.experimental.events.EventsManager;
import org.matsim.core.config.Config;
import org.matsim.core.config.ConfigUtils;
import org.matsim.core.config.groups.RoutingConfigGroup;
import org.matsim.core.config.groups.ScoringConfigGroup.ActivityParams;
import org.matsim.core.controler.AbstractModule;
import org.matsim.core.controler.Controler;
Expand Down Expand Up @@ -132,6 +133,7 @@ private Scenario createScenario() {
Config config = ConfigUtils.createConfig();
config.controller().setOverwriteFileSetting(OverwriteFileSetting.deleteDirectoryIfExists);
config.controller().setLastIteration(0);
config.routing().setNetworkRouteConsistencyCheck(RoutingConfigGroup.NetworkRouteConsistencyCheck.disable);

ActivityParams genericParams = new ActivityParams("generic");
genericParams.setTypicalDuration(1.0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import org.matsim.api.core.v01.population.*;
import org.matsim.core.api.experimental.events.EventsManager;
import org.matsim.core.config.ConfigUtils;
import org.matsim.core.config.groups.RoutingConfigGroup;
import org.matsim.core.controler.PrepareForSimUtils;
import org.matsim.core.events.EventsUtils;
import org.matsim.core.mobsim.qsim.QSimBuilder;
Expand Down Expand Up @@ -142,6 +143,7 @@ private static final class PseudoInputs{
public PseudoInputs(){
scenario = ScenarioUtils.createScenario(ConfigUtils.createConfig());
scenario.getConfig().qsim().setUsingFastCapacityUpdate(true);
scenario.getConfig().routing().setNetworkRouteConsistencyCheck(RoutingConfigGroup.NetworkRouteConsistencyCheck.disable);
population = scenario.getPopulation();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import org.matsim.core.api.experimental.events.EventsManager;
import org.matsim.core.config.Config;
import org.matsim.core.config.ConfigUtils;
import org.matsim.core.config.groups.RoutingConfigGroup;
import org.matsim.core.controler.Injector;
import org.matsim.core.controler.OutputDirectoryHierarchy.OverwriteFileSetting;
import org.matsim.core.controler.PrepareForSimUtils;
Expand Down Expand Up @@ -222,7 +223,9 @@ static class Fixture {
Scenario scenario;

public Fixture() {
this.scenario = ScenarioUtils.createScenario(ConfigUtils.createConfig());
Config config = ConfigUtils.createConfig();
config.routing().setNetworkRouteConsistencyCheck(RoutingConfigGroup.NetworkRouteConsistencyCheck.disable);
this.scenario = ScenarioUtils.createScenario(config);

Id<Node>[] nodeIds = new Id[5];
for (int i = 0; i < nodeIds.length; i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import org.matsim.core.config.Config;
import org.matsim.core.config.ConfigUtils;
import org.matsim.core.config.groups.QSimConfigGroup;
import org.matsim.core.config.groups.RoutingConfigGroup;
import org.matsim.core.controler.PrepareForSimUtils;
import org.matsim.core.controler.events.IterationEndsEvent;
import org.matsim.core.controler.events.StartupEvent;
Expand Down Expand Up @@ -182,6 +183,7 @@ public SimpleNetwork(){
config.qsim().setStorageCapFactor(1.0);
config.qsim().setMainModes(Arrays.asList("car","bike"));
config.qsim().setLinkDynamics(QSimConfigGroup.LinkDynamics.PassingQ);
config.routing().setNetworkRouteConsistencyCheck(RoutingConfigGroup.NetworkRouteConsistencyCheck.disable);

network = (Network) scenario.getNetwork();
this.network.setCapacityPeriod(Time.parseTime("1:00:00"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import org.matsim.core.api.experimental.events.EventsManager;
import org.matsim.core.config.Config;
import org.matsim.core.config.ConfigUtils;
import org.matsim.core.config.groups.RoutingConfigGroup;
import org.matsim.core.controler.PrepareForSimUtils;
import org.matsim.core.events.EventsUtils;
import org.matsim.core.mobsim.qsim.QSim;
Expand Down Expand Up @@ -137,6 +138,7 @@ private static void createThreeLanes(Scenario scenario) {
@Test
void testCapacityWoLanes() {
Config config = ConfigUtils.createConfig();
config.routing().setNetworkRouteConsistencyCheck(RoutingConfigGroup.NetworkRouteConsistencyCheck.disable);
MutableScenario scenario = (MutableScenario) ScenarioUtils.createScenario(config);
initNetwork(scenario.getNetwork());

Expand All @@ -155,6 +157,7 @@ void testCapacityWoLanes() {
@Test
void testCapacityWithOneLaneOneLane() {
Config config = ConfigUtils.createConfig();
config.routing().setNetworkRouteConsistencyCheck(RoutingConfigGroup.NetworkRouteConsistencyCheck.disable);
MutableScenario scenario = (MutableScenario) ScenarioUtils.createScenario(config);
initNetwork(scenario.getNetwork());
createOneLane(scenario, 1);
Expand Down Expand Up @@ -191,6 +194,7 @@ void testCapacityWithOneLaneOneLane() {
@Test
void testCapacityWithOneLaneTwoLanes() {
Config config = ConfigUtils.createConfig();
config.routing().setNetworkRouteConsistencyCheck(RoutingConfigGroup.NetworkRouteConsistencyCheck.disable);
MutableScenario scenario = (MutableScenario) ScenarioUtils.createScenario(config);
initNetwork(scenario.getNetwork());
createOneLane(scenario, 2);
Expand Down Expand Up @@ -228,6 +232,7 @@ void testCapacityWithOneLaneTwoLanes() {
@Test
void testCapacityWithLanes() {
Config config = ConfigUtils.createConfig();
config.routing().setNetworkRouteConsistencyCheck(RoutingConfigGroup.NetworkRouteConsistencyCheck.disable);
MutableScenario scenario = (MutableScenario) ScenarioUtils.createScenario(config);
initNetwork(scenario.getNetwork());
createThreeLanes(scenario);
Expand Down
Loading

0 comments on commit a47063e

Please sign in to comment.