To receive notifications about scheduled maintenance, please subscribe to the mailing-list gitlab-operations@sympa.ethz.ch. You can subscribe to the mailing-list at https://sympa.ethz.ch

metrics_hamming.jl 752 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
19
20
21
22
23
24
25
26
27
28
29
30
D = (1e-2,)
mu = [.1]
NMax = 10000
tend = 1.5
p = Dict{String,Any}();@pack! p = d,b,D,mu,NMax

myagents = [Agent(myspace,(0,),ancestors=true,rates=true) for i in 1:K0]
w0 = World(myagents,myspace,p,0.)
@info "Running simulation with Gillepsie algorithm"
@time sim = run!(w0,Gillepsie(),tend)

@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