Calculation of agent variation for constant population size
S_neu = \sum_milieus \lfloor X_neu^milieu \lfloor
\deltaS = S_neu - S_alt
X_neu^milieu = p^milieu * X_alt^milieu
Sort X_neu^milieu - \lfloor X_neu^milieu \lfloor
randomly choose \deltaS times milieu with max(X_neu^milieuRemaining - \lfloor X_neu^milieuRemaining \lfloor)
Analysis
POPULATION_UPDATE_INTERVAL
Calculate absolute area between S^1 and S^x where the index indicates the value for POPULATION_UPDATE_INTERVAL.
Important Hints
Do not forget to update internal agent lists that are initialised at simulation's beginning! To this end, there is an observer mechanism implemented at the GPopulationUpdater. To use it, let the class that cares for agent lists, for instance an implementation of ContextBuilder, implement the interface GimAgentBirthDieObserver and register it at the updater:
this.updater = new GPopulationUpdater<Household<?>>();
this.updater.subscribeAgentBirthDieObserver(this);
Consider network relations in die() and birth() methods. It is a good idea to use an instance of MoreNetworkService to build the network and make it available in the model manager.