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

Resolve error categorizing some Var discrete domains as "integer" #2954

Merged
merged 1 commit into from
Aug 17, 2023

Conversation

jsiirola
Copy link
Member

@jsiirola jsiirola commented Aug 17, 2023

Fixes # .

Summary/Motivation:

Variables with domains defined with a domain with step 1, but not starting at an integer value were being categorized as "integer" domains. This updates is_integer() to correctly report False for discrete domains that are not rooted (start or stop) at integer values. This adds a test to exercise / verify the expected behavior.

Changes proposed in this PR:

  • is_integer() should only be True if the range starts/ends at an integer
  • Add tests verifying the correct 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.

@codecov
Copy link

codecov bot commented Aug 17, 2023

Codecov Report

Patch coverage: 75.00% and no project coverage change.

Comparison is base (1cb37aa) 87.82% compared to head (039c5ec) 87.83%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2954   +/-   ##
=======================================
  Coverage   87.82%   87.83%           
=======================================
  Files         770      770           
  Lines       89654    89657    +3     
=======================================
+ Hits        78741    78747    +6     
+ Misses      10913    10910    -3     
Flag Coverage Δ
linux 84.86% <75.00%> (-0.01%) ⬇️
osx 74.57% <75.00%> (-0.01%) ⬇️
other 85.04% <75.00%> (-0.01%) ⬇️
win 82.10% <75.00%> (-0.01%) ⬇️

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

Files Changed Coverage Δ
pyomo/core/base/var.py 93.59% <75.00%> (-0.18%) ⬇️

... and 1 file with indirect coverage changes

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

@mrmundt mrmundt merged commit 99dc0f1 into Pyomo:main Aug 17, 2023
29 of 30 checks passed
@jsiirola jsiirola deleted the var-is-integer branch August 28, 2023 15:19
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.

2 participants