  General equilibrium macroeconomic models are a core tool used by policymakers
to understand a nation's economy. They represent the economy as a collection of
forward-looking actors whose behaviours combine, possibly with stochastic
effects, to determine global variables (such as prices) in a dynamic
equilibrium. However, standard semi-analytical techniques for solving these
models make it difficult to include the important effects of heterogeneous
economic actors. The COVID-19 pandemic has further highlighted the importance
of heterogeneity, for example in age and sector of employment, in macroeconomic
outcomes and the need for models that can more easily incorporate it. We use
techniques from reinforcement learning to solve such models incorporating
heterogeneous agents in a way that is simple, extensible, and computationally
efficient. We demonstrate the method's accuracy and stability on a toy problem
for which there is a known analytical solution, its versatility by solving a
general equilibrium problem that includes global stochasticity, and its
flexibility by solving a combined macroeconomic and epidemiological model to
explore the economic and health implications of a pandemic. The latter
successfully captures plausible economic behaviours induced by differential
health risks by age.
