|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object uk.ac.leeds.ccg.andyt.projects.genesis.process.Abstract_GENESIS_Model uk.ac.leeds.ccg.andyt.projects.genesis.process.Abstract_GENESIS_DemographicModel uk.ac.leeds.ccg.andyt.projects.genesis.process.GENESIS_DemographicModel
public class GENESIS_DemographicModel
A class for running a basic demographic simulation model as specified. The model is essentially aspatial in that it only deals with the processes of conception, miscarriage, birth and death. It does not deal with migration from one sub-region to another. It inputs age specific birth counts, age specific miscarriage rates and age and gender specific death counts. These are converted into mortality and fertility rates given the initial population. Conception is only maternally specified, paternal relationships are not handled. The initial population can be specified in age and gender counts, or it may be the output from a previous simulation of this kind. The model ticks with a daily time step and at each tick, death, miscarriage, pregnancy and birth are stochastically determined using probabilities and pseudo random tests. The model outputs statistics annually and is designed to run for a single year although there is scope for running for multiple years. There are options for continuing a simulation run. One option is to inputs check-pointed instances of the pseudo random sequence objects. With this option it is possible to run a simulation in a single 10 year step to produce a simulated results that is the same as running say one 5 year simulation followed by another 5 year simulation. Another option is to reset the pseudo random sequence objects and use an input argument to determine the pseudo random sequence used. This allows for a variety of results to be created. With pseudo random sequence resetting on an annual basis it should also be possible to produce identical results for multiple year runs done either in one process or in multiple processes. The implementation is designed to scale to large populations and will swap collections of people during execution as needed.
Field Summary |
---|
Fields inherited from class uk.ac.leeds.ccg.andyt.projects.genesis.process.Abstract_GENESIS_DemographicModel |
---|
_Demographics, _initial_Demographics, _InitialBirthCount_File, _InitialDeathCount_File, _InitialFertilityRate_File, _InitialMiscarriageRate_File, _InitialMortalityRate_File, _InitialPopulation_File, _LivingFemaleIDs, _LivingMaleIDs, _NearlyDuePregnantFemaleIDs, _NotPregnantFemaleIDs, _PregnantFemaleIDs, _regionIDs, _RunID, _SeedDirectory_File, _Years |
Fields inherited from class uk.ac.leeds.ccg.andyt.projects.genesis.process.Abstract_GENESIS_Model |
---|
_Directory, _GENESIS_AgentCollectionManager, _GENESIS_Environment, _HandleOutOfMemoryError, _ImageExporter, _InitialRandomSeed, _Input_Parameter_File, _NextRandomSeed, _RandomArray, _RandomSeed, _RandomSeedIncrement, _ResultDataDirectory_File, executorService |
Constructor Summary | |
---|---|
GENESIS_DemographicModel()
GENESIS_Environment reference |
|
GENESIS_DemographicModel(java.io.File thisFile)
|
|
GENESIS_DemographicModel(GENESIS_DemographicModel a_Demographic_Aspatial_1)
|
|
GENESIS_DemographicModel(GENESIS_Environment a_GENESIS_Environment)
|
Method Summary | |
---|---|
GENESIS_Female |
getNewInitialisedFemale(GENESIS_AgeBound ageBound,
java.lang.String birthSubregionID,
java.lang.String thisSubregionID,
java.util.TreeSet<java.lang.Long> subregionLivingFemaleIDs,
java.util.TreeSet<java.lang.Long> subregionNotPregnantFemaleIDs)
Creates and returns a new GENESIS_Female. |
GENESIS_Female |
getNewInitialisedFemale(GENESIS_AgeBound ageBound,
java.util.TreeSet<java.lang.Long> subregionLivingFemaleIDs,
java.util.TreeSet<java.lang.Long> subregionNotPregnantFemaleIDs)
Creates and returns a new GENESIS_Female. |
GENESIS_Male |
getNewInitialisedMale(GENESIS_AgeBound ageBound,
java.lang.String birthSubregionID,
java.lang.String thisSubregionID,
java.util.TreeSet<java.lang.Long> subregionLivingMaleIDs)
Creates and returns a new GENESIS_Male. |
GENESIS_Male |
getNewInitialisedMale(GENESIS_AgeBound ageBound,
java.util.TreeSet<java.lang.Long> subregionLivingMaleIDs)
Creates and returns a new GENESIS_Male. |
GENESIS_Age |
getRandomAge(GENESIS_AgeBound ageBound)
Used for initialising a time of birth. |
java.util.TreeMap<java.lang.String,java.util.TreeMap<java.lang.String,GENESIS_Population>> |
getSingleYearsOfAgePopulations(java.util.TreeMap<java.lang.String,java.util.TreeMap<java.lang.String,GENESIS_Population>> inputPopulation,
GENESIS_Time a_Time)
|
protected java.util.TreeSet<java.lang.Long> |
getSubregionIDs(java.util.TreeMap<java.lang.String,java.util.TreeSet<java.lang.Long>> regionIDMap,
java.util.TreeSet<java.lang.Long> subregionIDs,
java.lang.String subregionID)
|
void |
init_Demographics()
Initialises _Demographics. |
void |
initCollections(java.lang.String underscore)
|
int |
initialisePregnancies()
If at the start of the simulations there is no data about pregnancies this method can be used to initialise pregnancies so that due dates are spread out and in the first tick of a simulation then births may be due. |
void |
initialiseSubregionPopulations(java.util.TreeMap<java.lang.String,java.util.TreeMap<java.lang.String,GENESIS_Population>> singleYearAgeRegionPopulation)
From the single year age population counts initialise the individuals giving each a date of birth and for females evaluating pregnancy status. |
void |
initLookUpMSOAfromOAHashMap(java.lang.String fileSeparator)
CASDataHandler aCASDataHandler = new CASDataHandler(); theOAtoMSOALookup = aCASDataHandler.get_LookUpMSOAfromOAHashMap(); Generic_StaticIO.writeObject(theOAtoMSOALookup,inputFile) |
static void |
main(java.lang.String[] args)
This method wraps the entire process: It sets up logs, calls run(args), then after completion, it flushes the logs and returns. |
java.lang.String |
run(java.lang.Long randomSeed_Long,
uk.ac.leeds.ccg.andyt.projects.genesis.io.schema.parameters.ParametersType parameters,
java.lang.String fileSeparator,
boolean grid)
|
static void |
run(java.lang.String[] args,
boolean grid)
|
void |
run0()
|
java.util.HashSet<java.util.concurrent.Future> |
simulate(int years)
Dynamically simulates a population over time. |
java.lang.Object[] |
simulateBirth(GENESIS_Female a_Female,
long a_Female_ID,
GENESIS_Population localPopulation,
java.util.TreeSet<java.lang.Long> pregnantFemaleIDs,
java.util.TreeSet<java.lang.Long> nearlyDuePregnantFemaleIDs,
java.util.TreeSet<java.lang.Long> notPregnantFemaleIDs)
|
boolean |
simulateDeath(GENESIS_Mortality mortality,
GENESIS_Female a_Female,
java.lang.Long a_Female_ID,
GENESIS_FemaleCollection a_FemaleCollection,
java.lang.Long a_Collection_ID,
GENESIS_AgeBound ageBound,
GENESIS_Population subregionPopulation,
GENESIS_Population regionTotalPopulation,
java.util.TreeSet<java.lang.Long> pregnantFemaleIDs,
java.util.TreeSet<java.lang.Long> nearlyDuePregnantFemaleIDs,
java.util.TreeSet<java.lang.Long> notPregnantFemaleIDs)
|
boolean |
simulateDeath(GENESIS_Mortality mortality,
GENESIS_Male a_Male,
java.lang.Long a_Male_ID,
GENESIS_MaleCollection a_MaleCollection,
java.lang.Long a_Collection_ID,
GENESIS_AgeBound ageBound,
GENESIS_Population subregionPopulation,
GENESIS_Population regionTotalPopulation)
|
long |
simulateImmigrationToStudyRegion(GENESIS_Migration migration,
java.lang.String regionID,
java.util.TreeMap<java.lang.String,java.util.TreeSet<java.lang.Long>> regionLivingFemaleIDs,
java.util.TreeMap<java.lang.String,java.util.TreeSet<java.lang.Long>> regionNotPregnantFemaleIDs,
java.util.TreeMap<java.lang.String,java.util.TreeSet<java.lang.Long>> regionLivingMaleIDs)
|
long |
simulateInMigrationFromRestOfUK(GENESIS_Migration migration,
java.lang.String regionID,
java.util.TreeMap<java.lang.String,java.util.TreeSet<java.lang.Long>> regionLivingFemaleIDs,
java.util.TreeMap<java.lang.String,java.util.TreeSet<java.lang.Long>> regionNotPregnantFemaleIDs,
java.util.TreeMap<java.lang.String,java.util.TreeSet<java.lang.Long>> regionLivingMaleIDs)
|
boolean |
simulateMiscarriage(java.lang.String regionID,
GENESIS_Female a_Female,
long a_Female_ID,
GENESIS_AgeBound ageBound,
java.util.TreeSet<java.lang.Long> pregnantFemaleIDs,
java.util.TreeSet<java.lang.Long> nearlyDuePregantFemaleIDs,
java.util.TreeSet<java.lang.Long> notPregantFemaleIDs)
This should only get called if a_Female is known to be pregnant. |
boolean |
simulateMiscarriageNoRemoval(java.lang.String regionID,
GENESIS_Female a_Female,
long a_Female_ID,
GENESIS_AgeBound ageBound)
This should only get called if a_Female is known to be pregnant. |
boolean |
simulateOutMigration(GENESIS_Migration migration,
GENESIS_Female a_Female,
java.lang.Long a_Female_ID,
GENESIS_FemaleCollection a_FemaleCollection,
java.lang.Long a_Collection_ID,
GENESIS_AgeBound ageBound)
|
boolean |
simulateOutMigration(GENESIS_Migration migration,
GENESIS_Male a_Male,
java.lang.Long a_Male_ID,
GENESIS_MaleCollection a_MaleCollection,
java.lang.Long a_Collection_ID,
GENESIS_AgeBound ageBound)
|
boolean |
simulatePregnancy(GENESIS_Fertility fertility,
GENESIS_Female a_Female,
long a_Female_ID,
java.util.TreeSet<java.lang.Long> pregnantFemaleIDs,
java.util.TreeSet<java.lang.Long> notPregnantFemaleIDs)
|
void |
updateNearlyDuePregnantFemaleIDs()
Deprecated. |
void |
updateSubregionNearlyDuePregnantFemaleIDs(GENESIS_Female a_Female,
long a_Female_ID,
java.util.TreeSet<java.lang.Long> nearlyDuePregantFemaleIDs_HashSet)
|
protected void |
writeOutDeadCollectionNotAlreadyStoredOnFile()
Write out: _GENESIS_AgentCollectionManager._DeadFemaleCollection; _GENESIS_AgentCollectionManager._DeadMaleCollection; _GENESIS_AgentCollectionManager._DeadFemaleCollection_HashMap; _GENESIS_AgentCollectionManager._DeadMaleCollection_HashMap. |
void |
writeOutEstimatedFertility(java.io.File resultMetadataDirectory_File)
|
void |
writeOutEstimatedMortality(java.io.File resultMetadataDirectory_File)
|
void |
writeOutInputPopulations(java.util.TreeMap<java.lang.String,java.util.TreeMap<java.lang.String,GENESIS_Population>> inputPopulation,
java.io.File resultMetadataDirectory_File)
|
protected void |
writeOutLivingCollectionNotAlreadyStoredOnFile()
Writes out Living Collections that are not already stored on File from: _GENESIS_AgentCollectionManager._LivingFemaleCollection_HashMap; and, _GENESIS_AgentCollectionManager._LivingMaleCollection_HashMap. |
protected void |
writeOutLivingCollectionNotAlreadyStoredOnFile(boolean handleOutOfMemoryError)
Writes out Living Collections that are not already stored on File from: _GENESIS_AgentCollectionManager._LivingFemaleCollection_HashMap; and, _GENESIS_AgentCollectionManager._LivingMaleCollection_HashMap. |
void |
writeOutStartPopulations(java.io.File resultMetadataDirectory_File)
|
Methods inherited from class uk.ac.leeds.ccg.andyt.projects.genesis.process.Abstract_GENESIS_DemographicModel |
---|
get_Demographics, get_Fertility, get_Migration, get_Mortality, get_Years, init_Environment, initialiseBirthCount_File, initialiseDeathCount_File, initialiseFertilityRate_File, initialiseMiscarriageRate_File, initialiseMortalityRate_File, initialisePopulation_File |
Methods inherited from class uk.ac.leeds.ccg.andyt.projects.genesis.process.Abstract_GENESIS_Model |
---|
get_NextRandom, get_NextRandomSeed, get_Random, get_RandomArray, get_RandomArray, get_RandomArrayMinLength, getExecutorService, getFileThatExists, getLogger, init_RandomArrayMinLength, log |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public GENESIS_DemographicModel()
public GENESIS_DemographicModel(GENESIS_Environment a_GENESIS_Environment)
public GENESIS_DemographicModel(GENESIS_DemographicModel a_Demographic_Aspatial_1)
public GENESIS_DemographicModel(java.io.File thisFile)
Method Detail |
---|
public static void main(java.lang.String[] args)
args
- There are two expected arguments: args[0] long (psuedo random
sequence seed). A negative value is for continuing a simulation run by
loading the state of the pseudo random seed sequences of a continuation
run. If a continuation run is not being performed the program will exit
in error. args[1] String (workspace File path)public static void run(java.lang.String[] args, boolean grid)
args
- There are two expected arguments: args[0] long (psuedo random
sequence seed). A negative value is for continuing a simulation. A
continued simulation is run by loading check pointed serialised Random
instances in such a way that another result can be generated in a single
step at a later date without resetting Random seeds at arbitrary steps.
If a continuation run is not being performed the program will exit in
error. args[1] String (workspace File path)args
- public java.lang.String run(java.lang.Long randomSeed_Long, uk.ac.leeds.ccg.andyt.projects.genesis.io.schema.parameters.ParametersType parameters, java.lang.String fileSeparator, boolean grid)
randomSeed_Long
- parameters_File
- a_Parameters
-
public void run0()
protected void writeOutDeadCollectionNotAlreadyStoredOnFile()
protected void writeOutLivingCollectionNotAlreadyStoredOnFile(boolean handleOutOfMemoryError)
protected void writeOutLivingCollectionNotAlreadyStoredOnFile()
public void initCollections(java.lang.String underscore)
public void init_Demographics()
public java.util.TreeMap<java.lang.String,java.util.TreeMap<java.lang.String,GENESIS_Population>> getSingleYearsOfAgePopulations(java.util.TreeMap<java.lang.String,java.util.TreeMap<java.lang.String,GENESIS_Population>> inputPopulation, GENESIS_Time a_Time)
inputPopulation
- The population registered to age groups which is
not necessarily in single years of age.a_Time
-
TreeMap
the population in single years of age.public void initialiseSubregionPopulations(java.util.TreeMap<java.lang.String,java.util.TreeMap<java.lang.String,GENESIS_Population>> singleYearAgeRegionPopulation)
singleYearAgeRegionPopulation
- public GENESIS_Female getNewInitialisedFemale(GENESIS_AgeBound ageBound, java.lang.String birthSubregionID, java.lang.String thisSubregionID, java.util.TreeSet<java.lang.Long> subregionLivingFemaleIDs, java.util.TreeSet<java.lang.Long> subregionNotPregnantFemaleIDs)
ageBound
- birthSubregionID
- thisSubregionID
- subregionLivingFemaleIDs
- subregionNotPregnantFemaleIDs
-
public GENESIS_Female getNewInitialisedFemale(GENESIS_AgeBound ageBound, java.util.TreeSet<java.lang.Long> subregionLivingFemaleIDs, java.util.TreeSet<java.lang.Long> subregionNotPregnantFemaleIDs)
ageBound
- birthSubregionID
- thisSubregionID
-
public GENESIS_Male getNewInitialisedMale(GENESIS_AgeBound ageBound, java.lang.String birthSubregionID, java.lang.String thisSubregionID, java.util.TreeSet<java.lang.Long> subregionLivingMaleIDs)
ageBound
- birthSubregionID
- thisSubregionID
- subregionLivingMaleIDs
-
public GENESIS_Male getNewInitialisedMale(GENESIS_AgeBound ageBound, java.util.TreeSet<java.lang.Long> subregionLivingMaleIDs)
ageBound
- subregionLivingMaleIDs
-
public GENESIS_Age getRandomAge(GENESIS_AgeBound ageBound)
ageBound
-
public void writeOutEstimatedFertility(java.io.File resultMetadataDirectory_File)
public void writeOutEstimatedMortality(java.io.File resultMetadataDirectory_File)
public void writeOutInputPopulations(java.util.TreeMap<java.lang.String,java.util.TreeMap<java.lang.String,GENESIS_Population>> inputPopulation, java.io.File resultMetadataDirectory_File)
public void writeOutStartPopulations(java.io.File resultMetadataDirectory_File)
public java.util.HashSet<java.util.concurrent.Future> simulate(int years)
_Demographics
- _Years
- The number of years over which the simulation occursprotected java.util.TreeSet<java.lang.Long> getSubregionIDs(java.util.TreeMap<java.lang.String,java.util.TreeSet<java.lang.Long>> regionIDMap, java.util.TreeSet<java.lang.Long> subregionIDs, java.lang.String subregionID)
regionIDMap
- subregionIDs
- subregionID
-
public boolean simulateDeath(GENESIS_Mortality mortality, GENESIS_Female a_Female, java.lang.Long a_Female_ID, GENESIS_FemaleCollection a_FemaleCollection, java.lang.Long a_Collection_ID, GENESIS_AgeBound ageBound, GENESIS_Population subregionPopulation, GENESIS_Population regionTotalPopulation, java.util.TreeSet<java.lang.Long> pregnantFemaleIDs, java.util.TreeSet<java.lang.Long> nearlyDuePregnantFemaleIDs, java.util.TreeSet<java.lang.Long> notPregnantFemaleIDs)
a_Female
- a_Female_ID
- a_FemaleCollection
- age
-
public boolean simulateDeath(GENESIS_Mortality mortality, GENESIS_Male a_Male, java.lang.Long a_Male_ID, GENESIS_MaleCollection a_MaleCollection, java.lang.Long a_Collection_ID, GENESIS_AgeBound ageBound, GENESIS_Population subregionPopulation, GENESIS_Population regionTotalPopulation)
public boolean simulateOutMigration(GENESIS_Migration migration, GENESIS_Female a_Female, java.lang.Long a_Female_ID, GENESIS_FemaleCollection a_FemaleCollection, java.lang.Long a_Collection_ID, GENESIS_AgeBound ageBound)
public boolean simulateOutMigration(GENESIS_Migration migration, GENESIS_Male a_Male, java.lang.Long a_Male_ID, GENESIS_MaleCollection a_MaleCollection, java.lang.Long a_Collection_ID, GENESIS_AgeBound ageBound)
public long simulateInMigrationFromRestOfUK(GENESIS_Migration migration, java.lang.String regionID, java.util.TreeMap<java.lang.String,java.util.TreeSet<java.lang.Long>> regionLivingFemaleIDs, java.util.TreeMap<java.lang.String,java.util.TreeSet<java.lang.Long>> regionNotPregnantFemaleIDs, java.util.TreeMap<java.lang.String,java.util.TreeSet<java.lang.Long>> regionLivingMaleIDs)
public long simulateImmigrationToStudyRegion(GENESIS_Migration migration, java.lang.String regionID, java.util.TreeMap<java.lang.String,java.util.TreeSet<java.lang.Long>> regionLivingFemaleIDs, java.util.TreeMap<java.lang.String,java.util.TreeSet<java.lang.Long>> regionNotPregnantFemaleIDs, java.util.TreeMap<java.lang.String,java.util.TreeSet<java.lang.Long>> regionLivingMaleIDs)
public java.lang.Object[] simulateBirth(GENESIS_Female a_Female, long a_Female_ID, GENESIS_Population localPopulation, java.util.TreeSet<java.lang.Long> pregnantFemaleIDs, java.util.TreeSet<java.lang.Long> nearlyDuePregnantFemaleIDs, java.util.TreeSet<java.lang.Long> notPregnantFemaleIDs)
a_Female
- a_Female_ID
- a_FemaleCollection
- age
-
public void updateSubregionNearlyDuePregnantFemaleIDs(GENESIS_Female a_Female, long a_Female_ID, java.util.TreeSet<java.lang.Long> nearlyDuePregantFemaleIDs_HashSet)
@Deprecated public void updateNearlyDuePregnantFemaleIDs()
public boolean simulatePregnancy(GENESIS_Fertility fertility, GENESIS_Female a_Female, long a_Female_ID, java.util.TreeSet<java.lang.Long> pregnantFemaleIDs, java.util.TreeSet<java.lang.Long> notPregnantFemaleIDs)
a_Female
- a_Female_ID
- a_FemaleCollection
- age
-
public boolean simulateMiscarriage(java.lang.String regionID, GENESIS_Female a_Female, long a_Female_ID, GENESIS_AgeBound ageBound, java.util.TreeSet<java.lang.Long> pregnantFemaleIDs, java.util.TreeSet<java.lang.Long> nearlyDuePregantFemaleIDs, java.util.TreeSet<java.lang.Long> notPregantFemaleIDs)
a_Female
- a_Female_ID
- ageBound
-
public boolean simulateMiscarriageNoRemoval(java.lang.String regionID, GENESIS_Female a_Female, long a_Female_ID, GENESIS_AgeBound ageBound)
a_Female
- a_Female_ID
- ageBound
-
public int initialisePregnancies()
public void initLookUpMSOAfromOAHashMap(java.lang.String fileSeparator)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |