- Inspired originally by modeling population as a markov chain
December 3, 2015
Outlined in the paper "Using Markov Chains to Model Human Migration in a Network Equilibrium Framework", by J. Pan and A. Nagurney
For the individual, each region is assumed to have its own utility function, which is a function of its population, and a cost of moving, which is a function of the number of people moving in the current iteration.
The two regions have an initial population vector \(p = [p_1, p_2]\)
The flow matrix, which we solve for, will be \(F = \left[ \begin{array}{cc} f_{11} & f_{12} \\ f_{21} & f_{22} \end{array} \right]\)
This leaves us with the functions \(u_1 (p)\), \(u_2 (p)\), \(c_{12} (f)\) and \(c_{21} (f)\).
People will move from locations of lower utility to locations of higher utility.
At each iteration, we can solve the following for f:
\[ u_i (p) + c_{ij} (f) = u_j (p) \]
flowcalcpan <- function(p){
if(u2pan(p) > u1pan(p)){
f1 <- (p[1] - p[2] + 6)/4
f <- c(f1,0)
}else if(u1pan(p) > u2pan(p)){
f2 <- (p[2] - p[1] - 6)/4
f <- c(0,f2)
}else{f <- c(0,0)}
return(f)
}
p0 <- c(4,2)
pdatapan <- data.frame(p1 = 4, p2 = 2, u1 = u1pan(p0), u2 = u2pan(p0))
iter <- 1:5
for(i in iter){
p <- c(tail(pdatapan$p1,1),tail(pdatapan$p2,1))
f <- flowcalcpan(p)
u <- c(u1pan(p),u2pan(p))
totu <- sum(p*u)
pdatapan <- rbind(pdatapan, c(p[1]-f[1]+f[2], p[2]+f[1]-f[2], u))
}
| iter | p1 | p2 | u1 | u2 |
|---|---|---|---|---|
| 1 | 4.000 | 2.000 | 4.00 | 12.00 |
| 2 | 2.000 | 4.000 | 4.00 | 12.00 |
| 3 | 1.000 | 5.000 | 6.00 | 10.00 |
| 4 | 0.500 | 5.500 | 7.00 | 9.00 |
| 5 | 0.250 | 5.750 | 7.50 | 8.50 |
| 6 | 0.125 | 5.875 | 7.75 | 8.25 |
The algorithm for bilateral migration is very similar. We pick two locations at random, and calculate the relative utility between the two locations. We accept the move if \(u_i (p) + c_{ij} (f) < u_j (p)\)
If the inequality doesn't hold, we accept the move with a certain probability. For this algorithm, I defined this probability as:
\[ Prob_{accept} = \frac{u_j (p) - c_{ij} (1)}{u_i (p)} \]
Apply this to models with more than two regions!
Try to perform some sensitivity analysis on the different constraints, such as how we define utility and cost functions, and initial populations.
Examine the discrepancy between an individual's utility and social utility in this model
| iter | p1 | p2 | u1 | u2 | totalU |
|---|---|---|---|---|---|
| 1 | 4.000 | 2.000 | 4.00 | 12.00 | 40.0000 |
| 2 | 2.000 | 4.000 | 4.00 | 12.00 | 56.0000 |
| 3 | 1.000 | 5.000 | 6.00 | 10.00 | 56.0000 |
| 4 | 0.500 | 5.500 | 7.00 | 9.00 | 53.0000 |
| 5 | 0.250 | 5.750 | 7.50 | 8.50 | 50.7500 |
| 6 | 0.125 | 5.875 | 7.75 | 8.25 | 49.4375 |