Example #1
0
    def __init__(self,
                 cycles=1,
                 **kwds):
        '''
        Instantiate a new ConsumerType with given data, and construct objects
        to be used during solution (income distribution, assets grid, etc).
        See ConsumerParameters.init_pref_shock for a dictionary of
        the keywords that should be passed to the constructor.

        Parameters
        ----------
        cycles : int
            Number of times the sequence of periods should be solved.

        Returns
        -------
        None
        '''
        params = init_preference_shocks.copy()
        params.update(kwds)

        IndShockConsumerType.__init__(self,
                                      cycles=cycles,
                                      **params)
        self.solveOnePeriod = makeOnePeriodOOSolver(ConsPrefShockSolver)
Example #2
0
    def __init__(self, **kwargs):
        IndShockConsumerType.__init__(self, **kwargs)

        # Add consumer-type specific objects, copying to create independent versions
        if (not self.CubicBool) and (not self.vFuncBool):
            solver = ConsIndShockSolverBasicFast
        else:  # Use the "advanced" solver if either is requested
            solver = ConsIndShockSolverFast

        self.solveOnePeriod = makeOnePeriodOOSolver(solver)
Example #3
0
    def __init__(self, cycles=0, verbose=1, quiet=False, **kwds):
        self.time_vary = []
        self.time_inv = [
            "CRRA", "Rfree", "DiscFac", "phi", "eta", "nu", "pssi", "B"
        ]
        self.state_vars = []
        self.shock_vars = []
        cmin = 1e-6  # lower bound on consumption

        Matlabgrid = loadmat('Bgrid')
        griddata = list(Matlabgrid.items())
        datagrid_array = np.array(griddata)
        print(datagrid_array[3, 1])
        Bgrid_uc = datagrid_array[3, 1]

        params = init_GL.copy()
        #params.update(kwds)
        kwds = params
        print(kwds)
        #setup grid based on constraint phi
        Bgrid = []
        for i in range(200):
            if Bgrid_uc[0, i] > phi:
                Bgrid.append(Bgrid_uc[0, i])
        Bgrid = np.array(Bgrid).reshape(1, len(Bgrid))

        #initial Guess for Cpolicy
        Cguess = np.maximum(Rfree * np.ones(13).reshape(13, 1).dot(Bgrid),
                            cmin)
        # Define some universal values for all consumer types

        solution_terminal_ = GLConsumerSolution(Cpol=Cguess, )

        AgentType.__init__(
            self,
            solution_terminal=deepcopy(solution_terminal_),
            cycles=cycles,
            pseudo_terminal=False,
            **kwds)  #going to need to specify **kwds and solution_terminal_

        self.verbose = verbose
        self.quiet = quiet
        self.solveOnePeriod = makeOnePeriodOOSolver(GLsolver)
    def __init__(self, cycles=1, **kwds):
        """
        Instantiate a new ConsumerType with given data, and construct objects
        to be used during solution (income distribution, assets grid, etc).
        See init_kinky_pref for a dictionary of the keywords
        that should be passed to the constructor.

        Parameters
        ----------
        cycles : int
            Number of times the sequence of periods should be solved.

        Returns
        -------
        None
        """
        params = init_kinky_pref.copy()
        params.update(kwds)
        kwds = params
        IndShockConsumerType.__init__(self, **kwds)
        self.solveOnePeriod = makeOnePeriodOOSolver(ConsKinkyPrefSolver)
        self.addToTimeInv("Rboro", "Rsave")
        self.delFromTimeInv("Rfree")
Example #5
0
    def __init__(self, **kwargs):
        PerfForesightConsumerType.__init__(self, **kwargs)

        self.solveOnePeriod = makeOnePeriodOOSolver(
            ConsPerfForesightSolverFast)