Skip to content

Conversation

@dallan-keylogic
Copy link
Contributor

Summary/Motivation:

Until Pyomo/pyomo#3785 is addressed, solve_strongly_connected_components does not take scaling into account. However, the initialization postcheck does, so constraints may have too large of a scaled residual to past the postcheck. Here we fix that issue by performing a block solve after solve_strongly_connected_components returns.

Additionally, I've switched block triangularization from using the Pyomo SolverFactory to get_solver so it uses IDAES's default solver settings. Using get_solver had caused issues in the past, but hopefully scaling has addressed them.

Legal Acknowledgement

By contributing to this software project, I agree to the following terms and conditions for my contribution:

  1. I agree my contributions are submitted under the license terms described in the LICENSE.txt file at the top level of this directory.
  2. I represent I am authorized to make the contributions and grant the license. If my employer has rights to intellectual property that includes these contributions, I represent that I have received permission to make contributions and grant the required license on behalf of that employer.

@codecov
Copy link

codecov bot commented Nov 17, 2025

Codecov Report

❌ Patch coverage is 77.77778% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.43%. Comparing base (a0957e8) to head (ef1aa1c).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...aes/core/initialization/block_triangularization.py 77.77% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1704      +/-   ##
==========================================
- Coverage   77.44%   77.43%   -0.01%     
==========================================
  Files         395      395              
  Lines       64785    64792       +7     
  Branches    10900    10902       +2     
==========================================
  Hits        50173    50173              
- Misses      12098    12105       +7     
  Partials     2514     2514              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dallan-keylogic dallan-keylogic marked this pull request as ready for review November 17, 2025 15:39
@dallan-keylogic dallan-keylogic added the CI:run-integration triggers_workflow: Integration label Nov 17, 2025
@idaes-build idaes-build removed the CI:run-integration triggers_workflow: Integration label Nov 17, 2025
"""
Call solve_strongly_connected_components on a given BlockData.
"""
if number_activated_constraints(block_data) == 0:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this here? Should there be some kind of warning or error thrown?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is here because Pyomo throws an error when solve is called on a block with no constraints. We need to support initialization for blocks with no constraints because block triangularization is the default initializer for state blocks. Certain state blocks end up having no constraints (typically when defined_state == True). It's easier to put this check in the block triangularization rather than building out infrastructure for every property package to handle this circumstance.

@dallan-keylogic dallan-keylogic added the CI:run-integration triggers_workflow: Integration label Nov 19, 2025
@idaes-build idaes-build removed the CI:run-integration triggers_workflow: Integration label Nov 19, 2025
@dallan-keylogic dallan-keylogic added the CI:run-integration triggers_workflow: Integration label Nov 19, 2025
@idaes-build idaes-build removed the CI:run-integration triggers_workflow: Integration label Nov 19, 2025
@ksbeattie ksbeattie added the Priority:High High Priority Issue or PR label Nov 19, 2025
@dallan-keylogic dallan-keylogic merged commit 8f96b37 into IDAES:main Nov 19, 2025
94 of 97 checks passed
@dallan-keylogic dallan-keylogic deleted the block_triangularization_temp_fix branch November 19, 2025 17:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Priority:High High Priority Issue or PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants