Skip to content

Commit 87866b8

Browse files
committed
up
1 parent 9cd90cf commit 87866b8

File tree

1 file changed

+0
-171
lines changed

1 file changed

+0
-171
lines changed

test/upstream/mtk_problem_inputs.jl

Lines changed: 0 additions & 171 deletions
Original file line numberDiff line numberDiff line change
@@ -158,177 +158,6 @@ let
158158
end
159159
end
160160

161-
### Vector Species/Parameters Tests ###
162-
163-
begin
164-
# Declares the model (with vector species/parameters, with/without default values, and observables).
165-
@species X(t)[1:2] Y(t)[1:2] = [10.0, 20.0] XY(t)[1:2]
166-
@parameters p[1:2] d[1:2] = [0.2, 0.5]
167-
rxs = [
168-
Reaction(p[1], [], [X[1]]),
169-
Reaction(p[2], [], [X[2]]),
170-
Reaction(d[1], [X[1]], []),
171-
Reaction(d[2], [X[2]], []),
172-
Reaction(p[1], [], [Y[1]]),
173-
Reaction(p[2], [], [Y[2]]),
174-
Reaction(d[1], [Y[1]], []),
175-
Reaction(d[2], [Y[2]], [])
176-
]
177-
observed = [XY[1] ~ X[1] + Y[1], XY[2] ~ X[2] + Y[2]]
178-
@named model_vec = ReactionSystem(rxs, t; observed)
179-
model_vec = complete(model_vec)
180-
181-
# Declares various u0 versions (scalarised and vector forms).
182-
u0_alts_vec = [
183-
# Vectors not providing default values.
184-
[X => [1.0, 2.0]],
185-
[X[1] => 1.0, X[2] => 2.0],
186-
[model_vec.X => [1.0, 2.0]],
187-
[model_vec.X[1] => 1.0, model_vec.X[2] => 2.0],
188-
[:X => [1.0, 2.0]],
189-
# Vectors providing default values.
190-
[X => [1.0, 2.0], Y => [10.0, 20.0]],
191-
[X[1] => 1.0, X[2] => 2.0, Y[1] => 10.0, Y[2] => 20.0],
192-
[model_vec.X => [1.0, 2.0], model_vec.Y => [10.0, 20.0]],
193-
[model_vec.X[1] => 1.0, model_vec.X[2] => 2.0, model_vec.Y[1] => 10.0, model_vec.Y[2] => 20.0],
194-
[:X => [1.0, 2.0], :Y => [10.0, 20.0]],
195-
# Dicts not providing default values.
196-
Dict([X => [1.0, 2.0]]),
197-
Dict([X[1] => 1.0, X[2] => 2.0]),
198-
Dict([model_vec.X => [1.0, 2.0]]),
199-
Dict([model_vec.X[1] => 1.0, model_vec.X[2] => 2.0]),
200-
Dict([:X => [1.0, 2.0]]),
201-
# Dicts providing default values.
202-
Dict([X => [1.0, 2.0], Y => [10.0, 20.0]]),
203-
Dict([X[1] => 1.0, X[2] => 2.0, Y[1] => 10.0, Y[2] => 20.0]),
204-
Dict([model_vec.X => [1.0, 2.0], model_vec.Y => [10.0, 20.0]]),
205-
Dict([model_vec.X[1] => 1.0, model_vec.X[2] => 2.0, model_vec.Y[1] => 10.0, model_vec.Y[2] => 20.0]),
206-
Dict([:X => [1.0, 2.0], :Y => [10.0, 20.0]]),
207-
# Tuples not providing default values.
208-
(X => [1.0, 2.0]),
209-
(X[1] => 1.0, X[2] => 2.0),
210-
(model_vec.X => [1.0, 2.0]),
211-
(model_vec.X[1] => 1.0, model_vec.X[2] => 2.0),
212-
(:X => [1.0, 2.0]),
213-
# Tuples providing default values.
214-
(X => [1.0, 2.0], Y => [10.0, 20.0]),
215-
(X[1] => 1.0, X[2] => 2.0, Y[1] => 10.0, Y[2] => 20.0),
216-
(model_vec.X => [1.0, 2.0], model_vec.Y => [10.0, 20.0]),
217-
(model_vec.X[1] => 1.0, model_vec.X[2] => 2.0, model_vec.Y[1] => 10.0, model_vec.Y[2] => 20.0),
218-
(:X => [1.0, 2.0], :Y => [10.0, 20.0]),
219-
]
220-
221-
# Declares various ps versions (vector forms only).
222-
p_alts_vec = [
223-
# Vectors not providing default values.
224-
[p => [1.0, 2.0]],
225-
[model_vec.p => [1.0, 2.0]],
226-
[:p => [1.0, 2.0]],
227-
# Vectors providing default values.
228-
[p => [4.0, 5.0], d => [0.2, 0.5]],
229-
[model_vec.p => [4.0, 5.0], model_vec.d => [0.2, 0.5]],
230-
[:p => [4.0, 5.0], :d => [0.2, 0.5]],
231-
# Dicts not providing default values.
232-
Dict([p => [1.0, 2.0]]),
233-
Dict([model_vec.p => [1.0, 2.0]]),
234-
Dict([:p => [1.0, 2.0]]),
235-
# Dicts providing default values.
236-
Dict([p => [4.0, 5.0], d => [0.2, 0.5]]),
237-
Dict([model_vec.p => [4.0, 5.0], model_vec.d => [0.2, 0.5]]),
238-
Dict([:p => [4.0, 5.0], :d => [0.2, 0.5]]),
239-
# Tuples not providing default values.
240-
(p => [1.0, 2.0]),
241-
(model_vec.p => [1.0, 2.0]),
242-
(:p => [1.0, 2.0]),
243-
# Tuples providing default values.
244-
(p => [4.0, 5.0], d => [0.2, 0.5]),
245-
(model_vec.p => [4.0, 5.0], model_vec.d => [0.2, 0.5]),
246-
(:p => [4.0, 5.0], :d => [0.2, 0.5]),
247-
]
248-
249-
# Declares a timespan.
250-
tspan = (0.0, 10.0)
251-
end
252-
253-
# Perform ODE simulations (singular and ensemble).
254-
let
255-
# Creates normal and ensemble problems.
256-
base_oprob = ODEProblem(model_vec, u0_alts_vec[1], tspan, p_alts_vec[1])
257-
base_sol = solve(base_oprob, Tsit5(); saveat = 1.0)
258-
base_eprob = EnsembleProblem(base_oprob)
259-
base_esol = solve(base_eprob, Tsit5(); trajectories = 2, saveat = 1.0)
260-
261-
# Simulates problems for all input types, checking that identical solutions are found.
262-
for u0 in u0_alts_vec, p in p_alts_vec
263-
oprob = remake(base_oprob; u0, p)
264-
@test base_sol == solve(oprob, Tsit5(); saveat = 1.0)
265-
eprob = remake(base_eprob; u0, p)
266-
@test base_esol == solve(eprob, Tsit5(); trajectories = 2, saveat = 1.0)
267-
end
268-
end
269-
270-
# Perform SDE simulations (singular and ensemble).
271-
let
272-
# Creates normal and ensemble problems.
273-
base_sprob = SDEProblem(model, u0_alts_vec[1], tspan, p_alts_vec[1])
274-
base_sol = solve(base_sprob, ImplicitEM(); seed, saveat = 1.0)
275-
base_eprob = EnsembleProblem(base_sprob)
276-
base_esol = solve(base_eprob, ImplicitEM(); seed, trajectories = 2, saveat = 1.0)
277-
278-
# Simulates problems for all input types, checking that identical solutions are found.
279-
for u0 in u0_alts_vec, p in p_alts_vec
280-
sprob = remake(base_sprob; u0, p)
281-
@test base_sol == solve(sprob, ImplicitEM(); seed, saveat = 1.0)
282-
eprob = remake(base_eprob; u0, p)
283-
@test base_esol == solve(eprob, ImplicitEM(); seed, trajectories = 2, saveat = 1.0)
284-
end
285-
end
286-
287-
# Perform jump simulations (singular and ensemble).
288-
let
289-
# Creates normal and ensemble problems.
290-
base_dprob = DiscreteProblem(model, u0_alts_vec[1], tspan, p_alts_vec[1])
291-
base_jprob = JumpProblem(model, base_dprob, Direct(); rng)
292-
base_sol = solve(base_jprob, SSAStepper(); seed, saveat = 1.0)
293-
base_eprob = EnsembleProblem(base_jprob)
294-
base_esol = solve(base_eprob, SSAStepper(); seed, trajectories = 2, saveat = 1.0)
295-
296-
# Simulates problems for all input types, checking that identical solutions are found.
297-
for u0 in u0_alts_vec, p in p_alts_vec
298-
jprob = remake(base_jprob; u0, p)
299-
@test base_sol == solve(base_jprob, SSAStepper(); seed, saveat = 1.0)
300-
eprob = remake(base_eprob; u0, p)
301-
@test base_esol == solve(eprob, SSAStepper(); seed, trajectories = 2, saveat = 1.0)
302-
end
303-
end
304-
305-
# Solves a nonlinear problem (EnsembleProblems are not possible for these).
306-
let
307-
base_nlprob = NonlinearProblem(model, u0_alts_vec[1], p_alts_vec[1])
308-
base_sol = solve(base_nlprob, NewtonRaphson())
309-
for u0 in u0_alts_vec, p in p_alts_vec
310-
nlprob = remake(base_nlprob; u0, p)
311-
@test base_sol == solve(nlprob, NewtonRaphson())
312-
end
313-
end
314-
315-
# Perform steady state simulations (singular and ensemble).
316-
let
317-
# Creates normal and ensemble problems.
318-
base_ssprob = SteadyStateProblem(model, u0_alts_vec[1], p_alts_vec[1])
319-
base_sol = solve(base_ssprob, DynamicSS(Tsit5()))
320-
base_eprob = EnsembleProblem(base_ssprob)
321-
base_esol = solve(base_eprob, DynamicSS(Tsit5()); trajectories = 2)
322-
323-
# Simulates problems for all input types, checking that identical solutions are found.
324-
for u0 in u0_alts_vec, p in p_alts_vec
325-
ssprob = remake(base_ssprob; u0, p)
326-
@test base_sol == solve(ssprob, DynamicSS(Tsit5()))
327-
eprob = remake(base_eprob; u0, p)
328-
@test base_esol == solve(eprob, DynamicSS(Tsit5()); trajectories = 2)
329-
end
330-
end
331-
332161
### Checks Errors On Faulty Inputs ###
333162

334163
# Checks various erroneous problem inputs, ensuring that these throw errors.

0 commit comments

Comments
 (0)