1
1
JumpType = Union{VariableRateJump, ConstantRateJump, MassActionJump}
2
2
3
+ """
4
+ $(TYPEDEF)
5
+
6
+ A system of jump processes.
7
+
8
+ # Fields
9
+ $(FIELDS)
10
+
11
+ # Example
12
+
13
+ ```
14
+ using ModelingToolkit
15
+
16
+ @parameters β γ t
17
+ @variables S I R
18
+ rate₁ = β*S*I
19
+ affect₁ = [S ~ S - 1, I ~ I + 1]
20
+ rate₂ = γ*I
21
+ affect₂ = [I ~ I - 1, R ~ R + 1]
22
+ j₁ = ConstantRateJump(rate₁,affect₁)
23
+ j₂ = ConstantRateJump(rate₂,affect₂)
24
+ j₃ = MassActionJump(2*β+γ, [R => 1], [S => 1, R => -1])
25
+ js = JumpSystem([j₁,j₂,j₃], t, [S,I,R], [β,γ])
26
+ ```
27
+ """
3
28
struct JumpSystem{U <: ArrayPartition } <: AbstractSystem
29
+ """
30
+ The jumps of the system. Allowable types are `ConstantRateJump`,
31
+ `VariableRateJump`, `MassActionJump`.
32
+ """
4
33
eqs:: U
34
+ """ The independent variable, usually time."""
5
35
iv:: Variable
36
+ """ The dependent variables, representing the state of the system."""
6
37
states:: Vector{Variable}
38
+ """ The parameters of the system."""
7
39
ps:: Vector{Variable}
40
+ """ The name of the system."""
8
41
name:: Symbol
42
+ """ The internal systems."""
9
43
systems:: Vector{JumpSystem}
10
44
end
11
45
@@ -93,7 +127,16 @@ function DiffEqBase.DiscreteProblem(sys::AbstractSystem, u0map, tspan,
93
127
parammap=DiffEqBase.NullParameters; kwargs...)
94
128
```
95
129
96
- Generates a DiscreteProblem from an AbstractSystem
130
+ Generates a DiscreteProblem from an AbstractSystem.
131
+
132
+ Continuing the example from the [`JumpSystem`](@ref) definition:
133
+ ```julia
134
+ using DiffEqBase, DiffEqJump
135
+ u₀map = [S => 999, I => 1, R => 0]
136
+ parammap = [β => .1/1000, γ => .01]
137
+ tspan = (0.0, 250.0)
138
+ dprob = DiscreteProblem(js, u₀map, tspan, parammap)
139
+ ```
97
140
"""
98
141
function DiffEqBase. DiscreteProblem (sys:: AbstractSystem , u0map, tspan:: Tuple ,
99
142
parammap= DiffEqBase. NullParameters (); kwargs... )
@@ -111,6 +154,12 @@ function DiffEqBase.JumpProblem(js::JumpSystem, prob, aggregator; kwargs...)
111
154
```
112
155
113
156
Generates a JumpProblem from a JumpSystem.
157
+
158
+ Continuing the example from the [`DiscreteProblem`](@ref) definition:
159
+ ```julia
160
+ jprob = JumpProblem(js, dprob, Direct())
161
+ sol = solve(jprob, SSAStepper())
162
+ ```
114
163
"""
115
164
function DiffEqJump. JumpProblem (js:: JumpSystem , prob, aggregator; kwargs... )
116
165
0 commit comments