# Time iteration¶

We consider an fg model, that is a model with the form:

$$s_t = g\left(s_{t-1}, x_{t-1}, \epsilon_t \right)$$

$$0 = E_t \left[ f\left(s_{t}, x_{t}, s_{t+1}, x_{t+1} \right) \right]$$

where $$g$$ is the state transition function, and $$f$$ is the arbitrage equation.

The time iteration algorithm consists in approximating the optimal controls, $$x_t = x(s_t)$$.

At step $$n$$, the current guess for the control, $$x(s_t) = \varphi^n(s_t)$$, serves as the control being exercised next period :
• Given current guess, find the current period’s control by solving the arbitrage equation : $$0 = E_t \left[ f\left(s_{t}, \varphi^{n+1}(s_t), g(s_t, \varphi^{n+1}(s_t)), \varphi^{n}(g(s_t, \varphi^{n+1}(s_t))) \right) \right]$$
dolo.algos.time_iteration.time_iteration(model, initial_guess=None, with_complementarities=True, verbose=True, grid={}, maxit=1000, inner_maxit=10, tol=1e-06, hook=None)

Finds a global solution for model using backward time-iteration.

This algorithm iterates on the residuals of the arbitrage equations

Parameters: model : NumericModel “dtmscc” model to be solved verbose : boolean if True, display iterations initial_dr : decision rule initial guess for the decision rule with_complementarities : boolean (True) if False, complementarity conditions are ignored grid: grid options maxit: maximum number of iterations inner_maxit: maximum number of iteration for inner solver tol: tolerance criterium for successive approximations decision rule : approximated solution
dolo.algos.time_iteration.residuals_simple(f, g, s, x, dr, dprocess, parms)