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

Erroneous sorting in DiagnosticToolbox methods #1516

Open
adam-a-a opened this issue Oct 30, 2024 · 5 comments
Open

Erroneous sorting in DiagnosticToolbox methods #1516

adam-a-a opened this issue Oct 30, 2024 · 5 comments
Assignees
Labels
diagnostics enhancement New feature or request Priority:Low Low Priority Issue or PR

Comments

@adam-a-a
Copy link
Contributor

Sorting does not work as expected for methods such as display_constraints_with_extreme_jacobians and display_variables with_extreme_jacobians.

Here is a snapshot of output from display_constraints_with_extreme_jacobians:

image

@lbianchi-lbl
Copy link
Contributor

@adam-a-a would you be able to provide an example (code snippet) to reproduce this behavior?

@lbianchi-lbl lbianchi-lbl added the Priority:Low Low Priority Issue or PR label Oct 31, 2024
@adam-a-a
Copy link
Contributor Author

adam-a-a commented Nov 5, 2024

@lbianchi-lbl After attempting to solve a model, m, which has extreme jacobian elements, and assuming you created the following instance of the DiagnosticToolbox ( dt = DiagnosticToolbox(m)), you could then check the following:

# This would report numerical issues and hint at checking extreme jacobian elements
dt.report_numerical_issues()
# Then check the extreme jac elements:
dt.display_constraints_with_extreme_jacobians()

@andrewlee94
Copy link
Member

andrewlee94 commented Nov 5, 2024

@adam-a-a What we need is an example of a model that exhibits the behaviour. Right now we have no idea why the ordering is not working nor any way to test that we have fixed it.

@dallan-keylogic dallan-keylogic added enhancement New feature or request and removed bug Something isn't working labels Feb 3, 2025
@dallan-keylogic
Copy link
Contributor

I have ascertained that the Diagnostics Toolbox is currently sorting variables and constraints as intended: from most extreme to least extreme, i.e., in order of descending abs(log(norm)). We can discuss about what would be a more intuitive sorting order, like whether we should have separate lists of rows with large and small norms, but it's not a bug.

I would like to hear what @adam-a-a and @andrewlee94 think, if they have time.

@andrewlee94
Copy link
Member

@adam-a-a @dallan-keylogic I think the first question needs to be "what a user would expect to see", with the caveat that many users do not really know how to interpret these results. From the numerical standpoint, i.e. from most extreme to least extreme, i.e., in order of descending abs(log(norm)) is probably the most useful, but it does result in some unintuitive behaviours like the example above (which on review is actually correct).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
diagnostics enhancement New feature or request Priority:Low Low Priority Issue or PR
Projects
None yet
Development

No branches or pull requests

4 participants