-
-
Notifications
You must be signed in to change notification settings - Fork 37
feat: Introducing vr_aggregator with VRDirectCB and VRFRMODE #477
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
base: master
Are you sure you want to change the base?
feat: Introducing vr_aggregator with VRDirectCB and VRFRMODE #477
Conversation
Signed-off-by: sivasathyaseeelan <dnsiva.sathyaseelan.chy21@iitbhu.ac.in>
Signed-off-by: sivasathyaseeelan <dnsiva.sathyaseelan.chy21@iitbhu.ac.in>
Signed-off-by: sivasathyaseeelan <dnsiva.sathyaseelan.chy21@iitbhu.ac.in>
Signed-off-by: sivasathyaseeelan <dnsiva.sathyaseelan.chy21@iitbhu.ac.in>
Signed-off-by: sivasathyaseeelan <dnsiva.sathyaseelan.chy21@iitbhu.ac.in>
Signed-off-by: sivasathyaseeelan <dnsiva.sathyaseelan.chy21@iitbhu.ac.in>
Signed-off-by: sivasathyaseeelan <dnsiva.sathyaseelan.chy21@iitbhu.ac.in>
Signed-off-by: sivasathyaseeelan <dnsiva.sathyaseelan.chy21@iitbhu.ac.in>
Signed-off-by: sivasathyaseeelan <dnsiva.sathyaseelan.chy21@iitbhu.ac.in>
Signed-off-by: sivasathyaseeelan <dnsiva.sathyaseelan.chy21@iitbhu.ac.in>
Signed-off-by: sivasathyaseeelan <dnsiva.sathyaseelan.chy21@iitbhu.ac.in>
Signed-off-by: sivasathyaseeelan <dnsiva.sathyaseelan.chy21@iitbhu.ac.in>
Signed-off-by: sivasathyaseeelan <dnsiva.sathyaseelan.chy21@iitbhu.ac.in>
Signed-off-by: sivasathyaseeelan <dnsiva.sathyaseelan.chy21@iitbhu.ac.in>
Signed-off-by: sivasathyaseeelan <dnsiva.sathyaseelan.chy21@iitbhu.ac.in>
Signed-off-by: sivasathyaseeelan <dnsiva.sathyaseelan.chy21@iitbhu.ac.in>
Signed-off-by: sivasathyaseeelan <dnsiva.sathyaseelan.chy21@iitbhu.ac.in>
Signed-off-by: sivasathyaseeelan <dnsiva.sathyaseelan.chy21@iitbhu.ac.in>
Signed-off-by: sivasathyaseeelan <dnsiva.sathyaseelan.chy21@iitbhu.ac.in>
Signed-off-by: sivasathyaseeelan <dnsiva.sathyaseelan.chy21@iitbhu.ac.in>
@sivasathyaseeelan I'm traveling the next few days, but will try to take a look Sunday if I have a chance, or next Tuesday. |
@@ -0,0 +1,140 @@ | |||
using DiffEqBase, JumpProcesses, OrdinaryDiffEq, StochasticDiffEq |
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.
This should be moved to SciMLBenchmarks.jl
rate_funcs = [jump.rate for jump in vjumps] | ||
affect_funcs = [jump.affect! for jump in vjumps] |
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.
These should get functionwrapped if they aren't tuples?
cur_rates::Vector{T} | ||
|
||
function VRDirectCBEventCache(jumps::JumpSet; rng = DEFAULT_RNG) | ||
T = Float64 # Could infer from jumps or t later |
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.
Should get an issue.
end | ||
rate_increment *= (dt / 2) | ||
|
||
cache.cumulative_rate += rate_increment |
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.
what is this quantity? Because it's not correctly the cumulative rate: it doesn't take into account condition rejections. But it's also not used.
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 should probably just be deleted?
rate_increment *= (dt / 2) | ||
|
||
cache.cumulative_rate += rate_increment | ||
cache.total_rate_cache = total_variable_rate(vjumps, u, p, t, cache.cur_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.
Why is this evaluated here instead of in the affect!?
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.
Move this there, it's just unnecessary on most steps.
# Condition functor defined directly on the cache | ||
function (cache::VRDirectCBEventCache)(u, t, integrator) | ||
if integrator.t != cache.current_time | ||
cache.prev_threshold = cache.current_threshold |
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.
This has a bug because cache.current_threshold
is never set, so you'll never actually accumulate.
cache.prev_threshold = cache.current_threshold | ||
cache.current_threshold = randexp(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.
cache.prev_threshold = cache.current_threshold | |
cache.current_threshold = randexp(rng) | |
cache.current_threshold = randexp(rng) | |
cache.prev_threshold = cache.current_threshold |
|
||
return cache.prev_threshold - rate_increment |
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.
return cache.prev_threshold - rate_increment | |
cache.current_threshold = cache.prev_threshold - rate_increment # cache increment if not zeroed in this round | |
return cache.current_threshold |
It's impossible for this to generally work without actually updating the current threshold https://github.com/SciML/JumpProcesses.jl/pull/477/files#r2052157167, so make a test case that stresses that and fails and then after bringing in that change it should pass. You should be able to see this if you do something like set |
Checklist
contributor guidelines, in particular the SciML Style Guide and
COLPRAC.
Additional context
Add any other context about the problem here.