org.cfpm.caves.za
Class SouthAfricaModel

java.lang.Object
  extended by uchicago.src.sim.engine.SimModelImpl
      extended by org.cfpm.caves.za.SouthAfricaModel
All Implemented Interfaces:
uchicago.src.reflector.DescriptorContainer, uchicago.src.sim.engine.SimEventProducer, uchicago.src.sim.engine.SimModel

public class SouthAfricaModel
extends uchicago.src.sim.engine.SimModelImpl

The model class.

Author:
Ruth, Scott

Nested Class Summary
 class SouthAfricaModel.AgeDistributionRecorder
           
(package private)  class SouthAfricaModel.EmpiricalDiscreteDist
          This inner class defines a discrete distribution of empirical values, e.g.
(package private)  class SouthAfricaModel.EmpiricalDiscreteDistArray
          An array of discrete distributions of empirical values.
 class SouthAfricaModel.FriendshipNetworkRecorder
           
 class SouthAfricaModel.HHIncomeRecorder
           
 class SouthAfricaModel.HHWealthDistRecorder
           
 class SouthAfricaModel.HIVDeathRecorder
           
 class SouthAfricaModel.HouseholdEconomyRecorder
           
 class SouthAfricaModel.MinerSource
          This inner class is a source of miners, i.e.
 class SouthAfricaModel.MiningRecorder
           
 class SouthAfricaModel.PartnershipRecorder
           
 class SouthAfricaModel.SexualNetworkRecorder
           
 class SouthAfricaModel.StokvelRecorder
           
 class SouthAfricaModel.VillageEconomyRecorder
           
(package private)  class SouthAfricaModel.WHOLifeTable
          This class represents a life table as produced by the WHO.
 
Field Summary
(package private)  double adultEmploymentRate
          model parameter: overall proportion of adults with a job.
(package private)  SouthAfricaModel.AgeDistributionRecorder ageDistRecorder
           
(package private)  double birthRate
          model parameter: birth rate as number of births per 1000 per year.
(package private)  double burialCost
          model parameter: average cost of a burial.
private static int CHILD
           
(package private)  double childGrant
          model parameter: monthly child grant for children under the age limit.
(package private)  int childGrantAgeLimit
          model parameter: upper age limit for child grant.
(package private)  double childGrantProportion
          model parameter: proportion of eligible children receiving the child grant.
(package private)  java.util.ArrayList<java.lang.String> chosenHH
           
(package private)  double churchParticipationRate
          model parameter: overall proportion of households being member of a church.
(package private)  double collegeFee
          model parameter: yearly university fees.
(package private)  SouthAfricaModel.HIVDeathRecorder deathRecorder
           
(package private)  double densityFactor
          model parameter: density factor of villages.
(package private)  org.cfpm.caves.za.EndorsementDisposalPolicy disposalPolicy
          Retracts facts when they become obsolete according to the specified filters ("disposal policies").
(package private)  jess.Rete engine
          the Jess engine
(package private)  SouthAfricaModel.WHOLifeTable femalesTable
           
(package private)  double foodCostChild
          model parameter: monthly food cost for a child up to 7 years.
(package private)  double foodCostFemaleAdult
          model parameter: monthly food cost for a female.
(package private)  double foodCostMaleAdult
          model parameter: monthly food cost for a male.
(package private)  org.cfpm.caves.za.MultiLayerNetwork2DDisplay friendNetwork
           
(package private)  uchicago.src.sim.gui.DisplaySurface friendNetworkDisplay
           
(package private)  SouthAfricaModel.FriendshipNetworkRecorder friendNetworkRecorder
           
(package private)  double governmentEmploymentRate
          model parameter: overall proportion of adults with a government job.
private static int GRANDCHILD
           
(package private)  int gridSizeX
          model parameter: size (number of cells) of the 2D grid used as spatial model in x direction.
(package private)  int gridSizeY
          model parameter: size (number of cells) of the 2D grid used as spatial model in y direction.
(package private)  SouthAfricaModel.HouseholdEconomyRecorder hhEconomyRecorder
           
(package private)  SouthAfricaModel.HHIncomeRecorder hhIncomeRecorder
           
(package private)  SouthAfricaModel.HHWealthDistRecorder hhWealthDistRecorder
           
(package private)  int houseCost
          model parameter: average cost for a new house in the village.
(package private)  java.util.ArrayList<org.cfpm.caves.za.Household> householdList
          list of households
(package private)  double interArrivalTime
          model parameter: mean inter-arrival time for in-migrating mine workers.
(package private)  org.cfpm.caves.za.FactBaseScourer jessLink
          the class containing procedural functionality outsourced from Jess.
(package private)  org.cfpm.caves.za.MultiLayerNetwork2DDisplay kinshipNetwork
           
(package private)  uchicago.src.sim.gui.DisplaySurface kinshipNetworkDisplay
           
(package private)  int lowerMaxNumFriends
          model parameter: lower limit for the maximal number of friends.
(package private)  int lowerMaxNumPartners
          model parameter: lower limit for the maximal number of concurrent sexual partners.
(package private)  SouthAfricaModel.WHOLifeTable malesTable
           
(package private)  double maxEndorsementBase
          model parameter: maximum value for the base used to compute the overall endorsement value.
(package private)  int maxEndorsementClasses
          model parameter: maximum number of endorsement classes.
(package private)  int maxLobola
          model parameter: maximum lobola (bride price).
(package private)  int maxRemittance
          model parameter: maximum remittance from a migrant agent.
(package private)  int maxShackRent
          model parameter: upper bound of the monthly rent asked for a shack in the village.
(package private)  double maxTagEvolutionPropensity
          model parameter: maximal tag evolution propensity.
(package private)  int meanAgeArrived
          model parameter: mean age of in-migrants.
(package private)  int meanNumArrived
          model parameter: mean number of in-migrants arriving in the area at one time.
(package private)  org.cfpm.caves.za.Mine mine
          the mine
(package private)  double mineHIVPrevalence
          model parameter: HIV prevalence amongst in-migrating mine workers.
(package private)  double minEndorsementBase
          model parameter: minimum value for the base used to compute the overall endorsement value.
(package private)  int minEndorsementClasses
          model parameter: minimum number of endorsement classes.
(package private)  SouthAfricaModel.MinerSource minerSource
          the source of miners from outside the area
(package private)  SouthAfricaModel.MiningRecorder miningRecorder
           
(package private)  int miningTick
          model parameter: tick to start mining in the area.
(package private)  int minLobola
          model parameter: minimum lobola (bride price).
(package private)  int minRemittance
          model parameter: minimum remittance from a migrant agent.
(package private)  int minShackRent
          model parameter: lower bound of the monthly rent asked for a shack in the village.
(package private)  double minTagEvolutionPropensity
          model parameter: minimal tag evolution propensity.
 int month
           
(package private)  uchicago.src.sim.analysis.LocalDataRecorder monthlyDataRecorder
           
(package private)  double motherChildHIVTransmissionRate
          model parameter: mother-to-child transmission rate of HIV.
(package private)  java.util.HashMap<java.lang.String,org.cfpm.caves.za.Household> nameHouseholdMap
          data structure to map names to Household objects, helpful for the interface with Jess
(package private)  java.util.HashMap<java.lang.String,org.cfpm.caves.za.Person> namePersonMap
          data structure to map names to Person objects, helpful for the interface with Jess
(package private)  java.util.HashMap<java.lang.String,org.cfpm.caves.za.Village> nameVillageMap
          data structure to map names to Village objects, helpful for the interface with Jess
(package private)  int neededSkilled
          model parameter: number of skilled workers needed for the mine.
(package private)  int neededUnskilled
          model parameter: number of unskilled workers needed for the mine.
(package private)  double neighbourhoodRadius
          model parameter: radius (number of cells) used to determine neighbourhood of a household.
(package private)  int[][] nextBirths
          data structure to store the dates (week/month) of upcoming births at the beginning of a simulated year
(package private)  int numDenominations
          model parameter: number of church denominations.
(package private)  int numHHAskingForFood
           
(package private)  int numHHWithoutEnoughFood
           
(package private)  int numHouseholds
          model parameter: number of initial households.
(package private)  int numMiners
           
(package private)  int numVillages
          model parameter: number of villages.
private static int OTHER
           
(package private)  java.io.File outputFile
           
(package private)  java.lang.String outputPath
          model parameter: Path for the output directory.
(package private)  SouthAfricaModel.PartnershipRecorder partnershipRecorder
           
(package private)  java.lang.String pathName
           
private  java.beans.PropertyChangeSupport pcs
          Necessary for the interface with Jess to make changes in the slots (fields) of shadow facts (Java objects) immediately visible in Jess.
(package private)  int pensionAgeLimitFemale
          model parameter: lower age limit for female seniors to receive a state pension.
(package private)  int pensionAgeLimitMale
          model parameter: lower age limit for male seniors to receive a state pension.
(package private)  double pensionProportionFemale
          model parameter: proportion of female seniors >= 60 receiving a pension.
(package private)  double pensionProportionMale
          model parameter: proportion of male seniors >= 65 receiving a pension.
 int personIndex
          counter for person IDs
(package private)  java.util.ArrayList<org.cfpm.caves.za.Person> personList
          list of agents (persons)
(package private)  java.io.PrintWriter printOut
           
(package private)  boolean printToFile
          model parameter: flag to turn the output to file on (true) or off (false).
(package private)  double randomPartnerProbability
          model parameter: probability to encounter a random sexual partner.
(package private)  double remittanceProbability
          model parameter: probability for sending remittance home for any migrant in any month.
private  uchicago.src.sim.engine.Schedule schedule
           
(package private)  double schoolFee
          model parameter: yearly school fee for non-compulsory secondary school (pupils > 15 years).
(package private)  int sdAgeArrived
          model parameter: standard deviation of the age of in-migrants.
(package private)  int sdNumArrived
          model parameter: standard deviation of the number of in-migrants.
(package private)  int seed
          model parameter: seed for the random number generators.
(package private)  SouthAfricaModel.SexualNetworkRecorder sexualNetworkRecorder
           
(package private)  double shackProportion
          model parameter: proportion of households in the village with a shack to rent out if necessary.
(package private)  boolean showGUI
          model parameter: flag to turn the GUI on (true) or off (false).
(package private)  boolean showOutput
          model parameter: flag to turn the output to console on (true) or off (false).
(package private)  double similarityAgeRange
          model parameter: age range for similarity assessment (basically, age range for friends) given as proportion of age of the agent.
(package private)  uchicago.src.sim.space.Object2DGrid space
          the 2D grid used as a representation of space
(package private)  uchicago.src.sim.gui.DisplaySurface spaceDisplay
           
(package private)  SouthAfricaModel.EmpiricalDiscreteDist stageDist
           
(package private)  double standardWage
          model parameter: monthly wage within village.
(package private)  double statePension
          model parameter: monthly state pension for seniors.
(package private)  org.cfpm.caves.za.MultiLayerNetwork2DDisplay stokvelNetwork
           
(package private)  uchicago.src.sim.gui.DisplaySurface stokvelNetworkDisplay
           
(package private)  SouthAfricaModel.StokvelRecorder stokvelRecorder
           
(package private)  int stopTime
          model parameter: tick to stop the simulation run.
(package private)  int tagBase
          model parameter: number of different values a tag can take (integers between 0 and tagBase - 1).
(package private)  int tagLength
          model parameter: number of tags (= length of the tag array) used to model agents' characteristic traits.
 int tick
           
(package private)  int upperMaxNumFriends
          model parameter: upper limit for the maximal number of friends.
(package private)  int upperMaxNumPartners
          model parameter: upper limit for the maximal number of concurrent sexual partners.
(package private)  SouthAfricaModel.VillageEconomyRecorder villageEconomyRecorder
           
 int week
           
