-
-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AbstractSSAJumpAggregator interface #20
Conversation
This couples everything to an aggregator. One can overload these if desired.
Default to xorshifts to make simulation multithreading-safe.
The template can be re-used by other aggregators. Someday we should be able to use the generic routines pending: JuliaLang/julia#14919
@isaacsas wanna take a look? |
@@ -19,15 +19,16 @@ JumpProblem(prob,aggregator::AbstractAggregatorAlgorithm,jumps::AbstractJump...; | |||
JumpProblem(prob,jumps::JumpSet;kwargs...) = JumpProblem(prob,NullAggregator(),jumps;kwargs...) | |||
|
|||
function JumpProblem(prob,aggregator::AbstractAggregatorAlgorithm,jumps::JumpSet; | |||
save_positions = typeof(prob) <: AbstractDiscreteProblem ? (false,true) : (true,true)) | |||
save_positions = typeof(prob) <: AbstractDiscreteProblem ? (false,true) : (true,true), | |||
rng = Xorshifts.Xoroshiro128Star(rand(UInt64))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use Xoroshiro128Plus. See the end of the chat which states it's not the same as the one in the post.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought Xoroshiro128Plus is claimed to fail particular test battery? I'm using Xoroshiro128Star.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, XorShift128Plus, not Xoroshiro128Plus.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to clarify. The blog post found issues with Xoroshiro128Plus. It recommended as fine XorShift* 128/64. I haven't found any info about Xoroshiro128star.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh really? But then it passed all of the tests of the repo?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It failed a different series of tests (newer I think) called PractRand, and another series called TestU01. These are different from the Big Crush tests (which are the most popular I think). I'm not an expert on these tests, so don't know the significance, but at least some people seem to feel that there are good generators that don't fail these tests that should be preferred. You can see the details on the blog post I linked back in the issue thread.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know enough to comment on this but can change as needed.
Forgot to define the abstract type |
src/aggregators/direct.jl
Outdated
rates = p.rates | ||
|
||
@inbounds fill_cur_rates(u, params, t, cur_rates, 1, rates...) | ||
@inbounds cur_rates[1] = cur_rates[1] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this necessary?
Codecov Report
@@ Coverage Diff @@
## master #20 +/- ##
==========================================
- Coverage 78.73% 78.39% -0.35%
==========================================
Files 13 14 +1
Lines 428 435 +7
==========================================
+ Hits 337 341 +4
- Misses 91 94 +3
Continue to review full report at Codecov.
|
src/aggregators/direct.jl
Outdated
############################# Required Functions ############################# | ||
|
||
# creating the JumpAggregation structure | ||
@inline function aggregate(aggregator::Direct, u, p, t, end_time, constant_jumps, save_positions, rng) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The inline here also seems unnecessary (it was present before but I don't see what good it can do here).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah it's probably unnecessary.
It looks good to me modulo the issue about |
src/aggregators/direct.jl
Outdated
function aggregate(aggregator::Direct, u, p, t, end_time, constant_jumps, save_positions, rng) | ||
rates = ((c.rate for c in constant_jumps)...) | ||
affects! = ((c.affect! for c in constant_jumps)...) | ||
cur_rates = Vector{Float64}(length(rates)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe instead of using Float64's here you should use typeof(t)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. I'll hold off on pushing so I don't trigger so many builds...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, sorry for the intermittent stream of comments there. I'm still getting used to looking at PRs on Github... That should be it from me -- I've gone through everything now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't worry about triggering builds. It'll queue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note you can also add [ci-skip] to make it not queue a build for a commit.
Fantastic. Many thanks to both you for all the help! 🎉 |
Many thanks to you! |
I think everything we discussed is in place. Please feel free to suggest alternative names for the various functions and fields added.