cfm.jl 709 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
cd(@__DIR__)
using Random
Random.seed!(0)
using LightGraphs
using Test
using Revise,ABMEv
using UnPack,JLD2

myspace = (RealSpace{1,Float64}(),)
sigma_K = .9;
sigma_a = .7;
K0 = 1000;
Victor's avatar
Victor committed
13
14
b(X,t) = 1.
d(X,Y,t) = gaussian(X[1],Y[1],sigma_a)/gaussian(X[1],0.,sigma_K)/K0
15
D = [1e-2]
16
mu = [.1]
Victor's avatar
Victor committed
17
NMax = 2000
Victor's avatar
Victor committed
18
tend = 1500
Victor's avatar
Victor committed
19
20
21
# Cbar = b([0],0.)/K0 + d([0],[0],0.)
dm = d([0],[0],0.);bm = 1.
p = Dict{String,Any}();@pack! p = d,b,D,mu,NMax,dm,bm
22

23
myagents = [Agent(myspace,[1e-2 * randn()],ancestors=false,rates=false) for i in 1:K0]
24
25
26
w0 = World(myagents,myspace,p,0.)
w1 = copy(w0)
@info "Running simulation with CFM algorithm"
27
@time sim = run!(w1,CFM(),tend,b,d,dt_saving=10.)
28

Victor's avatar
Victor committed
29
# ABMEv.clean!(sim)
30
31
using Plots
Plots.plot(sim)