Skip to content

Make exporting of PyROS subproblems more customizable #3649

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

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

shermanjasonaf
Copy link
Contributor

Summary/Motivation:

The PyROS solver provides two optional arguments keepfiles and subproblem_file_directory for specifying whether and where subproblems that were not solved to an acceptable level are to be written. However, when subproblems are written, they are exclusively written in 'bar' format. Other formats ('gams', 'nl', etc.) may be of interest to the user.

Changes proposed in this PR:

  • Add a new optional PyROS solver argument subproblem_format_options. This argument should be (castable to) a dict object, of which each entry maps a Pyomo WriterFactory format (e.g., 'bar', 'gams') to a value for the argument io_options to BlockData.write().
  • Add tests to check that PyROS writes subproblems as expected.

TODO (after #3646 merged)

  • Update version number, changelog

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 Jun 29, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.94%. Comparing base (874352c) to head (bfe850a).
Report is 40 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3649   +/-   ##
=======================================
  Coverage   88.94%   88.94%           
=======================================
  Files         888      888           
  Lines      102455   102451    -4     
=======================================
+ Hits        91127    91129    +2     
+ Misses      11328    11322    -6     
Flag Coverage Δ
builders 26.68% <27.27%> (+<0.01%) ⬆️
default 85.53% <100.00%> (?)
expensive 34.04% <27.27%> (?)
linux 86.78% <100.00%> (-1.92%) ⬇️
linux_other 86.78% <100.00%> (+0.03%) ⬆️
osx 83.08% <100.00%> (+0.03%) ⬆️
win 84.97% <100.00%> (+0.02%) ⬆️
win_other 84.97% <100.00%> (+0.02%) ⬆️

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.

Copy link
Contributor

@mrmundt mrmundt left a comment

Choose a reason for hiding this comment

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

I love reductions of duplicate code. Looks good!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Reviewer Approved
Development

Successfully merging this pull request may close these issues.

4 participants