Skip to content

faq 80052227

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

Aborting an agent

by Milos Balac on 2016-08-24 09:31:39


Hi Everybody,

I am trying to abort an agent after a certain condition is met close to the end of his activity. So what I do at the moment, if the condition is met I set the agent state to ABORT. However, this state gets changed to LEG state when ActivityEngine detects that the activity should end during the doSimStep. So the agent recovers and continues his plan. I also tried implementing MobsimEngine and using InternalInterface in order to arranegeNextAgentState, but it also did not help.

Setting the route of the following leg to null in order to abort the plan is something that makes this work, but I would like to have to avoid hacks like this.

So I am wondering, when should be the right moment to abort the plan (if it is possible) or where should be my point of entry in order to do this?

 

Thanks,

Milos


Comments: 1


Re: Aborting an agent

by Kai Nagel on 2016-08-25 07:33:18

Dear Milos, my intuition is that you need to solve this somewhere else.  The framework (= the activity engine, the leg engines) sets the agent state to abort if it does not know what to do (e.g. try to enter an outgoing link that is not connected to the intersection).  I would say you need to solve this inside the agent.  I.e. first something like "rescheduleActivityEnd" to "now".  As a result, the framework will call "endActivityAndComputeNextAction", which is an agent method.  Here, the agent should react in the way you need it.  –. I think you have examples how to program composed agents. – If you need more info, pls let me know, or bring to developer meeting.  Best, Kai

Clone this wiki locally