Skip to content

faq 35815439

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

How to end an agent's activity prematurely?

by Kai Nagel on 2015-09-24 20:57:40


Question by Lin Padgham:
Is there a way that once an activity has started, we can make its end time earlier? Just altering it in the plan doesn't work - it retains the original time it seems...

Comments: 1


Re: How to end an agent's activity prematurely?

by Kai Nagel on 2015-09-24 21:14:43

You are correct, changing the plan by itself is not sufficient.  The reason is that the architecture here is event-driven (to save computing time), that is, the agent essentially tells the simulation to wake him up at the end of the activity, and then goes to sleep.

For the time being, the solution is to call

qsim.rescheduleActivityEnd( agent ) ;

after a change of the activity end time of the current plan (where qsim is the instance of the QSim one is working with).  This also needs to be done for agents without plans; every time you expect that agent.getActivityEndTime() returns a different answer then before, the above method will have to be called (in order to re-schedule the wake-up time).

An example would be good (it would look similar to RunWithinDayReplanningFromPlansExample) ... but I don't have enough time right now to write it.

Clone this wiki locally