world.jl 817 Bytes
Newer Older
1
2
3
using LightGraphs
using Test
using Revise,ABMEv
Victor's avatar
Victor committed
4
using UnPack
5
6
myspace = (GraphSpace(SimpleGraph(10,10)),RealSpace{1,Float64}())
myagents = [Agent(myspace,ancestors=true,rates=true) for i in 1:10]
Victor's avatar
Victor committed
7
8
d(X,Y,t) = gaussian(X[1],Y[1],1)
b(X,Y,t) = gaussian(X[1],0,1)
9
10
11
12
13
14
15
D = (Int64(1),Float64(1.))
mu = [1,1]
NMax = 100
p = Dict{String,Any}();@pack! p = d,b,D,mu,NMax



Victor's avatar
Victor committed
16
17
@test eltype(myagents) <: AbstractAgentM
@test typeof(myagents) <: Vector{A} where {A<:AbstractAgentM}
18

Victor's avatar
Victor committed
19
w = World(myagents,myspace,p,0.)
20
21
22
23
24
25
26
27
@test size(w)  10
newa = give_birth(1,w)
addAgent!(w,newa)
@test size(w)  11
removeAgent!(w,11)
@test size(w)  10
@test isnothing(update_clock!(w,.1))

28
29
30
@test typeof(w[1]) <: AbstractAgent
@test size(get_x(w,:)) == (10,2)

31
32
##############  Testing world with Gillepsie
@test !isnothing(updateWorld!(w,Gillepsie()))