Beispiel #1
0
        pyplot.xlabel(state)


if __name__ == '__main__':
    from dolo import yaml_import, approximate_controls
    model = yaml_import('../../examples/global_models/capital.yaml')

    dr = approximate_controls(model)

    [y, x, parms] = model.read_calibration()
    sigma = model.read_covariances()

    from dolo.compiler.compiler_global import CModel

    import numpy
    cmodel = CModel(model)
    s0 = numpy.atleast_2d(dr.S_bar).T
    horizon = 50

    simul = simulate(cmodel,
                     dr,
                     s0,
                     sigma,
                     n_exp=500,
                     parms=parms,
                     seed=1,
                     horizon=horizon)

    from dolo.numeric.quantization import quantization_nodes
    N = 80
    [x, w] = quantization_nodes(N, sigma)
Beispiel #2
0
bounds[:, 1] += s0[1]
print('bounds')
print bounds

P = eigs[1]

sg = SmolyakGrid(bounds, 5, P)

[y, x, parms] = model.read_calibration()

xinit = dr(sg.grid)
sg.fit_values(xinit)

from dolo.compiler.compiler_global import CModel, time_iteration, deterministic_residuals

gc = CModel(model)

res = deterministic_residuals(sg.grid, xinit, sg, gc.f, gc.g, dr.sigma, parms)

n_e = 5
epsilons = np.zeros((1, n_e))
weights = np.ones(n_e) / n_e

dr_smol = time_iteration(sg.grid,
                         sg,
                         xinit,
                         gc.f,
                         gc.g,
                         parms,
                         epsilons,
                         weights,