Check the terminal period of the transition path against a separate resource-constraint tolerance - #1225
Open
arihantlodha-cmd wants to merge 1 commit into
Open
Check the terminal period of the transition path against a separate resource-constraint tolerance#1225arihantlodha-cmd wants to merge 1 commit into
arihantlodha-cmd wants to merge 1 commit into
Conversation
…esource-constraint tolerance Closes PSLmodels#1210. RC_TPI was a single scalar compared against the resource-constraint error at every period with np.any, so the terminal period could not be exempted without waiving the check across the whole path. The terminal period of a truncated transition is not a true steady state, so its RC error is routinely larger than the interior periods, and the only workaround was to raise RC_TPI globally, which silently allows mid-path violations of the same size. This adds an RC_TPI_terminal parameter and checks the interior periods (RC_error[:-1]) against RC_TPI and the terminal period (RC_error[-1]) against RC_TPI_terminal. RC_TPI_terminal defaults to RC_TPI (1e-4), so default behavior is unchanged; a user who needs to exempt the truncation boundary can now loosen RC_TPI_terminal alone and keep the tight interior check. The failure message names whichever tolerance the worst error breaches. Adds a test that the message names RC_TPI_terminal for a terminal-period spike and RC_TPI for an interior one.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1225 +/- ##
==========================================
- Coverage 75.17% 75.16% -0.02%
==========================================
Files 24 24
Lines 6031 6039 +8
==========================================
+ Hits 4534 4539 +5
- Misses 1497 1500 +3
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Member
|
@arihantlodha-cmd What's the use case for doing this? Is this for some kind of test run? I won't want to make it easier for users to think they've found an equilibrium when they have not as the RC error often points to some model misspecification or a calibration issue. |
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
Closes #1210.
RC_TPIwas a single scalar compared against the resource-constraint error at every period withnp.any, so the terminal period could not be exempted without waiving the check across the whole path. The terminal period of a truncated transition is not a true steady state, so its RC error is routinely larger than the interior periods, and the only workaround was to raiseRC_TPIglobally, which silently allows mid-path violations of the same size (for example OG-UK setsRC_TPI = 0.2to route around the terminal spike, which then lets a 0.2 interior violation pass).Changes
RC_TPI_terminalparameter.RC_error[:-1]) againstRC_TPIand the terminal period (RC_error[-1]) againstRC_TPI_terminal._rc_error_messagenow names whichever tolerance the worst error breaches.Behavior and compatibility
RC_TPI_terminaldefaults toRC_TPI(1e-4), so default behavior is unchanged. A user who needs to exempt the truncation boundary can now loosenRC_TPI_terminalalone and keep the tight interior check, which restores the interior diagnostic that a global loosening removes.Testing
tests/test_parameters.pypasses (16 passed).test_rc_error_message_names_terminal_tolerance: the message namesRC_TPI_terminalfor a terminal-period spike andRC_TPIfor an interior one. The existingtest_rc_error_messagestill passes (the helper's third argument is optional).