コード例 #1
0
ファイル: make-scipy-plots.py プロジェクト: fagan2888/PARK-1
          ' seconds.')
    LifecycleExample.unpackcFunc()
    LifecycleExample.timeFwd()

    # Plot the consumption functions during working life
    print('Consumption functions while working:')
    mMin = min([
        LifecycleExample.solution[t].mNrmMin
        for t in range(LifecycleExample.T_cycle)
    ])
    plotFuncs(LifecycleExample.cFunc[:LifecycleExample.T_retire], mMin, 5)

    # Plot the consumption functions during retirement
    print('Consumption functions while retired:')
    plotFuncs(LifecycleExample.cFunc[LifecycleExample.T_retire:], 0, 5)
    LifecycleExample.timeRev()

    ###############################################################################

    # Make and solve a "cyclical" consumer type who lives the same four quarters repeatedly.
    # The consumer has income that greatly fluctuates throughout the year.
    CyclicalExample = IndShockConsumerType(**Params.init_cyclical)
    CyclicalExample.cycles = 0

    start_time = clock()
    CyclicalExample.solve()
    end_time = clock()
    print('Solving a cyclical consumer took ' + mystr(end_time - start_time) +
          ' seconds.')
    CyclicalExample.unpackcFunc()
    CyclicalExample.timeFwd()