metrics_hamming.jl 753 Bytes
Newer Older
Victor's avatar
Victor committed
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;
13
14
b(X,t) = gaussian(X[1],0.,sigma_K)
d(X,Y,t) = gaussian(X[1],Y[1],sigma_a)/K0
Victor's avatar
Victor committed
15
16
17
18
D = (1e-2,)
mu = [.1]
NMax = 10000
tend = 1.5
Victor's avatar
Victor committed
19
p = Dict{String,Any}();@pack! p = D,mu,NMax
Victor's avatar
Victor committed
20

21
myagents = [Agent(myspace,[0.,],ancestors=true,rates=true) for i in 1:K0]
Victor's avatar
Victor committed
22
23
w0 = World(myagents,myspace,p,0.)
@info "Running simulation with Gillepsie algorithm"
Victor's avatar
Victor committed
24
@time sim = run!(w0,Gillepsie(),tend,b,d)
Victor's avatar
Victor committed
25
26
27
28
29
30

@testset "Hamming distances" begin
    @test typeof(get_xhist_mat(agents(w0))[1] )<: Array
    @test get_pairwise_average_isolation(w0) >0
    @test get_local_pairwise_average_isolation(w0) > 0
end