Commit 7b466e4d by Victor Boussange

### no message

parent 41f47779
 ... ... @@ -52,12 +52,13 @@ This function increments current position by inc and updates xhist, function increment_x!(a::Agent{Float64},p::Dict;reflected=false) tdim = length(p["D"]) if reflected inc = [get_inc_reflected(get_x(a)[1],p["D"][1] *randn())] inc = [get_inc_reflected(get_x(a,1),p["D"][1] *randn())] if tdim > 1 inc = vcat(inc,rand.(Binomial.(1,p["mu"][2:end])) .* p["D"][2:end] .* randn(tdim-1)) inc = vcat(inc,(rand(tdim-1) < p["mu"][2:end]) .* p["D"][2:end] .* randn(tdim-1)) end else inc = rand.(Binomial.(1,p["mu"][:])) .* p["D"][:] .* randn(length(tdim)) # inc = yes no mutation * mutation inc = (rand(tdim) < vec(p["mu"])) .* vec(p["D"][:]) .* randn(tdim) end a.x_history = hcat(a.x_history, get_x(a) + reshape(inc,:,1)); end ... ...
 ... ... @@ -8,11 +8,11 @@ K(X) = gaussian(X[1],0.,sigma_K) p_default = Dict( "alpha" => α, "K" => K, "D" => [1e-2], # we let mutation constant and =1e-3 "mu" => [.1], # we consider there is a probability of 1 to have mutation "tend" => 150., "D" => [1e-2], "mu" => [.1], "tend" => 1000., "NMax" => Int(10000)) na_init = 150 na_init = 200 world0 = new_world_G(na_init,p_default,spread = .01, offset = -.25) @time worldall,p_default["tspan"] = runWorld_store_G(p_default,world0) # ====================================================================== ... ...
 ... ... @@ -2,6 +2,7 @@ using Distributed;addprocs() @everywhere push!(LOAD_PATH,homedir()*"/ETHZ/projects/ABMEv.jl/src") @everywhere using ABMEv,BenchmarkTools,SharedArrays ## Testing update_afterbirth_std! p= Dict("K0" => 1000., "D" => [1e-2 - 1e-3], "mu" => [.1], ... ... @@ -17,3 +18,7 @@ world0 = vcat(agent0[:],repeat([missing],Int(p["NMax"] - na_init))) C = SharedArray{Float64}((Int(p["K0"]),Int(p["K0"]))) @btime update_afterbirth_std!(skipmissing(world0),C,1,p) ## Testing get_inc_reflected a = Agent @btime get_inc_reflected(get_x(a,1),p["D"][1] *randn())
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!