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

Update handling of 0* in linear, quadratic walkers #2981

Merged
merged 6 commits into from
Aug 31, 2023

Conversation

jsiirola
Copy link
Member

Fixes # .

Summary/Motivation:

@Robbybp pointed out inconsistencies / errors in how 0* was handled for monomial, linear, quadratic, and general nonlinear terms within the Linear and Quadratic representation visitors. This PR resolves those inconsistencies and adds tests for the expected behavior.

Changes proposed in this PR:

  • 0*term should result in the term being removed from the representation (for all cases of monomial, linear, quadratic, and general nonlinear)
  • Add tests for this behavior.

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
Member

@blnicho blnicho left a comment

Choose a reason for hiding this comment

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

I found one minor typo

pyomo/repn/linear.py Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Aug 31, 2023

Codecov Report

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

Comparison is base (1764336) 88.06% compared to head (bb7261c) 88.08%.
Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2981      +/-   ##
==========================================
+ Coverage   88.06%   88.08%   +0.02%     
==========================================
  Files         769      769              
  Lines       89454    89473      +19     
==========================================
+ Hits        78780    78816      +36     
+ Misses      10674    10657      -17     
Flag Coverage Δ
linux 85.18% <100.00%> (-0.01%) ⬇️
osx 74.98% <100.00%> (-0.01%) ⬇️
other 85.35% <100.00%> (-0.01%) ⬇️
win 82.43% <100.00%> (+<0.01%) ⬆️

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

Files Changed Coverage Δ
pyomo/repn/linear.py 96.47% <100.00%> (-0.58%) ⬇️
pyomo/repn/quadratic.py 91.00% <100.00%> (+0.14%) ⬆️

... and 16 files with indirect coverage changes

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

@mrmundt mrmundt merged commit a8c8f09 into Pyomo:main Aug 31, 2023
1 check passed
@jsiirola jsiirola deleted the linear-quad-handle-prod-0 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