display
Class Model

java.lang.Object
  extended by uchicago.src.sim.engine.SimModelImpl
      extended by display.Model
All Implemented Interfaces:
uchicago.src.reflector.DescriptorContainer, uchicago.src.sim.engine.SimEventProducer, uchicago.src.sim.engine.SimModel

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


Nested Class Summary
 class Model.Cluster
           
 class Model.WHOLifeTable
          WHO Life Tables for calculating death probabilities
 
Field Summary
private  FinanceAgency agency
          Agency awarding grants
private  uchicago.src.sim.gui.Network2DDisplay agentDisplayNetwork
           
private  uchicago.src.sim.gui.AbstractGraphLayout agentFriendsGraphLayout
           
private  java.util.ArrayList<Agent> agentList
          List of agents
private  java.util.HashMap<java.lang.Integer,Agent> agentMap
          Maps agents with their IDS
private  uchicago.src.sim.gui.DisplaySurface agentSurface
          network display variables
private  AidsSpread aidSpread
          Gets AIDS prevalence
private  java.util.HashMap<java.lang.Integer,java.util.ArrayList<Household>> churches
          Map for churches
private  Clinic clinic
          Abstract clinic
(package private)  int clusterProportion
          initial number of households
(package private)  flanagan.math.PsRandom courtShipDuration
          Distribution for agents' courtship duration
private  java.util.ArrayList<Household> currentEmployers
           
private  int currentTick
           
private  java.util.ArrayList<Agent> dead
          List of dying this step
(package private)  cern.jet.random.Normal expectedAgeNormal
          Distribution for agents' expected life
private  uchicago.src.sim.gui.Network2DDisplay extendedFamilyDisplayNetwork
           
private  uchicago.src.sim.gui.AbstractGraphLayout extendedFamilyGraphLayout
           
private  uchicago.src.sim.gui.DisplaySurface extendedFamilySurface
          network display variables
(package private)  cern.jet.random.Normal femaleFertilityNormal
          Distribution for female agents' fertility
 Model.WHOLifeTable femalesTable
           
private  Fermi fermi
           
private  java.util.ArrayList<FuneralClub> funeralClubs
          List of funeral clubs
private  ModelGUI gui
           
(package private)  boolean healthExpenditure
          for health expenses
(package private)  boolean HIV
          Should include HIV/AIDS
private  java.util.ArrayList<Agent> hivOutsiderPatients
          List of current HIV Patients who are outside
private  java.util.ArrayList<Agent> hivPatients
          List of current HIV Patients
private  uchicago.src.sim.gui.Network2DDisplay householdDisplayNetwork
           
private  uchicago.src.sim.gui.AbstractGraphLayout householdGraphLayout
           
private  java.util.ArrayList<Household> householdList
          List of households
private  uchicago.src.sim.gui.DisplaySurface householdSurface
          network display variables
private  java.util.HashMap<java.lang.Integer,Household> houseMap
          Map of households with their IDs
private  java.util.ArrayList<Agent> hungryAgents
          List of agents going hungry at current time
private  int incidence
           
private  uchicago.src.sim.engine.BasicAction initialAction
          Initial action
(package private)  int initialFuneralClubs
          initial number of households
private  int initialSteps
           
(package private)  int initNumHouseholds
          initial number of households
private  KS ks
           
(package private)  int lastAgentID
          initial number of households
(package private)  int lastCoupleID
          initial number of households
(package private)  int lastHouseholdID
          initial number of households
 Model.WHOLifeTable malesTable
           
(package private)  int maxHouseholdSize
          initial number of households
(package private)  double meanFemaleDegree
           
(package private)  double meanMaleDegree
           
private  java.util.ArrayList<Agent> migratedAgents
          List of migrated agent
private  Mine mine
          Abstract mine
(package private)  int minHouseholdSize
          initial number of households
private  uchicago.src.collection.RangeMap neighborMap
          from Repast JinGirNew Implemenation
(package private)  int networkRecordInterval
          Records network at this time interval
 int numAdults
           
 int numAgentsJobless
           
 int numAgentsNotLaborFit
           
 int numAgentsOnMineJob
           
 int numAgentsOnStreet
           
 int numAgentsPieceWork
           
 int numberBirths
           
private  int numBirthsLastYear
          number of birth last year
private  int numBirthsThisYear
          number of birth at this year
 int numChildHH
           
 int numChildren
           
 int numChildrenBornHIVParents
           
 int numDeathsPerYear
           
 int numDyads
           
 int numHHAccommodated
           
 int numHHDissolved
           
 int numHHFuneralClubMembers
           
 int numHHGracePeriod
           
 int numHHLackingFood
           
 int numHHReceivingGrants
           
 int numHHStokvelMembers
           
private  int numIncidenceThisYear
          number of possible new infections this year
private  int numInfantsDeathThisYear
          number of infant deaths at this year
 int numMarriedAgents
           
 int numSeniors
           
 int numSexuallyActiveAgents
           
 int numSingleFemales
           
 int numSingleMales
           
 int numUnPairedIndividuals
           
 int numWidowedFemales
           
 int numWidowedMales
           
(package private)  flanagan.math.PsRandom outsiderPsr
           
private  java.util.ArrayList<Agent> outsidersList
          List of outsiders
private  java.util.ArrayList<Message> partnershipMessageInbox
           
private  java.util.ArrayList<Message> partnershipMessageOutbox
           
private  java.util.ArrayList<Couple> partnersList
          List of unmarried couples
private  java.util.ArrayList<Agent> pregnantFemales
          List of pregnant females
private  int proportionPatients
           
(package private)  flanagan.math.PsRandom psr
           
private  uchicago.src.sim.analysis.LocalDataRecorder recorder
           
private  uchicago.src.sim.analysis.LocalDataRecorder recorder2
           
private  uchicago.src.sim.analysis.LocalDataRecorder recorder3
           
private  uchicago.src.sim.analysis.LocalDataRecorder recorder4
           
private  uchicago.src.sim.analysis.LocalDataRecorder recorder5
           
private  uchicago.src.sim.analysis.LocalDataRecorder recorder6
           
private  uchicago.src.collection.RangeMap removalMap
           
private  double removeProb
          from Repast JinGirNew Implemenation
private  double Rsub0
           
private  double Rsub1
           
private  java.util.ArrayList<SavingsClub> savingsClubs
          List of savings clubs
private  uchicago.src.sim.gui.Network2DDisplay savingsDisplayNetwork
           
private  uchicago.src.sim.gui.AbstractGraphLayout savingsGraphLayout
           
private  uchicago.src.sim.gui.DisplaySurface savingsSurface
          network display variables
private  uchicago.src.sim.engine.Schedule schedule
          Main schedule
private  int seed
          seed for empirical distributions
(package private)  boolean showGui
          Should display Gui
private  Sigmoid sig
          Gives agents' fast health decay
private  java.util.ArrayList<Message> stokvelMessageInbox
           
private  java.util.ArrayList<Message> stokvelMessageOutbox
           
(package private)  double varFemaleDegree
           
(package private)  double varMaleDegree
           
private  Weibull weibull
          Gives HIV incidence
 
Fields inherited from class uchicago.src.sim.engine.SimModelImpl
descriptors, modelManipulator
 
Constructor Summary
Model()
          Default constructor
 
Method Summary
private  void adjustEducationLevel(Agent agent)
          author: ruth meyer - assigne education levels
 void agentsOnStreetCase(Household household)
          Handle agents who do not have a household to live anymore
 void AIDS()
          function for spread of HIV at the current month
private  void assignEducationLevels()
          author: ruth meyer - assigns education levels
 void assignParents(Agent child, Agent head, Agent spouse)
          Assign parents to the created child agnet
 void begin()
           
 void birth()
          Handles brith to pregnant female agents for whom birth is now possible
 void birthToSingleMother(Agent mother)
          Birth to a single mother who is not linked with the father of the new born anymore.
 void borrowFood()
          Agents who go hungry borrow food from their friends' households
 void buildDisplay()
          Creates layouts and displays for the networks
 void buildModel()
          Builds the agents, households, churches and family clusters
protected  void buildSchedule()
           
 void calcuDescStat()
          Calculates the mean and variance of the degree of sexual network
 void calculateUtilization()
          Calculates the percentage of sexually active agents linked to a partner
 boolean checkChildMortality(Agent agent)
          Incorporating an infant mortality rate using 5% chance for infant mortality ...tested it's 37 deaths per 1000 infants for Limpopo source: http://www.hst.org.za/healthstats/7/data/geo also checking for firth 24 months ...
 void childBornToCouple(Couple couple)
          Using child birth rate, infant mortality rate, and maternal mortality rate for child birth
 void createChildAgent(int _id, Agent mother, Agent father, Household household)
          this function is called when child agent, if any, is to be created during the simulation run
 void createChurches()
          Creates churches and assign households to them.
private  void createEmpiricalHouseholds()
          RM-SJA: Creates empirical households based on RADAR Survey
 void createFuneralClubs()
          Creates funeral clubs and assign some households initially
 void createHouseholdClusters()
          Create moieties in the village
 int createHouseholdMembers(Household household, int size, int curCount)
          this is to match the 'anectodal comments: .
 void createHouseholds()
          from Radar:The household size varies from 1 to 19, with a mean of 6.98.
 void createNewHouse(Couple couple)
          Creates a new house for a couple/nuclear family
private  void createOutsiders()
          outsiders: migrant workers outsiders have no houses and are assumed to be living in mine(s)' hostels.
 void createSavingsClub(SavingsClub club)
          this does the bookkeeping actually for the stokvel
 void displaySurfaceAll()
           
 void femaleTreatment()
          currently, this is women specific treatment to prevent Mother-to-Child-Transfer...
 uchicago.src.sim.gui.AbstractGraphLayout getAgentFriendsGraphLayout()
           
 java.util.ArrayList<Agent> getAgentList()
           
 java.util.HashMap<java.lang.Integer,Agent> getAgentMap()
           
 uchicago.src.sim.gui.DisplaySurface getAgentSurface()
           
 int getAIDSPatients()
           
 Clinic getClinic()
           
 int getClusterProportion()
           
 flanagan.math.PsRandom getCourtShipDuration()
           
 java.util.ArrayList<Household> getCurrentEmployers()
           
 cern.jet.random.Normal getExpectedAgeNormal()
           
 uchicago.src.sim.gui.AbstractGraphLayout getExtendedFamilyGraphLayout()
           
 cern.jet.random.Normal getFemaleFertilityNormal()
           
 Fermi getFermi()
           
 java.util.ArrayList<FuneralClub> getFuneralClubs()
           
 ModelGUI getGui()
           
 uchicago.src.sim.gui.Network2DDisplay getHouseholdDisplayNetwork()
           
 uchicago.src.sim.gui.AbstractGraphLayout getHouseholdGraphLayout()
           
 java.util.ArrayList<Household> getHouseholdList()
           
 uchicago.src.sim.gui.DisplaySurface getHouseholdSurface()
           
 java.util.HashMap getHouseMap()
           
 java.util.ArrayList<Agent> getHungryAgents()
           
 int getIncidence()
           
 int getInitialFuneralClubs()
           
 int getInitNumHouseholds()
           
 java.lang.String[] getInitParam()
           
 int getLastAgentID()
           
 int getMarriedCoupleCounts()
           
 double getMeanFemaleDegree()
           
 double getMeanMaleDegree()
           
 java.util.ArrayList<Agent> getMigratedAgents()
           
 Mine getMine()
           
 java.lang.String getName()
           
 int getNetworkRecordInterval()
           
 int getNumAdults()
           
 int getNumAgentsJobless()
          Returns number of stokvels
 int getNumAgentsNotLaborFit()
          Returns number of unfit agents
 int getNumAgentsOnMineJob()
          Returns number of agents on mine job
 int getNumAgentsOnStreet()
           
 int getNumAgentsPieceWork()
          Returns number of agents on piecework
 int getNumberBirths()
          Returns birth occuring this step
 int getNumChildHH()
           
 int getNumChildren()
           
 int getNumChildrenBornHIVParents()
          Returns children born to HIV parents this step.
 int getNumDeathsPerYear()
          Returns number deaths this year
 double getNumDyads()
          Calcualtes the number of dyads in the sexual network
 int getNumHH()
           
 int getNumHHAccommodated()
           
 int getNumHHDissolved()
           
 int getNumHHFuneralClubMembers()
          Returns number of households which are members of funeral clubs
 int getNumHHGracePeriod()
           
 int getNumHHStokvelMembers()
          Returns total number of stokvel members
 int getNumHIVPatients()
          Returns number of HIV/AIDS patients
 int getNumIncidence()
           
 int getNumInfantsDeathThisYear()
          Adapted from Repast JinGirNew Impplementation
 int getNumMarriedAgents()
           
 int getNumMigrants()
          Returns number of stokvels
 int getNumMigratedAgents()
           
 int getNumSeniors()
           
 int getNumSexuallyActiveAgents()
           
 int getNumSingleFemales()
           
 int getNumSingleMales()
           
 int getNumStokvels()
          Returns number of stokvels
 int getNumUnPairedIndividuals()
           
 int getNumWidowedFemales()
           
 int getNumWidowedMales()
           
 flanagan.math.PsRandom getOutsiderPsr()
           
 int getPartners()
           
 java.util.ArrayList<Message> getPartnershipMessageInbox()
           
 java.util.ArrayList<Message> getPartnershipMessageOutbox()
           
 java.util.ArrayList<Couple> getPartnersList()
           
 double getPercentage()
           
 int getPopulation()
          Returns Population size
 Couple getPregnancyCouple(Agent female)
          Returns the couple for the female that gets pregnant at this step.
 java.util.ArrayList<Agent> getPregnantFemales()
           
 double getPrevalence()
          Returns prevalence in population
 int getProportion()
           
 double getProportionHHLackingFood()
          Returns percentage of households lacking food
 double getProportionHHReceivingGrants()
          Returns percentage of households receiving grants
 flanagan.math.PsRandom getPsr()
           
 java.util.ArrayList<SavingsClub> getSavingsClubs()
           
 uchicago.src.sim.gui.AbstractGraphLayout getSavingsGraphLayout()
           
 uchicago.src.sim.gui.DisplaySurface getSavingsSurface()
           
 uchicago.src.sim.engine.Schedule getSchedule()
           
 Sigmoid getSig()
           
 java.util.ArrayList<Message> getStokvelMessageInbox()
           
 java.util.ArrayList<Message> getStokvelMessageOutbox()
           
 double getVarFemaleDegree()
           
 double getVarMaleDegree()
           
 Weibull getWeibull()
           
 void householdBorrowFood()
          Households who go hungry borrow food from their neighbours
 void initialAction()
          Initial action called before the first time step
 void initializeFuneralClub(FuneralClub club)
          populate it with some members for a kick-start ...
 void initializeHIV()
          Agents aare assigned HIV infection at the start
 void initializeMigrants()
          Initializes some agents with migration
 boolean isFuneralClub()
           
 boolean isHealthExpenditure()
           
 boolean isHIV()
           
 boolean isShowGui()
           
static void main(java.lang.String[] args)
           
 void mainAction()
          main action of the simulation
 void makeAcquaintances(Agent agent1, Agent agent2)
          Make agent1 and agent2 as acquaintances to each other.
 Couple makePartners(Agent male, Agent female)
          Makes a unmarried couple for the male and the female agent
 void marriage(Couple couple)
          Marriage means the female in the couple moves to the male's house and the lobola is paid.
 void marriages()
          Marriage occurs for an existing unmarried couple.
 void migration()
          Migration of agents occur; also, agents visit home and resume migration again.
 void migratoryIncidence()
          Incidence to the migrant workers is introduced this month.
 void mineJobApplication()
          Application of the agents and the outsiders for mine jobs
 void mining()
          Controls the start/stop of the mine.
 boolean motherToChildAIDSTransfer(Agent mother, Agent child)
          from avert.org: "Without treatment, around 15-30% of babies born to HIV positive women will become infected with HIV during pregnancy and delivery." here the assumption is that their is no nevirapine or Antiretroviral drugs are available ...
 void MTCT(Agent newBorn)
          Gives the chances for MTCT transfer for the newborn
private  void neighborMeeting()
          Adapted from Repast JinGirNew Impplementation
 boolean newHousePossible(Household household, Couple couple)
          Checks if a new house needs and can be created or not
 void newHouses()
          Create new house for the couple.
 void pieceworkJobs()
          Households offering piecewise jobs
 void populateHousehold(int numMembers, Household household, cern.jet.random.Normal hhHeadAgeDist, cern.jet.random.Normal ageDiffDist, cern.jet.random.Gamma ageDist, EmpiricalDiscreteDist femaleStatusDist, EmpiricalDiscreteDist maleStatusDist, EmpiricalDiscreteDist memberTypeDist)
          Populate the household with members and distributions.
 void populateRelatives(Model.Cluster cluster)
          Populate extended families in the given moiety
 void pregnancyFemale()
          Female agents who can get pregnant are filtered out.
 void print(java.lang.String printString)
           
 void printAIDSProfile()
          Prints the incidence and prevalence in the population.
 void purgeAgent(Agent agent)
          Purge the agent from the simulation, once it is dead.
 void purgeHousehold(Household household)
          Purge the household; dissolve it and accommodate orphans, if any.
 void randomMeeting()
          Adapted from Repast JinGirNew Impplementation
 void record()
           
 void recordNetworks()
           
 void recordSexDegree(java.lang.String prefix)
           
 java.util.HashMap<java.lang.String,java.lang.String[]> recordSexualNetwork()
          Records the sexual network
