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

Control over autodiff in linearization #3351

Open
baggepinnen opened this issue Jan 24, 2025 · 0 comments
Open

Control over autodiff in linearization #3351

baggepinnen opened this issue Jan 24, 2025 · 0 comments

Comments

@baggepinnen
Copy link
Contributor

baggepinnen commented Jan 24, 2025

The current implementation of linearize uses ForwardDiff, which often works fine. However, models with discontinuities and saturation are sometimes better linearized with finite differences, with a relatively large perturbation size, (or even better, with stochastic linearization). It would be nice to allow the user to select exactly how the model is linearized, and if using finite-differences, the perturbation size for each variable. For input variables this would be straightforward to support, but for state variables less so since the state is not always known at the time of the call to linearize. A two-step approach could be okay, where the user first calls linearize and obtains the state realization, after which the perturbation sizes can be tuned. Alternatively, one could specify perturbation size for any desired variables, and the initialization system could be used to translate those sizes into whatever state realization is selected.


I notice that the AutoFiniteDiff backend from ADTypes has options for relative step size, this could perhaps be good enough in some situations

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

No branches or pull requests

1 participant