(package private)  uchicago.src.sim.analysis.LocalDataRecorder weeklyDataRecorder
           
 int year
           
 
Fields inherited from class uchicago.src.sim.engine.SimModelImpl
descriptors, modelManipulator
 
Constructor Summary
SouthAfricaModel()
           
 
Method Summary
 void addPropertyChangeListener(java.beans.PropertyChangeListener p)
          adds a property change listener (for Jess)
private  void adjustEducationLevel(org.cfpm.caves.za.Person p)
          helper function for assignEducationLevels()
private  int ageClassIndexOf(int age, int[] classes)
          helper function for pickHIVPositives()
 boolean askChildGrantOracle(org.cfpm.caves.za.Person p)
          Determines if the given person will receive a child grant.
 boolean askPensionOracle(org.cfpm.caves.za.Person p)
          Determines if the given person will receive a pension.
private  void assignEducationLevels()
          Initialisation related: assign initial education levels to agents according to RADAR data
private  void assignEmployments()
          Initialisation related: choose some agents to be government employees
 void begin()
          required by Repast: creates all model components and the schedule
private  void buildDisplay()
          recommended by Repast: initialises the model GUI
private  void buildModel()
          recommended by Repast: initialises the model
 jess.Value buildNewHouse(org.cfpm.caves.za.Person head)
          Create a new household with the given person as head.
private  void buildSchedule()
          recommended by Repast: creates the schedule
 double calculateClusterCoefficient()
          calculates the cluster coefficient of the friend network applying the algorithm from Repast
(package private)  void calculateNextBirths()
          Determines number and dates of births for the upcoming year
(package private)  void checkDeath()
          Determines number and dates of deaths at the beginning of a year using the WHO life tables.
(package private)  void checkDeath(java.util.ArrayList<org.cfpm.caves.za.Person> ageGroup, SouthAfricaModel.WHOLifeTable table)
          helper function for checkDeath(): determines deaths for given age group according to given life table.
(package private)  void checkDeath(org.cfpm.caves.za.Person p)
          Old version of checkDeath().
 java.util.HashMap<java.lang.String,java.lang.String[]> compileSexualNetwork()
          compiles the sexual network to be recorded
private  double computeDistance(java.util.ArrayList<org.cfpm.caves.za.NetworkNode> clusterA, java.util.ArrayList<org.cfpm.caves.za.NetworkNode> clusterB, double[][] distances)
          helper method for determineClusters()
private  void createBurialSocieties()
          Initialisation related: create some burial societies
private  void createChurches(int village, int startIndex, int endIndex)
          Initialisation related: create churches for a given village and assign the village's households randomly to the churches.
private  void createFamilyLinks(org.cfpm.caves.za.Household hh, org.cfpm.caves.za.Person[] members, int[] memberType)
          helper function for populateHouseholds()
private  void createFamilyLinks(org.cfpm.caves.za.Person baby, org.cfpm.caves.za.Person mother, org.cfpm.caves.za.Household household)
          creates family links between new person and members of the household
private  org.cfpm.caves.za.Person createHouseholdMember(java.lang.String name, org.cfpm.caves.za.Household hhold)
          Creates a new member for the given household.
private  void createHouseholds()
          Initialisation related: create households according to RADAR data
private  java.util.ArrayList<java.util.ArrayList<org.cfpm.caves.za.NetworkNode>> createKinshipNetwork()
          Initialisation related: create the kinship network between households as a small-world network
 void createMine()
          Initialisation related: create a mine and some mine workers from outside the village
private  void createNeighbourNetwork()
          Initialisaiton related: create the neighbour network according to the households' position in space
(package private)  void createNewPerson()
          Creates a new agent during simulation, i.e.
private  org.cfpm.caves.za.Village createVillage(java.lang.String name, int numHouseholds, java.util.ArrayList<org.cfpm.caves.za.Village> villages)
          Initialisation related: creates a village for the given number of households and positions it in space.
private  java.util.ArrayList<java.util.ArrayList<org.cfpm.caves.za.NetworkNode>> determineClusters(java.util.List list)
          Perform cluster analysis on kinship network: sort nodes (= households) into as many clusters as there are villages.
private  int[] determineVillageLocation(int radius, java.util.ArrayList<org.cfpm.caves.za.Village> villages)
          helper method for createVillage()
 void dump(java.lang.String text)
          Output the given text to console (if showOutput is true) and/or trace file (if printToFile is true).
private  void endorseAllNeighbours(org.cfpm.caves.za.Person p, org.cfpm.caves.za.Household hh)
          helper function: assert neighbour endorsements for the given person and every member of the given household's neighbour households.
 void endorseKin(org.cfpm.caves.za.Household hh1, org.cfpm.caves.za.Household hh2)
          Assert kinship endorsements in Jess between the members of the given households.
(package private)  void endorseKin(org.cfpm.caves.za.Person baby)
          Assert kinship endorsements in Jess for the given person (a newborn baby).
(package private)  void endorseNeighbours(org.cfpm.caves.za.Person p)
          Assert neighbour endorsements in Jess for the given person (a newborn baby).
 void endorseNeighbours(org.cfpm.caves.za.Person p, org.cfpm.caves.za.Household hh)
          Assert neighbour endorsements in Jess for the given person (a miner renting a shack from the given household)
 void finalize()
          closes trace file on finalisation of model object
private  java.util.ArrayList<jess.Value> findChurches(java.util.ArrayList<org.cfpm.caves.za.Person> list)
          helper function for pickFriends
private  org.cfpm.caves.za.Household findHouseholdOf(org.cfpm.caves.za.NetworkNode node)
          returns the household to a given network node
private  int findParent(org.cfpm.caves.za.Person[] members, int[] type, int childIndex)
          helper function for createFamilyLinks()
private  java.util.ArrayList<org.cfpm.caves.za.Household> findRelatedHouseholds(org.cfpm.caves.za.Household hh, java.util.ArrayList<org.cfpm.caves.za.Household> hhList)
          helper function for createBurialSocieties()
 boolean fitForMarriage(java.lang.String male, java.lang.String female)
          checks if the specified agents are fit for marriage, i.e.
 jess.Value fitForMarriage(jess.Value male, jess.Value female)
          wrapper for the fitForMarriage method
 double getAdultEmploymentRate()
          returns the adult employment rate
 double getAvgHHCash()
          returns the average amount of cash over all households
 double getBirthRate()
          returns the birth rate (number of births per 1000 persons in the population)
 double getBurialCost()
          returns the average cost of a burial
 double getChildGrant()
          returns the monthly child grant for children up to age 7
 int getChildGrantAgeLimit()
          returns the age limit for child grants.
 double getChildGrantProportion()
          returns the proportion of children under the age limit who receive a child grant.
 double getChurchParticipationRate()
          returns the overall church participation rate
 double getCollegeFee()
          returns the yearly college/university fee.
 int getCurrentNumHouseholds()
          returns the current number of households in the model.
 double getDensityFactor()
          returns the density factor determining how densely the villages are populated with households (1.0 = very compact, every cell filled with a house)
 double getFoodCostChild()
          returns the monthly food cost for a child <= 7 years old
 double getFoodCostFemaleAdult()
          returns the monthly food cost for a female adult
 double getFoodCostMaleAdult()
          returns the monthly food cost for a male adult
 double getGovernmentEmploymentRate()
          returns the government employment rate, i.e.
 int getGridSizeX()
          returns the size in dimension x of the 2D grid used as a spatial model
 int getGridSizeY()
          returns the size in dimension y of the 2D grid used as a spatial model
 int getHIVIncidence()
          calculates the HIV incidence for the last month
 int getHouseCost()
          returns the average cost to build a new house in the village.
 java.lang.String[] getInitParam()
          required by Repast: returns a list of model parameters, which can be manipulated via the Repast GUI
 double getInterArrivalTime()
          returns the mean inter-arrival time for in-migrating mine workers.
private  java.util.ArrayList<org.cfpm.caves.za.NetworkNode> getLinkedNodes(org.cfpm.caves.za.NetworkNode node)
          helper method for determineClusters()
 int getLowerMaxNumFriends()
          returns the lower limit for the maximum number of friends
 int getLowerMaxNumPartners()
          returns the lower limit for the maximum number of concurrent sexual partners
 double getMaxEndorsementBase()
          returns the maximum value for the endorsement base used in the computation of overall endorsement values.
 int getMaxEndorsementClasses()
          returns the maximum number of endorsement classes.
 double getMaxHHCash()
          returns the highest amount of cash one of the households owns in the model
 int getMaxLobola()
          returns the upper bound for the lobola a groom has to pay the bride's household.
 int getMaxRemittance()
          returns the upper bound for remittances from migrants to their household in the village
 int getMaxShackRent()
          returns the upper limit for monthly rent of a shack in the village.
 double getMaxTagEvolutionPropensity()
          returns the upper bound for agents' tag evolution propensity
 int getMeanAgeArrived()
          returns the mean for the age distribution of in-migrants.
 int getMeanNumArrived()
          returns the mean number of in-migrant mine workers arriving at one time.
 double getMineHIVPrevalence()
          returns the HIV prevalence amongst in-migrating mine workers
 double getMinEndorsementBase()
          returns the minimum value for the endorsement base used in the computation of overall endorsement values.
 int getMinEndorsementClasses()
          returns the minimum number of endorsement classes.
 double getMinHHCash()
          returns the smallest amount of cash one of the households owns in the model
 int getMiningTick()
          returns the tick when mining starts in the simulation
 int getMinLobola()
          returns the lower bound for the lobola a groom has to pay the bride's household.
 int getMinRemittance()
          returns the lower bound for remittances from migrants to their household in the village
 int getMinShackRent()
          returns the lower limit for monthly rent of a shack in the village.
 double getMinTagEvolutionPropensity()
          returns the lower bound for agents' tag evolution propensity
 int getMonth()
          returns the current month
 double getMotherChildHIVTransmissionRate()
          returns the rate for mother-to-child HIV transmission.
 java.lang.String getName()
          Required by Repast: returns the model name
 int getNeededSkilled()
          returns the number of skilled workers needed in the mine
 int getNeededUnskilled()
          returns the number of unskilled workers needed in the mine
 double getNeighbourhoodRadius()
          returns the neighbourhood radius
private  int getNodeIndex(org.cfpm.caves.za.NetworkNode node)
          helper method for determineClusters()
private  java.util.ArrayList getNodes(java.util.ArrayList agents)
          helper method for buildDisplay(): returns a list of nodes for the given agents
 int getNumBSMembers()
          returns the number of agents who are members of a burial society
 int getNumDenominations()
          returns the overall number of church denominations
 int getNumEmployedMiners()
          returns the number of in-migrant miners employed at the mine
 int getNumFemaleHIVPositives()
          returns the number of female HIV-positive persons
 int getNumHHAskingForFood()
          returns the number of households asking for food during the current month
 int getNumHHWithoutEnoughFood()
          returns the number of households with a lack of food even after having asked relatives/neighbours for help
 int getNumHIVPositives()
          returns the number of HIV-positive persons
 int getNumHouseholds()
          returns the number of households with which to initialise the model
 int getNumMigrants()
          returns the current number of migrants from the villages.
 int getNumMigrantsOnVisit()
          returns the number of migrants currently on visit in the village(s).
 int getNumMinerHIVPositives()
          returns the number of HIV-positive miners (in-migrants)
 int getNumMiners()
          returns the number of in-migrant miners in the area
 int getNumPersons()
          returns the number of persons
 int getNumStokvelMembers()
          returns the number of agents who are members of a stokvel
 int getNumUnskilled()
          returns the number of employed unskilled workers in the mine
 int getNumVillages()
          returns the number of villages
 java.lang.String getOutputPath()
          returns the output path
 int getPensionAgeLimitFemale()
          returns the age limit for state pensions for female seniors.
 int getPensionAgeLimitMale()
          returns the age limit for state pensions for male seniors.
 double getPensionProportionFemale()
          returns the proportion of female seniors over the age limit who receive state pensions.
 double getPensionProportionMale()
          returns the proportion of male seniors over the age limit who receive state pensions.
