Pseudo Code version.
Define variables and constants
The variables chosen correspond with empirical data from the database. Paul Stirling's database data will be used to initialise the situation as it was in 1950.
popsurvivesk, int = popsk //---------- surviving population variable
popmig, int = pmig //-------------- migrant population variable
birth rates, const = brate //------- (need to add rate randomiser)
death rates, const = drate //------- (need to add rate randomiser)
infant mortality, const = inrate //------- Infant mortality rate
qtylandarea, const = l //------- const
no house holds, int = hh //------ variable starting values
thresholdfor Land, double = T1 //--------- 'share the land' threshold
//---- In practise this will be an important
//----value to play with
cycles, int = N //------------ simulation cycles - ticks!
Initialisation - from Index 1 and Crude birth rate data. - death rate is guessed & infant
mortality data comes from ethnography.
brate = 5 //--------- initial birth rate
drate = 3 //-------- initial death rate
inrate = 30 //-------- initial infant mortal;ty rate
hh = 105 //-------- initial no of house holds
popsk = 633 //------------- initial village population
pmig = 0 //---------------- Initial migrant population
qtylandarea = 12000 //------------ Initial amount of land
for i = 1 to N do //--------Start of loop
male = p/2 //---------derivative of pop make half the pop male - corresponds
females = p/2 //--------derivative of pop make half the pop female - corresponds
popsk = (100-inrate)*(((popsk*brate/100)+popsk) - ((popsk*drate/100)+popsk))/100
//----------- calculates surviving population from birth rate; death rate & infant //-----mortality
male / hh = mh
//--- distribute no of new males across house holds equally at first then with //
//------agent centered use a distribution.
female / hh = fh //---- distribute no of new females across house holds // ----- ------------- equally at first then with agent centered use a distribution.
qtylandarea / hh = lh //---- distribute equally at first then with
// -----agent centered
//-----use a distribution.
Rules / decisions
if mh + fh > 6 make new house hold; hh = hh + 1 //---------- comes from Fig. 8 & Fig. 9 (the algorithm doesn't distinguish males)
if 1h < T1 //---------------- migration threshold variable (contains all the
pmig = pmig + 1 and popsk = popsk -1
graph popsk //------- graph the results for village population
graph pmig //------- graph the results for migrant population
next //------ Continue the loop for N sims
The next stage is to implement this pseudo routine in Java.
The original idea to build an agent centered Java based model required a number of modules such as a harvest 'object' & a 'person object' etc. To that end a lot of data was gathered i.e. climatic data for the harvest model. economic data for the cash flow model, a historical events list 'The Chronograph'. This data in now in Appendix C - website. The descriptive statistics opposite which come from the 1950 Sakaltutan population distribution were to be used to distribute ages across a population or 'person' objects. The original model spec. is in Appendix F along with the object relation diagrams and the object - process tables.
Although this approach in the long run would have allowed more flexibility, upon analysis it was found to be unnecessarily complex for this study. A simpler solution was sort - at least to start off with. This has been outlined above.
The above program was implemented in a Java applet cyclical simulation shell developed by Mike Fischer in the visual café development environment for Macintosh. The working model can be accessed from the website
Run the Simulation
although at present there are still some practical points to be ironed. The listing for the object instances and methods appear in Appendix F with comments. A fuller formal specification of the program will appear on the website version soon.
SimParam - is the heart of the simulation shell. It is a variable house keeping shell and maintains simulation parameter objects which are subclassed from SimParam placed in the graphical container of SimApp (the AWT applet panel) at design time by linking SimParam subclasses to aDField and associated objects (which provide an AWT data entry field, internal value and label for the field). It keeps track of these objects through the cycles of the simulation and greatly reduces the need for elaborate coding for each new sim. It takes care of initialisation (init()) which happens once in the sim lifecycle; reset(), which occurs at the end of each sim run or at the press of the reset button; graphing , it uses an MGraph object and methods to graph selected variables (via the registerGraph() method). It handles the updating of simulation parameter calculations (calc()) for the two cycles, a major cycle (static instance variable numCycle) and an inner minor cycle (static instance variable theTick); it manages messages between the SimParam objects and logs the results of a sim trial through the PrintFormat (implements printf() functionality) and XFile (a simple AWT file management object) objects and associated methods. SimParam registers the name of every subclass in a static array, which make its possible for different subclasses to reference each other.
Household - The HouseHold class extends SimParam and its instantiation maintains the initial and calculated number of households. As with all SimParam subclasses, it overides the init, reset and calc methods of SimParam. It utilises a number of simple reference objects in its calculation method. HHpop is the number of people in any one household; HHmax is the max allowed people per household and HHNorm is the normal member ship value of the aggregated household. The land object is merely a data container for the amount of land available.MinlandHH is the sensitive object. This determines the threshold at which, given the household conditions, a migrant population will be created.
SimApp - This class extends the basic applet and provides the Java.AWT GUI container for the SimParam subclasses. It takes care of GUI event handling and starts the global cycle mechanism of SimParam.
SkPop - This class provides a wrapper for dealing with population variables. The birthrates and deathrates are randomly generated via a normal distribution which is passed a varience value and the population is generated by the interplay of these two. The infant mortality variable was not implemented as for the purposes of this simulation it was not necessary.
The cycle box accepts 4 digit integers. In this sim they represent months therefore 444 months is a run from 1949 to 1986. The supercycle button merely repeats the whole trial N time. The start log button writes a unicode output to file including basic statistics, mean, standard deviation, max & min values if wanted. The reset button returns all values to default (as defined in the reset() method of each subclass of SimParam).