Skip to content

Mass-action jumps and event handling #185

@skleinbo

Description

@skleinbo

Is it possible to change the rates of mass-action jumps through callbacks? (see also this discourse thread)

I.e., how to make the following work

rn2 = @reaction_network begin
    a, 0 --> X
end a

prob2_jump = JumpProblem(rn2, DiscreteProblem(rn2, [0], (0.0, 10.0), [1.0]), Direct())

_cond(u,t,integ) = u[1] > 5
_affect!(integ) = integ.p[1] = 0.0

_cb = DiscreteCallback(_cond, _affect!)
solve(prob2_jump, SSAStepper(), callback=_cb)

such that the rate is adjusted when X passes the threshold. Certainly this version of _affect! is too naive.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions