Skip to content

Commit

Permalink
loading init_perfect_foresight parameters by default. See econ-ark#446
Browse files Browse the repository at this point in the history
  • Loading branch information
sbenthall committed Jan 3, 2020
1 parent 5663528 commit 5c6afef
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions HARK/ConsumptionSaving/ConsIndShockModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import numpy as np
from scipy.optimize import newton
from HARK import AgentType, Solution, NullFunc, HARKobject
import HARK.ConsumptionSaving.ConsumerParameters as Params
from HARK.utilities import warnings # Because of "patch" to warnings modules
from HARK.interpolation import CubicInterp, LowerEnvelope, LinearInterp
from HARK.simulation import drawDiscrete, drawLognormal, drawUniform
Expand Down Expand Up @@ -1596,7 +1597,12 @@ class PerfForesightConsumerType(AgentType):
poststate_vars_ = ['aNrmNow','pLvlNow']
shock_vars_ = []

def __init__(self,cycles=1, time_flow=True,verbose=False,quiet=False, **kwds):
def __init__(self,
cycles=1,
time_flow=True,
verbose=False,
quiet=False,
**kwds):
'''
Instantiate a new consumer type with given data.
See ConsumerParameters.init_perfect_foresight for a dictionary of
Expand All @@ -1613,6 +1619,11 @@ def __init__(self,cycles=1, time_flow=True,verbose=False,quiet=False, **kwds):
-------
None
'''

params = Params.init_perfect_foresight.copy()
params.update(kwds)
kwds = params

# Initialize a basic AgentType
AgentType.__init__(self,solution_terminal=deepcopy(self.solution_terminal_),
cycles=cycles,time_flow=time_flow,pseudo_terminal=False,**kwds)
Expand Down Expand Up @@ -2669,15 +2680,14 @@ def constructAssetsGrid(parameters):
####################################################################################################

def main():
import HARK.ConsumptionSaving.ConsumerParameters as Params
from HARK.utilities import plotFuncsDer, plotFuncs
from time import time
mystr = lambda number : "{:.4f}".format(number)

do_simulation = True

# Make and solve an example perfect foresight consumer
PFexample = PerfForesightConsumerType(**Params.init_perfect_foresight)
PFexample = PerfForesightConsumerType()
PFexample.cycles = 0 # Make this type have an infinite horizon

start_time = time()
Expand Down

0 comments on commit 5c6afef

Please sign in to comment.