Skip to content
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

[WIP] clean 'newborn' code on IndShockConsumerType.getShocks(), fixes #494 #499

Closed
wants to merge 4 commits into from

Conversation

sbenthall
Copy link
Contributor

This PR cleans the code in IndShockConsumerType.getShocks():

  • Less duplicate code
  • More efficient runtime--doesn't compute 'newborn' shocks twice

@sbenthall sbenthall requested a review from mnwhite February 9, 2020 00:35
@llorracc
Copy link
Collaborator

llorracc commented Feb 9, 2020

@sbenthall, am glad to see you doing the cleanup work of this kind.

But before you do much more of it, I think we need to confront an issue that we have talked about many times but not reached any answer to: We need to figure out a way to devise some tests for whether the SUBSTANTIVE outputs of anything change when there has been a code change. Travis will tell us whether any code 'breaks' in the sense of not executing, but it is likely that at some point someone will make what they think is an innocuous "cleanup" push which will pass Travis but will meaningfully (and wrongly) change quantitative results.

We should start with some one particular example, a REMARK. If necessary, we can modify it to construct all of its output in some simple machine-readable way that excludes meaningless stuff like creation timestamps etc. Then the test would be basically whether the new output files generated by rerunning it (say, the do_all.sh script) are different at all from the output files generated on the last run. If so, we would flag it as an error.

I'm about to do a bit of work on BufferStockTheory, and will see if that is the REMARK we should use to start with.

@sbenthall
Copy link
Contributor Author

@llorracc , I think this opens up a lot of questions around release management and testing that are way beyond the scope of this PR, which is for a trivial change.

I've made a new issue for the broader issue you've raised:
#504

@sbenthall
Copy link
Contributor Author

t_age is different from t_cycle, and the change in the original commit breaks things.

t_age always increments, while t_cycle cycles.

@sbenthall
Copy link
Contributor Author

See also #327

@sbenthall
Copy link
Contributor Author

See also #326

@sbenthall
Copy link
Contributor Author

Good news: the automated test designed to catch if this PR would create a breaking change has caught that this PR would create a breaking change. The system works.

On the point of design, I hope I can get clarity on a point from @mnwhite 👍

If I understand correctly, a newborn agent must always be born at the 0th cyclic period.

In other words, all newborn agents are born in January. It's impossible to be born in August.

Is that: (a) correct? or (b) intentional?

This is related to #562 and #563.

@sbenthall sbenthall changed the title clean 'newborn' code on IndShockConsumerType.getShocks(), fixes #494 [WIP] clean 'newborn' code on IndShockConsumerType.getShocks(), fixes #494 Apr 23, 2020
@sbenthall sbenthall closed this Jul 14, 2020
@mnwhite
Copy link
Contributor

mnwhite commented Jul 14, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants