This vignette describes the potential function of the Harris and
Wilson model introduced by Osawa, Akamatsu and Kogure (2025), and the
projected gradient ascent algorithms of blvim() that
maximise it (algorithm = "gradient", the default, and
algorithm = "gradient_z"). The potential also gives the
convergence criterion of all the algorithms of blvim(),
including the Boltzmann–Lotka–Volterra ones. The model itself and the
Boltzmann–Lotka–Volterra algorithms are presented in
vignette("theory").
Notations
We use a simplified notation for the Harris–Wilson (HW) model:
\[ w_{ij}=w_{ij}(\beta)=\exp(-\beta c_{ij}) \qquad S_i=S_i(\mathbf{Z},\alpha,\beta)=\sum_{k=1}^pZ_k^{\alpha}w_{ik} \qquad P_{ij}=\frac{Z_j^{\alpha}w_{ij}}{S_i} \] so that \(P_{ij}\) is the share of origin \(i\)’s demand attracted to destination \(j\). The total flow received by destination \(j\) is
\[ D_j(\mathbf{Z},\alpha,\beta) = \sum_{i=1}^n X_i P_{ij}, \] and the Harris–Wilson residual map is
\[ G_j(\mathbf{Z},\alpha,\beta) = D_j(\mathbf{Z},\alpha,\beta) - \kappa_j Z_j, \] where \(\kappa_j > 0\) is the conversion factor at destination \(j\). A Harris–Wilson equilibrium is a vector \(\mathbf{Z}^* \geq 0\) satisfying \(G(\mathbf{Z}^*) = \mathbf{0}\). We denote \(X_{\rm tot}=\sum_{i=1}^n X_i\) the total production. As \(\sum_j P_{ij}=1\), we have \(\sum_j D_j = X_{\rm tot}\), so every equilibrium satisfies the constraint \(\sum_j \kappa_j Z_j = X_{\rm tot}\): the attractivenesses, converted into incoming flows by the conversion factors, sum to the total production.
The Potential Function
In 2025, Osawa, Akamatsu and Kogure introduced a new interpretation of the HW model. It can be seen as a large-population potential game. This concept, which comes from game theory, allows us to see the HW model as a single maximisation problem characterised by a potential function defined as:
\[ f(\mathbf{Z},\alpha,\beta)=A(\mathbf{Z},\alpha,\beta)-\sum_{j=1}^p\kappa_jZ_j \] \[ A(\mathbf{Z},\alpha,\beta)=\frac{1}{\alpha}\sum_{i=1}^nX_i\log S_i=\frac{1}{\alpha}\sum_{i=1}^n X_i \log\!\left(\sum_{j=1}^p Z_j^{\alpha}\,\exp(-\beta c_{ij})\right) \]
The authors look for vectors \(\mathbf{Z}\) that maximise \(f\) subject to the constraint \(\sum_j \kappa_j Z_j = X_{\rm tot}\) and the non-negativity constraint \(Z_j \geq 0\) for all \(j\). By the stochastic-stability result of Sandholm (2010, §12.2), the global maximiser(s) of \(f\) correspond to the most likely spatial patterns when small random perturbations can occur.
The potential of a model computed by blvim() is given by
sim_potential(). When blvim() is run from
several starting points, it keeps the solution with the largest
potential.
Gradient of the Potential Function
We now show why the potential is linked to the Harris–Wilson equilibria. Differentiating \(A\) with respect to \(Z_j\) gives
\[ \frac{\partial A}{\partial Z_j} = \frac{1}{\alpha}\sum_{i=1}^n X_i \cdot \frac{\alpha Z_j^{\alpha-1}\,w_{ij}}{S_i} = \sum_{i=1}^n X_i\,\frac{Z_j^{\alpha-1}\,w_{ij}}{S_i}. \]
Recognising that \(Z_j^{\alpha-1} w_{ij} / S_i = P_{ij} / Z_j\), this becomes
\[ \frac{\partial A}{\partial Z_j} = \frac{1}{Z_j}\sum_{i=1}^n X_i P_{ij} = \frac{D_j}{Z_j} \] Adding the derivative of the linear term \(-\kappa_j Z_j\), we obtain
\[ \frac{\partial f}{\partial Z_j}(\mathbf{Z},\alpha,\beta) = \frac{D_j - \kappa_j Z_j}{Z_j} = \frac{G_j(\mathbf{Z},\alpha,\beta)}{Z_j} \] In other words, \(\nabla f = {\rm diag}(\mathbf{Z})^{-1}G\): the residual map is the gradient of the potential up to a positive rescaling of each coordinate.
Let us first consider the simple case of interior points (\(Z_j > 0\) for all \(j\)). There, \(\nabla f\) vanishes if and only if \(G(\mathbf{Z}) = \mathbf{0}\): the critical points of \(f\) in the interior are exactly the Harris–Wilson equilibria with no inactive destination. The constraint \(\sum_j \kappa_j Z_j = X_{\rm tot}\) plays no role in this simple case, as every equilibrium satisfies it automatically.
This is not the whole picture, as the potential is maximised on a constraint set whose boundary contains configurations in which some destinations have vanished (\(Z_j = 0\)). At such points, \(\partial f/\partial Z_j = G_j/Z_j\) is not defined and the vanishing of the gradient is not the right optimality condition. The general case is handled by the Karush–Kuhn–Tucker (KKT) conditions of the constrained problem, which we analyse now. They lead to the same conclusion: for \(\alpha > 1\), the KKT points are exactly the Harris–Wilson equilibria, with or without inactive destinations. In particular, every local maximum of \(f\), interior or on the boundary, is an equilibrium. Conversely, an equilibrium is a critical point of the potential, but not necessarily a maximum: telling maxima apart from other equilibria is a second-order question, addressed in the section on local maxima and stability.
KKT Conditions and Equilibrium Structure
The Lagrangian of the constrained maximisation problem (\(\max f\) subject to \(\sum_j \kappa_j Z_j = X_{\rm tot}\), \(Z_j \geq 0\)) is
\[ \mathcal{L}(\mathbf{Z},\mu,\pmb{\lambda}) = -f(\mathbf{Z},\alpha,\beta) - \sum_{j=1}^p \lambda_j Z_j + \mu\!\left(X_{\rm tot} - \sum_{j=1}^p \kappa_j Z_j\right). \]
The first-order KKT conditions are, for each \(j\):
\[ \frac{\partial \mathcal{L}}{\partial Z_j} = -\sum_{i=1}^n X_i\,\frac{Z_j^{\alpha-1}\,w_{ij}}{S_i} + \kappa_j - \lambda_j - \mu\kappa_j = 0, \qquad \lambda_j \geq 0, \quad \lambda_j Z_j = 0. \] Note that we use here the expression of the derivative of \(A\) obtained above, before the simplification into \(D_j/Z_j\): it remains defined when \(Z_j = 0\) (for \(\alpha > 1\)), in which case the sum vanishes.
KKT points are equilibria. Multiplying the condition by \(Z_j\) gives \(-D_j + (1-\mu)\kappa_j Z_j - \lambda_j Z_j = 0\). Using complementary slackness (\(\lambda_j Z_j = 0\)), summing over \(j\) and using \(\sum_j D_j = X_{\rm tot} = \sum_j \kappa_j Z_j\), one finds \(\mu = 0\). Then, for each \(j\), \(\kappa_j Z_j = D_j\), i.e. \(G_j = 0\): this holds for active destinations (\(Z_j > 0\)) as well as for inactive ones, for which both sides vanish.
Equilibria are KKT points. Conversely, let \(\mathbf{Z}^*\) be a Harris–Wilson equilibrium and set \(\mu^* = 0\).
- If \(Z^*_j > 0\), then \(\sum_i X_i Z_j^{*\alpha-1} w_{ij}/S_i = D_j/Z^*_j = \kappa_j\) and \(\lambda^*_j = 0\) cancels the partial derivative while satisfying \(\lambda^*_j Z^*_j = 0\).
- If \(Z^*_j = 0\), the partial derivative reduces to \(\kappa_j - \lambda_j\): setting \(\lambda^*_j = \kappa_j > 0\) cancels it, and obviously \(\lambda^*_j Z^*_j = 0\).
Hence, for \(\alpha>1\), the KKT points of the constrained problem are exactly the Harris–Wilson equilibria (possibly with inactive destinations). As the constraints are linear, the KKT conditions are necessary conditions for a local maximum: every local maximum of the potential is thus an equilibrium, whether it lies in the interior of the constraint set or on its boundary. Inactive destinations are therefore a normal feature of the solutions: a local maximum of the potential can lie on a face of the constraint set, where some destinations have vanished.
For \(\alpha\leq 1\), the partial derivative of \(A\) does not vanish when \(Z_j\to0\) (it tends to a positive value for \(\alpha=1\) and to \(+\infty\) for \(\alpha<1\)), and an equilibrium with inactive destinations is in general not a KKT point. Local maxima remain equilibria, though. For \(\alpha=1\), \(f\) is still continuously differentiable and the first part of the argument applies unchanged. For \(\alpha<1\), moving a small amount \(\varepsilon\) of attractiveness to an inactive destination increases \(A\) by a term of order \(\varepsilon^\alpha \gg \varepsilon\), so a local maximum has no inactive destination and is an interior equilibrium.
Reduction to the Unit Simplex
The gradient algorithms of blvim() do not work directly
with \(\mathbf{Z}\). They use the
rescaled attractivenesses
\[ U_j=\frac{\kappa_j Z_j}{X_{\rm tot}},\qquad Z_j=\frac{X_{\rm tot}}{\kappa_j}U_j, \] which map the weighted simplex \(\{\mathbf{Z}\geq0 : \sum_j \kappa_j Z_j = X_{\rm tot}\}\) to the unit simplex \(\Delta=\{\mathbf{U}\geq0 : \sum_j U_j = 1\}\). Substituting \(Z_j=X_{\rm tot}U_j/\kappa_j\) in \(f\) and using \(\sum_j\kappa_jZ_j=X_{\rm tot}\) gives, for every \(\mathbf{U}\in\Delta\),
\[ f(\mathbf{Z},\alpha,\beta)=\Phi(\mathbf{U})+X_{\rm tot}\log X_{\rm tot}-X_{\rm tot}, \qquad \Phi(\mathbf{U})=\frac{1}{\alpha}\sum_{i=1}^n X_i \log\left(\sum_{j=1}^p \left(\frac{U_j}{\kappa_j}\right)^\alpha w_{ij}\right). \] The constant does not depend on \(\mathbf{U}\): maximising \(f\) on the weighted simplex is equivalent to maximising \(\Phi\) on \(\Delta\). The shares \(P_{ij}\), and therefore the flows, are unchanged by the change of variables, and the partial derivatives of \(\Phi\) at interior points are
\[ g_j(\mathbf{U})=\frac{\partial \Phi}{\partial U_j}=\frac{D_j}{U_j}. \] For \(\alpha>1\), \(D_j\) is of order \(U_j^{\alpha}\) when \(U_j\to0\), so \(g_j\) extends continuously by \(g_j=0\) to the faces of the simplex.
On the unit simplex, the KKT conditions take a simple form. A point \(\mathbf{U}\in\Delta\) is a KKT point if there is a \(\mu\) such that \(g_j=\mu\) for the active destinations (\(U_j>0\)) and \(g_j\leq\mu\) for the inactive ones. As \(U_jg_j=D_j\), we have
\[ \sum_{j=1}^p U_j g_j(\mathbf{U}) = \sum_{j=1}^p D_j = X_{\rm tot} \] for every \(\mathbf{U}\in\Delta\), so the multiplier is always \(\mu=X_{\rm tot}\), and the condition \(g_j=X_{\rm tot}\) is exactly \(D_j=\kappa_jZ_j\). For \(\alpha>1\), inactive destinations have \(g_j=0<X_{\rm tot}\), with a large margin.
Projected Gradient Ascent
The Iteration
Projected gradient ascent alternates a gradient step, which may leave the simplex, and a projection back onto it. Starting from \(\mathbf{U}^0\in\Delta\) (the projection of the initial attractivenesses), the iteration is
\[ \mathbf{U}^{t+1}=\Pi_\Delta\left(\mathbf{U}^t+\rho_t\left(\mathbf{g}(\mathbf{U}^t)-X_{\rm tot}\mathbf{1}\right)\right), \] where \(\rho_t>0\) is a step size chosen by a line search and \(\Pi_\Delta\) is the Euclidean projection onto \(\Delta\). The shift of the gradient by \(X_{\rm tot}\mathbf{1}=(\mathbf{g}^T\mathbf{U}^t)\mathbf{1}\) does not change the projected point, because \(\Pi_\Delta(\mathbf{y}+c\mathbf{1})=\Pi_\Delta(\mathbf{y})\) for all \(c\), but it keeps the trial points close to the simplex. The shifted gradient \(g_j-X_{\rm tot}\) is positive for destinations that receive more flow than their attractiveness supports (\(D_j>\kappa_jZ_j\)), and negative for the others.
The projection is given by
\[ \Pi_\Delta(\mathbf{y})_j=\max(y_j-\tau,0), \] where the threshold \(\tau\) is the unique solution of \(\sum_j\max(y_j-\tau,0)=1\). This piecewise linear equation is solved exactly by a Newton type method in a few iterations (see Condat, 2016, for a review of projection algorithms).
Line Search
The step size is chosen by backtracking. A trial step \(\rho\) is accepted when the Armijo sufficient increase condition
\[ \Phi(\mathbf{U}(\rho))-\Phi(\mathbf{U}^t)\geq c\,\mathbf{g}(\mathbf{U}^t)^T\left(\mathbf{U}(\rho)-\mathbf{U}^t\right) \] holds, where \(\mathbf{U}(\rho)\) is the projected trial point and \(c\) is a small constant. Otherwise, \(\rho\) is multiplied by a shrink factor and the test is repeated, at most a given number of times. The right hand side is positive for every \(\rho>0\) unless \(\mathbf{U}^t\) is a KKT point, which guarantees that the line search succeeds for small enough steps. To avoid a long line search at each iteration, the first trial step of iteration \(t+1\) is \(\rho_t\) when the line search of iteration \(t\) needed reductions, and \(\min(\rho_{\rm init}, 1.25\,\rho_t)\) otherwise.
The parameters of the line search are set with
blvim_gradient_control(): rho_init is \(\rho_{\rm init}\), shrink is
the shrink factor, sufficient_increase is \(c\) and ls_iter_max is the
maximal number of reductions. As the step applies to the \(U_j\), which sum to one,
rho_init does not depend on the scale of the productions or
of the attractivenesses.
Stopping Criterion
The algorithms stop when the duality gap
\[ \gamma(\mathbf{U})=\max_{j}g_j(\mathbf{U})-\mathbf{g}(\mathbf{U})^T\mathbf{U} =\max_{\mathbf{V}\in\Delta}\mathbf{g}(\mathbf{U})^T(\mathbf{V}-\mathbf{U}) \] is small. It is nonnegative and vanishes exactly at KKT points: as \(\mathbf{g}^T\mathbf{U}\) is a weighted mean of the \(g_j\) of the active destinations, \(\gamma=0\) means that they are all equal to their maximum. As \(\mathbf{g}^T\mathbf{U}=X_{\rm tot}\), the gap has a direct interpretation:
\[ \frac{\gamma(\mathbf{U})}{X_{\rm tot}}=\max_j\frac{D_j}{\kappa_jZ_j}-1 \] is the largest relative excess of the flow received by a destination over its attractiveness. Were \(\Phi\) concave, \(\gamma\) would bound the distance to the maximal potential (this is the Frank–Wolfe gap). The potential is not concave in general, and \(\gamma\) is only a measure of stationarity.
The ascent stops when \(\gamma\leq\delta\,(1+\max(1, X_{\rm
tot},\max_j|g_j|))\), where \(\delta\) is the precision
argument of blvim(). It also stops after
iter_max iterations, when the steps become negligible
(status "stalled"), and when the line search fails. The
status and the final gap are reported by
sim_diagnostic().
The same criterion is used by the Boltzmann–Lotka–Volterra algorithms
of blvim() (see the relation with
these algorithms below).
Vanishing Destinations
The projection sets coordinates exactly to zero: destinations can vanish in a finite number of iterations, as opposed to the Boltzmann–Lotka–Volterra updates, in which an attractiveness only tends to zero. For \(\alpha>1\), a vanished destination has \(g_j-X_{\rm tot}=-X_{\rm tot}\), a strongly negative component of the ascent direction, so it normally stays at zero in the next iterations. Under strict complementarity, which holds here as the margin \(X_{\rm tot}-g_j\) of inactive destinations is positive, projected gradient methods identify the set of active destinations of the limit point in a finite number of iterations (Calamai and Moré, 1987; Burke and Moré, 1988). The number of active destinations at each iteration is recorded in the history of the algorithm (see below).
For \(\alpha\leq1\), the faces of the simplex are not traps: \(g_j\) does not vanish when \(U_j\to0\), and a vanished destination can be reactivated.
Geometry of the Ascent
Diagonal Metrics
The direction \(\mathbf{g}-X_{\rm tot}\mathbf{1}\) is the (shifted) gradient for the Euclidean geometry of the \(U_j\). More generally, for a positive vector \(\mathbf{d}\), the gradient of \(\Phi\) for the inner product \(\langle\mathbf{u},\mathbf{v}\rangle_{\mathbf{d}}=\sum_j u_jv_j/d_j\) is \(\mathbf{d}\odot\mathbf{g}\), and the projection onto \(\Delta\) for the associated norm is
\[
\Pi^{\mathbf{d}}_\Delta(\mathbf{y})_j=\max(y_j-\tau d_j,0),
\qquad\textstyle\sum_j\max(y_j-\tau d_j,0)=1.
\] The projected ascent with this metric uses the direction \(\mathbf{d}\odot(\mathbf{g}-X_{\rm
tot}\mathbf{1})\) and the projection \(\Pi^{\mathbf{d}}_\Delta\). The metric is
rescaled so that the \(d_j\) have a
unit mean, which keeps the meaning of rho_init.
The two gradient algorithms of blvim() differ only by
their metric:
-
"gradient"(the default) uses the Euclidean geometry of the \(U_j\), \(d_j=1\); -
"gradient_z"uses the Euclidean geometry of the attractivenesses \(Z_j\). As \(Z_j=X_{\rm tot}U_j/\kappa_j\), the squared Euclidean norm of a variation of \(\mathbf{Z}\) is \(X_{\rm tot}^2\sum_j (\Delta U_j)^2/\kappa_j^2\), which corresponds to \(d_j\propto\kappa_j^2\).
When all the \(\kappa_j\) are equal,
the two algorithms are identical. An additional diagonal preconditioner
can be specified with the preconditioner parameter of
blvim_gradient_control(): it multiplies \(\mathbf{d}\) component-wise.
The metric changes neither the KKT points nor the duality gap, which does not depend on \(\mathbf{d}\). But it changes the path followed by the algorithm, and as the potential is not concave in general, it can change the local maximum reached from a given starting point. It also changes the speed of convergence, as illustrated below.
Relation with the Boltzmann–Lotka–Volterra Updates
Using \(D_j-\kappa_jZ_j=Z_j\,\partial
f/\partial Z_j\), the two update rules of
vignette("theory") can be written
\[
Z_j^{t+1}=Z_j^t+\epsilon\,\frac{Z_j^t}{\kappa_j}\,\frac{\partial
f}{\partial Z_j}(\mathbf{Z}^t)
\quad\text{("linear")},
\qquad
Z_j^{t+1}=Z_j^t+\epsilon\,\frac{(Z_j^t)^2}{\kappa_j}\,\frac{\partial
f}{\partial Z_j}(\mathbf{Z}^t)
\quad\text{("quadratic")}.
\] They are therefore gradient steps on the potential with a
fixed step \(\epsilon\) and a state
dependent diagonal metric, without projection and without line search.
In particular, they are not guaranteed to increase the potential at each
step. The linear update can be written \(Z_j^{t+1}=(1-\epsilon)Z_j^t+\epsilon
D_j(\mathbf{Z}^t)/\kappa_j\) and, as \(\sum_j D_j=X_{\rm tot}\), it gives \(\sum_j\kappa_jZ_j^{t+1}=(1-\epsilon)\sum_j\kappa_jZ_j^t+\epsilon
X_{\rm tot}\): an admissible starting point (non-negative and
satisfying \(\sum_j\kappa_jZ_j=X_{\rm
tot}\)) remains admissible for \(\epsilon\leq1\), and the iterates stay on
the weighted simplex. This does not hold for the quadratic update, whose
iterates are on the weighted simplex only at equilibrium. Finally, as
the metric is proportional to \(Z_j\)
(or to \(Z_j^2\)), a vanishing
destination slows down as it approaches zero. Because of the different
metrics, the four algorithms of blvim() can converge to
different equilibria from the same starting point.
The Boltzmann–Lotka–Volterra algorithms use the stopping criterion of the projected ascent. As their iterates are not necessarily on the unit simplex, the duality gap is evaluated at \(U_j=\kappa_jZ_j/\sum_k\kappa_kZ_k\): the flows, hence the \(D_j\), do not change when all the attractivenesses are multiplied by the same factor, and \(\gamma(\mathbf{U})=0\) characterises the equilibria up to this normalisation. For the quadratic update, the relative residual of the constraint, \(|\sum_j\kappa_jZ_j-X_{\rm tot}|/X_{\rm tot}\), must also be smaller than \(\delta\). The criterion does not depend on \(\epsilon\) and has the same meaning for the four algorithms.
These updates converge linearly at best: near a strict local maximum,
the error is multiplied at each iteration by the spectral radius of
\(I+\epsilon\,{\rm
diag}(\mathbf{Z}^*/\pmb{\kappa})H\) (see the stability of the dynamics below),
which is close to one for a small \(\epsilon\) or close to a bifurcation.
Worse, a vanishing destination decreases geometrically with the linear
update, but only as \(1/(\epsilon t)\)
with the quadratic one, as \(Z_j^{t+1}\approx
Z_j^t-\epsilon (Z_j^t)^2\). A small step \(\mathbf{Z}^{t+1}-\mathbf{Z}^t\) is
therefore not a sign of convergence. blvim() estimates the
convergence rate of the criterion over windows of 100 iterations,
reports it in sim_diagnostic() and stops the iterations
with the status "slow convergence" when this rate shows
that the precision cannot be reached within iter_max
iterations.
Local Maxima and Stability
Hessian of the Potential Function
Recall the softmax share \(P_{ij} = Z_j^\alpha w_{ij}/S_i\) with \(S_i = \sum_k Z_k^\alpha w_{ik}\), and record its derivative with respect to \(Z_k\): \[ \frac{\partial P_{ij}}{\partial Z_k} = \frac{\alpha}{Z_k}\,P_{ik}\bigl(\delta_{jk} - P_{ij}\bigr), \] where \(\delta_{jk}\) is the Kronecker symbol.
Recall that \(\partial f/\partial Z_j = G_j/Z_j\), where \(G_j = D_j - \kappa_j Z_j\) is the disequilibrium gap. Differentiating once more with respect to \(Z_k\) yields the full Hessian \(H = \bigl(\partial^2 f/\partial Z_j\,\partial Z_k\bigr)\) at any interior point \(\mathbf{Z} \gg 0\):
\[ H_{jk} = \begin{cases} \displaystyle -\frac{G_j}{Z_j^2} +(\alpha-1)\,Z_j^{\alpha-2}\sum_i X_i\,\frac{w_{ij}}{S_i} -\alpha\,Z_j^{2(\alpha-1)}\sum_i X_i\,\frac{w_{ij}^2}{S_i^2}, & j = k,\\[10pt] \displaystyle -\alpha\,Z_j^{\alpha-1}Z_k^{\alpha-1} \sum_i X_i\,\frac{w_{ij}\,w_{ik}}{S_i^2}, & j \neq k. \end{cases} \]
At a Harris–Wilson equilibrium \(G_j = 0\) for every active destination, the term \(-G_j/Z_j^2\) vanishes on the diagonal and the Hessian reduces to
\[ H_{jk}\big|_{G=0} = \begin{cases} \displaystyle (\alpha-1)\,Z_j^{\alpha-2}\sum_i X_i\,\frac{w_{ij}}{S_i} -\alpha\,Z_j^{2(\alpha-1)}\sum_i X_i\,\frac{w_{ij}^2}{S_i^2}, & j = k,\\[10pt] \displaystyle -\alpha\,Z_j^{\alpha-1}Z_k^{\alpha-1} \sum_i X_i\,\frac{w_{ij}\,w_{ik}}{S_i^2}, & j \neq k. \end{cases} \]
Strict Local Maxima
As the maximisation is constrained by \(\sum_j \kappa_j Z_j = X_{\rm tot}\), the second-order analysis must be restricted to the directions compatible with this constraint. An interior equilibrium is a strict local maximum of \(f\) on the weighted simplex if \(H\) is negative definite on the tangent space \(\{\mathbf{v} : \sum_j \kappa_j v_j = 0\}\), i.e. if the largest eigenvalue of the restriction of \(H\) to this subspace is negative. The bifurcation threshold corresponds to this largest eigenvalue reaching \(0\).
The stability analysis below involves the eigenvalues of \(H\) on the whole space, not only on the tangent space. The two conditions are in fact equivalent. The first term \(A\) of the potential satisfies \(A(s\mathbf{Z})=A(\mathbf{Z})+X_{\rm tot}\log s\), and differentiating this identity shows that \(H\mathbf{Z}^*=-\pmb{\kappa}\) at an interior equilibrium \(\mathbf{Z}^*\). As \(\pmb{\kappa}^T\mathbf{Z}^*=X_{\rm tot}\neq0\), every vector can be written uniquely \(\mathbf{v}=\mathbf{t}+c\mathbf{Z}^*\) with \(\mathbf{t}\) in the tangent space, and \[ \mathbf{v}^TH\mathbf{v} =\mathbf{t}^TH\mathbf{t}+2c\,\mathbf{Z}^{*T}H\mathbf{t} +c^2\,\mathbf{Z}^{*T}H\mathbf{Z}^* =\mathbf{t}^TH\mathbf{t}-c^2X_{\rm tot}, \] because \(\mathbf{Z}^{*T}H\mathbf{t}=-\pmb{\kappa}^T\mathbf{t}=0\). Hence \(H\) is negative definite on the whole space if and only if it is negative definite on the tangent space. More precisely, its inertia is that of its restriction to the tangent space plus one negative eigenvalue.
An equilibrium on a face is handled by removing its inactive destinations: for \(\alpha>1\), it is a strict local maximum of the potential when it is a strict local maximum of the model restricted to its active destinations, because moving mass to an inactive destination decreases the potential at first order (\(g_j=0<X_{\rm tot}\)).
Stability of the Dynamics
At an interior equilibrium, \(\nabla f(\mathbf{Z}^*)=0\), so differentiating \(G_j=Z_j\,\partial f/\partial Z_j\) gives
\[
J_G(\mathbf{Z}^*)={\rm diag}(\mathbf{Z}^*)\,H,
\] where \(J_G\) is the Jacobian
of the residual map, computed by sim_residual_jacobian().
As \({\rm diag}(\mathbf{Z}^*)\) is
positive, \(J_G\) is similar to the
symmetric matrix \({\rm
diag}(\mathbf{Z}^*)^{1/2}H\,{\rm diag}(\mathbf{Z}^*)^{1/2}\): its
eigenvalues are real, with the same signs as those of \(H\) (Sylvester’s law of inertia). The same
argument applies to the Jacobians \(I+\epsilon\,{\rm
diag}(\mathbf{Z}^*/\pmb{\kappa})H\) and \(I+\epsilon\,{\rm
diag}(\mathbf{Z}^{*2}/\pmb{\kappa})H\) of the
Boltzmann–Lotka–Volterra updates. Consequently, an interior equilibrium
is a linearly stable fixed point of these updates, for a small enough
\(\epsilon\), if and only if it is a
strict local maximum of the potential. The maxima computed by the
gradient algorithms are thus the stable configurations of the dynamic
model.
In Practice
We use the first 15 French cities of the french_cities
data set in a non-bipartite setting, with unit productions.
distances <- french_cities_distances[1:15, 1:15] / 1000 ## convert to km
production <- rep(1, 15)
attractiveness <- rep(1, 15)Comparing the Algorithms
We run the four algorithms of blvim() from the same
starting point.
algorithms <- c("gradient", "gradient_z", "linear", "quadratic")
compare_algorithms <- function(kappa = 1) {
models <- lapply(algorithms, function(algorithm) {
blvim(distances, production, 1.5, 1 / 50, attractiveness,
kappa = kappa, bipartite = FALSE, algorithm = algorithm
)
})
data.frame(
algorithm = algorithms,
potential = sapply(models, sim_potential),
iterations = sapply(models, sim_iterations),
status = sapply(models, function(model) sim_diagnostic(model)$cd$status),
active = sapply(models, function(model) sum(attractiveness(model) > 0)),
diversity = sapply(models, diversity)
)
}
compare_algorithms()
#> algorithm potential iterations status active diversity
#> 1 gradient -13.42567 37 converged 13 12.41430
#> 2 gradient_z -13.42567 37 converged 13 12.41430
#> 3 linear -13.42568 7588 converged 15 12.41430
#> 4 quadratic -13.43387 33701 slow convergence 15 12.42027As all the \(\kappa_j\) are equal, the two gradient algorithms are identical. They converge in a few dozen iterations to a configuration where two destinations have vanished. The Boltzmann–Lotka–Volterra updates need many more iterations: the attractivenesses of the vanishing destinations only tend to zero. The linear update reaches the same equilibrium, with two attractivenesses that are small but positive. The quadratic update is stopped for slow convergence, far from the requested precision.
With conversion factors that vary between destinations, the geometry of the gradient steps matters.
compare_algorithms(kappa = seq(0.5, 2, length.out = 15))
#> algorithm potential iterations status active diversity
#> 1 gradient -11.31982 22 converged 8 6.789843
#> 2 gradient_z -11.31982 145 converged 8 6.789843
#> 3 linear -11.31983 3735 converged 15 6.789844
#> 4 quadratic -11.36752 29401 slow convergence 15 6.810038The "gradient" algorithm, whose metric does not depend
on the \(\kappa_j\), converges much
faster than the "gradient_z" algorithm in this example.
This depends on the problem and should not be taken as a general
rule.
Monitoring the Ascent
With history = TRUE in
blvim_gradient_control(), the algorithms record their
iterations, which can be retrieved with sim_history().
model <- blvim(distances, production, 1.5, 1 / 50, attractiveness,
bipartite = FALSE,
control = blvim_gradient_control(history = TRUE)
)
summary(sim_history(model))
#>
#> ── Iteration history of a blvim run ──
#>
#> • 37 iterations, potential from -13.88252 to -13.42567.
#> • Final duality gap: 1.425e-05.
#> • Convergence rate of the duality gap: 0.5295 per iteration.
#> • Line search: 15 step reductions, smallest accepted step 0.005049.
#> • Active destinations: from 15 to 13, 2 face changes, the last one at iteration
#> 26.
#> • The final configuration is on a face of the simplex.The autoplot() method shows the evolution of the duality
gap, of the distance to the final potential, of the step size and of the
number of active destinations.
autoplot(sim_history(model))
The duality gap is not monotone: it increases while two destinations are vanishing, and then decreases quickly once the final set of active destinations has been identified.
The Boltzmann–Lotka–Volterra algorithms record the same history. Their diagnostic includes the estimated convergence rate of the duality gap.
linear_model <- blvim(distances, production, 1.5, 1 / 50, attractiveness,
bipartite = FALSE, algorithm = "linear",
control = blvim_gradient_control(history = TRUE)
)
sim_diagnostic(linear_model)
#> BLV model obtained with the "linear" algorithm.
#> ℹ The algorithm converged after 7588 iterations:
#> • Number of flow evaluations: 7588.
#> • Duality gap: 1.598234e-05.
#> • Estimated convergence rate: 0.9901946.
#> • Return status: "converged".
#> • Iteration history (7588 rows) available via `sim_history()`.
autoplot(sim_history(linear_model), c("gap", "n_active"))
During the first 6000 iterations, the gap increases slowly while two destinations are vanishing: the attractivenesses barely change from one iteration to the next, but the algorithm is far from an equilibrium. A test based on the size of the steps would stop here. The gap decreases geometrically only once the two destinations have (almost) vanished, below the activity threshold of \(10^{-5}\) in rescaled attractiveness. As the estimated rate is larger than one during the slow phase, the algorithm does not stop early for slow convergence.
Multiple Local Maxima
As the potential is not concave, the result of the ascent depends on
its starting point. blvim_initialise() specifies several
starting points, and blvim() keeps the solution with the
largest potential. sim_logs() summarises all the runs.
set.seed(1)
model <- blvim(distances, production, 1.5, 1 / 50, blvim_initialise(n = 20),
bipartite = FALSE, keep_runs = TRUE
)
summary(sim_logs(model))
#>
#> ── Summary of 20 runs of blvim ──
#>
#> • 20 of 20 runs converged.
#> • Status: converged (20).
#> • Iterations: median 22, range [16, 68].
#> • Evaluations: median 34, range [25, 91].
#> • Largest duality gap of the converged runs: 1.574e-05.
#>
#> ── Final configurations
#> 16 distinct configurations. The best one (potential -13.42567, 13 active
#> destinations) was reached by 3 of 20 runs.
#> The second best potential is -13.42744 (difference 0.001761).
#> configuration potential n_active runs share converged
#> 1 -13.4257 13 3 0.15 3
#> 2 -13.4274 13 1 0.05 1
#> 3 -13.4328 13 2 0.10 2
#> 4 -13.4334 13 1 0.05 1
#> 5 -13.6183 12 1 0.05 1
#> ... and 11 more.In this example, the 20 starting points lead to 16 distinct final configurations, several of them with a potential very close to the best one.
We can extract the corresponding models to display them all at once.
destination_positions(model) <-
as.matrix(french_cities[1:15, c("th_longitude", "th_latitude")])
grid_autoplot(sim_df_runs(model, unique = TRUE), round(potential, 4),
with_positions = TRUE
) +
coord_sf(crs = "epsg:4326") +
scale_linewidth_continuous(range = c(0, 1.5))
The figure shows small variations in flows between the different solutions. Those differences are not massive, but they show that different but close configurations can lead to quite different interpretations, for instance when the exchange flow between two location reverses. This manifests in the two best models where the flow from Toulon to Marseille (best configuration) turns into a flow from Marseille to Toulon (second best configuration).
Checking a Maximum
The eigenvalues of the residual Jacobian restricted to the active destinations are real and negative at a strict local maximum (of the restricted model).
active <- attractiveness(model) > 0
jacobian <- sim_residual_jacobian(model)[active, active]
eigen(jacobian, only.values = TRUE)$values
#> [1] -1.0000000 -0.9991713 -0.9966107 -0.9890369 -0.9864179 -0.9767000
#> [7] -0.9399668 -0.9202801 -0.8480084 -0.7984520 -0.6395746 -0.6300408
#> [13] -0.4346903The eigenvalue \(-1\) corresponds to the direction \(\mathbf{Z}^*\), transverse to the weighted simplex: as \(H\mathbf{Z}^*=-\pmb{\kappa}\), \(J_G\mathbf{Z}^*=-\pmb{\kappa}\odot\mathbf{Z}^*\), which is \(-\mathbf{Z}^*\) when all the \(\kappa_j\) are equal to 1. The other eigenvalues describe the curvature of the potential on the simplex.
References
Burke, J. V., & Moré, J. J. (1988). “On the Identification of Active Constraints”, SIAM Journal on Numerical Analysis, 25(5), 1197–1211. https://doi.org/10.1137/0725068
Calamai, P. H., & Moré, J. J. (1987). “Projected gradient methods for linearly constrained problems”, Mathematical Programming, 39(1), 93–116. https://doi.org/10.1007/BF02592073
Condat, L. (2016). “Fast projection onto the simplex and the \(\ell_1\) ball”, Mathematical Programming, 158(1), 575–585. https://doi.org/10.1007/s10107-015-0946-6
Osawa, M., Akamatsu, T., & Kogure, Y. (2025). “Most likely retail agglomeration patterns: Potential maximization and stochastic stability of spatial equilibria”. https://arxiv.org/abs/2011.06778v2
Sandholm, W. H. (2010). “Population Games and Evolutionary Dynamics”. MIT Press.