Add DDETST problems and restructure existing DDE problems #39
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I tried to add the currently missing DDE problems from DDETST (and thereby fix #11). I also tried to organize the existing DDE problems better and replace
build_prob_dde_*
functions withremake
. I added deprecations for backwards compatibility, but I guess if the changes in this PR seem acceptable one could also just update the DelayDiffEq test suite and not include those deprecations.I haven't tested all DDETST problems yet but it seems that especially the ones with vanishing delay are challenging for DelayDiffEq at the moment, so, e.g., trying to solve the naively implemented problem
prob_dde_DDETST_F1
with vanishing delay at the initial time point yields an error due to interpolation problems in the history function. I have to investigate this more closely but my initial guess is that currently DelayDiffEq can not deal with the derivative at the initial time point being specified only via the history function (and not as an additional variable in the state vector).Generally, while implementing the test suite I made the following observations:
It seems a bit unintuitive that one has to provide both a history function and an initial state - the initial state should just be the history function evaluated at the initial time point. I think it would be nice to at least be able to specify only a history function. Related to this, the current logic for guessing the order of the discontinuity at the initial time point seems strange - checking
u0 == h(p, t0)
should always betrue
. I think we should just get rid of this check and by default assume that the function is discontinuous at the initial time point. Since the order of the discontinuity is an immediate consequence ofu0
andh
and not dependent on any numerical algorithm, it would be reasonable to include it inDDEProblem
, I guess.It's a bit unfortunate that the type of
u
is not accessible from inside the user-implemented history function. This makes it impossible for users to write a generic history function that works with arbitrary types ofu
andt
- in particular, if number types with units are used this is a problem. I added a hack in the implementation of the standard problems with constant delays by settingp = typeof(eltype(u))
, but this seems unsatisfying. Maybe this could be solved by reviving the old idea of passingintegrator
instead ofp
to bothf
andh
?