Closed mhinsch closed 1 year ago
For me this may correspond to agents.jl agent_step! method. Going to examine that.
So for me, following an agent_step! pattern to death! and births! is not so smooth, though I think that the functions birth! and death! are usable by applyTransition! (did not try).
On the other side,
My understanding now is that these functions are not completely the same as marraiges, divorces etc. as they don't only apply "in-place" modifications for single agents, but also modify the whole population. So having them within agent-step! method is not so "smooth".
Suggestion:
You may want to consider having an additional applyTransition! (with an additional argument corresponding to a subpopulation (deads, babies or later e.g. immigrants) or simply another transition function applyModelTransition!
that is applied to the whole population rather than a single agent.
So for me, following an agent_step! pattern to death! and births! is not so smooth, though I think that the functions birth! and death! are usable by applyTransition! (did not try).
On the other side,
* doBirths! adds agents to the population, and yes towards unification this needs to be changed so that agents can be added in a separate step * doDeaths! does not remove agents from the population, in contrary to doBirths! (and this is properly ok so, as the client have the options to remove or leave deads)
My understanding now is that these functions are not completely the same as marraiges, divorces etc. as they don't only apply "in-place" modifications for single agents, but also modify the whole population. So having them within agent-step! method is not so "smooth".
If we think of transitions more as "events" that can happen to agents then both, birth and death, are regular events just as socialTransition. The main issue is that they don't just modify the agents they apply to (which both of them do), but also the global state, which is not provided for in the applyTransition paradigm.
Anyway, I think the cleanest solution is probably to have functions birthAgent!
and killAgent!
(or something along these lines) operating on model which can then be called from within birth and death. Would that work with MultiAgents?
This has been shown in a closed PR why such a pattern needs to be avoided.
This has been shown in a closed PR why such a pattern needs to be avoided.
Sorry, I missed the 'to-be-closed' label earlier. Which pattern are you referring to? And why do you want to close this?
132
That's a pretty long thread. Could you specify?
These one-word replies are really not very helpful. If you are referring to the issue with the removal of dead agents, that's easily solvable (as discussed further down in the same thread) and does not at all prevent making birth and death single-agent functions.
The topic has been extensively discussed. It has been shown that the proposed suggestion is not applicable. It has been shown that:
Can you please stop closing this until we have an agreement.
Birth and death should be handled analogously to the other transition functions, i.e. it should be possible to simply call them on a set of agents in turn.
This obviously doesn't work a priori as death removes agents and birth produces agents. I can think of three obvious way to handle this:
applyTransition
that handles births and/or deaths. This would circumvent the issue with the accessibility of the pop within the transition, but it's not the prettiest solution IMO.