SPB Git

spb/wp24_uqo

Public
4.6 KB · 59 lines latex
1\section{Computational methods}2\label{app:algorithms}34All code is in \texttt{src/agi\_ge/} of the replication package (Python 3.14, NumPy, SciPy, numba); the5one-command reproduction is described in Appendix~\ref{app:replication}.67\subsection{Static block}89Given the predetermined stocks $(K^N_t,K^Q_t,K^E_t,K^H_t)$ and the period's $(\alpha_{i,t},\varepsilon_t)$, the10competitive allocation of labor and compute across tasks is the solution of the concave program11$\max_{L,Q\ge0}Y$ subject to $\sum_{i\in\Omega(s)}L_i=H_s$ and $\sum_iQ_i=Q$, with variables scaled to $[0,1]$12($l_i=L_i/H_{s(i)}$, $q_i=Q_i/Q$). It is solved by sequential least-squares programming with analytic gradients13and then \emph{polished}: the active set identified by the first solver (which tasks use labor, which use14compute) is fixed and the Karush--Kuhn--Tucker equalities $F_i=w_{s(i)}$ for tasks with labor, $F_i/\alpha_i=A$15for tasks with compute, and the two adding-up constraints are solved by Newton's method to machine precision.16The polished solution is accepted only if no inactive variable has a positive shadow value. Factor prices are the17multipliers (envelope theorem): $w_s=\max_{i\in\Omega(s)}F_i$, $A=\max_iF_i/\alpha_i$, $R^N=ZG_VV_K$,18$R^T=ZG_T$, $P^E=ZG_E$. Energy supply is predetermined by $K^E_t$ and allocated residually to final production;19if the marginal value of compute falls below its energy cost, utilization $u_t<1$ is found by bisection in20$\log u$ on the condition $A_t=\varepsilon_tP^E_t$. The housing rent follows from aggregate goods consumption.21A static solve takes 1--3 milliseconds; the Karush--Kuhn--Tucker violation is below $10^{-6}$ in every test and22the income identity \eqref{eq:identity} holds to $10^{-8}$.2324\subsection{Perfect-foresight transition (two-class economy)}2526Unknowns are, for $t=0,\ldots,T-1$, the logarithms of the four stocks $K^k_{t+1}$, the logarithm of capitalists'27expenditure $x^K_t$, and $r_{t+1}$: six per period, $6T$ in total. Residuals are the four capital Euler equations28\eqref{eq:capital_euler}, the goods-market clearing condition and the capitalists' Euler equation29\eqref{eq:euler}. Writing expenditure as an unknown rather than as the goods-market residual keeps the system30smooth where investment booms would otherwise drive the residual expenditure through zero. Beyond $T$ the31investment rates, the interest rate and the growth rate of expenditure are held at their period-$(T-1)$ values32and land prices take their Gordon values. Each residual depends on unknowns at $t-1$, $t$, $t+1$ only, so the33Jacobian is banded; it is computed by colored finite differences (30 evaluations of the full path) and factored34sparsely. Newton steps use a backtracking line search. The solution is reached by homotopy in the size of the35technology shock ($\lambda\in\{0,0.25,0.5,0.75,1\}$ scaling $g_{pQ}$, $g_\varepsilon$ and $g_\alpha$), with the base36point re-calibrated at each $\lambda$ so that 2026 stays consistent with the anticipated price path, on the full37horizon of 275 years (2026--2300). Convergence is declared when the maximum residual is below $10^{-9}$.38Truncation is checked by re-solving with 50 additional years and comparing the first 225 years of the stock and39interest-rate paths (Table~\ref{tab:diagnostics}).4041\subsection{Heterogeneous households}4243Given paths of returns, wages, transfers and the price index, the household problem is solved backward from the44stationary policy at the terminal prices by the endogenous grid method on a 300-point asset grid (curvature 4,45upper bound 400 times the 2026 average labor income, detrended by the efficiency factor), for the two skills,46three discount types and five productivity states. The distribution is simulated forward with the lottery method47of non-stochastic simulation. The general-equilibrium path of returns is found by relaxation: the production48side is re-solved with the return path given (the same banded Newton method with five unknowns per period), the49household block is re-solved, and $r_{t+1}$ is reduced in proportion to the log excess demand for claims at $t$,50until the maximum log excess demand is below $10^{-4}$.5152\subsection{Tests}5354The test suite (\texttt{pytest}, Appendix~\ref{app:replication}) checks: Propositions~1--6 of the source in the55benchmark; the Karush--Kuhn--Tucker conditions of the static block; the income identity, and that it fails on a56deliberately inconsistent accounting; the exactness of the frozen-technology balanced growth path; the57accuracy of the banded Jacobian against a dense one; the Euler-equation residuals, goods-market and asset-market58clearing of every saved scenario; and the horizon check.59
Files · main
Menu

Theme