Skip to content

fix: erase cache contexts before building function in Symbolics #760

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

Merged
merged 4 commits into from
Mar 28, 2025

Conversation

gdalle
Copy link
Member

@gdalle gdalle commented Mar 28, 2025

This PR fixes bad cache handling with Symbolics.
The cache variables need to be erased or otherwise replaced before the symbolic function is built. Otherwise the derivatives are deduced from the caches and not from the active variable, as seen in JuliaControl/ModelPredictiveControl.jl#174 (comment)

@gdalle
Copy link
Member Author

gdalle commented Mar 28, 2025

@brianguenter do you have any idea why such a fix isn't necessary with FastDifferentiation?

Copy link

codecov bot commented Mar 28, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.87%. Comparing base (9546d6d) to head (a283e97).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #760   +/-   ##
=======================================
  Coverage   97.87%   97.87%           
=======================================
  Files         128      128           
  Lines        7428     7444   +16     
=======================================
+ Hits         7270     7286   +16     
  Misses        158      158           
Flag Coverage Δ
DI 98.94% <100.00%> (+<0.01%) ⬆️
DIT 95.20% <ø> (ø)

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.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@brianguenter
Copy link

@gdalle I do not. Symbolics uses very different representations of symbolic expressions than FastDifferentiation does. Somewhere in the nitty gritty details of these differences lies the cause.

@gdalle gdalle merged commit 51c56e8 into main Mar 28, 2025
50 checks passed
@gdalle
Copy link
Member Author

gdalle commented Mar 28, 2025

Alright, I guess the mystery will remain!

@gdalle gdalle deleted the gd/symcache branch April 16, 2025 14:11
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