MengeCrowdSim / Menge

The source code for the Menge crowd simulation framework
Apache License 2.0
139 stars 64 forks source link

Is it possible to register a task using the xml specification? #155

Closed JSchweiz77 closed 3 years ago

JSchweiz77 commented 3 years ago

Hi,

I would like to instantiate a task using the xml specification file. I know, that there is the Formation plugin example, which is also using a task element. But I don't understand how the task is registered to the simulation.

How do I have to modify the xml specification, that a task is in the pipleline cycle and executed?

Thanks for the help

MengeCrowdSim commented 3 years ago

Sorry for the slow response. I've been cut off a bit recently.

Your question highlights a gap. The tasks that have been created in the past are all in support of some other element. So, the element itself specifies a task (and that's how it gets added to the simulation). That said, there's absolutely no reason why a task should not be declared explicitly in the simulation as just some thing that does work. For example, I could imagine a task that simply dumps out a density field at each time step. However, as of now you can't do that literally.

You've got a couple of options:

1) If the task is truly a data sink (i.e., it does work that nothing in the simulation depends on), you might consider recording the agent trajectories into an scb file and do the analysis as a post processing endeavor. Obviously, if the task you have in mind depends on more than agent position (and related), this approach would be insufficient. 2) You could create a dummy element that has associated the task you want to do. By instantiating one such element, it will automatically register its task. 3) Help extend the Menge code to allow parsing of a <Task> tag, akin to how the other element tags are created.

If you give me a sense of what the nature of the Task that you need to execute, I can give you a bit more directed guidance.