gillepsie_discrete_2d.jl 773 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
using ABMEv,UnPack
cd(@__DIR__)
using Dates
using JLD2
using Random;Random.seed!(0)


a = 1;
D = [1e0;a];
mu = [1.;.001];
sigma_K = 1.;
sigma_a = .8;
nodes = 10
K0 = 1000
K(X) = gaussian(X[2],X[1] * a,sigma_K) / nodes
alpha(X,Y) = (X[1]  Y[1]) * gaussian(X[2],Y[2],sigma_a) / K0
NMax = 5000
18
tend = 1.
19
20
21
22
23
24
25
26
27
28
29
30
31
32
reflected = true;
dt_saving = 15.

p = Dict{String,Any}()
@pack! p = alpha,K,D,NMax,tend,reflected,nodes, dt_saving,mu


agent0 = [Agent{MixedAgent}( Float32[rand(1:p["nodes"]), 1e-2* randn() + (p["nodes"] + 1 ) * a/2 ] ) for i in 1:K0]
world0 = vcat(agent0[:],repeat([missing],Int(p["NMax"] - K0)))
worldall,p["tspan"] = runWorld_store_G(p,world0);
# @save "worldall_discrete_a=$(a)_mu2=$(mu[2])_D2=$(D[2])_D1=$(D[1]).jld2"

using Plots
Plots.plot(worldall,p,trait=2)