private  java.util.ArrayList<org.cfpm.caves.za.Person> getPossibleMothers()
          helper function: determines possible mothers for a baby.
 boolean getPrintToFile()
          returns if the output to file is set on or off
 double getRandomPartnerProbability()
          returns the probability to encounter a random sexual partner
 double getRemittanceProbability()
          returns the probability for sending remittance home for any migrant in any month.
 uchicago.src.sim.engine.Schedule getSchedule()
          Required by Repast: returns the schedule
 double getSchoolFee()
          returns the yearly school fee for non-compulsory secondary school (pupils > 15 years).
 int getSdAgeArrived()
          returns the standard deviation for the age distribution of in-migrants.
 int getSdNumArrived()
          returns the standard deviation of the number of in-migrant mine workers arriving at one time.
 int getSeed()
          returns the seed to be used with random generators
 double getShackProportion()
          returns the proportion of households with a shack to rent out if necessary
 boolean getShowGUI()
          returns if the GUI is to be displayed or not
 double getSimilarityAgeRange()
          returns the similarity age range
 double getStandardWage()
          returns the standard monthly wage (for piece jobs in the village).
 double getStatePension()
          returns the monthly state pension for seniors.
 int getStopTime()
          returns the tick when a model run stops
 int getTagBase()
          returns the tag base (number of values per tag)
 int getTagLength()
          returns the tag length (number of tags)
 int getTick()
          returns the current tick
 int getUpperMaxNumFriends()
          returns the upper limit for the maximum number of friends
 int getUpperMaxNumPartners()
          returns the upper limit for the maximum number of concurrent sexual partners
 int getWeek()
          returns the current week
 int getYear()
          returns the current year
 void incNumHHAskingForFood()
          increases the number of households asking for food by 1
 void incNumHHWithoutEnoughFood()
          increases the number of households without enough food by 1
 boolean isShowOutput()
          returns if the output to console is set on or off
private  void locateHouseholds(java.util.ArrayList<java.util.ArrayList<org.cfpm.caves.za.NetworkNode>> hhClusters)
          Initialisation related: create villages, assing households to villages, position households in space.
static void main(java.lang.String[] args)
          The main method: runs the model
 void marry(java.lang.String maleNameString, java.lang.String femaleNameString)
          wrapper for the marry() method: turns the parameters of type String into parameters of type Value.
 void marry(jess.Value maleName, jess.Value femaleName)
          Make a happy couple out of a male and female agent.
private  void openOutput()
          helper method: opens trace file and directs Jess ouput to it
private  boolean overlapping(int[] centre, int radius, java.util.ArrayList<org.cfpm.caves.za.Village> villages)
          helper method for createVillage()
private  void pickFriends(java.util.ArrayList<org.cfpm.caves.za.Person> members, int maxNum, java.util.ArrayList<org.cfpm.caves.za.Household> village)
          helper function for createBurialSocieties()
private  void pickHIVPositives()
          Initialisation related: choose some agents to be HIV positive
private  void pickMigrants()
           
private  org.cfpm.caves.za.Person pickMother(java.util.ArrayList<org.cfpm.caves.za.Person> possibleMothers)
           
private  void pickRelatives(java.util.ArrayList<org.cfpm.caves.za.Household> related, int n, java.util.ArrayList<org.cfpm.caves.za.Person> members)
          helper function for createBurialSocieties()
private  void populateHousehold(int numMembers, org.cfpm.caves.za.Household hh, cern.jet.random.Normal hhHeadAgeDist, cern.jet.random.Normal ageDiffDist, cern.jet.random.Gamma ageDist, SouthAfricaModel.EmpiricalDiscreteDist femaleStatusDist, SouthAfricaModel.EmpiricalDiscreteDist maleStatusDist, SouthAfricaModel.EmpiricalDiscreteDist memberTypeDist)
          Initialisation related: create household members according to empirical data (RADAR)
private  void populateVillage(org.cfpm.caves.za.Village village, int startIndex, int endIndex)
          Initialisation related: position households in space, or to be more precise, position them randomly inside the area the village takes up.
 boolean probabilityp(double p)
          returns true with the given probability p.
 int randomInt(int from, int to)
          samples a random uniform distribution in the interval from-to.
 void recordStokvelEvent(java.lang.String stokvel, java.lang.String event)
          records the given event for the given stokvel
 void recordStokvelEvent(java.lang.String stokvel, java.lang.String event, org.cfpm.caves.za.Person member)
          records the given event regarding the given member for the given stokvel
 void removeHousehold(org.cfpm.caves.za.Household hh)
          Removes the given dissolved household from the model
private  void removeLinks(org.cfpm.caves.za.Household hh)
          helper method for removeHousehold(): removes the links of the given dissolved household
private  void removeLinks(org.cfpm.caves.za.Person p)
          Helper function: removes the links of the given dead person.
 void removeMiner(org.cfpm.caves.za.Person p)
          Removes an external miner from the model
(package private)  void removeNeighbourLinks(java.util.ArrayList<java.lang.String> list)
          helper function: removes neighbour links (is-neighbour endorsements) for the given list of persons (members of a household, group of leaving miners)
(package private)  void removeNeighbourLinks(jess.Value[] list)
          helper function: wrapper for same method with ArrayList parameter
 void removePerson(org.cfpm.caves.za.Person p)
          Removes a dead person from the model and records his/her death.
 void removePropertyChangeListener(java.beans.PropertyChangeListener p)
          removes a property change listener (for Jess)
private  void resetNextBirths()
          helper function: resets the data structure keeping track of upcoming births
 void resetOutputVariables()
          resets the output variables recorded on a monthly basis
(package private)  java.util.ArrayList<org.cfpm.caves.za.Person> retrieveObjects(jess.Value[] names)
          returns the Person objects for the given list of names.
 void setAdultEmploymentRate(double rate)
          sets the adult employment rate
private  void setAsHead(org.cfpm.caves.za.Person person, SouthAfricaModel.EmpiricalDiscreteDist statusDistribution)
          helper function for populateHouseholds()
 void setBirthRate(double birthRate)
          sets the birth rate (number of births per 1000 persons in the population)
 void setBurialCost(double burialCost)
          sets the average cost of a burial
 void setChildGrant(double childGrant)
          sets the monthly child grant for children up to age 7
 void setChildGrantAgeLimit(int childGrantAgeLimit)
          sets the age limit for child grants.
 void setChildGrantProportion(double childGrantProportion)
          sets the proportion of children under the age limit who receive a child grant.
 void setChurchParticipationRate(double churchParticipationRate)
          sets the overall church participation rate
 void setCollegeFee(double collegeFee)
          sets the yearly college/university fee.
private  void setDateValues()
          computes and sets the current date values (year, month, week)
 void setDensityFactor(double densityFactor)
          sets the density factor determining how densely the villages are populated with households (1.0 = very compact, every cell filled with a house)
private  void setDisposalPolicy()
          Jess related: define disposal policies for unneeded facts
 void setFoodCostChild(double foodCostChild)
          sets the monthly food cost for a child <= 7 years old
 void setFoodCostFemaleAdult(double foodCostFemaleAdult)
          sets the monthly food cost for a female adult
 void setFoodCostMaleAdult(double foodCostMaleAdult)
          sets the monthly food cost for a male adult
 void setGovernmentEmploymentRate(double governmentEmploymentRate)
          sets the government employment rate, i.e.
 void setGridSizeX(int gridSizeX)
          sets the size in dimension x of the 2D grid used as a spatial model
 void setGridSizeY(int gridSizeY)
          sets the size in dimension y of the 2D grid used as a spatial model
 void setHouseCost(int houseCost)
          sets the average cost to build a new house in the village.
 void setInterArrivalTime(double interArrivalTime)
          sets the mean inter-arrival time for in-migrating mine workers.
 void setLowerMaxNumFriends(int lowerMaxNumFriends)
          sets the lower limit for the maximum number of friends
 void setLowerMaxNumPartners(int lowerMaxNumPartners)
          sets the lower limit for the maximum number of concurrent sexual partners
 void setMaxEndorsementBase(double maxEndorsementBase)
          sets the maximum value for the endorsement base used in the computation of overall endorsement values.
 void setMaxEndorsementClasses(int maxEndorsementClasses)
          sets the maximum number of endorsement classes.
 void setMaxLobola(int maxLobola)
          sets the upper bound for the lobola a groom has to pay the bride's household.
 void setMaxRemittance(int maxRemittance)
          sets the upper bound for remittances from migrants to their household in the village
 void setMaxShackRent(int maxShackRent)
          sets the upper limit for monthly rent of a shack in the village.
 void setMaxTagEvolutionPropensity(double maxTagEvolutionPropensity)
          sets the upper bound for agents' tag evolution propensity
 void setMeanAgeArrived(int meanAgeArrived)
          sets the mean for the age distribution of in-migrants.
 void setMeanNumArrived(int meanNumArrived)
          sets the mean number of in-migrant mine workers arriving at one time.
 void setMineHIVPrevalence(double mineHIVPrevalence)
          sets the HIV prevalence amongst in-migrating mine workers
 void setMinEndorsementBase(double minEndorsementBase)
          sets the minimum value for the endorsement base used in the computation of overall endorsement values.
 void setMinEndorsementClasses(int minEndorsementClasses)
          sets the minimum number of endorsement classes.
 void setMiningTick(int miningTick)
          sets the tick when mining starts in the simulation
 void setMinLobola(int minLobola)
          sets the lower bound for the lobola a groom has to pay the bride's household.
 void setMinRemittance(int minRemittance)
          sets the lower bound for remittances from migrants to their household in the village
 void setMinShackRent(int minShackRent)
          sets the lower limit for monthly rent of a shack in the village.
 void setMinTagEvolutionPropensity(double minTagEvolutionPropensity)
          sets the lower bound for agents' tag evolution propensity
 void setMonth(int m)
          sets the current month
 void setMotherChildHIVTransmissionRate(double motherChildHIVTransmissionRate)
          sets the rate for mother-to-child HIV transmission.
 void setNeededSkilled(int neededSkilled)
          sets he number of skilled workers needed in the mine
 void setNeededUnskilled(int neededUnskilled)
          sets he number of unskilled workers needed in the mine
 void setNeighbourhoodRadius(double neighbourhoodRadius)
          sets the neighbourhood radius
 void setNumDenominations(int numDenominations)
          sets the overall number of church denominations
protected  void setNumHHAskingForFood(int numHHAskingForFood)
          sets the number of households asking for food during the current month