private  void refreshVariables()
           
 void registerDisplaySurface(java.lang.String name, uchicago.src.sim.gui.DisplaySurface surface)
          Registers a DisplaySurface with this model and associates it with a particular name.
 void removeCouple(Couple couple)
          Removes the unmarried couple.
 void removeHousehold(Household household)
          Removes the household from the networks and data structures.
 void removeInitialAction()
           
private  void removeRandomFriendship()
          Adapted from Repast JinGirNew Impplementation
 Couple returnBirthCouple(Agent female)
          Returns the female which will give birth
 void searchPartner()
          Searching for a sexual partners by the male agents to the potential female agents.
 void setAgentFriendsGraphLayout(uchicago.src.sim.gui.AbstractGraphLayout agentGraphLayout)
           
private  void setAsHead(Agent person, EmpiricalDiscreteDist statusDistribution)
          Sets the person as head of household
 void setClusterProportion(int clusterProportion)
           
 void setCurrentEmployers(java.util.ArrayList<Household> currentEmployers)
           
 void setHealthExpenditure(boolean healthExpenditure)
           
 void setHIV(boolean hiv)
           
 void setHIVInfection(Agent agent)
          Infects the agent with the HIV infection and its stage
 void setHouseholdGraphLayout(uchicago.src.sim.gui.AbstractGraphLayout householdGraphLayout)
           
private  void setInitalizeHIVInfection(Agent agent)
          Function to determin an agents' HIV->AIDS stage
 void setInitialFuneralClubs(int initialFuneralClubs)
           
 void setInitNumHouseholds(int _initNumHouseholds)
           
 void setNetworkRecordInterval(int pajekInterval)
           
 void setShowGui(boolean showGui)
           
 void setup()
           
 void sexualHIVTransmission()
          Possibility of sexual transmission of HIV among the couples.
 void sexualNetworkPajek(java.lang.String prefix)
          Ruth - Records the sexual network into pajek with a prefix string
 void sexualNetworkPajekAIDS(java.lang.String prefix)
           
private  int[] sortTypes(int[] types)
           
 void stokvelPostOffice()
          Function to handle the messages between the agents regarding creating new stokvels.
 void stokvels()
          Creating of new stokvels and also payment of the dues for the existing ones.
 void surfaceSettingsAll()
           
 boolean unAccommodated(Household household)
          Handles unaccommodated household
 void updateAgents()
          Updates all agents at each time step.
 void updateCouples()
          Checks if the couple should breakup or should marry.
 void updateDisplayAll()
           
 void updateFriendshipNetwork()
          Based on the Repast implementation for JinGirNew Model
 void updateGraphLayoutAll()
          Updates all the graph layouts during the simulation.
 void updateHouseholds()
          Updates all households at each time step.
 void updateOutsiderAgents()
          Updates all outsider agents at each time step.
 
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, registerMediaProducer, removePropertyListener, removeSimEventListener, setController, setRngSeed, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

schedule

private uchicago.src.sim.engine.Schedule schedule
Main schedule


initialAction

private uchicago.src.sim.engine.BasicAction initialAction
Initial action


agentList

private java.util.ArrayList<Agent> agentList
List of agents


hungryAgents

private java.util.ArrayList<Agent> hungryAgents
List of agents going hungry at current time


householdList

private java.util.ArrayList<Household> householdList
List of households


agentMap

private java.util.HashMap<java.lang.Integer,Agent> agentMap
Maps agents with their IDS


hivPatients

private java.util.ArrayList<Agent> hivPatients
List of current HIV Patients


hivOutsiderPatients

private java.util.ArrayList<Agent> hivOutsiderPatients
List of current HIV Patients who are outside


dead

private java.util.ArrayList<Agent> dead
List of dying this step


houseMap

private java.util.HashMap<java.lang.Integer,Household> houseMap
Map of households with their IDs


funeralClubs

private java.util.ArrayList<FuneralClub> funeralClubs
List of funeral clubs


savingsClubs

private java.util.ArrayList<SavingsClub> savingsClubs
List of savings clubs


migratedAgents

private java.util.ArrayList<Agent> migratedAgents
List of migrated agent


partnersList

private java.util.ArrayList<Couple> partnersList
List of unmarried couples


agency

private FinanceAgency agency
Agency awarding grants


gui

private ModelGUI gui

aidSpread

private AidsSpread aidSpread
Gets AIDS prevalence


sig

private Sigmoid sig
Gives agents' fast health decay


weibull

private Weibull weibull
Gives HIV incidence


fermi

private Fermi fermi

clinic

private Clinic clinic
Abstract clinic


mine

private Mine mine
Abstract mine


ks

private KS ks

expectedAgeNormal

cern.jet.random.Normal expectedAgeNormal
Distribution for agents' expected life


femaleFertilityNormal

cern.jet.random.Normal femaleFertilityNormal
Distribution for female agents' fertility


psr

flanagan.math.PsRandom psr

outsiderPsr

flanagan.math.PsRandom outsiderPsr

courtShipDuration

flanagan.math.PsRandom courtShipDuration
Distribution for agents' courtship duration


seed

private int seed
seed for empirical distributions


healthExpenditure

boolean healthExpenditure
for health expenses


HIV

boolean HIV
Should include HIV/AIDS


showGui

boolean showGui
Should display Gui


networkRecordInterval

int networkRecordInterval
Records network at this time interval


householdSurface

private uchicago.src.sim.gui.DisplaySurface householdSurface
network display variables


agentSurface

private uchicago.src.sim.gui.DisplaySurface agentSurface
network display variables


savingsSurface

private uchicago.src.sim.gui.DisplaySurface savingsSurface
network display variables


extendedFamilySurface

private uchicago.src.sim.gui.DisplaySurface extendedFamilySurface
network display variables


agentFriendsGraphLayout

