act/legEnds (in corresponding engine) --> control goes to agent --> control goes to qsim (scheduleActivityEnd/Departure)
This causes problems once one tries to compose the agents, since in the second arrow, only the delegate is passed. After some discussion, it seems that the more normal approach in similar situations (e.g. context switches in user applications) is to return control back to the calling method and advance from there. For our purposes:
act/legEnds (in corresponding engine) --> agent advances plan --> control goes back to calling engine --> engine schedules the agent (presumably via the mobsim)
This is in conjunction with the attempt to make replanning agents pluggable (via re-implementation).
Checking this in since I have reached some stable intermediate state with working tests (a branch would be better, but ...).