uk.ac.leeds.ccg.andyt.projects.genesis.process
Class Compare_GENESIS_DemographicModel

java.lang.Object
  extended by uk.ac.leeds.ccg.andyt.projects.genesis.process.Abstract_GENESIS_Model
      extended by uk.ac.leeds.ccg.andyt.projects.genesis.process.Compare_GENESIS_DemographicModel
All Implemented Interfaces:
java.io.Serializable

public class Compare_GENESIS_DemographicModel
extends Abstract_GENESIS_Model

A class to generate a society. Designed so that the population can be optionally and where appropriate, stored on file. This should scale to larger populations although disk IO speed may be an issue...

See Also:
Serialized Form

Field Summary
 
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
Compare_GENESIS_DemographicModel()
           
 
Method Summary
protected  void addResultToCompare(java.io.File resultToCompare, java.io.File resultToCompareBase, java.lang.String fileSeparator)
          Updates resultsToCompare_TreeMap to include resultToCompare mapping in the pseudoRandomNumberSeed from the metadata directory as the key for the map.
 void compare(java.io.File a_File, java.io.File b_File)
          Compares simulation results in file a_File with result in File b_File and reports differences via the report(String) method.
 java.io.File compare(java.lang.String fileSeparator, java.lang.String underscore)
          Compare all results in resultsToCompare_TreeMap using getSimilarity(String,File,File,String) The File location of the result with the closest similarity to another estimate (theoretically expected estimate based on estimated mid-year populations) is returned.
 java.math.BigDecimal compareFertility(GENESIS_Fertility inputFertility_Fertility, GENESIS_Fertility outputFertility_Fertility)
           
 java.math.BigDecimal compareMortality(GENESIS_Mortality inputMortality_Mortality, GENESIS_Mortality outputMortality_Mortality)
           
 void doGenesisSimulatorRun(java.lang.String[] args, java.lang.String fileSeparator, java.lang.String underscore)
          This is for grid comparison runs.
 void doLocalPCRun(java.lang.String[] args, java.lang.String fileSeparator, java.lang.String underscore)
           
 void fertilityOutput(java.lang.String areaCode, java.io.File resultDirectory, java.lang.String title, java.lang.String format, int dataWidth, int dataHeight, java.lang.String xAxisLabel, java.lang.String yAxisLabel, boolean drawOriginLinesOnPlot, int ageIntervals, int startAgeOfEndYearInterval, java.lang.Long minAgeYears, java.lang.Long maxAgeYears, int decimalPlacePrecisionForCalculations, int decimalPlacePrecisionForDisplay, java.math.RoundingMode roundingMode, long range, long highestLeaf, long l, java.lang.String partFilename)
           
protected  void generateComparisonPlots()
           
 uk.ac.leeds.ccg.andyt.projects.genesis.io.schema.metadata.MetadataType getMetadataForResult(java.io.File resultDirectory, java.lang.String underscore)
           
 java.math.BigDecimal getSimilarity(java.lang.String fileSeparator, java.io.File parameters_File, java.io.File base_File, java.lang.String underscore)
           
 long getStartYearForResult(java.io.File resultDirectory, java.lang.String underscore)
           
static void main(java.lang.String[] args)
           
 void miscarriageOutput(java.lang.String areaCode, java.io.File resultDirectory, java.lang.String title, java.lang.String format, int dataWidth, int dataHeight, java.lang.String xAxisLabel, java.lang.String yAxisLabel, boolean drawOriginLinesOnPlot, int ageIntervals, int startAgeOfEndYearInterval, java.lang.Long minAgeYears, java.lang.Long maxAgeYears, int decimalPlacePrecisionForCalculations, int decimalPlacePrecisionForDisplay, java.math.RoundingMode roundingMode, long range, long highestLeaf, long l, java.lang.String partFilename)
           
 void mortalityOutput(java.lang.String areaCode, java.io.File resultDirectory, java.lang.String title, java.lang.String format, int dataWidth, int dataHeight, java.lang.String xAxisLabel, java.lang.String yAxisLabel, boolean drawOriginLinesOnPlot, int ageIntervals, int startAgeOfEndYearInterval, java.lang.Long minAgeYears, java.lang.Long maxAgeYears, int decimalPlacePrecisionForCalculations, int decimalPlacePrecisionForDisplay, java.math.RoundingMode roundingMode, long range, long highestLeaf, long l, java.lang.String partFilename)
           
 void popOutput(java.lang.String areaCode, java.io.File resultDirectory, java.lang.String title, java.lang.String format, int dataWidth, int dataHeight, java.lang.String xAxisLabel, java.lang.String yAxisLabel, boolean drawOriginLinesOnPlot, int ageIntervals, int startAgeOfEndYearInterval, java.lang.Long minAgeYears, java.lang.Long maxAgeYears, int decimalPlacePrecisionForCalculations, int decimalPlacePrecisionForDisplay, java.math.RoundingMode roundingMode, long range, long highestLeaf, long l, java.lang.String partFilename)
           
 
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_Environment, init_RandomArrayMinLength, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Compare_GENESIS_DemographicModel

public Compare_GENESIS_DemographicModel()
Method Detail

main

public static void main(java.lang.String[] args)

doGenesisSimulatorRun

public void doGenesisSimulatorRun(java.lang.String[] args,
                                  java.lang.String fileSeparator,
                                  java.lang.String underscore)
                           throws java.io.IOException
This is for grid comparison runs. In this case, all the results to be compared are in a directory containing other data so the. These results all start with the name "output" and so this is used to filter for these results which are then dug into to find a more specific file location within. It is assumed that there is only one result output per result, i.e. the output is not a multiple run.

