CompetingDestinationsMixing#
- class CompetingDestinationsMixing(scenario=None, params=None)[source]#
Bases:
BaseMixingCompeting destinations mixing model that accounts for the effects of nearby destinations.
- Formula:
- \[M_{i,j} = k \frac{p_i^{a-1} p_j^b}{d_{i,j}^c} \left(\sum_{k \ne i,j} \frac{p_k^b}{d_{ik}^c}\right)^\delta\]
- Where:
M_{i,j}: migration flow from origin i to destination j
k: calibration constant
p_i, p_j, p_k: population at origins/destinations
d_{i,j}, d_{ik}: distances between l ocations
a, b, c, δ: model parameters
- get_migration_matrix()[source]#
Initialize a migration/diffusion matrix for population mixing. The diffusion matrix is a square matrix where each row represents the outbound migration from a given patch to all other patches e.g., [i,j] = [from_i, to_j].
Convention is: - Trips into node j: N_i @ M[i,j] - Trips out of node i: np.sum(M[i,j] * N_i[:,np.newaxis], axis=1)
- Returns:
The diffusion matrix: (N, N)
- Return type:
ndarray