private uchicago.src.sim.gui.AbstractGraphLayout agentFriendsGraphLayout

householdGraphLayout

private uchicago.src.sim.gui.AbstractGraphLayout householdGraphLayout

savingsGraphLayout

private uchicago.src.sim.gui.AbstractGraphLayout savingsGraphLayout

extendedFamilyGraphLayout

private uchicago.src.sim.gui.AbstractGraphLayout extendedFamilyGraphLayout

householdDisplayNetwork

private uchicago.src.sim.gui.Network2DDisplay householdDisplayNetwork

agentDisplayNetwork

private uchicago.src.sim.gui.Network2DDisplay agentDisplayNetwork

savingsDisplayNetwork

private uchicago.src.sim.gui.Network2DDisplay savingsDisplayNetwork

extendedFamilyDisplayNetwork

private uchicago.src.sim.gui.Network2DDisplay extendedFamilyDisplayNetwork

initNumHouseholds

int initNumHouseholds
initial number of households


minHouseholdSize

int minHouseholdSize
initial number of households


maxHouseholdSize

int maxHouseholdSize
initial number of households


initialFuneralClubs

int initialFuneralClubs
initial number of households


lastHouseholdID

int lastHouseholdID
initial number of households


lastAgentID

int lastAgentID
initial number of households


clusterProportion

int clusterProportion
initial number of households


lastCoupleID

int lastCoupleID
initial number of households


initialSteps

private int initialSteps

numBirthsThisYear

private int numBirthsThisYear
number of birth at this year


numInfantsDeathThisYear

private int numInfantsDeathThisYear
number of infant deaths at this year


numBirthsLastYear

private int numBirthsLastYear
number of birth last year


numIncidenceThisYear

private int numIncidenceThisYear
number of possible new infections this year


proportionPatients

private int proportionPatients

currentTick

private int currentTick

incidence

private int incidence

recorder

private uchicago.src.sim.analysis.LocalDataRecorder recorder

recorder2

private uchicago.src.sim.analysis.LocalDataRecorder recorder2

recorder3

private uchicago.src.sim.analysis.LocalDataRecorder recorder3

recorder4

private uchicago.src.sim.analysis.LocalDataRecorder recorder4

recorder5

private uchicago.src.sim.analysis.LocalDataRecorder recorder5

recorder6

private uchicago.src.sim.analysis.LocalDataRecorder recorder6

numberBirths

public int numberBirths

numDeathsPerYear

public int numDeathsPerYear

numHHReceivingGrants

public int numHHReceivingGrants

numHHLackingFood

public int numHHLackingFood

numHHFuneralClubMembers

public int numHHFuneralClubMembers

numHHGracePeriod

public int numHHGracePeriod

numHHStokvelMembers

public int numHHStokvelMembers

numAgentsPieceWork

public int numAgentsPieceWork

numAgentsJobless

public int numAgentsJobless

numAgentsNotLaborFit

public int numAgentsNotLaborFit

numAgentsOnMineJob

public int numAgentsOnMineJob

numChildrenBornHIVParents

public int numChildrenBornHIVParents

numHHDissolved

public int numHHDissolved

numHHAccommodated

public int numHHAccommodated

numAdults

public int numAdults

numChildren

public int numChildren

numSeniors

public int numSeniors

numAgentsOnStreet

public int numAgentsOnStreet

numChildHH

public int numChildHH

numSingleMales

public int numSingleMales

numSingleFemales

public int numSingleFemales

numMarriedAgents

public int numMarriedAgents

numWidowedMales

public int numWidowedMales

numWidowedFemales

public int numWidowedFemales

numSexuallyActiveAgents

public int numSexuallyActiveAgents

numUnPairedIndividuals

public int numUnPairedIndividuals

numDyads

public int numDyads

meanFemaleDegree

double meanFemaleDegree

meanMaleDegree

double meanMaleDegree

varFemaleDegree

double varFemaleDegree

varMaleDegree

double varMaleDegree

currentEmployers

private java.util.ArrayList<Household> currentEmployers

stokvelMessageInbox

private java.util.ArrayList<Message> stokvelMessageInbox

stokvelMessageOutbox

private java.util.ArrayList<Message> stokvelMessageOutbox

partnershipMessageInbox

private java.util.ArrayList<Message> partnershipMessageInbox

partnershipMessageOutbox

private java.util.ArrayList<Message> partnershipMessageOutbox

neighborMap

private uchicago.src.collection.RangeMap neighborMap
from Repast JinGirNew Implemenation


removalMap

private uchicago.src.collection.RangeMap removalMap

removeProb

private double removeProb
from Repast JinGirNew Implemenation


Rsub0

private double Rsub0

Rsub1

private double Rsub1

outsidersList

private java.util.ArrayList<Agent> outsidersList
List of outsiders


pregnantFemales

private java.util.ArrayList<Agent> pregnantFemales
List of pregnant females


churches

private java.util.HashMap<java.lang.Integer,java.util.ArrayList<Household>> churches
Map for churches


malesTable

public Model.WHOLifeTable malesTable

femalesTable

public Model.WHOLifeTable femalesTable
Constructor Detail

Model

public Model()
Default constructor

Method Detail

buildModel

public void buildModel()
Builds the agents, households, churches and family clusters


createChurches

public void createChurches()
Creates churches and assign households to them.


createFuneralClubs

public void createFuneralClubs()
Creates funeral clubs and assign some households initially


initializeFuneralClub

public void initializeFuneralClub(FuneralClub club)
populate it with some members for a kick-start ...


createHouseholds

public void createHouseholds()
from Radar:The household size varies from 1 to 19, with a mean of 6.98. The size distribution can be approximated by a Normal distribution with mean = 7 and standard deviation = 3 (variance is 9.003).


createHouseholdMembers

public int createHouseholdMembers(Household household,
                                  int size,
                                  int curCount)
this is to match the 'anectodal comments: . [in reality there would be a few hh – possibly 30% with no seniors, there would also be some with no children 5%, and some with seniors and no adults but still children, 5%] this is just to improve towards it ...


createChildAgent

public void createChildAgent(int _id,
                             Agent mother,
                             Agent father,
                             Household household)
this function is called when child agent, if any, is to be created during the simulation run


MTCT

public void MTCT(Agent newBorn)
Gives the chances for MTCT transfer for the newborn

Parameters:
newBorn -

motherToChildAIDSTransfer

public boolean motherToChildAIDSTransfer(Agent mother,
                                         Agent child)
from avert.org: "Without treatment, around 15-30% of babies born to HIV positive women will become infected with HIV during pregnancy and delivery." here the assumption is that their is no nevirapine or Antiretroviral drugs are available ... which can reduce the risk to as low (perhaps ideally) to a below 2% we're making it 30% chance of getting HIV from mother; mother to child transmission (MTCT)


createHouseholdClusters

public void createHouseholdClusters()
Create moieties in the village


populateRelatives

public void populateRelatives(Model.Cluster cluster)
Populate extended families in the given moiety

Parameters:
cluster -

buildDisplay

public void buildDisplay()
Creates layouts and displays for the networks


initialAction

public void initialAction()
Initial action called before the first time step


initializeHIV

public void initializeHIV()
Agents aare assigned HIV infection at the start


setInitalizeHIVInfection

private void setInitalizeHIVInfection(Agent agent)
Function to determin an agents' HIV->AIDS stage

Parameters:
agent -

initializeMigrants

public void initializeMigrants()
Initializes some agents with migration


AIDS

public void AIDS()
function for spread of HIV at the current month


migration

public void migration()
Migration of agents occur; also, agents visit home and resume migration again.


mineJobApplication

public void mineJobApplication()
Application of the agents and the outsiders for mine jobs


mining

public void mining()
Controls the start/stop of the mine.


mainAction

public void mainAction()
main action of the simulation


updateFriendshipNetwork

public void updateFriendshipNetwork()
Based on the Repast implementation for JinGirNew Model


stokvels

public void stokvels()
Creating of new stokvels and also payment of the dues for the existing ones.


searchPartner

public void searchPartner()
Searching for a sexual partners by the male agents to the potential female agents.


makePartners

public Couple makePartners(Agent male,
                           Agent female)
Makes a unmarried couple for the male and the female agent

Parameters:
male -
female -
Returns:

updateCouples

public void updateCouples()
Checks if the couple should breakup or should marry.


removeCouple

public void removeCouple(Couple couple)
Removes the unmarried couple.

Parameters:
couple -

birth

public void birth()
Handles brith to pregnant female agents for whom birth is now possible


returnBirthCouple

public Couple returnBirthCouple(Agent female)
Returns the female which will give birth

Parameters:
female -
Returns:

birthToSingleMother

public void birthToSingleMother(Agent mother)
Birth to a single mother who is not linked with the father of the new born anymore.

Parameters:
mother -

getPregnancyCouple

public Couple getPregnancyCouple(Agent female)
Returns the couple for the female that gets pregnant at this step.

Parameters:
female -
Returns:

pregnancyFemale

public void pregnancyFemale()
Female agents who can get pregnant are filtered out.


marriages

public void marriages()
Marriage occurs for an existing unmarried couple.


newHouses

public void newHouses()
Create new house for the couple.


pieceworkJobs

public void pieceworkJobs()
Households offering piecewise jobs


childBornToCouple

public void childBornToCouple(Couple couple)
Using child birth rate, infant mortality rate, and maternal mortality rate for child birth


setHIVInfection

public void setHIVInfection(Agent agent)
Infects the agent with the HIV infection and its stage

Parameters:
agent -

migratoryIncidence

public void migratoryIncidence()
Incidence to the migrant workers is introduced this month.


sexualHIVTransmission

public void sexualHIVTransmission()
Possibility of sexual transmission of HIV among the couples.


femaleTreatment

public void femaleTreatment()
currently, this is women specific treatment to prevent Mother-to-Child-Transfer... in the the next stage, we'll extend that to all males and females receiving treatments


marriage

public void marriage(Couple couple)
Marriage means the female in the couple moves to the male's house and the lobola is paid.

Parameters:
couple -

newHousePossible

public boolean newHousePossible(Household household,
                                Couple couple)
Checks if a new house needs and can be created or not


createNewHouse

public void createNewHouse(Couple couple)
Creates a new house for a couple/nuclear family

Parameters:
couple -

purgeHousehold

public void purgeHousehold(Household household)
Purge the household; dissolve it and accommodate orphans, if any.

Parameters:
household -

agentsOnStreetCase

public void agentsOnStreetCase(Household household)
Handle agents who do not have a household to live anymore

Parameters:
household -

unAccommodated

public boolean unAccommodated(Household household)
Handles unaccommodated household

Parameters:
household -
Returns:

removeHousehold

public void removeHousehold(Household household)
Removes the household from the networks and data structures.

Parameters:
household -

purgeAgent

public void purgeAgent(Agent agent)
Purge the agent from the simulation, once it is dead.

Parameters:
agent -

createSavingsClub

public void createSavingsClub(SavingsClub club)
this does the bookkeeping actually for the stokvel


makeAcquaintances

public void makeAcquaintances(Agent agent1,
                              Agent agent2)
Make agent1 and agent2 as acquaintances to each other.

Parameters:
agent1 -
agent2 -

borrowFood

public void borrowFood()
Agents who go hungry borrow food from their friends' households


householdBorrowFood

public void householdBorrowFood()
Households who go hungry borrow food from their neighbours


checkChildMortality

public boolean checkChildMortality(Agent agent)
Incorporating an infant mortality rate using 5% chance for infant mortality ...tested it's 37 deaths per 1000 infants for Limpopo source: http://www.hst.org.za/healthstats/7/data/geo also checking for firth 24 months ... (magic number)


updateAgents