Parameters:
args - args[0] is a directory location containing the outputs to be compared. These should be the only files or directories with names starting with the string "output" args[1] is the location that a results file comparison.out will be written.
Throws:
java.io.IOException

addResultToCompare

protected void addResultToCompare(java.io.File resultToCompare,
                                  java.io.File resultToCompareBase,
                                  java.lang.String fileSeparator)
Updates resultsToCompare_TreeMap to include resultToCompare mapping in the pseudoRandomNumberSeed from the metadata directory as the key for the map. Generic_StaticIO.recursiveFileList(resultToCompareBase, 2) is reported if resultToCompareBase is not null.

Parameters:
resultToCompare -
resultToCompareBase -
fileSeparator -

doLocalPCRun

public void doLocalPCRun(java.lang.String[] args,
                         java.lang.String fileSeparator,
                         java.lang.String underscore)
                  throws java.io.IOException
Parameters:
args - args[0] is the directory containing the results to compare args[1] is the directory where the comparison.out file will be written
Throws:
java.io.IOException

generateComparisonPlots

protected void generateComparisonPlots()

popOutput

public void popOutput(java.lang.String areaCode,
                      java.io.File resultDirectory,
                      java.lang.String title,
                      java.lang.String format,
                      int dataWidth,
                      int dataHeight,
                      java.lang.String xAxisLabel,
                      java.lang.String yAxisLabel,
                      boolean drawOriginLinesOnPlot,
                      int ageIntervals,
                      int startAgeOfEndYearInterval,
                      java.lang.Long minAgeYears,
                      java.lang.Long maxAgeYears,
                      int decimalPlacePrecisionForCalculations,
                      int decimalPlacePrecisionForDisplay,
                      java.math.RoundingMode roundingMode,
                      long range,
                      long highestLeaf,
                      long l,
                      java.lang.String partFilename)

miscarriageOutput

public void miscarriageOutput(java.lang.String areaCode,
                              java.io.File resultDirectory,
                              java.lang.String title,
                              java.lang.String format,
                              int dataWidth,
                              int dataHeight,
                              java.lang.String xAxisLabel,
                              java.lang.String yAxisLabel,
                              boolean drawOriginLinesOnPlot,
                              int ageIntervals,
                              int startAgeOfEndYearInterval,
                              java.lang.Long minAgeYears,
                              java.lang.Long maxAgeYears,
                              int decimalPlacePrecisionForCalculations,
                              int decimalPlacePrecisionForDisplay,
                              java.math.RoundingMode roundingMode,
                              long range,
                              long highestLeaf,
                              long l,
                              java.lang.String partFilename)

mortalityOutput

public void mortalityOutput(java.lang.String areaCode,
                            java.io.File resultDirectory,
                            java.lang.String title,
                            java.lang.String format,
                            int dataWidth,
                            int dataHeight,
                            java.lang.String xAxisLabel,
                            java.lang.String yAxisLabel,
                            boolean drawOriginLinesOnPlot,
                            int ageIntervals,
                            int startAgeOfEndYearInterval,
                            java.lang.Long minAgeYears,
                            java.lang.Long maxAgeYears,
                            int decimalPlacePrecisionForCalculations,
                            int decimalPlacePrecisionForDisplay,
                            java.math.RoundingMode roundingMode,
                            long range,
                            long highestLeaf,
                            long l,
                            java.lang.String partFilename)

fertilityOutput

public void fertilityOutput(java.lang.String areaCode,
                            java.io.File resultDirectory,
                            java.lang.String title,
                            java.lang.String format,
                            int dataWidth,
                            int dataHeight,
                            java.lang.String xAxisLabel,
                            java.lang.String yAxisLabel,
                            boolean drawOriginLinesOnPlot,
                            int ageIntervals,
                            int startAgeOfEndYearInterval,
                            java.lang.Long minAgeYears,
                            java.lang.Long maxAgeYears,
                            int decimalPlacePrecisionForCalculations,
                            int decimalPlacePrecisionForDisplay,
                            java.math.RoundingMode roundingMode,
                            long range,
                            long highestLeaf,
                            long l,
                            java.lang.String partFilename)

compare

public java.io.File compare(java.lang.String fileSeparator,
                            java.lang.String underscore)
Compare all results in resultsToCompare_TreeMap using getSimilarity(String,File,File,String) The File location of the result with the closest similarity to another estimate (theoretically expected estimate based on estimated mid-year populations) is returned.


compareMortality

public java.math.BigDecimal compareMortality(GENESIS_Mortality inputMortality_Mortality,
                                             GENESIS_Mortality outputMortality_Mortality)
Parameters:
inputMortality_Mortality -
outputMortality_Mortality -
Returns:
SSE

compareFertility

public java.math.BigDecimal compareFertility(GENESIS_Fertility inputFertility_Fertility,
                                             GENESIS_Fertility outputFertility_Fertility)
Parameters:
inputFertility_Fertility -
outputFertility_Fertility -
Returns:
SSE

getSimilarity

public java.math.BigDecimal getSimilarity(java.lang.String fileSeparator,
                                          java.io.File parameters_File,
                                          java.io.File base_File,
                                          java.lang.String underscore)

compare

public void compare(java.io.File a_File,
                    java.io.File b_File)
Compares simulation results in file a_File with result in File b_File and reports differences via the report(String) method.


getStartYearForResult

public long getStartYearForResult(java.io.File resultDirectory,
                                  java.lang.String underscore)

getMetadataForResult

public uk.ac.leeds.ccg.andyt.projects.genesis.io.schema.metadata.MetadataType getMetadataForResult(java.io.File resultDirectory,
                                                                                                   java.lang.String underscore)