Solves a simple AK-OLG-model for closed economy in Julia (version 3)
Shows how to solve a simple deterministic overlapping-generations model (OLG) of Auerbauch-Kotlikoff type, solving for the transition path between two steady-states. Data variables are collected in a structure that is passed between functions (including unpacking to use familiar variable names). For the household problem individual cohort informations (slices) are passed as copies which (probably) allows Julia to use stack allocations. This implies a performance improvement compared to version 2 though at the cost of being more error prone (passing all individual variables between functions in the right order). Cohorts can be computed in parallel.
A model description can be found here: https://github.com/solveCGE/solveOLG_doc.
Parameters can be set in calib.jl
. Policy shocks are defined in run_sim.jl
(or just uncomment some of the predefined exemplary shocks). The model is then solved by just running run.jl
:
julia -t4 run.jl
from the terminal or in the Julia REPL (julia -t4
)
include("run.jl")
The number of threads has to be specified when calling Julia using the -t
flag (i.e. the code above uses 4 threads). Running run_sim.jl
twice allows taking time without precompilation.
Philip Schuster