Skip to content

Conversation

jas-yao
Copy link
Contributor

@jas-yao jas-yao commented Apr 11, 2025

Fixes: #2724, #3508

Summary/Motivation:

This PR provides updates to PyROS uncertainty set validation methods and related tests.
Here, a validate method replaces the is_valid method (which solves 2N bounding problems to check for set boundedness) in all uncertainty sets, with each set having its own custom validate method that efficiently checks set-specific attributes and raises informative exceptions if any issues are found.

Changes proposed in this PR:

  • Update is_bounded and is_nonempty methods in base UncertaintySet class
  • Provide a _solve_feasibility method in base UncertaintySet class
  • Replace is_valid with validate method that runs is_bounded and is_nonempty in the base UncertaintySet class
  • Override validate in subclass uncertainty sets to check set-specific attributes
  • Remove attribute setter checks in uncertainty sets that have been moved to the validate method
  • Update unit tests for is_bounded, is_nonempty, _solve_feasibility, and validate methods

TODO

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.

jas-yao added 30 commits April 7, 2025 15:31
@jas-yao
Copy link
Contributor Author

jas-yao commented Jul 2, 2025

@shermanjasonaf @jsiirola I have addressed all comments.

I would appreciate further feedback on my implementations for is_bounded and _compute_exact_parameter_bounds.
I will also need to complete the final TODO to update the version number and changelog.

Copy link
Member

@jsiirola jsiirola left a comment

Choose a reason for hiding this comment

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

This looks good. @jas-yao, @shermanjasonaf: do you want to update the version & changelog as part of this PR before we merge it, or just add it to the next PR?

@github-project-automation github-project-automation bot moved this from Review In Progress to Reviewer Approved in August 2025 Release Jul 17, 2025
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.

There are two doc issues (missing variables names), but this is otherwise lovely.


Returns
-------
: bool
Copy link
Contributor

Choose a reason for hiding this comment

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

The actual varname is missing here.


Returns
-------
: list of tuple
Copy link
Contributor

Choose a reason for hiding this comment

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

The actual varname is missing here.

Copy link
Member

Choose a reason for hiding this comment

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

These are return values, so the actual var name is not necessary (or really all that relevant). I believe that this is syntactically correct numpydoc (the : just makes it explicit that we are providing the return type and are not specifying a (suggested) name.

@shermanjasonaf
Copy link
Contributor

@jas-yao This looks good. You may want to remove the custom implementation of DiscreteScenarioSet.is_bounded(), which, though never used in the code (apart from in the discrete uncertainty set tests), unconditionally returns True.

@shermanjasonaf
Copy link
Contributor

This looks good. @jas-yao, @shermanjasonaf: do you want to update the version & changelog as part of this PR before we merge it, or just add it to the next PR?

@jsiirola Let's leave the version number and changelog updates for #3649.

@jsiirola jsiirola merged commit 31b08b8 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
No open projects
Development

Successfully merging this pull request may close these issues.

Make PyROS UncertaintySet Valid Numeric Types Mutable
6 participants