Community
Participate
Working Groups
Build Identifier: If any new agents are being created (i.e. from the global model by an action and a rule) during run time the new agents are build however they do not perform any initialize action according their agent class. Reproducible: Always
This is actually something that I've thought a bit about and I'm not sure what option to take. Form one point of view it make senses to always call the initialize method for newly created agents. On the other hand when agents are created during a run is that "really" initialization? For example, we often set agents at random locations at the start of a run and that typically wouldn't be something e would want to do late in a run. If we call initialize automatically, there would be no way to prevent that from happening. On the other hand, you can always call initialize directly using the "Perform" action. ANother option would be to have a flag for create agents which indicates whether the agents should be initialized as well.
I see the point, where you do not want to have the new agents be initialized. However in many cases an initialization is desired. The workaround we did was using an additional method calling the initialization: List<Rule> rules = new ArrayList<Rule>(); for(Object obi : getPatientScape().getInitialRules().getVector()){ rules.add((Rule)obi); But this is not very intuitive. I like your idea with the flag, where I can specify in the properties if the new agents should be initialized or not. Such feature would help a lot.
Before deciding to do it that way, what about adding an "Initialize" Action to the set of actions which would call all agent initialize actions, or explicitly calling the separate Initialize actions? I mention that because when we create better support for grouped actions it may be that the start up behavior becomes a group action that includes the Initialize actions. Just something to think about; the flag is probably the most straightforward way to support this.