Skip to content

DelayDiffEq support #28

Open
Open

Description

@MasonProtter

We'll eventually need to support delay diffeqs in GraphDynamics. This should be technically easy, but might involve some hard API choices, specifically, what the best way will be to expose the history function in subsystem_differential.

Activity

  1. self-assigned this
    on Apr 28, 2025
  2. singhharsh1708 commented on Aug 16, 2026

    @singhharsh1708

    I'd like to take a run at this if you haven't started. I see it's assigned to you, so happy to back off.

    On the API question, there are already two traits in the codebase that solve the same problem, and copying them seems better than changing the signature. subsystem_differential_requires_inputs defaults to true and lets a type opt out, connection_needs_ctx defaults to false and lets a rule opt in. Same shape here:

    subsystem_differential_needs_history(::Type{T}) where {T} = false

    and when it's true, _graph_ode_mapping_f hands h down through apply_subsystem_differential! to a 4-arg subsystem_differential(sys, input, t, h). Nothing existing changes, and the branch resolves at compile time like the other two.

    The part I think matters more is that in a spiking network the delay usually lives on the edge rather than in the subsystem, since conduction delay is a property of the connection. calculate_inputs already builds

    ctx = (; states_partitioned, params_partitioned, connection_matrices)

    and hands it to any rule with connection_needs_ctx(Mlj) == true. Adding h to that NamedTuple gets delayed synapses nearly for free at the user-facing level. The plumbing isn't free though: h has to thread from graph_ode! through all three _graph_ode! scheduler methods down to calculate_inputs, so it's about seven signatures, all mechanical and all in graph_solve.jl.

    Two things that aren't API but need deciding:

    Lags. It's much better to declare constant_lags up front than to lean on residual-control discontinuity detection. GraphSystem already collects tstops off the flat graph via event_times, so the same pass could collect lags from connections that declare one.

    State-dependent lags need dependent_lags, and they interact with the discrete events, since a spike time is already a discontinuity.

    Would you rather see the subsystem hook, the ctx route, or both? Happy to start with whichever you prefer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions