Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PT stops access and egress times #3449

Open
leonefamily opened this issue Sep 4, 2024 · 0 comments
Open

PT stops access and egress times #3449

leonefamily opened this issue Sep 4, 2024 · 0 comments

Comments

@leonefamily
Copy link

Hello fellow MATSim users and developers!

Recenly I started to look for ways to artificially delay agents that enter or leave PT stops which may be under/over the ground. Upon code inspection I figured that there are few relatively new methods responsible for handling access and egress times (in the core library and in raptor algorithm).

When running first simulation though (pt-tutorial with added stop attributes accessTime and egressTime), MATSim gave me an error about being unable to cast variable to another data type - it was indeed wrong, I needed to reference Double instead of Integer. This is how transitSchedule looks now:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE transitSchedule SYSTEM "http://www.matsim.org/files/dtd/transitSchedule_v2.dtd">

<transitSchedule>
	<transitStops>
		<stopFacility id="1" x="1050" y="1050" linkRefId= "11">
			<attributes>
				<attribute name="accessTime" class="java.lang.Double">75</attribute>
				<attribute name="egressTime" class="java.lang.Double">50</attribute>
			</attributes>
		</stopFacility>
		<stopFacility id="2a" x="2050" y="2940" linkRefId= "12">
			<attributes>
				<attribute name="accessTime" class="java.lang.Double">75</attribute>
				<attribute name="egressTime" class="java.lang.Double">50</attribute>
			</attributes>
		</stopFacility>
		<stopFacility id="2b" x="2050" y="2960" linkRefId= "32">
			<attributes>
				<attribute name="accessTime" class="java.lang.Double">75</attribute>
				<attribute name="egressTime" class="java.lang.Double">50</attribute>
			</attributes>
		</stopFacility>
		<stopFacility id="3" x="3950" y="1050" linkRefId= "33">
			<attributes>
				<attribute name="accessTime" class="java.lang.Double">75</attribute>
				<attribute name="egressTime" class="java.lang.Double">50</attribute>
			</attributes>
		</stopFacility>
	</transitStops>
	...

What was weird, that the error happened after the first iteration, when replanning for the second one:

...
2024-09-04T16:29:31,355  INFO AbstractController:184 ### ITERATION 0 ENDS
2024-09-04T16:29:31,355  INFO AbstractController:185 ###################################################
2024-09-04T16:29:31,355  INFO AbstractController:136 ###################################################
2024-09-04T16:29:31,355  INFO AbstractController:137 ### ITERATION 1 BEGINS
2024-09-04T16:29:31,355  INFO ControlerListenerManagerImpl:156 calling notifyIterationStarts on org.matsim.analysis.LegHistogramListener with priority 0.0
2024-09-04T16:29:31,355  INFO ControlerListenerManagerImpl:156 calling notifyIterationStarts on org.matsim.analysis.LinkStatsControlerListener with priority 0.0
2024-09-04T16:29:31,355  INFO ControlerListenerManagerImpl:156 calling notifyIterationStarts on org.matsim.core.replanning.ReplanningContextImpl with priority 0.0
2024-09-04T16:29:31,355  INFO ControlerListenerManagerImpl:156 calling notifyIterationStarts on org.matsim.core.scoring.ScoringFunctionsForPopulation$$Lambda$262/0x00000205ba383890 with priority 0.0
2024-09-04T16:29:31,357  INFO ControlerListenerManagerImpl:156 calling notifyIterationStarts on org.matsim.core.scoring.ExperiencedPlansServiceImpl$1 with priority 0.0
2024-09-04T16:29:31,357  INFO ControlerListenerManagerImpl:159 [it.1] all ControlerIterationStartsListeners called.
2024-09-04T16:29:31,358  INFO ControlerListenerManagerImpl:221 calling notifyReplanning on org.matsim.core.controler.corelisteners.PlansReplanningImpl with priority 0.0
2024-09-04T16:29:31,358  INFO RandomizingTimeDistanceTravelDisutilityFactory:86  sigma: 3.0; resulting normalization: 0.011108996538242306
2024-09-04T16:29:31,359  INFO RandomizingTimeDistanceTravelDisutilityFactory:86  sigma: 3.0; resulting normalization: 0.011108996538242306
2024-09-04T16:29:31,368  INFO GenericPlanStrategyImpl:135 Plan-Strategy finished, 626 plans handled. Strategy: BestPlanSelector
2024-09-04T16:29:31,368  INFO AbstractMultithreadedModule:142 [PlanRouter] starting 2 threads, handling 83 plans
2024-09-04T16:29:31,372  INFO Counter:70 [PlanRouter] handled plan # 1
2024-09-04T16:29:31,372 ERROR AbstractMultithreadedModule$ExceptionHandler:211 Thread PlanRouter.0 died with exception. Will stop after all threads finished.
java.lang.ClassCastException: class java.lang.Integer cannot be cast to class java.lang.Double (java.lang.Integer and java.lang.Double are in module java.base of loader 'bootstrap')
	at org.matsim.pt.transitSchedule.TransitScheduleUtils.getStopAccessTime(TransitScheduleUtils.java:44) ~[matsim-2024.0.jar:?]
	at ch.sbb.matsim.routing.pt.raptor.DefaultRaptorStopFinder.lambda$findAccessStops$0(DefaultRaptorStopFinder.java:109) ~[matsim-2024.0.jar:?]
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197) ~[?:?]
	at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625) ~[?:?]
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) ~[?:?]
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) ~[?:?]
	at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921) ~[?:?]
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:?]
	at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682) ~[?:?]
	at ch.sbb.matsim.routing.pt.raptor.DefaultRaptorStopFinder.findAccessStops(DefaultRaptorStopFinder.java:113) ~[matsim-2024.0.jar:?]
	at ch.sbb.matsim.routing.pt.raptor.DefaultRaptorStopFinder.findStops(DefaultRaptorStopFinder.java:91) ~[matsim-2024.0.jar:?]
	at ch.sbb.matsim.routing.pt.raptor.SwissRailRaptor.findAccessStops(SwissRailRaptor.java:250) ~[matsim-2024.0.jar:?]
	at ch.sbb.matsim.routing.pt.raptor.SwissRailRaptor.calcRoute(SwissRailRaptor.java:91) ~[matsim-2024.0.jar:?]
	at ch.sbb.matsim.routing.pt.raptor.SwissRailRaptorRoutingModule.calcRoute(SwissRailRaptorRoutingModule.java:70) ~[matsim-2024.0.jar:?]
	at org.matsim.core.router.TripRouter.calcRoute(TripRouter.java:180) ~[matsim-2024.0.jar:?]
	at org.matsim.core.router.PlanRouter.run(PlanRouter.java:95) ~[matsim-2024.0.jar:?]
	at org.matsim.core.replanning.modules.AbstractMultithreadedModule$PlanAlgoThread.run(AbstractMultithreadedModule.java:235) ~[matsim-2024.0.jar:?]
	at java.base/java.lang.Thread.run(Thread.java:842) [?:?]
...

When running further iterations with attributes class corrected to Double errors did not pop up.

Does it mean that access and egress times are not considered for the first iteration? How do I make sure this functionality works at all, and what does it really affect? Events or trips analysis didn't reveal any apparent change, agents proceed to walk right after exiting the vehicle or start waitingForPt after arrival to a stop. The smallest wait_time in output_trips.csv.gz file was just around 10 seconds, which is way less than accessTime that was set to 75.

Thank you for explanation in advance!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant