-
-
Notifications
You must be signed in to change notification settings - Fork 197
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Include newborns' initial conditions in make_shock_history
and read_shocks==True
#1101
Conversation
An annoying aspect of this solution is that I have to have HARK currently does not declare which subset of the state variables are required to initialize an agent, and that is why my general solution creates arrays for all states. An alternative would be to give |
Codecov Report
@@ Coverage Diff @@
## master #1101 +/- ##
==========================================
+ Coverage 73.73% 73.85% +0.12%
==========================================
Files 69 69
Lines 10579 10631 +52
==========================================
+ Hits 7800 7852 +52
Misses 2779 2779
Continue to review full report at Codecov.
|
I see how this is connected to the issue in #1099 I suppose 'post_states' used to be those states that required newborn initialization. Assuming that I believe that the state variables that "must" be drawn/filled for newborns can be identified from from dependency graph implied by the equations. |
Yes, I believe the variables would be those needed by Lines 541 to 559 in 9562caf
Once the graph machinery works, that could be automated. How is this as a temporary solution? |
…into plumbing/newborn_shocks # Conflicts: # Documentation/CHANGELOG.md
I've added a few comments inline. |
# Conflicts: # Documentation/CHANGELOG.md
|
This is ready for re-review. @sbenthall recommended me not to aim for the perfect solution that tried to go into aggregate states and their handling, but to go for whatever works now and revise once the higher-up design questions about states, aggregate, and post-states handling have been resolved. That was a great liberating piece of advise. I did add a neat test. It creates a shock history, but then manually modifies its shocks and initial conditions to things that make it easy to check whether they are indeed being used. It then uses the shocks to simulate and compares the results with the easy-to-compute predicted behavior. |
@sbenthall, I guess you will review this again? Thx. |
Awesome. Thanks for all this great work @Mv77 . I've reviewed and will merge the PR. |
Fixes #1097.
make_shock_history
now creates an additional agent property callednewborn_init_history
, a dictionary ofT_sim x AgentCount
arrays, one for each state variable. The arrays are full ofnan
s except for times, agents and states that are set when an agent is reborn.For example, if agent 35 is re-born at time 7, then
newborn_init_history['aNrm'][7,35]
will be theaNrm
value that has to be used to initialize the re-born agent.