Skip to content

Commit

Permalink
Address comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
Vilin97 committed Jan 13, 2024
1 parent 11df159 commit ed966e9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
20 changes: 13 additions & 7 deletions src/aggregators/aggregators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -195,18 +195,24 @@ function select_aggregator(jumps::JumpSet; vartojumps_map=nothing, jumptovars_ma
# detect if a spatial SSA should be used
!isnothing(spatial_system) && !isnothing(hopping_constants) && return DirectCRDirect

Check warning on line 197 in src/aggregators/aggregators.jl

View check run for this annotation

Codecov / codecov/patch

src/aggregators/aggregators.jl#L197

Added line #L197 was not covered by tests
# if variable rate jumps are present, return the only SSA that supports them
num_vrjs(jumps) != 0 && return Coevolve
# if variable rate jumps are present, return one of the two SSAs that support them
if num_vrjs(jumps) != 0
any(isbounded, vrjs) && return Coevolve
return Direct
end

# if the number of jumps is small, return the Direct
num_majumps(jumps) + num_crjs(jumps) < 10 && return Direct
num_jumps(jumps) < 10 && return Direct

Check warning on line 205 in src/aggregators/aggregators.jl

View check run for this annotation

Codecov / codecov/patch

src/aggregators/aggregators.jl#L204-L205

Added lines #L204 - L205 were not covered by tests

# if there are only massaction jumps, we can any build dependency graph, so return the fastest aggregator
num_crjs(jumps) == 0 && num_vrjs(jumps) == 0 && return RSSACR
# if there are only massaction jumps, we can any build dependency graph
can_build_dependency_graphs = num_crjs(jumps) == 0 && num_vrjs(jumps) == 0
have_dependency_graphs = !isnothing(vartojumps_map) && !isnothing(jumptovars_map)

# in the presence of constant rate jumps, we rely on the given dependency graphs
if !isnothing(vartojumps_map) && !isnothing(jumptovars_map)
# if we have the species-jumps dependency graphs or can build them, use one of the Rejection-based methods
if can_build_dependency_graphs || have_dependency_graphs
num_jumps(jumps) < 100 && return RSSA
return RSSACR
# if we have the jumps-jumps dependency graph, use the Composition-Rejection Direct method
elseif !isnothing(dep_graph)
return DirectCR
else

Check warning on line 218 in src/aggregators/aggregators.jl

View check run for this annotation

Codecov / codecov/patch

src/aggregators/aggregators.jl#L218

Added line #L218 was not covered by tests
Expand Down
2 changes: 1 addition & 1 deletion test/spatial/ABC.jl
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ push!(jump_problems,
JumpProblem(prob, DirectCRDirect(), majumps, hopping_constants = hopping_constants,
spatial_system = grids[1], save_positions = (false, false), rng = rng))
push!(jump_problems,
JumpProblem(prob, majumps, hopping_constants = hopping_constants,
JumpProblem(prob, majumps, hopping_constants = hopping_constants,
spatial_system = grids[1], save_positions = (false, false), rng = rng))
# setup flattenned jump prob
push!(jump_problems,
Expand Down

0 comments on commit ed966e9

Please sign in to comment.