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

Ensure templatize_constraint returns an expression #2983

Merged
merged 3 commits into from
Aug 31, 2023

Conversation

jsiirola
Copy link
Member

@jsiirola jsiirola commented Aug 31, 2023

Fixes # .

Summary/Motivation:

@codykarcher reported two errors with templatize_constraint: first, the templatized expression was not guaranteed to be an expression (it could contain a tuple), and the other was a missing import. This PR resolves both of those issues.

Changes proposed in this PR:

  • Ensure that the first return value from templatize_constraint is always an expression
  • Add tests

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.

@jsiirola jsiirola changed the title Ensure templatize_constraint returns an expressionTemplateize constraint fix tuple Ensure templatize_constraint returns an expression Aug 31, 2023
@jsiirola jsiirola force-pushed the templateize-constraint-fix-tuple branch from ad228ed to ecbd709 Compare August 31, 2023 16:20
@jsiirola jsiirola requested a review from mrmundt August 31, 2023 16:53
@codecov
Copy link

codecov bot commented Aug 31, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.01% 🎉

Comparison is base (1764336) 88.06% compared to head (ecbd709) 88.07%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2983      +/-   ##
==========================================
+ Coverage   88.06%   88.07%   +0.01%     
==========================================
  Files         769      769              
  Lines       89454    89476      +22     
==========================================
+ Hits        78780    78810      +30     
+ Misses      10674    10666       -8     
Flag Coverage Δ
linux 85.18% <100.00%> (-0.01%) ⬇️
osx 74.98% <100.00%> (+<0.01%) ⬆️
other 85.36% <100.00%> (+<0.01%) ⬆️
win 82.42% <100.00%> (+<0.01%) ⬆️

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

Files Changed Coverage Δ
pyomo/core/expr/relational_expr.py 89.50% <100.00%> (+0.23%) ⬆️
pyomo/core/expr/template_expr.py 87.76% <100.00%> (+0.07%) ⬆️

... and 15 files with indirect coverage changes

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

@mrmundt mrmundt merged commit 1e01f00 into Pyomo:main Aug 31, 2023
30 checks passed
@jsiirola jsiirola deleted the templateize-constraint-fix-tuple branch September 18, 2023 19:00
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.

3 participants