protected  void setNumHHWithoutEnoughFood(int numHHWithoutEnoughFood)
          sets the number of households with a lack of food even after having asked relatives/neighbours for help
 void setNumHouseholds(int numHouseholds)
          sets the number of households with which to initialise the model
 void setNumVillages(int numVillages)
          sets the number of villages
 void setOutputPath(java.lang.String outputPath)
          sets the output path
 void setPensionAgeLimitFemale(int pensionFemaleAgeLimit)
          sets the age limit for state pensions for female seniors.
 void setPensionAgeLimitMale(int pensionMaleAgeLimit)
          sets the age limit for state pensions for male seniors.
 void setPensionProportionFemale(double pensionProportionFemale)
          sets the proportion of female seniors over the age limit who receive state pensions.
 void setPensionProportionMale(double pensionProportionMale)
          sets the proportion of male seniors over the age limit who receive state pensions.
 void setPrintToFile(boolean printToFile)
          turns the output to file on or off
 void setRandomPartnerProbability(double randomPartnerProbability)
          sets the probability to encounter a random sexual partner
 void setRemittanceProbability(double remittanceProbability)
          sets the probability for sending remittance home for any migrant in any month.
 void setSchoolFee(double schoolFee)
          sets the yearly school fee for non-compulsory secondary school (pupils > 15 years).
 void setSdAgeArrived(int sdAgeArrived)
          sets the standard deviation for the age distribution of in-migrants.
 void setSdNumArrived(int sdNumArrived)
          sets the standard deviation of the number of in-migrant mine workers arriving at one time.
 void setSeed(int seed)
          sets the seed to be used with random generators
 void setShackProportion(double shackProportion)
          sets the proportion of households with a shack to rent out if necessary
 void setShowGUI(boolean showGUI)
          sets if the GUI is to be displayed or not
 void setShowOutput(boolean showOutput)
          turns the output to console on or off
 void setSimilarityAgeRange(double similarityAgeRange)
          sets the similarity age range
 void setStandardWage(double standardWage)
          sets the standard monthly wage (for piece jobs in the village).
 void setStatePension(double statePension)
          sets the monthly state pension for seniors.
 void setStopTime(int stopTime)
          sets the tick when a model run stops
 void setTagBase(int tagBase)
          sets the tag base (number of values per tag)
 void setTagLength(int tagLength)
          sets the tag length (number of tags)
 void setTick(int t)
          sets the current tick
 void setup()
          required by Repast: resets the model
 void setUpperMaxNumFriends(int upperMaxNumFriends)
          sets the upper limit for the maximum number of friends
 void setUpperMaxNumPartners(int upperMaxNumPartners)
          sets the upper limit for the maximum number of concurrent sexual partners
 void setWeek(int wk)
          sets the current week
 void setYear(int yr)
          sets the current year
private  int[] sortHouseholdList(java.util.ArrayList<java.util.ArrayList<org.cfpm.caves.za.NetworkNode>> clusters)
          helper function for locateHouseholds(): sorts household list into clusters detected in the kinship network
private  int[] sortPersonList(int lowAge, int highAge, java.util.ArrayList<org.cfpm.caves.za.Person> newList)
          helper method for pickMigrants()
private  int[] sortTypes(int[] types)
          helper function for populateHousehold()
private  void supplyGrants()
          Supply households with state grants: child grants for children < 7 and pensions for registered pensioners.
 void unwatchFacts()
          equivalent to (unwatch facts) in Jess
(package private)  void update()
          procedural update of the model state, called each tick
(package private)  void updateAgents()
          Procedural update of agents (persons), once each tick.
 void watchFacts()
          equivalent to (watch facts) in Jess
 
Methods inherited from class uchicago.src.sim.engine.SimModelImpl
addPropertyListener, addSimEventListener, clearMediaProducers, clearPropertyListeners, fireBooleanPropertyEvent, fireEndSim, fireNumericPropertyEvent, fireObjectPropertyEvent, firePauseSim, fireSimEvent, fireStopSim, fireStringPropertyEvent, generateNewSeed, getController, getMediaProducers, getModelManipulator, getParameterDescriptors, getPropertiesValues, getRngSeed, getTickCount, pause, registerDisplaySurface, registerMediaProducer, removePropertyListener, removeSimEventListener, setController, setRngSeed, stop
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CHILD

private static int CHILD

GRANDCHILD

private static int GRANDCHILD

OTHER

private static int OTHER

numHouseholds

int numHouseholds
model parameter: number of initial households. Default is 24.


numVillages

int numVillages
model parameter: number of villages. Default is 1.


numDenominations

int numDenominations
model parameter: number of church denominations. Default is 4.


churchParticipationRate

double churchParticipationRate
model parameter: overall proportion of households being member of a church. Default is 0.8.


adultEmploymentRate

double adultEmploymentRate
model parameter: overall proportion of adults with a job. Default is 0.4.


governmentEmploymentRate

double governmentEmploymentRate
model parameter: overall proportion of adults with a government job. Default is 0.1.


standardWage

double standardWage
model parameter: monthly wage within village. Default is 200 Rand.


childGrant

double childGrant
model parameter: monthly child grant for children under the age limit. Default is 200 Rand.


childGrantProportion

double childGrantProportion
model parameter: proportion of eligible children receiving the child grant. Default is 1.0


childGrantAgeLimit

int childGrantAgeLimit
model parameter: upper age limit for child grant. Default is 7 years.


statePension

double statePension
model parameter: monthly state pension for seniors. Default is 870 Rand.


pensionProportionFemale

double pensionProportionFemale
model parameter: proportion of female seniors >= 60 receiving a pension. Default is 0.58.


pensionProportionMale

double pensionProportionMale
model parameter: proportion of male seniors >= 65 receiving a pension. Default is 0.5.


pensionAgeLimitFemale

int pensionAgeLimitFemale
model parameter: lower age limit for female seniors to receive a state pension. Default is 60.


pensionAgeLimitMale

int pensionAgeLimitMale
model parameter: lower age limit for male seniors to receive a state pension. Default is 65.


foodCostChild

double foodCostChild
model parameter: monthly food cost for a child up to 7 years. Default is 25 Rand.


foodCostFemaleAdult

double foodCostFemaleAdult
model parameter: monthly food cost for a female. Default is 100 Rand.


foodCostMaleAdult

double foodCostMaleAdult
model parameter: monthly food cost for a male. Default is 120 Rand.


schoolFee

double schoolFee
model parameter: yearly school fee for non-compulsory secondary school (pupils > 15 years). Default is 200 Rand.


collegeFee

double collegeFee
model parameter: yearly university fees. Default is 10000 Rand.


minLobola

int minLobola
model parameter: minimum lobola (bride price). Default is 8000 Rand


maxLobola

int maxLobola
model parameter: maximum lobola (bride price). Default is 12000 Rand


minRemittance

int minRemittance
model parameter: minimum remittance from a migrant agent. Default is 200 Rand.


maxRemittance

int maxRemittance
model parameter: maximum remittance from a migrant agent. Default is 600 Rand.


remittanceProbability

double remittanceProbability
model parameter: probability for sending remittance home for any migrant in any month. Default is 0.1


burialCost

double burialCost
model parameter: average cost of a burial. Default is 5000 Rand.


shackProportion

double shackProportion
model parameter: proportion of households in the village with a shack to rent out if necessary. Default is 0.4


minShackRent

int minShackRent
model parameter: lower bound of the monthly rent asked for a shack in the village. Default is 200 Rand


maxShackRent

int maxShackRent
model parameter: upper bound of the monthly rent asked for a shack in the village. Default is 500 Rand


houseCost

int houseCost
model parameter: average cost for a new house in the village. Default is 2000 Rand.


motherChildHIVTransmissionRate

double motherChildHIVTransmissionRate
model parameter: mother-to-child transmission rate of HIV. Default is 0.33


birthRate

double birthRate
model parameter: birth rate as number of births per 1000 per year. Default is 19.0.


gridSizeX

int gridSizeX
model parameter: size (number of cells) of the 2D grid used as spatial model in x direction. Default is 30.


gridSizeY

int gridSizeY
model parameter: size (number of cells) of the 2D grid used as spatial model in y direction. Default is 30.


neighbourhoodRadius

double neighbourhoodRadius
model parameter: radius (number of cells) used to determine neighbourhood of a household. Default is 4.24.


densityFactor

double densityFactor
model parameter: density factor of villages. Determines how "packed" villages are with houses. Default is 1.3.


miningTick

int miningTick
model parameter: tick to start mining in the area. Set to -1 to not have any mines. Default is 240 (5 years).


neededSkilled

int neededSkilled
model parameter: number of skilled workers needed for the mine. Default is 20.


neededUnskilled

int neededUnskilled
model parameter: number of unskilled workers needed for the mine. Default is 80.


mineHIVPrevalence

double mineHIVPrevalence
model parameter: HIV prevalence amongst in-migrating mine workers. Default is 0.3.


interArrivalTime

double interArrivalTime
model parameter: mean inter-arrival time for in-migrating mine workers. Default is 10.


meanNumArrived

int meanNumArrived
model parameter: mean number of in-migrants arriving in the area at one time. Default is 5.


sdNumArrived

int sdNumArrived
model parameter: standard deviation of the number of in-migrants. Default is 2.


meanAgeArrived

int meanAgeArrived
model parameter: mean age of in-migrants. Default is 29.


sdAgeArrived

int sdAgeArrived
model parameter: standard deviation of the age of in-migrants. Default is 7.


tagLength

int tagLength
model parameter: number of tags (= length of the tag array) used to model agents' characteristic traits. Default is 7.


tagBase

int tagBase
model parameter: number of different values a tag can take (integers between 0 and tagBase - 1). Default is 5.


maxTagEvolutionPropensity

double maxTagEvolutionPropensity
model parameter: maximal tag evolution propensity. Default is 0.08. Every agent is assigned a random tag evolution propensity between max and min.


minTagEvolutionPropensity

double minTagEvolutionPropensity
model parameter: minimal tag evolution propensity. Default is 0.01.


minEndorsementBase

double minEndorsementBase
model parameter: minimum value for the base used to compute the overall endorsement value. Default is 1.0. Every agent is assigned a random base between max and min.


maxEndorsementBase

double maxEndorsementBase
model parameter: maximum value for the base used to compute the overall endorsement value. Default is 3.0. Every agent is assigned a random base between max and min.


minEndorsementClasses

int minEndorsementClasses
model parameter: minimum number of endorsement classes. Default is 2. Every agent is assigned a random number of classes between max and min.


maxEndorsementClasses

int maxEndorsementClasses
model parameter: maximum number of endorsement classes. Default is 5. Every agent is assigned a random number of classes between max and min.


upperMaxNumFriends

int upperMaxNumFriends
model parameter: upper limit for the maximal number of friends. Default is 12. Every agent is assigned a random maximal number of friends between upper and lower limit.


lowerMaxNumFriends

int lowerMaxNumFriends
model parameter: lower limit for the maximal number of friends. Default is 6. Every agent is assigned a random maximal number of friends between upper and lower limit.


upperMaxNumPartners

int upperMaxNumPartners
model parameter: upper limit for the maximal number of concurrent sexual partners. Default is 5. Every agent is assigned a random maximal number of partners between upper and lower limit.


lowerMaxNumPartners

int lowerMaxNumPartners
model parameter: lower limit for the maximal number of concurrent sexual partners. Default is 1. Every agent is assigned a random maximal number of partners between upper and lower limit.


similarityAgeRange

double similarityAgeRange
model parameter: age range for similarity assessment (basically, age range for friends) given as proportion of age of the agent. Default is 0.25 (age range is +- 25% of own age).


randomPartnerProbability

double randomPartnerProbability
model parameter: probability to encounter a random sexual partner. Default is 0.1.


showGUI

boolean showGUI
model parameter: flag to turn the GUI on (true) or off (false). Default is false.


printToFile

boolean printToFile
model parameter: flag to turn the output to file on (true) or off (false). Default is true.


showOutput

boolean showOutput
model parameter: flag to turn the output to console on (true) or off (false). Default is true.


outputPath

java.lang.String outputPath
model parameter: Path for the output directory.


seed

int seed
model parameter: seed for the random number generators. Default is 123456.


stopTime

int stopTime
model parameter: tick to stop the simulation run. Default is 2400 (= 50 years)


personList

java.util.ArrayList<org.cfpm.caves.za.Person> personList
list of agents (persons)


householdList

java.util.ArrayList<org.cfpm.caves.za.Household> householdList
list of households


space

uchicago.src.sim.space.Object2DGrid space
the 2D grid used as a representation of space


mine

org.cfpm.caves.za.Mine mine
the mine


minerSource

SouthAfricaModel.MinerSource minerSource
the source of miners from outside the area


nextBirths

int[][] nextBirths
data structure to store the dates (week/month) of upcoming births at the beginning of a simulated year


year

public int year

month

public int month

week

public int week

tick

public int tick

personIndex

