Skip to content

Adjust PyROS handling of separation objective evaluation errors #3646

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

Merged
merged 4 commits into from
Jul 19, 2025

Conversation

shermanjasonaf
Copy link
Contributor

@shermanjasonaf shermanjasonaf commented Jun 25, 2025

Summary/Motivation:

Upon the solution of a separation problem, PyROS attempts to evaluate the violations of all second-stage inequality constraints at the optimal solution to that separation problem. In (rare) cases, the evaluation may fail due to an exception encountered/raised by the Pyomo expression evaluators. This exception may be of type ValueError or ArithmeticError. Currently, PyROS does not handle an exception of type ArithmeticError and handles a ValueError-type exception as follows:

  • Issue INFO-level logging messages reporting the names and values of all first-stage variables and second-stage variables of the separation model
  • Raise an ArithmeticError with a message of the form "Evaluation . . . of constraint . . . led to a math domain error. Does the constraint contain . . . functions . . . with tricky domains?"

In this PR, we modify PyROS to handle an exception of type ValueError or ArithmeticError as follows:

  • Issue an ERROR-level logging message reporting that PyROS encountered an evaluation error, and including the names and values of all variables of the separation model (including variables representing uncertain parameters) that appear in the expression
  • Reraise the exception

Changes proposed in this PR:

See above.

Legal Acknowledgement

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

  1. I agree my contributions are submitted under the BSD license.
  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.

Copy link

codecov bot commented Jul 1, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.87%. Comparing base (56521be) to head (6dfffe6).
Report is 212 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3646      +/-   ##
==========================================
- Coverage   88.94%   88.87%   -0.07%     
==========================================
  Files         888      889       +1     
  Lines      102444   104721    +2277     
==========================================
+ Hits        91115    93067    +1952     
- Misses      11329    11654     +325     
Flag Coverage Δ
builders 26.68% <0.00%> (+0.01%) ⬆️
default 85.52% <100.00%> (?)
expensive 34.04% <0.00%> (?)
linux 86.67% <0.00%> (-2.03%) ⬇️
linux_other 86.67% <0.00%> (-0.09%) ⬇️
osx 83.03% <0.00%> (-0.02%) ⬇️
win 84.94% <0.00%> (+0.01%) ⬆️
win_other 84.94% <0.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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.

@jsiirola jsiirola merged commit 14a1c10 into Pyomo:main Jul 19, 2025
35 checks passed
@github-project-automation github-project-automation bot moved this from Reviewer Approved to Done in August 2025 Release Jul 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

4 participants