Example #1
0
    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()
Example #2
0
    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()
Example #3
0
    def __init__(self, cycles=0, time_flow=False, **kwds):
        '''
        Instantiate a new TractableConsumerType with given data.

        Parameters
        ----------
        cycles : int
            Number of times the sequence of periods should be solved.
        time_flow : boolean
            Whether time is currently "flowing" forward for this instance.

        Returns:
        -----------
        New instance of TractableConsumerType.
        '''
        # Initialize a basic AgentType
        AgentType.__init__(self,
                           cycles=cycles,
                           time_flow=time_flow,
                           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
Example #4
0
    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()
Example #5
0
    def __init__(self,cycles=0,time_flow=False,**kwds):
        '''
        Instantiate a new TractableConsumerType with given data.
        '''       
        # Initialize a basic AgentType
        AgentType.__init__(self,cycles=cycles,time_flow=time_flow,pseudo_terminal=True,**kwds)

        # Add consumer-type specific objects, copying to create independent versions
        self.time_vary = []
        self.time_inv = ['beta','R','rho','Gamma','mho','kappa_PF','scriptR','Beth','m_min','m_max']
        self.solveAPeriod = addToStableArmPoints
Example #6
0
    def __init__(self,time_flow=True,**kwds):
        # Initialize a basic AgentType
        AgentType.__init__(self,solution_terminal=deepcopy(Model.ConsumerType.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.ConsumerType.time_vary_)
        self.time_inv = deepcopy(Model.ConsumerType.time_inv_)
        self.time_vary.remove('beta')
        self.time_inv.append('beta')
        self.solveAPeriod = Model.consumptionSavingSolverENDG # this can be swapped for consumptionSavingSolverEXOG or another solver
        self.update()
    def __init__(self,time_flow=True,**kwds):
        '''
        Make a new instance of AggShockConsumerType, an extension of
        IndShockConsumerType.  Sets appropriate solver and input lists.
        '''
        AgentType.__init__(self,solution_terminal=deepcopy(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(IndShockConsumerType.time_vary_)
        self.time_inv = deepcopy(IndShockConsumerType.time_inv_)
        self.delFromTimeInv('Rfree','BoroCnstArt','vFuncBool','CubicBool')
        self.solveOnePeriod = solveConsAggShock
        self.p_init = np.ones(self.Nagents)
        self.update()
Example #8
0
    def __init__(self,time_flow=True,**kwds):
        '''
        Make a new instance of AggShockConsumerType, an extension of the basic
        ConsumerType.  Sets appropriate solver and input lists.
        '''
        AgentType.__init__(self,solution_terminal=deepcopy(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(IndShockConsumerType.time_vary_)
        self.time_inv = deepcopy(IndShockConsumerType.time_inv_)
        self.time_vary.remove('DiscFac')
        self.time_inv += ['DiscFac','kGrid','kNextFunc','Rfunc','wFunc']
        self.solveOnePeriod = solveConsumptionSavingAggShocks
        self.update()
Example #9
0
    def __init__(self,time_flow=True,**kwds):
        '''
        Make a new instance of AggShockConsumerType, an extension of
        IndShockConsumerType.  Sets appropriate solver and input lists.
        '''
        AgentType.__init__(self,solution_terminal=deepcopy(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(IndShockConsumerType.time_vary_)
        self.time_inv = deepcopy(IndShockConsumerType.time_inv_)
        self.delFromTimeInv('Rfree','BoroCnstArt','vFuncBool','CubicBool')
        self.solveOnePeriod = solveConsAggShock
        self.p_init = np.ones(self.Nagents)
        self.update()
Example #10
0
    def __init__(self, cycles=1, time_flow=False, **kwds):
        '''
        Instantiate a new ConsumerType with given data.
        '''
        # Initialize a basic AgentType
        AgentType.__init__(self,
                           solution_terminal=deepcopy(
                               ConsumerType.solution_terminal_),
                           cycles=cycles,
                           time_flow=time_flow,
                           pseudo_terminal=False,
                           **kwds)

        # Add consumer-type specific objects, copying to create independent versions
        self.time_vary = deepcopy(ConsumerType.time_vary_)
        self.time_inv = deepcopy(ConsumerType.time_inv_)
        self.solveAPeriod = consumptionSavingSolverCubic  # this can be swapped for consumptionSavingSolverLinear or another solver
Example #11
0
    def __init__(self,cycles=0,time_flow=True,**kwds):
        '''
        Instantiate a new RetiringConsumerType with given data.
        '''       
        # Initialize a basic AgentType
        AgentType.__init__(self,solution_terminal=deepcopy(ConsumerType.solution_terminal_),cycles=cycles,time_flow=time_flow,pseudo_terminal=True,**kwds)

        # Add consumer-type specific objects, copying to create independent versions
        self.time_vary = deepcopy(ConsumerType.time_vary_)
        self.time_inv = deepcopy(ConsumerType.time_inv_)
        self.time_vary.remove('beta')
        self.time_vary.remove('survival_prob')
        self.time_vary.remove('Gamma')
        self.time_vary += ['sigma_epsilon','solveAPeriod']
        self.time_inv += ['solution_retired','transformations','state_grid','beta','survival_prob','Gamma']
        
        self.solveAPeriod = [discreteChoiceContinuousStateSolver, retirementChoiceSolver]
        self.update()
Example #12
0
 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,time_flow=False,**kwds):
        '''
        Instantiate a new TractableConsumerType with given data.
        
        Parameters
        ----------
        cycles : int
            Number of times the sequence of periods should be solved.
        time_flow : boolean
            Whether time is currently "flowing" forward for this instance.
        
        Returns:
        -----------
        New instance of TractableConsumerType.
        '''            
        # Initialize a basic AgentType
        AgentType.__init__(self,cycles=cycles,time_flow=time_flow,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.solveOnePeriod = addToStableArmPoints # set correct solver