log.info(" # links total: " + network.getLinks().size()); log.info(" # transfer links: " + toBeAdded.size());
public void testTravelTime() { Fixture f = new Fixture(); f.init(); TransitRouterConfig conf = new TransitRouterConfig(f.scenario.getConfig().planCalcScore(), f.scenario.getConfig().plansCalcRoute(), f.scenario.getConfig().transitRouter(), f.scenario.getConfig().vspExperimental()); TransitRouterNetworkTravelTimeAndDisutility tc = new TransitRouterNetworkTravelTimeAndDisutility(conf); TransitRouterImpl router = new TransitRouterImpl(conf, f.schedule); TransitRouterNetwork routerNet = router.getTransitRouterNetwork(); // find the link connecting C and G on the red line TransitRouterNetworkLink testLink = null; for (TransitRouterNetworkLink link : routerNet.getLinks().values()) { if ((link.getLine() == f.redLine) && (link.fromNode.stop.getStopFacility().getName().equals("C")) && (link.toNode.stop.getStopFacility().getName().equals("G"))) { testLink = link; } } assertEquals(9.0*60, tc.getLinkTravelTime(testLink, 6.0*3600, null, null), MatsimTestCase.EPSILON); }
public void testTravelTime() { //create the scenario test Fixture f = new Fixture(); f.init(); //create the adapted router TransitRouterConfig conf = new TransitRouterConfig(f.scenario.getConfig().planCalcScore(), f.scenario.getConfig().plansCalcRoute(), f.scenario.getConfig().transitRouter(), f.scenario.getConfig().vspExperimental()); TransitRouterNetworkTravelTimeAndDisutility tc = new TransitRouterNetworkTravelTimeAndDisutility(conf); TransitRouterImpl router = new TransitRouterImpl(conf, f.schedule) ; TransitRouterNetwork routerNet = router.getTransitRouterNetwork(); // find the link connecting C and G on the red line TransitRouterNetworkLink testLink = null; for (TransitRouterNetworkLink link : routerNet.getLinks().values()) { if ((link.getLine() == f.redLine) && (link.fromNode.stop.getStopFacility().getName().equals("C")) && (link.toNode.stop.getStopFacility().getName().equals("G"))) { testLink = link; } } //at 6:00 the link travel time = 540 assertEquals(9.0*60, tc.getLinkTravelTime(testLink, 6.0*3600, null, null), MatsimTestCase.EPSILON); }
public void testTravelTimeAfterMidnight() { Fixture f = new Fixture(); f.init(); TransitRouterConfig conf = new TransitRouterConfig(f.scenario.getConfig().planCalcScore(), f.scenario.getConfig().plansCalcRoute(), f.scenario.getConfig().transitRouter(), f.scenario.getConfig().vspExperimental()); TransitRouterNetworkTravelTimeAndDisutility tc = new TransitRouterNetworkTravelTimeAndDisutility(conf); TransitRouterImpl router = new TransitRouterImpl(conf, f.schedule); TransitRouterNetwork routerNet = router.getTransitRouterNetwork(); // find the link connecting C and D on the blue line TransitRouterNetworkLink testLink = null; for (TransitRouterNetworkLink link : routerNet.getLinks().values()) { if ((link.getLine() == f.blueLine) && (link.fromNode.stop.getStopFacility().getName().equals("C")) && (link.toNode.stop.getStopFacility().getName().equals("D"))) { testLink = link; } } // planned departure at 25:00, has to wait until 05:22 = 29:22 assertEquals(22.0*60 + 4.0*3600 + 7.0*60, tc.getLinkTravelTime(testLink, 25.0*3600, null, null), MatsimTestCase.EPSILON); // planned departure at 47:00, has to wait until 05:22 = 53:22 assertEquals(22.0*60 + 6.0*3600 + 7.0*60, tc.getLinkTravelTime(testLink, 47.0*3600, null, null), MatsimTestCase.EPSILON); // planned departure at 49:00, has to wait until 05:22 = 53:22, tests explicitly > 2*MIDNIGHT assertEquals(22.0*60 + 4.0*3600 + 7.0*60, tc.getLinkTravelTime(testLink, 49.0*3600, null, null), MatsimTestCase.EPSILON); }
public void testWaitingTime() { Fixture f = new Fixture(); f.init(); TransitRouterConfig conf = new TransitRouterConfig(f.scenario.getConfig().planCalcScore(), f.scenario.getConfig().plansCalcRoute(), f.scenario.getConfig().transitRouter(), f.scenario.getConfig().vspExperimental()); TransitRouterNetworkTravelTimeAndDisutility tc = new TransitRouterNetworkTravelTimeAndDisutility(conf); TransitRouterImpl router = new TransitRouterImpl(conf, f.schedule); TransitRouterNetwork routerNet = router.getTransitRouterNetwork(); // find the link connecting C and D on the blue line TransitRouterNetworkLink testLink = null; for (TransitRouterNetworkLink link : routerNet.getLinks().values()) { if ((link.getLine() == f.blueLine) && (link.fromNode.stop.getStopFacility().getName().equals("C")) && (link.toNode.stop.getStopFacility().getName().equals("D"))) { testLink = link; } } assertEquals(2.0*60 + 7.0*60, tc.getLinkTravelTime(testLink, 6.0*3600, null, null), MatsimTestCase.EPSILON); assertEquals(1.0*60 + 7.0*60, tc.getLinkTravelTime(testLink, 6.0*3600 + 60, null, null), MatsimTestCase.EPSILON); assertEquals(0.0*60 + 7.0*60, tc.getLinkTravelTime(testLink, 6.0*3600 + 120, null, null), MatsimTestCase.EPSILON); assertEquals(20.0*60 -1 + 7.0*60, tc.getLinkTravelTime(testLink, 6.0*3600 + 121, null, null), MatsimTestCase.EPSILON); }
public void testTravelCostLineSwitch() { Fixture f = new Fixture(); f.init(); TransitRouterConfig conf = new TransitRouterConfig(f.scenario.getConfig().planCalcScore(), f.scenario.getConfig().plansCalcRoute(), f.scenario.getConfig().transitRouter(), f.scenario.getConfig().vspExperimental()); TransitRouterNetworkTravelTimeAndDisutility tc = new TransitRouterNetworkTravelTimeAndDisutility(conf); TransitRouterImpl router = new TransitRouterImpl(conf, f.schedule) ; TransitRouterNetwork routerNet = router.getTransitRouterNetwork(); // find the link connecting C and D on the blue line TransitRouterNetworkLink testLink = null; for (TransitRouterNetworkLink link : routerNet.getLinks().values()) { if ((link.getLine() == null) && (link.fromNode.stop.getStopFacility().getName().equals("C")) && (link.toNode.stop.getStopFacility().getName().equals("C"))) { testLink = link; } } double oldCost = - conf.getUtilityOfLineSwitch_utl(); double cost1 = tc.getLinkTravelDisutility(testLink, 7.0*3600, null, null, null); conf.setUtilityOfLineSwitch_utl(0.0); double cost2 = tc.getLinkTravelDisutility(testLink, 6.0*3600, null, null, null); // use different time because of internal caching effects assertEquals(oldCost, cost1 - cost2, MatsimTestCase.EPSILON); conf.setUtilityOfLineSwitch_utl(-40.125); double cost3 = tc.getLinkTravelDisutility(testLink, 5.0*3600, null, null, null); assertEquals(40.125, cost3 - cost2, MatsimTestCase.EPSILON); }
public void testTravelCostLineSwitch() { Fixture f = new Fixture(); f.init(); TransitRouterConfig conf = new TransitRouterConfig(f.scenario.getConfig().planCalcScore(), f.scenario.getConfig().plansCalcRoute(), f.scenario.getConfig().transitRouter(), f.scenario.getConfig().vspExperimental()); TransitRouterNetworkTravelTimeAndDisutility tc = new TransitRouterNetworkTravelTimeAndDisutility(conf); TransitRouterImpl router = new TransitRouterImpl(conf, f.schedule); TransitRouterNetwork routerNet = router.getTransitRouterNetwork(); // find the link connecting C and D on the blue line TransitRouterNetworkLink testLink = null; for (TransitRouterNetworkLink link : routerNet.getLinks().values()) { if ((link.getLine() == null) && (link.fromNode.stop.getStopFacility().getName().equals("C")) && (link.toNode.stop.getStopFacility().getName().equals("C"))) { testLink = link; } } double oldCost = - conf.getUtilityOfLineSwitch_utl(); double cost1 = tc.getLinkTravelDisutility(testLink, 7.0*3600, null, null, null); conf.setUtilityOfLineSwitch_utl(0.0); double cost2 = tc.getLinkTravelDisutility(testLink, 6.0*3600, null, null, null); // use different time because of internal caching effects assertEquals(oldCost, cost1 - cost2, MatsimTestCase.EPSILON); conf.setUtilityOfLineSwitch_utl(-40.125); double cost3 = tc.getLinkTravelDisutility(testLink, 5.0*3600, null, null, null); assertEquals(40.125, cost3 - cost2, MatsimTestCase.EPSILON); }
for (TransitRouterNetworkLink link : routerNet.getLinks().values()) { if ((link.getLine() == null) && (link.fromNode.stop.getStopFacility().getName().equals("C")) &&
for (TransitRouterNetworkLink link : routerNet.getLinks().values()) { if ((link.getLine() == null) && (link.fromNode.stop.getStopFacility().getName().equals("C")) &&
for (TransitRouterNetworkLink link : routerNet.getLinks().values()) { if ((link.getLine() == f.blueLine) && (link.fromNode.stop.getStopFacility().getName().equals("C")) &&
for (TransitRouterNetworkLink link : routerNet.getLinks().values()) { if ((link.getLine() == f.blueLine) && (link.fromNode.stop.getStopFacility().getName().equals("C")) && (link.toNode.stop.getStopFacility().getName().equals("D"))) {