public void updateAgents()
Updates all agents at each time step.


updateOutsiderAgents

public void updateOutsiderAgents()
Updates all outsider agents at each time step.


updateHouseholds

public void updateHouseholds()
Updates all households at each time step.


removeInitialAction

public void removeInitialAction()

buildSchedule

protected void buildSchedule()

begin

public void begin()

displaySurfaceAll

public void displaySurfaceAll()

setup

public void setup()

getInitParam

public java.lang.String[] getInitParam()

getSchedule

public uchicago.src.sim.engine.Schedule getSchedule()

getName

public java.lang.String getName()

main

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

getAgentList

public java.util.ArrayList<Agent> getAgentList()

getClusterProportion

public int getClusterProportion()

getHouseholdList

public java.util.ArrayList<Household> getHouseholdList()

getHouseMap

public java.util.HashMap getHouseMap()

getGui

public ModelGUI getGui()

getAgentMap

public java.util.HashMap<java.lang.Integer,Agent> getAgentMap()

getHouseholdDisplayNetwork

public uchicago.src.sim.gui.Network2DDisplay getHouseholdDisplayNetwork()

getHouseholdSurface

public uchicago.src.sim.gui.DisplaySurface getHouseholdSurface()

getSig

public Sigmoid getSig()

getFuneralClubs

public java.util.ArrayList<FuneralClub> getFuneralClubs()

getSavingsClubs

public java.util.ArrayList<SavingsClub> getSavingsClubs()

getInitNumHouseholds

public int getInitNumHouseholds()

setInitNumHouseholds

public void setInitNumHouseholds(int _initNumHouseholds)

isFuneralClub

public boolean isFuneralClub()

getExpectedAgeNormal

public cern.jet.random.Normal getExpectedAgeNormal()

getAgentFriendsGraphLayout

public uchicago.src.sim.gui.AbstractGraphLayout getAgentFriendsGraphLayout()

setAgentFriendsGraphLayout

public void setAgentFriendsGraphLayout(uchicago.src.sim.gui.AbstractGraphLayout agentGraphLayout)

getHouseholdGraphLayout

public uchicago.src.sim.gui.AbstractGraphLayout getHouseholdGraphLayout()

setHouseholdGraphLayout

public void setHouseholdGraphLayout(uchicago.src.sim.gui.AbstractGraphLayout householdGraphLayout)

registerDisplaySurface

public void registerDisplaySurface(java.lang.String name,
                                   uchicago.src.sim.gui.DisplaySurface surface)
Registers a DisplaySurface with this model and associates it with a particular name.

Overrides:
registerDisplaySurface in class uchicago.src.sim.engine.SimModelImpl

getAgentSurface

public uchicago.src.sim.gui.DisplaySurface getAgentSurface()

getSavingsSurface

public uchicago.src.sim.gui.DisplaySurface getSavingsSurface()

getSavingsGraphLayout

public uchicago.src.sim.gui.AbstractGraphLayout getSavingsGraphLayout()

getExtendedFamilyGraphLayout

public uchicago.src.sim.gui.AbstractGraphLayout getExtendedFamilyGraphLayout()

updateGraphLayoutAll

public void updateGraphLayoutAll()
Updates all the graph layouts during the simulation.


surfaceSettingsAll

public void surfaceSettingsAll()

updateDisplayAll

public void updateDisplayAll()

getHungryAgents

public java.util.ArrayList<Agent> getHungryAgents()

getMigratedAgents

public java.util.ArrayList<Agent> getMigratedAgents()

getNumMigratedAgents

public int getNumMigratedAgents()

getFermi

public Fermi getFermi()

getPartnersList

public java.util.ArrayList<Couple> getPartnersList()

getAIDSPatients

public int getAIDSPatients()

getProportion

public int getProportion()

record

public void record()

getPercentage

public double getPercentage()

getIncidence

public int getIncidence()

getClinic

public Clinic getClinic()

getCurrentEmployers

public java.util.ArrayList<Household> getCurrentEmployers()

setCurrentEmployers

public void setCurrentEmployers(java.util.ArrayList<Household> currentEmployers)

stokvelPostOffice

public void stokvelPostOffice()
Function to handle the messages between the agents regarding creating new stokvels.


assignEducationLevels

private void assignEducationLevels()
author: ruth meyer - assigns education levels


adjustEducationLevel

private void adjustEducationLevel(Agent agent)
author: ruth meyer - assigne education levels


getStokvelMessageInbox

public java.util.ArrayList<Message> getStokvelMessageInbox()

getStokvelMessageOutbox

public java.util.ArrayList<Message> getStokvelMessageOutbox()

print

public void print(java.lang.String printString)

printAIDSProfile

public void printAIDSProfile()
Prints the incidence and prevalence in the population.


getFemaleFertilityNormal

public cern.jet.random.Normal getFemaleFertilityNormal()

randomMeeting

public void randomMeeting()
Adapted from Repast JinGirNew Impplementation


neighborMeeting

private void neighborMeeting()
Adapted from Repast JinGirNew Impplementation


removeRandomFriendship

private void removeRandomFriendship()
Adapted from Repast JinGirNew Impplementation


getLastAgentID

public int getLastAgentID()

getNumInfantsDeathThisYear

public int getNumInfantsDeathThisYear()
Adapted from Repast JinGirNew Impplementation


getPsr

public flanagan.math.PsRandom getPsr()

getCourtShipDuration

public flanagan.math.PsRandom getCourtShipDuration()

getMine

public Mine getMine()

getOutsiderPsr

public flanagan.math.PsRandom getOutsiderPsr()

getPopulation

public int getPopulation()
Returns Population size


getNumberBirths

public int getNumberBirths()
Returns birth occuring this step


getNumDeathsPerYear

public int getNumDeathsPerYear()
Returns number deaths this year


getProportionHHReceivingGrants

public double getProportionHHReceivingGrants()
Returns percentage of households receiving grants


getProportionHHLackingFood

