Demo models‎ > ‎Demo07‎ > ‎

1. The JAS-mine implementation


The JAS-mine class structure of the Demo07 model is organised as in Table 1. 

 

Table 1. Class structure 

The core of the simulation lies in the model package, which contains the classes PersonModel, Person and Household. The experiment package contains the StartPerson class that specifies to run the simulation in interactive mode, the PersonsCollector class that collects all the statistics needed to monitor the simulation and updates the output database, and the PersonsObserver class that creates and manages the graphical object for runtime monitoring. Parameters and coefficients are loaded into the Parameters class in the data package. All filters used to filter collections are grouped in the data.filters subpackage. The categories used for gender, educational levels, civil state and work state are stored as Enums in the model.enums subpackage. Finally the algorithms package contains classes that perform technical tasks (in the example, MapAgeSearch searches age- and gender- specific values in a map of coefficients, with age and gender as keys). Classes in the algorithms package are meant to be of general use beyond the specific model being developed, and are candidates for inclusion in the core libraries in future releases of JAS-mine.

The project is organised in the standard JAS-mine folder structure, as described in Table 2.

Folder

Files

Notes

input

p_birth.xls

Birth probabilities, by age and (simulated) year

 

p_death_f.xls

Death probabilities, by age and (simulated) year, for females

 

p_death_m.xls

Death probabilities, by age and (simulated) year, for males

 

p_marriage.xls

Marriage probability, by age group, gender and civil state

 

p_divorce.xls

 

p_inwork.xls

Alignment target Divorce probability, by age group and (simulated) year

Alignment target Employment probability, by age group, gender and (simulated) year

 

reg_marriage.xls

Marriage score coefficients: determine how well a specific male fits a given female

 

reg_divorce.xls

Divorce coefficients: determine the (unaligned) probability of divorcing

 

reg_inwork.xls

Employment coefficients: determine the (unaligned) probability of being employed

 

 

 

 

input.h2

Initial population including their properties

 

 

 

output

(empty)

 

 

 

 

src

(all java classes)

See Table 1

 

 

 

target

(compiled classes, JARs  etc.)

 

 

 

 

libs

(external libraries, empty)

 

 

 

 

(root)

pom.xml

 


Table 2. File structure

The Java classes are contained in the src folder. The input folder contains the MS Excel parameter files and the initial population, stored as an h2 database (input.h2). The output folder is initially empty. For each new simulation experiment, a new subfolder is created with the appropriate time stamp, so as to uniquely identify the experiment (e.g. 20141218151116, for experiments initiated on the 18th December 2014, at 16 seconds after 3.11pm). The subfolder contains a copy of all the input files (in the input directory) and an output database (out.h2, in the database directory).

The target and lib folders contain technical content of no immediate interest to the modeller. The root folder also contains a pom (project object model) file, which contains information on the JAS-mine version used for the project. Apache Maven, an open source software project management and comprehension tool uses this information to manage all the project's build, reporting and documentation. In particular, by specifying in the pom file the desired release for each library used (including the JAS-mine libraries), Maven automatically downloads the relevant libraries from the appropriate repositories.  This implies that each JAS-mine project has its own copy of all the libraries used, ensuring that the project is self-contained and that it keeps working exactly as intended even when new versions of the libraries are released (and even if backward compatibility is not respected). 

Next: 2. Parameters