Skip to content

Overhaul implementation of AutoSlots.__deepcopy__#3413

Merged
blnicho merged 13 commits intoPyomo:mainfrom
jsiirola:autoslots-deepcopy
Nov 14, 2024
Merged

Overhaul implementation of AutoSlots.__deepcopy__#3413
blnicho merged 13 commits intoPyomo:mainfrom
jsiirola:autoslots-deepcopy

Conversation

@jsiirola
Copy link
Copy Markdown
Member

Fixes # .

Summary/Motivation:

This resolves some lingering issues when deepcopying AutoSlot classes / Pyomo models.

  • Ensure that the temporary state created when deepcopying Components is preserved until deepcopy is finished. This is a more robust solution to a patch that was introduced in Fix bug in AutoSlots deepcopy #3412
  • Remove redundant deepcopy implementations (standardize all logic in AutoSlots)
  • Fix a minor logic error when determining if components are in/out of the __block_scope__
  • Minor performance improvements (enough so that pmedian8 runs slightly faster, even after the additional overhead of keeping the temporary states alive)

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 November 13, 2024 20:54
@codecov
Copy link
Copy Markdown

codecov bot commented Nov 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.66%. Comparing base (fe3f83f) to head (57e6082).
Report is 364 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3413      +/-   ##
==========================================
+ Coverage   84.77%   88.66%   +3.89%     
==========================================
  Files         879      879              
  Lines      100380   100383       +3     
==========================================
+ Hits        85097    89006    +3909     
+ Misses      15283    11377    -3906     
Flag Coverage Δ
linux 86.12% <100.00%> (?)
osx 76.11% <100.00%> (?)
other 86.61% <100.00%> (?)
win 84.50% <100.00%> (?)

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.

@blnicho blnicho merged commit 05c5ff2 into Pyomo:main Nov 14, 2024
@jsiirola jsiirola deleted the autoslots-deepcopy branch November 15, 2024 03:21
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