def __init__(self, **kwds): ''' Instantiate a new FashionVictim with given data. Parameters ---------- **kwds : keyword arguments Any number of keyword arguments key=value; each value will be assigned to the attribute key in the new instance. Returns ------- new instance of FashionVictimType ''' # Initialize a basic AgentType AgentType.__init__( self, solution_terminal=FashionVictimType._solution_terminal, cycles=0, time_flow=True, pseudo_terminal=True, **kwds) # Add class-specific features self.time_inv = [ 'DiscFac', 'conformUtilityFunc', 'punk_utility', 'jock_utility', 'switchcost_J2P', 'switchcost_P2J', 'pGrid', 'pEvolution', 'pref_shock_mag' ] self.time_vary = [] self.solveOnePeriod = solveFashion self.update()
def __init__(self, cycles=0, **kwds): ''' Instantiate a new TractableConsumerType with given data. Parameters ---------- cycles : int Number of times the sequence of periods should be solved. Returns: ----------- New instance of TractableConsumerType. ''' # Initialize a basic AgentType AgentType.__init__(self, cycles=cycles, pseudo_terminal=True, **kwds) # Add consumer-type specific objects, copying to create independent versions self.time_vary = [] self.time_inv = [ 'DiscFac', 'Rfree', 'CRRA', 'PermGroFacCmp', 'UnempPrb', 'PFMPC', 'Rnrm', 'Beth', 'mLowerBnd', 'mUpperBnd' ] self.shock_vars = ['eStateNow'] self.poststate_vars = ['aLvlNow', 'eStateNow'] # For simulation self.solveOnePeriod = addToStableArmPoints # set correct solver
def __init__(self, time_flow=True, **kwds): ''' Make a new consumer type for the cstwMPC model. Parameters ---------- time_flow : boolean Indictator for whether time is "flowing" forward for this agent. **kwds : keyword arguments Any number of keyword arguments of the form key=value. Each value will be assigned to the attribute named in self. Returns ------- new instance of cstwMPCagent ''' # Initialize a basic AgentType AgentType.__init__(self, solution_terminal=deepcopy( Model.IndShockConsumerType.solution_terminal_), time_flow=time_flow, pseudo_terminal=False, **kwds) # Add consumer-type specific objects, copying to create independent versions self.time_vary = deepcopy(Model.IndShockConsumerType.time_vary_) self.time_inv = deepcopy(Model.IndShockConsumerType.time_inv_) self.solveOnePeriod = Model.solveConsIndShock self.update()
def __init__(self, cycles=0, **kwds): """ Instantiate a new TractableConsumerType with given data. Parameters ---------- cycles : int Number of times the sequence of periods should be solved. Returns: ----------- New instance of TractableConsumerType. """ # Initialize a basic AgentType AgentType.__init__(self, cycles=cycles, pseudo_terminal=True, **kwds) # Add consumer-type specific objects, copying to create independent versions self.time_vary = [] self.time_inv = [ "DiscFac", "Rfree", "CRRA", "PermGroFacCmp", "UnempPrb", "PFMPC", "Rnrm", "Beth", "mLowerBnd", "mUpperBnd", ] self.shock_vars = ["eStateNow"] self.poststate_vars = ["aLvlNow", "eStateNow"] # For simulation self.solveOnePeriod = addToStableArmPoints # set correct solver
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, **kwds): params = init_tractable.copy() params.update(kwds) # Initialize a basic AgentType AgentType.__init__(self, pseudo_terminal=True, **params) # Add consumer-type specific objects, copying to create independent versions self.time_vary = [] self.time_inv = [ "DiscFac", "Rfree", "CRRA", "PermGroFacCmp", "UnempPrb", "PFMPC", "Rnrm", "Beth", "mLowerBnd", "mUpperBnd", ] self.shock_vars = ["eStateNow"] self.poststate_vars = ['aLvl', "eStateNow"] # For simulation self.solve_one_period = add_to_stable_arm_points # set correct solver