Demo models‎ > ‎Extended Schelling‎ > ‎

4. Structure

The model implements the JAS-mine Model-Collector-Observer architecture. The birth and death probabilities are loaded by the Model in the buildObjects() method. Note that, when there are more parameter files to be loaded, it is generally more transparent to put them in a separate class, e.g. Parameters.java, in the data package –see the demo07 model).

The parameters characterizing the grid and the synthetic population are defined in the Model as @GUIparameter (replacing the deprecated @ModelParameter annotation); when the model is built, a specific parameter frame is automatically created which allows direct imputation by the user. The loadPopulation parameter is a boolean parameter which determines whether the user-defined parameters have to be disregarded and the initial population loaded from the input database.

Similarly, the parameters controlling what output is produced are defined in the Collector as @GUIparameter (both the Model and the Collector implement a Manager interface); when the model is built, a second parameter frame is automatically created which allows direct imputation by the user. The saveMicrodata and saveMacrodata are boolean parameters which determine whether the whole population or only aggregate statistics are persisted in the database.

The Collector creates all the statistical objects required to produce the macro statistics (mean satisfaction and population size). To improve on clarity, the final variables to be persisted are stored in a separate class, Statistics.java of the @Entity type: this is passed as an argument in the DumpInfo process of the Collector: the JAS-mine persistence engine takes care of dumping all the variables not defined as @Transient in Statistics.java in a database table with the same name.


Previous: 3. Added microsimulation features             Next: 5. References