MadonnaModelø
Arialþ!þþDþö(.2>
B6:UIÙ
ø)8{Figure 2a von Neuman neighborhood migration of informational quantities}
{this model is identical to the material movement model except that in the basic population level equation, migration from a grid location is not deducted from the quantity in that location}
METHOD RK4
STARTTIME = 0
STOPTIME=10
DT = 0.01
{begin and end set the index for the grid. Begin should not be changed. Changing end increases or decreases the size of the grid}
begin = 1
end = 3
{constant percentage that will migrate out of each population}
outmig_constant = .10
{birth fractions and death fractions within each population are constant and equal for this example}
birth_fraction = 0.02
death_fraction = 0.02
{These constants determine how to divide up the out_migration population among the populations they will migrate to. Corner populations have two possible moves, edge pops have three possible moves, central populations have four possible moves}
vonNeuman_corner = 1/2
vonNeuman_edge = 1/3
vonNeuman_center = 1/4
{Limit populations to non-negative values}
limit pop >= 0
{Initialize the populations in all grid squares from an external data file}
init pop[begin..end,begin..end] = #import_2a(j,i)
{Calculate the birth and death rates for each population}
br_pop[begin..end,begin..end] = birth_fraction*pop[i,j]
dr_pop[begin..end,begin..end] = death_fraction*pop[i,j]
{Calculate popuation totals}
d/dt(pop[begin..end,begin..end]) = IF((i = begin OR i = end) AND (j = begin OR j = end)) THEN
br_pop[i,j] - dr_pop[i,j] + inmigration_pop[i,j]
ELSE IF (i = begin OR i = end OR j = begin OR j = end) THEN
br_pop[i,j] - dr_pop[i,j] + inmigration_pop[i,j]
ELSE
br_pop[i,j] - dr_pop[i,j] + inmigration_pop[i,j]
{Calculate inmigration as sum of outmigrations from neighbors}
{Inmigration takes into consideration the von Neuman neighborhood.
The first four IF statments are for the four corners of the grid.
The next four IF statements are for squares at the edges of the grid, but not corners.
Then last statement is for central locations.}
inmigration_pop[begin..end,begin..end] = IF ((i = begin) AND (j = begin)) THEN
outmigration_pop[i,j+1] + outmigration_pop[i+1,j]
ELSE IF ((i = begin) AND (j = end)) THEN
outmigration_pop[i,j-1] + outmigration_pop[i+1,j]
ELSE IF ((i = end) AND (j = end)) THEN
outmigration_pop[i,j-1] + outmigration_pop[i-1,j]
ELSE IF ((i = end) AND (j = begin)) THEN
outmigration_pop[i,j+1] + outmigration_pop[i-1,j]
ELSE IF (i-1 < begin) THEN
outmigration_pop[i,j+1] + outmigration_pop[i,j-1] + outmigration_pop[i+1,j]
ELSE IF (i+1 > end) THEN
outmigration_pop[i,j+1] + outmigration_pop[i,j-1] + outmigration_pop[i-1,j]
ELSE IF (j-1 < begin) THEN
outmigration_pop[i+1,j] + outmigration_pop[i-1,j] + outmigration_pop[i,j+1]
ELSE IF (j+1 > end) THEN
outmigration_pop[i+1,j] + outmigration_pop[i-1,j] + outmigration_pop[i,j-1]
ELSE
outmigration_pop[i+1,j] + outmigration_pop[i-1,j] + outmigration_pop[i,j+1] + outmigration_pop[i,j-1]
{Calculate outmigration from each population}
{outmigration is a constant proportion of each population (outmig_constant) divided by the number of places to which the migration can go. This number of places is determined by how many von Neuman neighbors the population has}
outmigration_pop[begin..end,begin..end] = IF((i = begin OR i = end) AND (j = begin OR j = end)) THEN
pop[i,j]*outmig_constant*vonNeuman_corner
ELSE IF (i = begin OR i = end OR j = begin OR j = end) THEN
pop[i,j]*outmig_constant*vonNeuman_edge
ELSE
pop[i,j]*outmig_constant*vonNeuman_centerøöm9ø#import_data€?@@@€?@€@@@@ AÈB @@@A@€@öÁ9ù9;ø#import_1a€?@@@€?ÈB@@@ö9;i;u<ø#import_2a€?@@@€?@ÈB@@ö©<Ù<å=ö
;}<í=ø9@ørk4ööþöúü©ñÒMbP?úü©ñÒMbP?ööúü©ñÒMbP?
DHL &,2^.Fjnr
z‰99a>vu9e9Q9>¹9 ¥9$¥?&?(µ?*½?,E>.Y>Å?