Refactor solve_lp_for_year.py #324
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Not ready to merge
In filing #323 I looked through this file, and took a stab at streamlining the code. Changes include:
wage_binfunction to create wage bins.lhs_varsdictionary elements.*add_targetfunction to assignrhs_varsdictionary elements.*model_varsfor year 2014.LPtolpsince it's not a constant.* These pieces won't currently work since they attempt to access
globals()from within a function (locals()also won't work). Per https://stackoverflow.com/q/56983782/1840471, there's no good way to access these in-between-scoped variables, and this is really a sign that something could be done better. It seems to me that sticking with the dictionary elements rather than creating new variables would be a clean alternative.I haven't tested this code yet. Would the right way be to run
make cps-files?