Value Function Iteration
Introduction
The Value Function Iteration (VFI) algorithm is a method to solve dynamic programming problems. It is particularly useful when the state space is low-dimensional. The VFI algorithm is a brute-force method that iteratively applies the Bellman operator to the value function until convergence. The VFI algorithm is computationally expensive because it requires solving the Bellman equation at each iteration. However, it is a simple and robust method that can be used as a benchmark for more sophisticated algorithms.
API
BellmanSolver.VFI.do_VFI
— Methoddo_VFI(
flow_value, k_grid, p_grid, trans_mat, β;
tol=1e-6, max_iter=1000, kwargs...
)
Do value function iteration for the case where we optimise over one variable, and there is one stochastic variable in the value function. The stochastic variable is represented by a markov process on a grid.
Arguments
flow_value::Function
: Function to compute the flow valuek_grid::Vector{Float64}
: Grid points for the capital stockp_grid::Vector{Float64}
: Grid points for the price of capitaltrans_mat::Array{Float64, 2}
: Transition matrix for the price processβ::Real
: Discount factortol::Real=1e-6
: Tolerance for convergencemax_iter::Int=1000
: Maximum number of iterationskwargs...
: Additional keyword arguments for flow_value
Returns
k_grid::Vector{Float64}
: Grid points for the capital stockp_grid::Vector{Float64}
: Grid points for the price of capitalKp_mat::Array{Float64, 2}
: Policy function for the capital stock at time t+1V::Array{Float64, 2}
: Value function
BellmanSolver.VFI.do_VFI
— Methoddo_VFI(flow_value, k_grid, β, interp; tol=1e-6, max_iter=1000, kwargs...)
Do Value Function Iteration for the case where we optimise over one variable and there are no stochastic elements, using interpolation to optimise over an interval for each grid point.
Arguments
flow_value::Function
: Function to calculate the flow valuek_grid::Vector{Float64}
: Grid points for the choice variableβ::Real
: Discount factorinterp::AbstractInterpolator
: Interpolator to usetol::Real=1e-6
: Tolerance for convergencemax_iter::Int=1000
: Maximum number of iterationskwargs...
: Keyword arguments to pass toflow_value
. Should be parameters of flow_value
Returns
k_grid::Vector{Float64}
: Grid points for the choice variablekp_vct::Vector{Float64}
: Optimal choiceV::Vector{Float64}
: Value function
BellmanSolver.VFI.do_VFI
— Methoddo_VFI(flow_value, k_grid, β; tol=1e-6, max_iter=1000, kwargs...)
Do value function iteration for the case where we optimise over one variable, and there are no stochastic elements.
Arguments
flow_value::Function
: Function to calculate the flow valuek_grid::Vector{Float64}
: Grid points for the choice variableβ::Real
: Discount factortol::Real=1e-6
: Tolerance for convergencemax_iter::Int=1000
: Maximum number of iterationskwargs...
: Keyword arguments to pass toflow_value
. Should be parameters of flow_value
Returns
k_grid::Vector{Float64}
: Grid points for the choice variablekp_vct::Vector{Float64}
: Optimal choiceV::Vector{Float64}
: Value function