* insertAgentIntoMobsim(agent) // initialization
and
* reInsertAgentIntoMobsim(agent) // at end of agent.endXxxAndAssumeControl()
This is in an attempt to find an incremental path to getting rid of the self-reinsertion of the agent.
---
() In PersonDriverAgentImpl.chooseNextLinkId() there was:
if (this.cachedRouteLinkIds == null) {
this.cachedRouteLinkIds = ((NetworkRoute) this.currentLeg.getRoute()).getLinkIds();
}
This could cause an error later if the execution logic got here with a leg that was non-car. This seems not to have happened in the past, but it may happen if one starts to modify the logic which makes agents stay at the same location, with a dummy leg in between ... currently, this dummy leg is treated as a full car departure, which does not make sense. Modified this to
if (this.cachedRouteLinkIds == null) {
if ( this.currentLeg.getRoute() instanceof NetworkRoute ) {
this.cachedRouteLinkIds = ((NetworkRoute) this.currentLeg.getRoute()).getLinkIds();
} else {
return null ;
}
}
I would argue that it makes sense to return null here if there is no route.
This _should_ not change anything but there is no guarantee.
---
() So far, an agent stuck event is thrown for ALL agents in the activity list. This is because it is assumed that agents who are done with their plan are not re-inserted into the activity list. In view of replanning, it seems to make more sense to keep them at the final activity, with activityEndTime = infty. Thus, only agents at an activity with an activityEndTime < infty (and, for backwards compatibility, != Time.UNDEFINED_TIME), will throw a stuck event.
This _should_ not change anything but there is no guarantee.