Skip to content

faq 80052239

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

Plan adaptation within simulation

by Milos Balac on 2016-08-25 07:11:09


Hi Everybody, So, I am trying to change the plan of the agent during the simulation, mainly adding legs and stage activities. So, what I want to do is the following: during the previous activity, under a certain condition, I want the agent to adapt his plan. This works perfectly if the duration of the previous activity is >0. However, if it is equal to 0, all the events like Arrival, ActivityStart, ActivityEnd, Departure all happen at the same time step, so I am not able to detect that the agent is actually performing an activity before he finishes it. I am at the moment using MobsimBeforeSimStep listener in order to check who is performing activities, so it works with activities that last at least 1 time step. Any ideas, how can I get around this problem? PS. As far as I can see in ActivityReplanningMap object in the withinday package, it also fails to detect activities that last less than 1 time step. Thanks, Milos

Source: MATSim

Comments: 2


Re: Plan adaptation within simulation

by Michal Maciejewski on 2016-08-25 09:25:38

Hi Milos,

We usually handle such things with DynAgent. Then while switching to the new activity (even of length 0), the agent can do some "other stuff", including replanning. Of course, you do not need to use DynAgent for that, it should be enough to extend the functionality of the "standard" agent to handle 0-duration activities properly.

Best, Michal


Re: Plan adaptation within simulation

by Kai Nagel on 2016-08-29 07:43:19

Might be related to  .  Let's discuss it at the dev mtg.  

Until then: I am not sure if the "withinday" package is made for such things.  To my understanding, it changes agents that are in a certain state to a different state.  If you want to catch things at transitions, this feels more like an event-driven approach to me, which means (I think) modifying the agent directly.  Maybe other people have other intuitions here.

Clone this wiki locally