Commit 629d8201 by Victor

### updating CFM

parent 61201fb0
Pipeline #77570 passed with stage
in 23 minutes and 29 seconds
 ... @@ -31,15 +31,15 @@ function updateWorld!(w::World{A,S,T},c::CFM) where {A,S,T} ... @@ -31,15 +31,15 @@ function updateWorld!(w::World{A,S,T},c::CFM) where {A,S,T} alive = agents(w) alive = agents(w) # Total rate of events # Total rate of events n = size(w) n = size(w) Cbar = (bm + dm)*n Cbar = (bm + dm) dt = rand(Exponential(Cbar)) / n dt = rand(Exponential(Cbar)) / (n*(n+1)) update_clock!(w,dt) update_clock!(w,dt) i = rand(1:n) i = rand(1:n) x = get_x(w[i]) x = get_x(w[i]) W = rand() W = rand() if dt > 0. if dt > 0. deathprob = (sum(d.(get_x.(alive),Ref(x),w.t)) .- d(x,x,w.t)) / Cbar deathprob = (sum(d.(get_x.(alive),Ref(x),w.t)) .- d(x,x,w.t)) / (Cbar*(n+1)) birthprob = b(x,w.t) / Cbar birthprob = b(x,w.t) / (Cbar*(n+1)) if W <= deathprob if W <= deathprob updateDeathEvent!(w,c,i) updateDeathEvent!(w,c,i) elseif W <= deathprob + birthprob 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!