Store retirement_age as int16 to shrink the parameters object - #1230
Open
arihantlodha-cmd wants to merge 1 commit into
Open
arihantlodha-cmd wants to merge 1 commit into
arihantlodha-cmd wants to merge 1 commit into
Conversation
Addresses the data-type part of PSLmodels#1080. retirement_age is a whole number of years, bounded well under the int16 range, but it was stored as a float64 array of length T+S. Casting it to int16 (rounding first, which keeps behavior identical to how it is already consumed in the retire calculation) cuts that array from 8 to 2 bytes per element. A baseline SS still solves to r = 0.0628 with pension outlays unchanged, and tests/test_parameters.py passes. This is the safe, self-contained piece of PSLmodels#1080; the broader float32/float16 downcasting of other arrays would change numerical results and is left out.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1230 +/- ##
=======================================
Coverage 75.17% 75.18%
=======================================
Files 24 24
Lines 6031 6032 +1
=======================================
+ Hits 4534 4535 +1
Misses 1497 1497
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What this does
Addresses the data-type part of #1080.
retirement_ageis a whole number of years, bounded well under the int16 range, but it was stored as a float64 array of length T+S. Casting it to int16 (rounding first, which keeps behavior identical to how it is already consumed in theretirecalculation) cuts that array from 8 to 2 bytes per element.Behavior and testing
A baseline SS still solves to r = 0.0628 with pension outlays unchanged,
retireis byte-for-byte the same (44 in the default calibration), andtests/test_parameters.pypasses (16 passed).ruff check/formatclean.Scope
This is the safe, self-contained piece of #1080. The broader float32/float16 downcasting of other arrays suggested in the issue would change numerical results, and the T-dimension array truncation is a larger refactor; both are left for separate work and a maintainer decision on the accuracy/memory tradeoff.