public int personIndex
counter for person IDs


namePersonMap

java.util.HashMap<java.lang.String,org.cfpm.caves.za.Person> namePersonMap
data structure to map names to Person objects, helpful for the interface with Jess


nameHouseholdMap

java.util.HashMap<java.lang.String,org.cfpm.caves.za.Household> nameHouseholdMap
data structure to map names to Household objects, helpful for the interface with Jess


nameVillageMap

java.util.HashMap<java.lang.String,org.cfpm.caves.za.Village> nameVillageMap
data structure to map names to Village objects, helpful for the interface with Jess


schedule

private uchicago.src.sim.engine.Schedule schedule

engine

jess.Rete engine
the Jess engine


jessLink

org.cfpm.caves.za.FactBaseScourer jessLink
the class containing procedural functionality outsourced from Jess. Goes through the fact base every tick before the engine is run to update agents and households.


disposalPolicy

org.cfpm.caves.za.EndorsementDisposalPolicy disposalPolicy
Retracts facts when they become obsolete according to the specified filters ("disposal policies"). Run every tick after Jess has finished.


pcs

private java.beans.PropertyChangeSupport pcs
Necessary for the interface with Jess to make changes in the slots (fields) of shadow facts (Java objects) immediately visible in Jess.


printOut

java.io.PrintWriter printOut

outputFile

java.io.File outputFile

pathName

java.lang.String pathName

numHHAskingForFood

int numHHAskingForFood

numHHWithoutEnoughFood

int numHHWithoutEnoughFood

numMiners

int numMiners

monthlyDataRecorder

uchicago.src.sim.analysis.LocalDataRecorder monthlyDataRecorder

weeklyDataRecorder

uchicago.src.sim.analysis.LocalDataRecorder weeklyDataRecorder

partnershipRecorder

SouthAfricaModel.PartnershipRecorder partnershipRecorder

sexualNetworkRecorder

SouthAfricaModel.SexualNetworkRecorder sexualNetworkRecorder

friendNetworkRecorder

SouthAfricaModel.FriendshipNetworkRecorder friendNetworkRecorder

deathRecorder

SouthAfricaModel.HIVDeathRecorder deathRecorder

chosenHH

java.util.ArrayList<java.lang.String> chosenHH

hhEconomyRecorder

SouthAfricaModel.HouseholdEconomyRecorder hhEconomyRecorder

villageEconomyRecorder

SouthAfricaModel.VillageEconomyRecorder villageEconomyRecorder

hhWealthDistRecorder

SouthAfricaModel.HHWealthDistRecorder hhWealthDistRecorder

hhIncomeRecorder

SouthAfricaModel.HHIncomeRecorder hhIncomeRecorder

stokvelRecorder

SouthAfricaModel.StokvelRecorder stokvelRecorder

miningRecorder

SouthAfricaModel.MiningRecorder miningRecorder

ageDistRecorder

SouthAfricaModel.AgeDistributionRecorder ageDistRecorder

friendNetworkDisplay

uchicago.src.sim.gui.DisplaySurface friendNetworkDisplay

kinshipNetworkDisplay

uchicago.src.sim.gui.DisplaySurface kinshipNetworkDisplay

stokvelNetworkDisplay

uchicago.src.sim.gui.DisplaySurface stokvelNetworkDisplay

spaceDisplay

uchicago.src.sim.gui.DisplaySurface spaceDisplay

friendNetwork

org.cfpm.caves.za.MultiLayerNetwork2DDisplay friendNetwork

kinshipNetwork

org.cfpm.caves.za.MultiLayerNetwork2DDisplay kinshipNetwork

stokvelNetwork

org.cfpm.caves.za.MultiLayerNetwork2DDisplay stokvelNetwork

malesTable

SouthAfricaModel.WHOLifeTable malesTable

femalesTable

SouthAfricaModel.WHOLifeTable femalesTable

stageDist

SouthAfricaModel.EmpiricalDiscreteDist stageDist
Constructor Detail

SouthAfricaModel

public SouthAfricaModel()
Method Detail

setup

public void setup()
required by Repast: resets the model


getInitParam

public java.lang.String[] getInitParam()
required by Repast: returns a list of model parameters, which can be manipulated via the Repast GUI


begin

public void begin()
required by Repast: creates all model components and the schedule


openOutput

private void openOutput()
helper method: opens trace file and directs Jess ouput to it


finalize

public void finalize()
closes trace file on finalisation of model object

Overrides:
finalize in class java.lang.Object

buildModel

private void buildModel()
recommended by Repast: initialises the model


buildDisplay

private void buildDisplay()
recommended by Repast: initialises the model GUI


getNodes

private java.util.ArrayList getNodes(java.util.ArrayList agents)
helper method for buildDisplay(): returns a list of nodes for the given agents


buildSchedule

private void buildSchedule()
recommended by Repast: creates the schedule


getSchedule

public uchicago.src.sim.engine.Schedule getSchedule()
Required by Repast: returns the schedule


getName

public java.lang.String getName()
Required by Repast: returns the model name


setDisposalPolicy

private void setDisposalPolicy()
Jess related: define disposal policies for unneeded facts


watchFacts

public void watchFacts()
equivalent to (watch facts) in Jess


unwatchFacts

public void unwatchFacts()
equivalent to (unwatch facts) in Jess


pickHIVPositives

private void pickHIVPositives()
Initialisation related: choose some agents to be HIV positive


ageClassIndexOf

private int ageClassIndexOf(int age,
                            int[] classes)
helper function for pickHIVPositives()


assignEducationLevels

private void assignEducationLevels()
Initialisation related: assign initial education levels to agents according to RADAR data


adjustEducationLevel

private void adjustEducationLevel(org.cfpm.caves.za.Person p)
helper function for assignEducationLevels()


createBurialSocieties

private void createBurialSocieties()
Initialisation related: create some burial societies


pickRelatives

private void pickRelatives(java.util.ArrayList<org.cfpm.caves.za.Household> related,
                           int n,
                           java.util.ArrayList<org.cfpm.caves.za.Person> members)
helper function for createBurialSocieties()


findRelatedHouseholds

private java.util.ArrayList<org.cfpm.caves.za.Household> findRelatedHouseholds(org.cfpm.caves.za.Household hh,
                                                                               java.util.ArrayList<org.cfpm.caves.za.Household> hhList)
helper function for createBurialSocieties()


pickFriends

private void pickFriends(java.util.ArrayList<org.cfpm.caves.za.Person> members,
                         int maxNum,
                         java.util.ArrayList<org.cfpm.caves.za.Household> village)
helper function for createBurialSocieties()


findChurches

private java.util.ArrayList<jess.Value> findChurches(java.util.ArrayList<org.cfpm.caves.za.Person> list)
helper function for pickFriends


locateHouseholds

private void locateHouseholds(java.util.ArrayList<java.util.ArrayList<org.cfpm.caves.za.NetworkNode>> hhClusters)
Initialisation related: create villages, assing households to villages, position households in space. Includes creating churches for villages and affiliate households with them (to just go through the village and household list once).

Parameters:
hhClusters - kinship clusters of households

createChurches

private void createChurches(int village,
                            int startIndex,
                            int endIndex)
Initialisation related: create churches for a given village and assign the village's households randomly to the churches. Called from locateHouseholds().

Parameters:
village - village index
startIndex - index into the household list (start of this village's households)
endIndex - index into the household list (end of this village's households)

populateVillage

private void populateVillage(org.cfpm.caves.za.Village village,
                             int startIndex,
                             int endIndex)
Initialisation related: position households in space, or to be more precise, position them randomly inside the area the village takes up. Called from locateHouseholds()

Parameters:
village -
startIndex - index into the household list (start of this village's households)
endIndex - index into the household list (end of this village's households)

sortHouseholdList

private int[] sortHouseholdList(java.util.ArrayList<java.util.ArrayList<org.cfpm.caves.za.NetworkNode>> clusters)
helper function for locateHouseholds(): sorts household list into clusters detected in the kinship network


findHouseholdOf

private org.cfpm.caves.za.Household findHouseholdOf(org.cfpm.caves.za.NetworkNode node)
returns the household to a given network node

Parameters:
node - the network node
Returns:
the associated household

createVillage

private org.cfpm.caves.za.Village createVillage(java.lang.String name,
                                                int numHouseholds,
                                                java.util.ArrayList<org.cfpm.caves.za.Village> villages)
Initialisation related: creates a village for the given number of households and positions it in space. The number of households determine the size of the village area.

Parameters:
name - the name of the village
numHouseholds - the number of households in the village
villages - the list of existing villages (needed to avoid overlapping villages in space)
Returns:
the new village

determineVillageLocation

private int[] determineVillageLocation(int radius,
                                       java.util.ArrayList<org.cfpm.caves.za.Village> villages)
helper method for createVillage()


overlapping

private boolean overlapping(int[] centre,
                            int radius,
                            java.util.ArrayList<org.cfpm.caves.za.Village> villages)
helper method for createVillage()


createHouseholds

private void createHouseholds()
Initialisation related: create households according to RADAR data


pickMigrants

private void pickMigrants()

sortPersonList

private int[] sortPersonList(int lowAge,
                             int highAge,
                             java.util.ArrayList<org.cfpm.caves.za.Person> newList)
helper method for pickMigrants()


populateHousehold

private void populateHousehold(int numMembers,
                               org.cfpm.caves.za.Household hh,
                               cern.jet.random.Normal hhHeadAgeDist,
                               cern.jet.random.Normal ageDiffDist,
                               cern.jet.random.Gamma ageDist,
                               SouthAfricaModel.EmpiricalDiscreteDist femaleStatusDist,
                               SouthAfricaModel.EmpiricalDiscreteDist maleStatusDist,
                               SouthAfricaModel.EmpiricalDiscreteDist memberTypeDist)
Initialisation related: create household members according to empirical data (RADAR)

Parameters:
numMembers - number of members
hh - the household
hhHeadAgeDist - distribution for the age of the household head
ageDiffDist - distribution for the age difference between head and spouse
ageDist - distribution for the age of household members in general
femaleStatusDist - distribution for the marital status of females
maleStatusDist - distribution for the marital status of males
memberTypeDist - distribution for the type of household members (child / grandchild of head or other)

createHouseholdMember

private org.cfpm.caves.za.Person createHouseholdMember(java.lang.String name,
                                                       org.cfpm.caves.za.Household hhold)
Creates a new member for the given household. Called during model initialisation and whenever a baby is born uring simulation.

Parameters:
name - the members's name
hhold - the household
Returns:
the new person

setAsHead

private void setAsHead(org.cfpm.caves.za.Person person,
                       SouthAfricaModel.EmpiricalDiscreteDist statusDistribution)
helper function for populateHouseholds()


createFamilyLinks

private void createFamilyLinks(org.cfpm.caves.za.Household hh,
                               org.cfpm.caves.za.Person[] members,
                               int[] memberType)
helper function for populateHouseholds()


assignEmployments

private void assignEmployments()
Initialisation related: choose some agents to be government employees


sortTypes

private int[] sortTypes(int[] types)
helper function for populateHousehold()


findParent

private int findParent(org.cfpm.caves.za.Person[] members,
                       int[] type,
                       int childIndex)
helper function for createFamilyLinks()


createNeighbourNetwork

private void createNeighbourNetwork()
Initialisaiton related: create the neighbour network according to the households' position in space


createKinshipNetwork

private java.util.ArrayList<java.util.ArrayList<org.cfpm.caves.za.NetworkNode>> createKinshipNetwork()
Initialisation related: create the kinship network between households as a small-world network

Returns:
the kinship network as a list of clusters

endorseKin

public void endorseKin(org.cfpm.caves.za.Household hh1,
                       org.cfpm.caves.za.Household hh2)
Assert kinship endorsements in Jess between the members of the given households. Called during model initialisation and whenever a couple builds a house and moves out into their own household during simulation.

Parameters:
hh1 - first household
hh2 - second household, related to first

endorseNeighbours

void endorseNeighbours(org.cfpm.caves.za.Person p)
Assert neighbour endorsements in Jess for the given person (a newborn baby).

Parameters:
p - a new person

endorseNeighbours

public void endorseNeighbours(org.cfpm.caves.za.Person p,
                              org.cfpm.caves.za.Household hh)
Assert neighbour endorsements in Jess for the given person (a miner renting a shack from the given household)

Parameters:
p - a miner
hh - his landlord household

endorseAllNeighbours

private void endorseAllNeighbours(org.cfpm.caves.za.Person p,
                                  org.cfpm.caves.za.Household hh)
helper function: assert neighbour endorsements for the given person and every member of the given household's neighbour households.

Parameters:
p - the person
hh - the household

endorseKin

void endorseKin(org.cfpm.caves.za.Person baby)
Assert kinship endorsements in Jess for the given person (a newborn baby).

Parameters:
baby - a new person

determineClusters

private java.util.ArrayList<java.util.ArrayList<org.cfpm.caves.za.NetworkNode>> determineClusters(java.util.List list)
Perform cluster analysis on kinship network: sort nodes (= households) into as many clusters as there are villages. Called from createKinshipNetwork().

Parameters:
list - the kinship network as a list of nodes
Returns:
list of clusters

computeDistance

private double computeDistance(java.util.ArrayList<org.cfpm.caves.za.NetworkNode> clusterA,
                               java.util.ArrayList<org.cfpm.caves.za.NetworkNode> clusterB,
                               double[][] distances)
helper method for determineClusters()


getNodeIndex

private int getNodeIndex(org.cfpm.caves.za.NetworkNode node)
helper method for determineClusters()


getLinkedNodes

private java.util.ArrayList<org.cfpm.caves.za.NetworkNode> getLinkedNodes(org.cfpm.caves.za.NetworkNode node)
helper method for determineClusters()


createMine

public void createMine()
Initialisation related: create a mine and some mine workers from outside the village


update

void update()
procedural update of the model state, called each tick


supplyGrants

private void supplyGrants()
Supply households with state grants: child grants for children < 7 and pensions for registered pensioners. For efficiency reasons, this is done in Java instead of Jess. The respective sum is added directly to a household's cash.


createNewPerson

void createNewPerson()
Creates a new agent during simulation, i.e. this models the birth of a person


pickMother

private org.cfpm.caves.za.Person pickMother(java.util.ArrayList<org.cfpm.caves.za.Person> possibleMothers)

createFamilyLinks

private void createFamilyLinks(org.cfpm.caves.za.Person baby,
                               org.cfpm.caves.za.Person mother,
                               org.cfpm.caves.za.Household household)
creates family links between new person and members of the household

Parameters:
baby - the new person
mother - their mother
household - their household

getPossibleMothers

private java.util.ArrayList<org.cfpm.caves.za.Person> getPossibleMothers()
helper function: determines possible mothers for a baby.

Returns:
list of possible mothers

calculateNextBirths

void calculateNextBirths()
Determines number and dates of births for the upcoming year


resetNextBirths

private void resetNextBirths()
helper function: resets the data structure keeping track of upcoming births


updateAgents

void updateAgents()
Procedural update of agents (persons), once each tick. Calls update() on each Person object, then removes all dead agents and left miners


checkDeath

void checkDeath()
Determines number and dates of deaths at the beginning of a year using the WHO life tables. HIV-positive persons are treated with priority, i.e. they will be chosen first in their age group.


checkDeath

void checkDeath(java.util.ArrayList<org.cfpm.caves.za.Person> ageGroup,
                SouthAfricaModel.WHOLifeTable table)
helper function for checkDeath(): determines deaths for given age group according to given life table. First sorts age group so that people with AIDS are in front, followed by HIV-positives, followed by healthy people. Then determines number of deaths (by drawing n samples from a random uniform distribution and checking how many of them are smaller than the death probability for the age group). Then picks the first m people in the list and assigns a random death week within the interval of the age group.


checkDeath

void checkDeath(org.cfpm.caves.za.Person p)
Old version of checkDeath(). Still called for new persons to check for infant mortality.

Parameters:
p - a newborn agent

askPensionOracle

public boolean askPensionOracle(org.cfpm.caves.za.Person p)
Determines if the given person will receive a pension. This is done randomly with probabilities 0.58 for females over 60 and 0.5 for males over 65 (RADAR data).

Parameters:
p - a senior
Returns:
true if person will receive a pension, false otherwise

askChildGrantOracle

public boolean askChildGrantOracle(org.cfpm.caves.za.Person p)
Determines if the given person will receive a child grant. This is done randomly with the proportion set as a model parameter.


removePerson

public void removePerson(org.cfpm.caves.za.Person p)
Removes a dead person from the model and records his/her death.

Parameters:
p - the dead person

removeMiner

public void removeMiner(org.cfpm.caves.za.Person p)
Removes an external miner from the model

Parameters:
p - the miner who is leaving the area

removeLinks

private void removeLinks(org.cfpm.caves.za.Person p)
Helper function: removes the links of the given dead person.

Parameters:
p - the dead person

removeHousehold

public void removeHousehold(org.cfpm.caves.za.Household hh)
Removes the given dissolved household from the model

Parameters:
hh - the household to be removed

removeLinks

private void removeLinks(org.cfpm.caves.za.Household hh)
helper method for removeHousehold(): removes the links of the given dissolved household

Parameters:
hh - the dissolved household

main

public static void main(java.lang.String[] args)
The main method: runs the model


probabilityp

public boolean probabilityp(double p)
returns true with the given probability p.

Parameters:
p - the given propability
Returns:
true if the random number sampled from a uniform distribution is lower than p, otherwise false

randomInt

public int randomInt(int from,
                     int to)
samples a random uniform distribution in the interval from-to. Provided for use in Jess rules.

Parameters:
from - lower bound
to - upper bound
Returns:
random number (int) between from and to

marry

public void marry(jess.Value maleName,
                  jess.Value femaleName)
Make a happy couple out of a male and female agent. The bride moves into the household of the groom.

Parameters:
maleName - name of the male
femaleName - name of the female

marry

public void marry(java.lang.String maleNameString,
                  java.lang.String femaleNameString)
wrapper for the marry() method: turns the parameters of type String into parameters of type Value.

Parameters:
maleNameString - name of the male agent as a String
femaleNameString - name of the female agent as a String

buildNewHouse

public jess.Value buildNewHouse(org.cfpm.caves.za.Person head)
                         throws jess.JessException
Create a new household with the given person as head. This happens when a couple has got enough money to move out from the husband's parents' household.

Parameters:
head - the household head
Returns:
name of the new household
Throws:
jess.JessException

removeNeighbourLinks

void removeNeighbourLinks(jess.Value[] list)
helper function: wrapper for same method with ArrayList parameter


removeNeighbourLinks

void removeNeighbourLinks(java.util.ArrayList<java.lang.String> list)
helper function: removes neighbour links (is-neighbour endorsements) for the given list of persons (members of a household, group of leaving miners)

Parameters:
list - list of names

retrieveObjects

java.util.ArrayList<org.cfpm.caves.za.Person> retrieveObjects(jess.Value[] names)
returns the Person objects for the given list of names. For use with family relations and friends.

Parameters:
names - list of agents' names
Returns:
list of Person objects

dump

public void dump(java.lang.String text)
Output the given text to console (if showOutput is true) and/or trace file (if printToFile is true).

Parameters:
text - the text to be output

getNumHHAskingForFood

public int getNumHHAskingForFood()
returns the number of households asking for food during the current month

Returns:
number of households asking for food

setNumHHAskingForFood

protected void setNumHHAskingForFood(int numHHAskingForFood)
sets the number of households asking for food during the current month

Parameters:
numHHAskingForFood - number of households asking for food

getNumHHWithoutEnoughFood

public int getNumHHWithoutEnoughFood()
returns the number of households with a lack of food even after having asked relatives/neighbours for help

Returns:
number of households without enough food

setNumHHWithoutEnoughFood

protected void setNumHHWithoutEnoughFood(int numHHWithoutEnoughFood)
sets the number of households with a lack of food even after having asked relatives/neighbours for help

Parameters:
numHHWithoutEnoughFood - number of households without enough food

incNumHHAskingForFood

public void incNumHHAskingForFood()
increases the number of households asking for food by 1


incNumHHWithoutEnoughFood

public void incNumHHWithoutEnoughFood()
increases the number of households without enough food by 1


getMaxHHCash

public double getMaxHHCash()
returns the highest amount of cash one of the households owns in the model

Returns:
max amount of cash

getMinHHCash

public double getMinHHCash()
returns the smallest amount of cash one of the households owns in the model

Returns:
min amount of cash

getAvgHHCash

public double getAvgHHCash()
returns the average amount of cash over all households

Returns:
average amount of cash

resetOutputVariables

public void resetOutputVariables()
resets the output variables recorded on a monthly basis


getNumHIVPositives

public int getNumHIVPositives()
returns the number of HIV-positive persons

Returns:
number of HIV-positive agents

getNumFemaleHIVPositives

public int getNumFemaleHIVPositives()
returns the number of female HIV-positive persons

Returns:
number of female HIV-positive agents

getNumMinerHIVPositives

public int getNumMinerHIVPositives()
returns the number of HIV-positive miners (in-migrants)

Returns:
number of HIV-positive miners

getNumPersons

public int getNumPersons()
returns the number of persons

Returns:
number of agents

getHIVIncidence

public int getHIVIncidence()
calculates the HIV incidence for the last month

Returns:
number of persons newly infected within the last month

getNumStokvelMembers

public int getNumStokvelMembers()
returns the number of agents who are members of a stokvel

Returns:
number of stokvel members

getNumBSMembers

public int getNumBSMembers()
returns the number of agents who are members of a burial society

Returns:
number of burial society members

compileSexualNetwork

public java.util.HashMap<java.lang.String,java.lang.String[]> compileSexualNetwork()
compiles the sexual network to be recorded

Returns:
the sexual network as a hash map (list of partners per agent)

calculateClusterCoefficient

public double calculateClusterCoefficient()
calculates the cluster coefficient of the friend network applying the algorithm from Repast

Returns:
cluster coefficient

recordStokvelEvent

public void recordStokvelEvent(java.lang.String stokvel,
                               java.lang.String event)
records the given event for the given stokvel

Parameters:
stokvel - name of a stokvel
event - type of event

recordStokvelEvent

public void recordStokvelEvent(java.lang.String stokvel,
                               java.lang.String event,
                               org.cfpm.caves.za.Person member)
records the given event regarding the given member for the given stokvel

Parameters:
stokvel - name of a stokvel
event - type of event
member - agent (stokvel member)

getMineHIVPrevalence

public double getMineHIVPrevalence()
returns the HIV prevalence amongst in-migrating mine workers

Returns:
HIV prevalence

setMineHIVPrevalence

public void setMineHIVPrevalence(double mineHIVPrevalence)
sets the HIV prevalence amongst in-migrating mine workers

Parameters:
mineHIVPrevalence - HIV prevalence

getMiningTick

public int getMiningTick()
returns the tick when mining starts in the simulation

Returns:
start tick of mining

setMiningTick

public void setMiningTick(int miningTick)
sets the tick when mining starts in the simulation

Parameters:
miningTick - start tick of mining

getNeededSkilled

public int getNeededSkilled()
returns the number of skilled workers needed in the mine

Returns:
number of skilled workers

setNeededSkilled

public void setNeededSkilled(int neededSkilled)
sets he number of skilled workers needed in the mine

Parameters:
neededSkilled - number of skilled workers

getNeededUnskilled

public int getNeededUnskilled()
returns the number of unskilled workers needed in the mine

Returns:
number of unskilled workers

setNeededUnskilled

public void setNeededUnskilled(int neededUnskilled)
sets he number of unskilled workers needed in the mine

Parameters:
neededUnskilled - number of unskilled workers

getNumUnskilled

public int getNumUnskilled()
returns the number of employed unskilled workers in the mine

Returns:
number of unskilled workers

getNumMiners

public int getNumMiners()
returns the number of in-migrant miners in the area

Returns:
number of miners

getNumEmployedMiners

public int getNumEmployedMiners()
returns the number of in-migrant miners employed at the mine

Returns:
number of employed in-migrant miners

getCurrentNumHouseholds

public int getCurrentNumHouseholds()
returns the current number of households in the model. Used for model output.

Returns:
current number of households

getNumMigrants

public int getNumMigrants()
returns the current number of migrants from the villages. Used for model output.

Returns:
current number of migrants

getNumMigrantsOnVisit

public int getNumMigrantsOnVisit()
returns the number of migrants currently on visit in the village(s).

Returns:
current number of visiting migrants

fitForMarriage

public boolean fitForMarriage(java.lang.String male,
                              java.lang.String female)
checks if the specified agents are fit for marriage, i.e. if the female is out of school and old enough to marry (>= 16) and if they've been together long enough (min. 2 months). This function is called from the Jess rule findSuitablePartner.

Parameters:
male - the name of the male partner
female - the name of the female partner
Returns:
true if the partners are fit for marriage, otherwise false.

fitForMarriage

public jess.Value fitForMarriage(jess.Value male,
                                 jess.Value female)
wrapper for the fitForMarriage method


getMonth

public int getMonth()
returns the current month

Returns:
month as int between 0 and 11

setMonth

public void setMonth(int m)
sets the current month


getWeek

public int getWeek()
returns the current week

Returns:
week as int between 0 and 3

setWeek

public void setWeek(int wk)
sets the current week


getYear

public int getYear()
returns the current year

Returns:
year as int starting from 0

setYear

public void setYear(int yr)
sets the current year


addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener p)
adds a property change listener (for Jess)


removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener p)
removes a property change listener (for Jess)


getTick

public int getTick()
returns the current tick

Returns:
tick as int starting from 0

setTick

public void setTick(int t)
sets the current tick


setDateValues

private void setDateValues()
computes and sets the current date values (year, month, week)


getNumHouseholds

public int getNumHouseholds()
returns the number of households with which to initialise the model

Returns:
the initial number of households

setNumHouseholds

public void setNumHouseholds(int numHouseholds)
sets the number of households with which to initialise the model

Parameters:
numHouseholds - the initial number of households

getSeed

public int getSeed()
returns the seed to be used with random generators

Returns:
the seed

setSeed

public void setSeed(int seed)
sets the seed to be used with random generators

Parameters:
seed - the seed

getShowGUI

public boolean getShowGUI()
returns if the GUI is to be displayed or not

Returns:
true if the GUI is on, false if the GUI is off

setShowGUI

public void setShowGUI(boolean showGUI)
sets if the GUI is to be displayed or not

Parameters:
showGUI - true to turn the GUI on, false to turn it off

getAdultEmploymentRate

public double getAdultEmploymentRate()
returns the adult employment rate

Returns:
adult employment rate

setAdultEmploymentRate

public void setAdultEmploymentRate(double rate)
sets the adult employment rate

Parameters:
rate - proportion of adult agents with a job

getGovernmentEmploymentRate

public double getGovernmentEmploymentRate()
returns the government employment rate, i.e. the proportion of adult agents with a government job

Returns:
government employment rate

setGovernmentEmploymentRate

public void setGovernmentEmploymentRate(double governmentEmploymentRate)
sets the government employment rate, i.e. the proportion of adult agents with a government job

Parameters:
governmentEmploymentRate - government employment rate

getGridSizeX

public int getGridSizeX()
returns the size in dimension x of the 2D grid used as a spatial model

Returns:
the number of cells in x

setGridSizeX

public void setGridSizeX(int gridSizeX)
sets the size in dimension x of the 2D grid used as a spatial model

Parameters:
gridSizeX - the number of cells in x

getGridSizeY

public int getGridSizeY()
returns the size in dimension y of the 2D grid used as a spatial model

Returns:
the number of cells in y

setGridSizeY

public void setGridSizeY(int gridSizeY)
sets the size in dimension y of the 2D grid used as a spatial model

Parameters:
gridSizeY - the number of cells in y

getNumVillages

public int getNumVillages()
returns the number of villages

Returns:
the number of villages

setNumVillages

public void setNumVillages(int numVillages)
sets the number of villages

Parameters:
numVillages - the number of villages

getDensityFactor

public double getDensityFactor()
returns the density factor determining how densely the villages are populated with households (1.0 = very compact, every cell filled with a house)

Returns:
the density factor

setDensityFactor

public void setDensityFactor(double densityFactor)
sets the density factor determining how densely the villages are populated with households (1.0 = very compact, every cell filled with a house)

Parameters:
densityFactor - the density factor

getBirthRate

public double getBirthRate()
returns the birth rate (number of births per 1000 persons in the population)

Returns:
the birth rate

setBirthRate

public void setBirthRate(double birthRate)
sets the birth rate (number of births per 1000 persons in the population)

Parameters:
birthRate - the birth rate

getNeighbourhoodRadius

public double getNeighbourhoodRadius()
returns the neighbourhood radius

Returns:
the neighbourhood radius

setNeighbourhoodRadius

public void setNeighbourhoodRadius(double neighbourhoodRadius)
sets the neighbourhood radius

Parameters:
neighbourhoodRadius - the neighbourhood radius

getTagLength

public int getTagLength()
returns the tag length (number of tags)

Returns:
the number of tags per agent

setTagLength

public void setTagLength(int tagLength)
sets the tag length (number of tags)

Parameters:
tagLength - the number of tags per agent

getTagBase

public int getTagBase()
returns the tag base (number of values per tag)

Returns:
the tag base

setTagBase

public void setTagBase(int tagBase)
sets the tag base (number of values per tag)

Parameters:
tagBase - the tag base

getChurchParticipationRate

public double getChurchParticipationRate()
returns the overall church participation rate

Returns:
the church participation rate

setChurchParticipationRate

public void setChurchParticipationRate(double churchParticipationRate)
sets the overall church participation rate

Parameters:
churchParticipationRate - the church participation rate

getNumDenominations

public int getNumDenominations()
returns the overall number of church denominations

Returns:
the number of denominations

setNumDenominations

public void setNumDenominations(int numDenominations)
sets the overall number of church denominations

Parameters:
numDenominations - the number of denominations

getMaxTagEvolutionPropensity

public double getMaxTagEvolutionPropensity()
returns the upper bound for agents' tag evolution propensity

Returns:
the maximal tag evolution propensity

setMaxTagEvolutionPropensity

public void setMaxTagEvolutionPropensity(double maxTagEvolutionPropensity)
sets the upper bound for agents' tag evolution propensity

Parameters:
maxTagEvolutionPropensity - the maximal tag evolution propensity

getMinTagEvolutionPropensity

public double getMinTagEvolutionPropensity()
returns the lower bound for agents' tag evolution propensity

Returns:
the minimal tag evolution propensity

setMinTagEvolutionPropensity

public void setMinTagEvolutionPropensity(double minTagEvolutionPropensity)
sets the lower bound for agents' tag evolution propensity

Parameters:
minTagEvolutionPropensity - the minimal tag evolution propensity

getPrintToFile

public boolean getPrintToFile()
returns if the output to file is set on or off

Returns:
true if turned on, false if turned off

setPrintToFile

public void setPrintToFile(boolean printToFile)
turns the output to file on or off

Parameters:
printToFile - true to turn it on, false to turn it off

getOutputPath

public java.lang.String getOutputPath()
returns the output path

Returns:
the output path

setOutputPath

public void setOutputPath(java.lang.String outputPath)
sets the output path

Parameters:
outputPath - output path

isShowOutput

public boolean isShowOutput()
returns if the output to console is set on or off

Returns:
true if output to console is turned on, false otherwise

setShowOutput

public void setShowOutput(boolean showOutput)
turns the output to console on or off

Parameters:
showOutput - true to turn the output on, false to turn it off

getStopTime

public int getStopTime()
returns the tick when a model run stops

Returns:
stop time of the model run

setStopTime

public void setStopTime(int stopTime)
sets the tick when a model run stops

Parameters:
stopTime - the stop time of a model run

getInterArrivalTime

public double getInterArrivalTime()
returns the mean inter-arrival time for in-migrating mine workers. Used for the arrival distribution in the miner source (mean inter-arrival time = 1 / lambda)

Returns:
mean inter-arrival time (in ticks)

setInterArrivalTime

public void setInterArrivalTime(double interArrivalTime)
sets the mean inter-arrival time for in-migrating mine workers. Used for the arrival distribution (neg. exponential) in the miner source (mean inter-arrival time = 1 / lambda)

Parameters:
interArrivalTime - mean inter-arrival time (in ticks)

getMeanNumArrived

public int getMeanNumArrived()
returns the mean number of in-migrant mine workers arriving at one time. Used for the number distribution (normal) in the miner source

Returns:
mean number of in-migrants

setMeanNumArrived

public void setMeanNumArrived(int meanNumArrived)
sets the mean number of in-migrant mine workers arriving at one time. Used for the number distribution (normal) in the miner source

Parameters:
meanNumArrived - mean number of in-migrants

getSdNumArrived

public int getSdNumArrived()
returns the standard deviation of the number of in-migrant mine workers arriving at one time. Used for the number distribution (normal) in the miner source

Returns:
standard deviation of the number of in-migrants

setSdNumArrived

public void setSdNumArrived(int sdNumArrived)
sets the standard deviation of the number of in-migrant mine workers arriving at one time. Used for the number distribution (normal) in the miner source

Parameters:
sdNumArrived - standard deviation of the number of in-migrants

getLowerMaxNumFriends

public int getLowerMaxNumFriends()
returns the lower limit for the maximum number of friends

Returns:
lower limit of maximum number of friends

setLowerMaxNumFriends

public void setLowerMaxNumFriends(int lowerMaxNumFriends)
sets the lower limit for the maximum number of friends

Parameters:
lowerMaxNumFriends - lower limit of maximum number of friends

getUpperMaxNumFriends

public int getUpperMaxNumFriends()
returns the upper limit for the maximum number of friends

Returns:
upper limit of maximum number of friends

setUpperMaxNumFriends

public void setUpperMaxNumFriends(int upperMaxNumFriends)
sets the upper limit for the maximum number of friends

Parameters:
upperMaxNumFriends - upper limit of maximum number of friends

getUpperMaxNumPartners

public int getUpperMaxNumPartners()
returns the upper limit for the maximum number of concurrent sexual partners

Returns:
upper limit of maximum number of partners

setUpperMaxNumPartners

public void setUpperMaxNumPartners(int upperMaxNumPartners)
sets the upper limit for the maximum number of concurrent sexual partners

Parameters:
upperMaxNumPartners - upper limit of maximum number of partners

getLowerMaxNumPartners

public int getLowerMaxNumPartners()
returns the lower limit for the maximum number of concurrent sexual partners

Returns:
lower limit of maximum number of partners

setLowerMaxNumPartners

public void setLowerMaxNumPartners(int lowerMaxNumPartners)
sets the lower limit for the maximum number of concurrent sexual partners

Parameters:
lowerMaxNumPartners - lower limit of maximum number of partners

getMaxEndorsementBase

public double getMaxEndorsementBase()
returns the maximum value for the endorsement base used in the computation of overall endorsement values. Each agent is assigned a random base between maximum and minimum value specified as model parameters.

Returns:
maximum value for the endorsement base

setMaxEndorsementBase

public void setMaxEndorsementBase(double maxEndorsementBase)
sets the maximum value for the endorsement base used in the computation of overall endorsement values. Each agent is assigned a random base between maximum and minimum value specified as model parameters.

Parameters:
maxEndorsementBase - maximum value for the endorsement base

getMinEndorsementBase

public double getMinEndorsementBase()
returns the minimum value for the endorsement base used in the computation of overall endorsement values. Each agent is assigned a random base between maximum and minimum value specified as model parameters.

Returns:
minimum value for the endorsement base

setMinEndorsementBase

public void setMinEndorsementBase(double minEndorsementBase)
sets the minimum value for the endorsement base used in the computation of overall endorsement values. Each agent is assigned a random base between maximum and minimum value specified as model parameters.

Parameters:
minEndorsementBase - minimum value for the endorsement base

getMinEndorsementClasses

public int getMinEndorsementClasses()
returns the minimum number of endorsement classes. Each agent is assigned a random number between min and max. The number of endorsement classes defines the range of values for the individual weights each agent assigns with the different endorsement tokens (with 1 <= weight_i <= number of classes).

Returns:
minimum number of endorsement classes

getMaxEndorsementClasses

public int getMaxEndorsementClasses()
returns the maximum number of endorsement classes. Each agent is assigned a random number between min and max. The number of endorsement classes defines the range of values for the individual weights each agent assigns with the different endorsement tokens (with 1 <= weight_i <= number of classes).

Returns:
maximum number of endorsement classes

setMaxEndorsementClasses

public void setMaxEndorsementClasses(int maxEndorsementClasses)
sets the maximum number of endorsement classes. Each agent is assigned a random number between min and max. The number of endorsement classes defines the range of values for the individual weights each agent assigns with the different endorsement tokens (with 1 <= weight_i <= number of classes).

Parameters:
maxEndorsementClasses - maximum number of endorsement classes

setMinEndorsementClasses

public void setMinEndorsementClasses(int minEndorsementClasses)
sets the minimum number of endorsement classes. Each agent is assigned a random number between min and max. The number of endorsement classes defines the range of values for the individual weights each agent assigns with the different endorsement tokens (with 1 <= weight_i <= number of classes).

Parameters:
minEndorsementClasses - minimum number of endorsement classes

getStandardWage

public double getStandardWage()
returns the standard monthly wage (for piece jobs in the village).

Returns:
standard monthly wage

setStandardWage

public void setStandardWage(double standardWage)
sets the standard monthly wage (for piece jobs in the village).

Parameters:
standardWage - standard monthly wage

getChildGrant

public double getChildGrant()
returns the monthly child grant for children up to age 7

Returns:
child grant

setChildGrant

public void setChildGrant(double childGrant)
sets the monthly child grant for children up to age 7

Parameters:
childGrant - child grant

getStatePension

public double getStatePension()
returns the monthly state pension for seniors.

Returns:
monthly state pension

setStatePension

public void setStatePension(double statePension)
sets the monthly state pension for seniors.

Parameters:
statePension - monthly state pension

getFoodCostChild

public double getFoodCostChild()
returns the monthly food cost for a child <= 7 years old

Returns:
monthly food cost for a child

setFoodCostChild

public void setFoodCostChild(double foodCostChild)
sets the monthly food cost for a child <= 7 years old

Parameters:
foodCostChild - monthly food cost for a child

getFoodCostFemaleAdult

public double getFoodCostFemaleAdult()
returns the monthly food cost for a female adult

Returns:
monthly food cost for a female

setFoodCostFemaleAdult

public void setFoodCostFemaleAdult(double foodCostFemaleAdult)
sets the monthly food cost for a female adult

Parameters:
foodCostFemaleAdult - monthly food cost for a female

getFoodCostMaleAdult

public double getFoodCostMaleAdult()
returns the monthly food cost for a male adult

Returns:
monthly food cost for a male

setFoodCostMaleAdult

public void setFoodCostMaleAdult(double foodCostMaleAdult)
sets the monthly food cost for a male adult

Parameters:
foodCostMaleAdult - monthly food cost for a male

getSimilarityAgeRange

public double getSimilarityAgeRange()
returns the similarity age range

Returns:
similarity age range

setSimilarityAgeRange

public void setSimilarityAgeRange(double similarityAgeRange)
sets the similarity age range

Parameters:
similarityAgeRange - similarity age range

getBurialCost

public double getBurialCost()
returns the average cost of a burial

Returns:
burial cost

setBurialCost

public void setBurialCost(double burialCost)
sets the average cost of a burial

Parameters:
burialCost - the burial cost

getRandomPartnerProbability

public double getRandomPartnerProbability()
returns the probability to encounter a random sexual partner

Returns:
random sexual partner probability

setRandomPartnerProbability

public void setRandomPartnerProbability(double randomPartnerProbability)
sets the probability to encounter a random sexual partner

Parameters:
randomPartnerProbability - random sexual partner probability

getMeanAgeArrived

public int getMeanAgeArrived()
returns the mean for the age distribution of in-migrants.

Returns:
mean age of in-migrants

setMeanAgeArrived

public void setMeanAgeArrived(int meanAgeArrived)
sets the mean for the age distribution of in-migrants.

Parameters:
meanAgeArrived - mean age of in-migrants

getSdAgeArrived

public int getSdAgeArrived()
returns the standard deviation for the age distribution of in-migrants.

Returns:
standard deviation of age of in-migrants

setSdAgeArrived

public void setSdAgeArrived(int sdAgeArrived)
sets the standard deviation for the age distribution of in-migrants.

Parameters:
sdAgeArrived - standard deviation of age of in-migrants

getShackProportion

public double getShackProportion()
returns the proportion of households with a shack to rent out if necessary

Returns:
proportion of shacks

setShackProportion

public void setShackProportion(double shackProportion)
sets the proportion of households with a shack to rent out if necessary

Parameters:
shackProportion - proportion of shacks in the village

getMinRemittance

public int getMinRemittance()
returns the lower bound for remittances from migrants to their household in the village

Returns:
lower bound for remittances

setMinRemittance

public void setMinRemittance(int minRemittance)
sets the lower bound for remittances from migrants to their household in the village

Parameters:
minRemittance - lower bound for remittances

getMaxRemittance

public int getMaxRemittance()
returns the upper bound for remittances from migrants to their household in the village

Returns:
upper bound for remittances

setMaxRemittance

public void setMaxRemittance(int maxRemittance)
sets the upper bound for remittances from migrants to their household in the village

Parameters:
maxRemittance - upper bound for remittances

getRemittanceProbability

public double getRemittanceProbability()
returns the probability for sending remittance home for any migrant in any month.

Returns:
probability for remittance

setRemittanceProbability

public void setRemittanceProbability(double remittanceProbability)
sets the probability for sending remittance home for any migrant in any month.

Parameters:
remittanceProbability - probability for remittance

getCollegeFee

public double getCollegeFee()
returns the yearly college/university fee.

Returns:
college fee

setCollegeFee

public void setCollegeFee(double collegeFee)
sets the yearly college/university fee.

Parameters:
collegeFee - college fee

getSchoolFee

public double getSchoolFee()
returns the yearly school fee for non-compulsory secondary school (pupils > 15 years).

Returns:
school fee

setSchoolFee

public void setSchoolFee(double schoolFee)
sets the yearly school fee for non-compulsory secondary school (pupils > 15 years).

Parameters:
schoolFee - school fee

getMaxLobola

public int getMaxLobola()
returns the upper bound for the lobola a groom has to pay the bride's household.

Returns:
upper bound for lobola

setMaxLobola

public void setMaxLobola(int maxLobola)
sets the upper bound for the lobola a groom has to pay the bride's household.

Parameters:
maxLobola - upper bound for lobola

getMinLobola

public int getMinLobola()
returns the lower bound for the lobola a groom has to pay the bride's household.

Returns:
lower bound for lobola

setMinLobola

public void setMinLobola(int minLobola)
sets the lower bound for the lobola a groom has to pay the bride's household.

Parameters:
minLobola - lower bound for lobola

getPensionProportionFemale

public double getPensionProportionFemale()
returns the proportion of female seniors over the age limit who receive state pensions.

Returns:
proportion of female seniors with pensions

setPensionProportionFemale

public void setPensionProportionFemale(double pensionProportionFemale)
sets the proportion of female seniors over the age limit who receive state pensions.

Parameters:
pensionProportionFemale - proportion of female seniors with pensions

getPensionProportionMale

public double getPensionProportionMale()
returns the proportion of male seniors over the age limit who receive state pensions.

Returns:
proportion of male seniors with pensions

setPensionProportionMale

public void setPensionProportionMale(double pensionProportionMale)
sets the proportion of male seniors over the age limit who receive state pensions.

Parameters:
pensionProportionMale - proportion of male seniors with pensions

getChildGrantProportion

public double getChildGrantProportion()
returns the proportion of children under the age limit who receive a child grant.

Returns:
proportion of children with child grants

setChildGrantProportion

public void setChildGrantProportion(double childGrantProportion)
sets the proportion of children under the age limit who receive a child grant.

Parameters:
childGrantProportion - proportion of children with child grants

getChildGrantAgeLimit

public int getChildGrantAgeLimit()
returns the age limit for child grants. Children under the age of this limit may receive a child grant from the state.

Returns:
age limit for child grants

setChildGrantAgeLimit

public void setChildGrantAgeLimit(int childGrantAgeLimit)
sets the age limit for child grants. Children under the age of this limit may receive a child grant from the state.

Parameters:
childGrantAgeLimit - age limit for child grants

getPensionAgeLimitFemale

public int getPensionAgeLimitFemale()
returns the age limit for state pensions for female seniors. Female seniors over the age of this limit may receive a state pension.

Returns:
female age limit for state pensions

setPensionAgeLimitFemale

public void setPensionAgeLimitFemale(int pensionFemaleAgeLimit)
sets the age limit for state pensions for female seniors. Female seniors over the age of this limit may receive a state pension.

Parameters:
pensionFemaleAgeLimit - female age limit for state pensions

getPensionAgeLimitMale

public int getPensionAgeLimitMale()
returns the age limit for state pensions for male seniors. Male seniors over the age of this limit may receive a state pension.

Returns:
male age limit for state pensions

setPensionAgeLimitMale

public void setPensionAgeLimitMale(int pensionMaleAgeLimit)
sets the age limit for state pensions for male seniors. Male seniors over the age of this limit may receive a state pension.

Parameters:
pensionMaleAgeLimit - male age limit for state pensions

getMotherChildHIVTransmissionRate

public double getMotherChildHIVTransmissionRate()
returns the rate for mother-to-child HIV transmission.

Returns:
mother-to-child HIV transmission rate

setMotherChildHIVTransmissionRate

public void setMotherChildHIVTransmissionRate(double motherChildHIVTransmissionRate)
sets the rate for mother-to-child HIV transmission.

Parameters:
motherChildHIVTransmissionRate - mother-to-child HIV transmission rate

getHouseCost

public int getHouseCost()
returns the average cost to build a new house in the village.

Returns:
average house cost

setHouseCost

public void setHouseCost(int houseCost)
sets the average cost to build a new house in the village.

Parameters:
houseCost - house cost

getMaxShackRent

public int getMaxShackRent()
returns the upper limit for monthly rent of a shack in the village.

Returns:
upper limit of the shack rent

setMaxShackRent

public void setMaxShackRent(int maxShackRent)
sets the upper limit for monthly rent of a shack in the village.

Parameters:
maxShackRent - upper limit of the shack rent

getMinShackRent

public int getMinShackRent()
returns the lower limit for monthly rent of a shack in the village.

Returns:
lower limit of the shack rent

setMinShackRent

public void setMinShackRent(int minShackRent)
sets the lower limit for monthly rent of a shack in the village.

Parameters:
minShackRent - lower limit of the shack rent