Skip to content

faq 112332361

Billy Charlton edited this page Sep 5, 2018 · 2 revisions

Can I change the Plan of a Person during EventsManager? (re-route)

by Cornelia Hebenstreit on 2017-10-04 08:50:15


I am working on EBikeSharing and i wonder how/if it is possible to change the during "handlePlan" or "handlePerson" generated AgentPlans, and further perform this plan within the same iteration.
I would like to use it for re-routing strategies if a Bike-Sharing-Station does not have bikes or parkings available. Therefore i would like to change the plan. e.g. if no bike was found at a station, the next nearest station will be walked to and a bike is taken there to finish the trip from bs-interation (take a bike) to bs-interaction (return the bike)...or the whole trip changes to a walk or a pt trip (as no bikes were available).
Similar if no bike-parking is available...

It would be super cool if someone can help me.

At the moment i introduced a class, which overwrites (among others) the method "endActivityAndComputeNextState" - where i can handle the station-updates...
I can also do the re-routing there - but how can i bind/add it to simulation, so that also the plan changes...?

Thanks in Advance!
Greets Cornelia


Comments: 3


Re: Can I change the Plan of a Person during EventsManager? (re-route)

by Kai Nagel on 2017-10-04 16:14:15

Dear Cornelia,

we can see that this functionality is important; it is, in fact, also something I am working on during my (current) research semester. There are currently a couple of approaches to this. From our (VSP's) side I would recommend Chapters 23 and 30 of [https://matsim.org/the-book]. I can't really say if replacing the agent logic (Chapter 30, Implementation alternative 2, roughly where you have ended up yourself so far) is the best way to go, or DynAgent (Chapter 23), or maybe something completely different.

The {{RunOwnMobsimAgentUsingRouterExample}} mentioned in Chapter 30 Alternative 2 might be closest to where you currently are.

Does this help you forward a bit? Best wishes Kai


Re: Can I change the Plan of a Person during EventsManager? (re-route)

by Cornelia Hebenstreit on 2017-10-09 07:14:36

Thanks for the answer! It helps a bit at least!

There was another question coming up.
If I use my own departure handler, just the first Leg of a plan is handled (for departure and activity) ...
is there a explaination of the departureHandler and MobsimEngines and their call somewhere?

Thanks a lot, Cornelia


Re: Can I change the Plan of a Person during EventsManager? (re-route)

by Cornelia Hebenstreit on 2017-12-04 08:56:53

Actually i found a way to change a Plan during EventsManager, it is not possible to generate a new plan, as an error occurs, but it is possible to add, remove, change Legs or Activities in the actual plan. With it, it is possible for me to change plan elements, which i need for a very precise depiction of the bike sharing process, where i.e. an agent might change his LegMode within an ongoing plan, when he does not find a bike at the bike sharing station.

The other problem I had, was because of my own "Engine", where i forgot to add one mode.

Clone this wiki locally