SciML / Optimization.jl

Mathematical Optimization in Julia. Local, global, gradient-based and derivative-free. Linear, Quadratic, Convex, Mixed-Integer, and Nonlinear Optimization in one simple, fast, and differentiable interface.
https://docs.sciml.ai/Optimization/stable/
MIT License
688 stars 75 forks source link

`deepcopy` to save population in default trace, instead of reference #730

Closed jonathanfischer97 closed 3 months ago

jonathanfischer97 commented 3 months ago

Default trace! overload was saving population by reference

deepcopy fixes the issue

This test fails with the old code, but passes with deepcopy:

# Test the the values of x are saved, not the reference
@test sol.original.trace[end].metadata["x"] !== sol.original.trace[end-1].metadata["x"]

Checklist

codecov[bot] commented 3 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 66.01%. Comparing base (0a417ea) to head (d4c732a). Report is 23 commits behind head on master.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #730 +/- ## =========================================== + Coverage 11.96% 66.01% +54.05% =========================================== Files 21 22 +1 Lines 1438 1477 +39 =========================================== + Hits 172 975 +803 + Misses 1266 502 -764 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.