Commit e0f9c937 authored by Victor's avatar Victor

again bm dm update

parent 629d8201
Pipeline #77578 passed with stage
in 22 minutes and 10 seconds
......@@ -31,15 +31,15 @@ function updateWorld!(w::World{A,S,T},c::CFM) where {A,S,T}
alive = agents(w)
# Total rate of events
n = size(w)
Cbar = (bm + dm)
dt = rand(Exponential(Cbar)) / (n*(n+1))
CbarI = bm + dm*(n+1)
dt = rand(Exponential(CbarI)) / n
update_clock!(w,dt)
i = rand(1:n)
x = get_x(w[i])
W = rand()
if dt > 0.
deathprob = (sum(d.(get_x.(alive),Ref(x),w.t)) .- d(x,x,w.t)) / (Cbar*(n+1))
birthprob = b(x,w.t) / (Cbar*(n+1))
deathprob = (sum(d.(get_x.(alive),Ref(x),w.t)) .- d(x,x,w.t)) / CbarI
birthprob = b(x,w.t) / CbarI
if W <= deathprob
updateDeathEvent!(w,c,i)
elseif W <= deathprob + birthprob
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment