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

Fix type registrations for ExternalFunction arguments #3168

Merged
merged 11 commits into from
Mar 5, 2024

Conversation

jsiirola
Copy link
Member

Fixes # .

Summary/Motivation:

This resolves an issue where new numeric types were not being correctly registered if they were initially seen as arguments to an ExternalFunction. This was part of the cause of IDAES/idaes-pse#1348.

As part of resolving this, the PR adds several new functions, including:

  • check_if_native_type()
  • check_if_logical_type()
    and improves the logic in check_if_numeric_type(). It also adds NonNumericValue to the PyomoObject class hierarchy (and defines __call__()).

This deprecates the pyomo_constant_types set: this set was only used in two locations in the codebase, and neither location actually needed too use the set.

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.

@blnicho blnicho self-requested a review February 27, 2024 19:37
Copy link

codecov bot commented Feb 28, 2024

Codecov Report

Attention: Patch coverage is 93.54839% with 4 lines in your changes are missing coverage. Please review.

Project coverage is 88.43%. Comparing base (26e4970) to head (e617a6e).
Report is 13 commits behind head on main.

Files Patch % Lines
pyomo/common/numeric_types.py 95.91% 2 Missing ⚠️
pyomo/core/base/external.py 85.71% 1 Missing ⚠️
pyomo/core/expr/numvalue.py 75.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3168      +/-   ##
==========================================
+ Coverage   88.38%   88.43%   +0.05%     
==========================================
  Files         846      846              
  Lines       94857    95461     +604     
==========================================
+ Hits        83835    84418     +583     
- Misses      11022    11043      +21     
Flag Coverage Δ
linux 86.33% <93.54%> (-0.01%) ⬇️
osx 75.73% <93.54%> (+<0.01%) ⬆️
other 86.52% <93.54%> (-0.01%) ⬇️
win 83.81% <93.54%> (-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.

@mrmundt mrmundt merged commit 0470903 into Pyomo:main Mar 5, 2024
33 checks passed
@jsiirola jsiirola deleted the external-fcns-catch-numpy branch March 11, 2024 17:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants