Add options to DiagnosticsToolbox to use scaled Jacobian when reporting numerical issues #1645
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.
Fixes
Summary/Motivation:
When the Jacobian is calculated in several of the DiagnosticsToolbox methods, the optional
scaled
argument inidaes.core.util.scaling.get_jacobian
(which actually defaults to True) is set to False every time it is called. Because it is hard-coded into the class, there is no option for the user to change this choice. One of the purposes of the numerical diagnostics is to identify scaling issues, but thescaled=False
argument whenever the Jacobian is calculated means that the numerical diagnostics always report the same results every time they run, no matter what scaling the user has added to the model to address the problems identified. Once any scaling is added to the model, they are flying blind as to whether the scaling factors are working or if other variables and constraints need additional scaling.Changes proposed in this PR:
use_scaled_jacobian
that the user can set when creating the DiagnosticsToolbox object. This option is used throughout the class whenever the Jacobian needs to be calculated.use_scaled_jacobian
argument to several class methods that are often called directly by the user, giving the user flexibility about which way to calculate the Jacobian without having to re-create the DiagnosticsToolbox object.force_jacobian_recalc
argument to several class methods where the stored Jacobian is used by default if present. There could be a situation where the model is re-run with new values, making the stored Jacobian outdated. The user needs to be able to force these methods to recalculate the Jacobian based on the updated model. This argument gives the user control over when that happens.Legal Acknowledgement
By contributing to this software project, I agree to the following terms and conditions for my contribution: