Пример #1
0
    def test_global_solution(self):
        from dolo import yaml_import, global_solve


        filename = 'examples/global_models/rbc.yaml'

        model = yaml_import(filename)

        print model.calibration['covariances']

        import time

        dr = global_solve(model, pert_order=1, maxit=500, smolyak_order=3, verbose=True, polish=False, method='newton')

        t1 = time.time()


        dr = global_solve(model, pert_order=1, maxit=5, smolyak_order=5, verbose=True, polish=False, method='newton')

        t2 = time.time()

        dr = global_solve(model, pert_order=1, maxit=5, interp_type='multilinear', verbose=True, polish=False, method='newton')

        t3 = time.time()

        print(t2-t1)
        print(t3-t2)
Пример #2
0
    def test_global_solution(self):
        from dolo import yaml_import, global_solve


        filename = 'examples/global_models/rbc.yaml'

        model = yaml_import(filename)

        import time

        dr = global_solve(model, pert_order=2, maxit=5, smolyak_order=3, verbose=True, polish=True)

        t1 = time.time()


        dr = global_solve(model, pert_order=1, maxit=5, smolyak_order=5, verbose=True, polish=False)

        t2 = time.time()

        dr = global_solve(model, pert_order=1, maxit=5, interp_type='multilinear', verbose=True, polish=False)

        t3 = time.time()

        print(t2-t1)
        print(t3-t2)
Пример #3
0
    def test_global_solution(self):
        from dolo import yaml_import, global_solve

        filename = 'examples/global_models/rbc.yaml'

        model = yaml_import(filename)

        print model.calibration['covariances']

        import time

        dr = global_solve(model,
                          pert_order=1,
                          maxit=500,
                          smolyak_order=3,
                          verbose=True,
                          polish=False,
                          method='newton')

        t1 = time.time()

        dr = global_solve(model,
                          pert_order=1,
                          maxit=5,
                          smolyak_order=5,
                          verbose=True,
                          polish=False,
                          method='newton')

        t2 = time.time()

        dr = global_solve(model,
                          pert_order=1,
                          maxit=5,
                          interp_type='multilinear',
                          verbose=True,
                          polish=False,
                          method='newton')

        t3 = time.time()

        print(t2 - t1)
        print(t3 - t2)
Пример #4
0
    def test_global_solution(self):
        from dolo import yaml_import, global_solve


        filename = 'examples/global_models/rbc.yaml'

        model = yaml_import(filename)

        import time

        t1 = time.time()

        dr = global_solve(model, pert_order=2, maxit=5, interp_type='spline', verbose=True)
Пример #5
0
    def test_global_solution(self):

        from dolo import yaml_import, global_solve

        filename = 'examples/models/rbc.yaml'

        model = yaml_import(filename)

        import time

        t1 = time.time()

        print('ok')
        dr = global_solve(model,
                          pert_order=1,
                          maxit=5,
                          interp_type='spline',
                          verbose=True)
Пример #6
0
    def test_global_solution(self):

        import time
        from dolo import yaml_import, global_solve


        filename = 'examples/models/rbc.yaml'

        model = yaml_import(filename)
        print(model.__class__)

        t3 = time.time()

        dr = global_solve(model, pert_order=1, maxit=5, interp_type='spline', verbose=True, interp_orders=[100,100])

        t4 = time.time()


        print(t4-t3)
Пример #7
0
    def test_global_solution(self):

        import time
        from dolo import yaml_import, global_solve

        filename = 'examples/models/rbc.yaml'

        model = yaml_import(filename)
        print(model.__class__)

        t3 = time.time()

        dr = global_solve(model,
                          pert_order=1,
                          maxit=5,
                          interp_type='spline',
                          verbose=True,
                          interp_orders=[100, 100])

        t4 = time.time()

        print(t4 - t3)
Пример #8
0
    # filename = '../../examples/dynare_modfiles/example1.mod'
    # filename = '/home/pablo/Documents/Research/CGR/revival/CKM.mod'

    filename = "../../examples/global_models/rbc.yaml"

    # from dolo.misc.modfile import dynare_import
    # model = dynare_import(filename)

    from dolo.misc.yamlfile import yaml_import

    model = yaml_import(filename)

    from dolo import global_solve

    dr = global_solve(model)

    from dolo.numeric.perturbations import solve_decision_rule

    print(model)

    model2 = model.copy()

    model2.set_calibration({"beta": 0.95})

    print(model.calibration)
    print(model2.calibration)

    print(model2)
    print(model)
Пример #9
0
    # print(model)

    # filename = '../../examples/dynare_modfiles/example1.mod'
    # filename = '/home/pablo/Documents/Research/CGR/revival/CKM.mod'

    filename = '../../examples/global_models/rbc.yaml'

    # from dolo.misc.modfile import dynare_import
    # model = dynare_import(filename)

    from dolo.misc.yamlfile import yaml_import
    model = yaml_import(filename)


    from dolo import global_solve
    dr = global_solve(model)

    from dolo.numeric.perturbations import solve_decision_rule

    print(model)

    model2 = model.copy()

    model2.set_calibration({'beta':0.95})

    print(model.calibration)
    print(model2.calibration)

    print(model2)
    print(model)
Пример #10
0
        from numpy import concatenate
        calibration = copy.copy(self.parent.calibration)
        #        calibration['controls'] = concatenate( [calibration['controls'], calibration['auxiliary']] )
        self.calibration = calibration

    def get_calibration(self, name):
        return self.parent.get_calibration(name)

    @property
    def x_bounds(self):
        return self.parent.x_bounds


if __name__ == "__main__":
    from dolo import *
    model = yaml_import("examples/models/rbc.yaml")

    model_fg = GModel_fg_from_fga(model)

    print(model_fg.get_calibration(['alpha', 'rho']))

    model_fg.set_calibration(alpha=0.1)
    print(model_fg.get_calibration(['alpha', 'rho']))

    print(model_fg.x_bounds)

    from dolo import global_solve

    dr = global_solve(model_fg, verbose=True)
    print(dr)
Пример #11
0
        import copy
        from numpy import concatenate
        calibration = copy.copy(self.parent.calibration)
#        calibration['controls'] = concatenate( [calibration['controls'], calibration['auxiliary']] )
        self.calibration = calibration

    def get_calibration(self, name):
        return self.parent.get_calibration(name)

    @property
    def x_bounds(self):
        return self.parent.x_bounds

if __name__ == "__main__":
    from dolo import *
    model = yaml_import("examples/models/rbc.yaml")

    model_fg = GModel_fg_from_fga(model)

    print( model_fg.get_calibration(['alpha','rho']) )

    model_fg.set_calibration(alpha=0.1)
    print( model_fg.get_calibration(['alpha','rho']) )

    print(model_fg.x_bounds)

    from dolo import global_solve

    dr = global_solve(model_fg, verbose=True)
    print(dr)