QuantEcon/QuantEcon.jl — pull request #30 by spencerlyon2 (2014-12-03 22:41:59+00:00)
Title: Add `solve_vf`, `solve_pf`, `solve_both` methods and an `AbstractModel` type

This PR adds an `AbstractModel` type that each of the types within the models subpackage now subtype.

In addition to the new type, we have new a few new functions:

* `init_values{T <: AbstractModel)(m::T)`: given a model object, this function returns the initial values used in the solutions notebook
* `solve_vf(m::AbstractModel, [init=init_values(m); kwargs...])`: this function calls `init = init_values(m)` to construct a starting guess for the value function, then passes `f(x) = bellman_operator(m, x)` through `compute_fixed_point(f, init; kwargs...)` to compute the solution to the problem.
* for models that don't implement `init_values` or `bellman_operator` (`AssetPrices`, `LucasTree`), this function will send an error saying that `init_values` and/or `bellman_operator` is not defined for this model type
* for the `ConsumerProblem` type in `ifp.jl` we write a special version of `solve_vf` that uses the more efficient `coleman_operator` instead of `bellman_operator`
* `solve_pf(m::AbstractModel, [init=init_values(m); kwargs...])`: This function gets the final value function from `vf = solve_vf(m, init; kwargs...)`, then computes and returns `get_greedy(m, vf)`
* `solve_both(m::AbstractModel, [init; kwargs...])`: This function uses the two previous functions to return both the final value function and policy function.

I have included tests for all of these methods (just that each of the functions does or doesn't run for a given model type).

If anyone has comments please let me know -- otherwise I'll merge this soon.