public double getProportionHHLackingFood()
Returns percentage of households lacking food


getNumHHFuneralClubMembers

public int getNumHHFuneralClubMembers()
Returns number of households which are members of funeral clubs


getNumHHGracePeriod

public int getNumHHGracePeriod()

getNumStokvels

public int getNumStokvels()
Returns number of stokvels


getNumHHStokvelMembers

public int getNumHHStokvelMembers()
Returns total number of stokvel members


getNumMigrants

public int getNumMigrants()
Returns number of stokvels


getNumAgentsJobless

public int getNumAgentsJobless()
Returns number of stokvels


getNumAgentsNotLaborFit

public int getNumAgentsNotLaborFit()
Returns number of unfit agents


getNumAgentsPieceWork

public int getNumAgentsPieceWork()
Returns number of agents on piecework


getNumAgentsOnMineJob

public int getNumAgentsOnMineJob()
Returns number of agents on mine job


getNumHIVPatients

public int getNumHIVPatients()
Returns number of HIV/AIDS patients


getPrevalence

public double getPrevalence()
Returns prevalence in population


getNumChildrenBornHIVParents

public int getNumChildrenBornHIVParents()
Returns children born to HIV parents this step.


getNumHHAccommodated

public int getNumHHAccommodated()

getNumHHDissolved

public int getNumHHDissolved()

getNumAdults

public int getNumAdults()

getNumChildren

public int getNumChildren()

getNumSeniors

public int getNumSeniors()

getNumAgentsOnStreet

public int getNumAgentsOnStreet()

getNumChildHH

public int getNumChildHH()

getNumHH

public int getNumHH()

recordSexualNetwork

public java.util.HashMap<java.lang.String,java.lang.String[]> recordSexualNetwork()
Records the sexual network


sexualNetworkPajek

public void sexualNetworkPajek(java.lang.String prefix)
Ruth - Records the sexual network into pajek with a prefix string

Parameters:
prefix -

getPregnantFemales

public java.util.ArrayList<Agent> getPregnantFemales()

refreshVariables

private void refreshVariables()

createEmpiricalHouseholds

private void createEmpiricalHouseholds()
RM-SJA: Creates empirical households based on RADAR Survey


assignParents

public void assignParents(Agent child,
                          Agent head,
                          Agent spouse)
Assign parents to the created child agnet

Parameters:
child -
head -
spouse -

populateHousehold

public void populateHousehold(int numMembers,
                              Household household,
                              cern.jet.random.Normal hhHeadAgeDist,
                              cern.jet.random.Normal ageDiffDist,
                              cern.jet.random.Gamma ageDist,
                              EmpiricalDiscreteDist femaleStatusDist,
                              EmpiricalDiscreteDist maleStatusDist,
                              EmpiricalDiscreteDist memberTypeDist)
Populate the household with members and distributions.

Parameters:
numMembers -
household -
hhHeadAgeDist -
ageDiffDist -
ageDist -
femaleStatusDist -
maleStatusDist -
memberTypeDist -

sortTypes

private int[] sortTypes(int[] types)

setAsHead

private void setAsHead(Agent person,
                       EmpiricalDiscreteDist statusDistribution)
Sets the person as head of household

Parameters:
person -
statusDistribution -

getWeibull

public Weibull getWeibull()

getPartners

public int getPartners()

getMarriedCoupleCounts

public int getMarriedCoupleCounts()

calcuDescStat

public void calcuDescStat()
Calculates the mean and variance of the degree of sexual network


recordSexDegree

public void recordSexDegree(java.lang.String prefix)

recordNetworks

public void recordNetworks()

getPartnershipMessageInbox

public java.util.ArrayList<Message> getPartnershipMessageInbox()

getPartnershipMessageOutbox

public java.util.ArrayList<Message> getPartnershipMessageOutbox()

getNumSingleMales

public int getNumSingleMales()

getNumSingleFemales

public int getNumSingleFemales()

getNumMarriedAgents

public int getNumMarriedAgents()

getNumWidowedMales

public int getNumWidowedMales()

getNumWidowedFemales

public int getNumWidowedFemales()

getNumSexuallyActiveAgents

public int getNumSexuallyActiveAgents()

getNumUnPairedIndividuals

public int getNumUnPairedIndividuals()

getNumDyads

public double getNumDyads()
Calcualtes the number of dyads in the sexual network

Returns:

sexualNetworkPajekAIDS

public void sexualNetworkPajekAIDS(java.lang.String prefix)

calculateUtilization

public void calculateUtilization()
Calculates the percentage of sexually active agents linked to a partner


getNumIncidence

public int getNumIncidence()

getMeanFemaleDegree

public double getMeanFemaleDegree()

getMeanMaleDegree

public double getMeanMaleDegree()

getVarFemaleDegree

public double getVarFemaleDegree()

getVarMaleDegree

public double getVarMaleDegree()

createOutsiders

private void createOutsiders()
outsiders: migrant workers outsiders have no houses and are assumed to be living in mine(s)' hostels. they could rent a place at a village (rented by a household; a shelter) ... can have partners from the village; can as well marry, if their courtship stays longers and build a new 'house' in the village. We are also not assuming any women outsider as a miner. They could be both skilled and unskilled workers


getInitialFuneralClubs

public int getInitialFuneralClubs()

setInitialFuneralClubs

public void setInitialFuneralClubs(int initialFuneralClubs)

setClusterProportion

public void setClusterProportion(int clusterProportion)

getNetworkRecordInterval

public int getNetworkRecordInterval()

setNetworkRecordInterval

public void setNetworkRecordInterval(int pajekInterval)

isHealthExpenditure

public boolean isHealthExpenditure()

setHealthExpenditure

public void setHealthExpenditure(boolean healthExpenditure)

isHIV

public boolean isHIV()

setHIV

public void setHIV(boolean hiv)

isShowGui

public boolean isShowGui()

setShowGui

public void setShowGui(boolean showGui)