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

Reversion: stop deep copying population, just save curr_u for OptimizationState construction #734

Merged
merged 3 commits into from
Apr 9, 2024

Conversation

jonathanfischer97
Copy link
Contributor

  1. Regarding my previous PRs fixed user trace! overload compat. Both x and user records now saved #702 and check identity instead of equality #732, I think they were mistaken because of my own unclear thinking about why dt["x"] needed to be saved via the default Evolutionary.trace! overload.

  2. I was operating from the perspective of my own uncommon workflow, where I accumulate "feasible" optimization solutions with each iteration, so I overload the trace! to save deep copies of all these feasible solutions, so that the trace acts as a permanent record.

  3. However, this is likely much different from the typical use case, where only the most recent OptimizationState is relevant for any user-injected callback. So a reference to curr_u as it is used in the callback interface _cb is fine, and in-fact preferred in most cases to minimize memory footprint.

  4. Therefore, I have changed the Evolutionary.trace! overload to just save a reference the last element of the population, under the key "curr_u", in line with how the trace was previously being accessed within _cb. This also clarifies the code by making the reason for the trace! overload more transparent.

  5. Any further trace functionality that a user might need, like in my own use case, should be left for the user to define via trace! overload. This keeps this package and its default settings tailored to the typical use case.

  • Appropriate tests were added
  • Any code changes were done in a way that does not break public API
  • All documentation related to code changes were updated
  • The new code follows the
    contributor guidelines, in particular the SciML Style Guide and
    COLPRAC.
  • Any new documentation only uses public API

Apologies, should have thought more carefully before making the previous PRs.

Copy link

codecov bot commented Apr 8, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 63.85%. Comparing base (e0610cd) to head (e2cad3d).
Report is 15 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff             @@
##           master     #734       +/-   ##
===========================================
+ Coverage   11.37%   63.85%   +52.47%     
===========================================
  Files          22       22               
  Lines        1512     1527       +15     
===========================================
+ Hits          172      975      +803     
+ Misses       1340      552      -788     

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

@jonathanfischer97 jonathanfischer97 marked this pull request as ready for review April 8, 2024 00:09
@Vaibhavdixit02
Copy link
Member

No worries, this makes sense

@Vaibhavdixit02 Vaibhavdixit02 merged commit 96c9b39 into SciML:master Apr 9, 2024
43 of 44 checks passed
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