Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacsas committed Mar 26, 2024
1 parent fac1dc2 commit 968c305
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/aggregators/coevolve.jl
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ end

# executing jump at the next jump time
function (p::CoevolveJumpAggregation)(integrator::I) where {I <:
AbstractSSAIntegrator}
AbstractSSAIntegrator}
if !accept_next_jump!(p, integrator, integrator.u, integrator.p, integrator.t)
return nothing
end
Expand Down
26 changes: 13 additions & 13 deletions test/jprob_symbol_indexing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ affect1!(integ) = (integ.u[1] += 1)
affect2!(integ) = (integ.u[2] += 1)
crj1 = ConstantRateJump(rate1, affect1!)
crj2 = ConstantRateJump(rate2, affect2!)
maj = MassActionJump([[1 => 1], [1 => 1]], [[1 => -1], [1 => -1]]; param_idxs = [1,2])
maj = MassActionJump([[1 => 1], [1 => 1]], [[1 => -1], [1 => -1]]; param_idxs = [1, 2])
g = DiscreteFunction((du, u, p, t) -> nothing;
sys = SymbolicIndexingInterface.SymbolCache([:a, :b], [:p1, :p2], :t))
dprob = DiscreteProblem(g, [0, 10], (0.0, 10.0), [1.0, 2.0])
Expand All @@ -15,8 +15,8 @@ jprob = JumpProblem(dprob, Direct(), crj1, crj2, maj)
# test basic querying of u0 and p
@test jprob[:a] == 0
@test jprob[:b] == 10
@test getp(jprob,:p1)(jprob) == 1.0
@test getp(jprob,:p2)(jprob) == 2.0
@test getp(jprob, :p1)(jprob) == 1.0
@test getp(jprob, :p2)(jprob) == 2.0
@test jprob.ps[:p1] == 1.0
@test jprob.ps[:p2] == 2.0

Expand Down Expand Up @@ -51,14 +51,14 @@ reset_aggregated_jumps!(integ)
# remake tests
dprob = DiscreteProblem(g, [0, 10], (0.0, 10.0), [1.0, 2.0])
jprob = JumpProblem(dprob, Direct(), crj1, crj2, maj)
jprob = remake(jprob; u0 = [:a => -10, :b => 100], p = [:p2 => 3.5, :p1 => .5])
jprob = remake(jprob; u0 = [:a => -10, :b => 100], p = [:p2 => 3.5, :p1 => 0.5])
@test jprob.prob.u0 == [-10, 100]
@test jprob.prob.p == [.5, 3.5]
@test jprob.massaction_jump.scaled_rates == [.5, 3.5]
@test jprob.prob.p == [0.5, 3.5]
@test jprob.massaction_jump.scaled_rates == [0.5, 3.5]
jprob = remake(jprob; u0 = [:b => 10], p = [:p2 => 4.5])
@test jprob.prob.u0 == [-10, 10]
@test jprob.prob.p == [.5, 4.5]
@test jprob.massaction_jump.scaled_rates == [.5, 4.5]
@test jprob.prob.p == [0.5, 4.5]
@test jprob.massaction_jump.scaled_rates == [0.5, 4.5]

# test updating problems via regular indexing still updates the mass action jump
dprob = DiscreteProblem(g, [0, 10], (0.0, 10.0), [1.0, 2.0])
Expand Down Expand Up @@ -86,11 +86,11 @@ reset_aggregated_jumps!(integ)
# remake tests for regular indexing
dprob = DiscreteProblem(g, [0, 10], (0.0, 10.0), [1.0, 2.0])
jprob = JumpProblem(dprob, Direct(), crj1, crj2, maj)
jprob = remake(jprob; u0 = [-10, 100], p = [.5, 3.5])
jprob = remake(jprob; u0 = [-10, 100], p = [0.5, 3.5])
@test jprob.prob.u0 == [-10, 100]
@test jprob.prob.p == [.5, 3.5]
@test jprob.massaction_jump.scaled_rates == [.5, 3.5]
@test jprob.prob.p == [0.5, 3.5]
@test jprob.massaction_jump.scaled_rates == [0.5, 3.5]
jprob = remake(jprob; u0 = [2 => 10], p = [2 => 4.5])
@test jprob.prob.u0 == [-10, 10]
@test jprob.prob.p == [.5, 4.5]
@test jprob.massaction_jump.scaled_rates == [.5, 4.5]
@test jprob.prob.p == [0.5, 4.5]
@test jprob.massaction_jump.scaled_rates == [0.5, 4.5]

0 comments on commit 968c305

Please sign in to comment.