-
-
Notifications
You must be signed in to change notification settings - Fork 36
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
Changes required for initialization #470
Comments
We discussed on Slack adding a cache array into JumpProblem to avoid allocating when wrapping. The one drawback is this moves us away from JumpProblem being immutable, which I had thought was a longer-term goal to be more consistent with other problem types. Otherwise we'd need to move from an interface where people call |
This might just be the right time to rewrite this. We don't need the |
If we are going to do that, it might also be the time to think about moving the aggregator initialization into |
(that would, I think, let us make JumpProblem immutable.) |
If this is going to take a while, I'd rather opt out of initialization for |
That's probably the right way to do this for now. |
JumpProblem
has a unique set of problems to solve for initialization. IgnoringSSAStepper
for a moment,JumpProblem
wraps another problem and relies on the integrator of the wrapped problem. It wraps the innerprob.u0
in anExtendedJumpArray
containing extra values. This makes initialization problematic sinceinitializeprobmap
returns aVector{Float64}
which does not have the required extra values, thus leading to an error.ExtendedJumpArray
is not public API, and hence MTK cannot handle this as an edge case. One solution discussed is to wrap the innerprob.u0
in anExtendedJumpArray
when the user callssolve
/init
. However, this is still problematic:solve
callsolve
call would callinit
on the wrapped integrator twice: once just to run initialization, and a second time withNoInit
to change the type ofintegrator.u
to the appropriateExtendedJumpArray
.Another potential solution is for JumpProcesses to take ownership of initialization - solve for the updated values, update the
ExtendedJumpArray
, and callinit
on the inner problem withNoInit
. The downside here is mostly just implementation. We can avoid a NonlinearSolve dependency by making it a weakdep, in a similar approach to how OrdinaryDiffEqNonlinearSolve extendsOrdinaryDiffEqCore.default_nlsolve
.The text was updated successfully, but these errors were encountered: