Commit 36286522 authored by Victor's avatar Victor
Browse files

changing ABMEv to EVOID

parent 2e59063c
Pipeline #99039 canceled with stage
......@@ -15,7 +15,7 @@ function World(w::Vector{A},s::S,p::Dict;t::T=0.) where {A<:AbstractAgent,S<:Abs
@unpack D,mu = p
for _m in mu
if !(typeof(_m) <: AbstractFloat)
if !(eltype(_m) <: AbstractFloat)
throw(ArgumentError("elements of mu should be of type AbstractFloat\n
to decide if mutations occur from a uniform probability law"))
end
......
......@@ -3,7 +3,7 @@ using Random
Random.seed!(0)
using LightGraphs
using Test
using Revise,ABMEv
using Revise,EVOID
using UnPack,JLD2
myspace = (RealSpace{1,Float64}(),)
......@@ -26,6 +26,6 @@ w1 = copy(w0)
@info "Running simulation with CFM algorithm"
@time sim = run!(w1,CFM(),tend,b,d,dt_saving=10.)
# ABMEv.clean!(sim)
# EVOID.clean!(sim)
using Plots
Plots.plot(sim)
......@@ -3,7 +3,7 @@ using Random
Random.seed!(0)
using LightGraphs
using Test
using Revise,ABMEv
using Revise,EVOID
using UnPack,JLD2
g1 = LightGraphs.grid([9,1])
......@@ -21,8 +21,8 @@ end
update_g(t) = periodic_update_graph(10,t)
dyng = DynGraphSpace(g,update_g)
## testing atomic methods
@test last(randomwalk(ABMEv.get_graph(dyng,16.),1,10)) 1
@test !(last(randomwalk(ABMEv.get_graph(dyng,1.),1,10)) 1)
@test last(randomwalk(EVOID.get_graph(dyng,16.),1,10)) 1
@test !(last(randomwalk(EVOID.get_graph(dyng,1.),1,10)) 1)
## simulations
myspace = (dyng,)
......
......@@ -3,7 +3,7 @@ using Random
Random.seed!(0)
using LightGraphs
using Test
using Revise,ABMEv
using Revise,EVOID
using UnPack,JLD2
myspace = (RealSpace{1,Float64}(),)
......
using LightGraphs
using Test
using Revise,ABMEv
using Revise,EVOID
using UnPack
myspace1 = (RealSpace{1,Float64}(),)
myspace2 = (RealSpace{1,Float64}(),RealSpace{1,Float64}())
......
......@@ -3,7 +3,7 @@ using Random
Random.seed!(0)
using LightGraphs
using Test
using Revise,ABMEv
using Revise,EVOID
using UnPack,JLD2
myspace = (RealSpace{1,Float64}(),)
......
......@@ -4,7 +4,7 @@ cd(@__DIR__)
using Distributed;addprocs(exeflags="--project")
using Test
@everywhere begin
using ABMEv
using EVOID
sigma_a = 1.251;
K0 = 1000;
K(X) = 1 - 0.125 * sum(X.^2)
......
using Distributed;addprocs()
@everywhere push!(LOAD_PATH,homedir()*"/ETHZ/projects/ABMEv.jl/src")
@everywhere using ABMEv,BenchmarkTools,SharedArrays
@everywhere push!(LOAD_PATH,homedir()*"/ETHZ/projects/EVOID.jl/src")
@everywhere using EVOID,BenchmarkTools,SharedArrays
## Testing update_afterbirth_std!
p= Dict("K0" => 1000.,
......@@ -20,7 +20,7 @@ C = SharedArray{Float64}((Int(p["K0"]),Int(p["K0"])))
@btime update_afterbirth_std!(skipmissing(world0),C,1,p)
## Testing get_inc_reflected
using ABMEv,BenchmarkTools
using EVOID,BenchmarkTools
a = Agent(rand(1))
@btime get_inc_reflected(get_x(a)[1],.1 *randn())
@btime rand()
......@@ -33,7 +33,7 @@ a = Agent(rand(1))
@btime get_xhist(a)[:,end]
##
using ABMEv,BenchmarkTools
using EVOID,BenchmarkTools
a = 0;
sigma_K = .9;
sigma_a = .7;
......@@ -50,7 +50,7 @@ p_default = Dict(
na_init = 1000
world0 = new_world_G(na_init,p_default,spread = .01, offset = -.25)
tspan=zeros(1)
import ABMEv:update_rates_std!,updateWorld_G!
import EVOID:update_rates_std!,updateWorld_G!
@btime update_rates_std!(skipmissing(world0),p_default,0.)
@btime updateWorld_G!(world0,p_default,update_rates_std!,tspan,true)
@btime update_afterbirth_std!(skipmissing(world0),1,p_default)
......@@ -60,7 +60,7 @@ import ABMEv:update_rates_std!,updateWorld_G!
# For now Gillepsie can not really be parallelised
using Distributed;addprocs(exeflags="--project")
@everywhere begin
using ABMEv
using EVOID
sigma_a = 1.251;
K0 = 1000;
K(X) = 1 - 0.125 * sum(X.^2)
......@@ -88,7 +88,7 @@ using Random
Random.seed!(0)
using LightGraphs
using Test
using Revise,ABMEv
using Revise,EVOID
using UnPack,JLD2
myspace = (RealSpace{1,Float64}(),)
......
using ABMEv, Test, JLD2,Random
using EVOID, Test, JLD2,Random
@testset "ABMEv" begin
@testset "EVOID" begin
include("gillepsie.jl")
# include("wrightfisher.jl")
include("metrics.jl")
......
using LightGraphs
using Test
using Revise,ABMEv
using Revise,EVOID
using UnPack
myspace = (GraphSpace(SimpleGraph(10,10)),RealSpace{1,Float64}())
myagents = [Agent(myspace,ancestors=true,rates=true) for i in 1:10]
......
using LightGraphs
using Test
using Revise,ABMEv
using Revise,EVOID
##### SPACES #####
mysegment = DiscreteSegment(1,10)
......@@ -23,19 +23,19 @@ myspace2 = (mysegment,mycontinuoussegment,real2d)
@test eltype(myspace2) == Tuple{Int64,Float64,Float64}
# increment on infinite spaces
@test ABMEv.get_inc(0.,myline) (0.)
@test ABMEv.get_inc(0.,mydiscreteline) (0.)
@test !(ABMEv.get_inc(1.,myline) 0.)
@test EVOID.get_inc(0.,myline) (0.)
@test EVOID.get_inc(0.,mydiscreteline) (0.)
@test !(EVOID.get_inc(1.,myline) 0.)
@test !(get_inc(1,1.,myline) 0.)
# @test !(get_inc(1,1.,mydiscreteline) ≈ 0.)
@test typeof(ABMEv.get_inc([1.,0.],real2d)) == Vector{Float64}
@test typeof(EVOID.get_inc([1.,0.],real2d)) == Vector{Float64}
@test typeof(get_inc([1.,0.],[1.,0.],real2d)) == Vector{Float64}
@test typeof(ABMEv.get_inc([1.],real2d)) == Vector{Float64}
@test typeof(ABMEv.get_inc(1.,real2d)) == Vector{Float64}
# ABMEv._get_inc([1.],real2d)
# ABMEv.initpos(myspace2)
@test typeof(EVOID.get_inc([1.],real2d)) == Vector{Float64}
@test typeof(EVOID.get_inc(1.,real2d)) == Vector{Float64}
# EVOID._get_inc([1.],real2d)
# EVOID.initpos(myspace2)
# increment on finite spaces
......@@ -44,10 +44,10 @@ myspace2 = (mysegment,mycontinuoussegment,real2d)
@test mysegment.s - eps() < get_inc(5.,100.,mysegment) + 5. < mysegment.e + eps()
@test mycontinuoussegment.s < get_inc(0.,100.,mycontinuoussegment) < mycontinuoussegment.e
mysegment2 = DiscreteSegment(-1,1)
@test ABMEv._reflect1D(0.,2.0,mysegment2) .0
@test ABMEv._reflect1D(0.,-2.0,mysegment2) .0
@test ABMEv._reflect1D(0.,4.0,mysegment2) .0
@test ABMEv._reflect1D(0.,1.1,mysegment2) 1 - .1
@test EVOID._reflect1D(0.,2.0,mysegment2) .0
@test EVOID._reflect1D(0.,-2.0,mysegment2) .0
@test EVOID._reflect1D(0.,4.0,mysegment2) .0
@test EVOID._reflect1D(0.,1.1,mysegment2) 1 - .1
end
#checking if graph works
......@@ -79,15 +79,15 @@ end
@test nancestors(increment_x!(a2,myspace,p_myspace,2.)) > 1
@test !isnothing(increment_x!(a4,myspace2,p_myspace2,2.))
@test !isnothing(increment_x!(a5,myspace2,p_myspace2,2.))
@test typeof(ABMEv._get_xinc(a2,myspace,p_myspace,0.)) == typeof(get_x(a2))
@test typeof(EVOID._get_xinc(a2,myspace,p_myspace,0.)) == typeof(get_x(a2))
# testing if get_xinc does not modify the value of a4
a4 = Agent(myspace2,[1,1.,[1.,1]],rates=true)
_xinc = ABMEv._get_xinc(a4,myspace2,p_myspace2,0.)
_xinc = EVOID._get_xinc(a4,myspace2,p_myspace2,0.)
@test get_x(a4) == [1,1.,[1.,1]]
end
# @show ABMEv._get_xinc(a4,myspace2,p_myspace2,0.)
# @show EVOID._get_xinc(a4,myspace2,p_myspace2,0.)
@testset "Multidimensional spaces" begin
myspace = (RealSpace{10,Float64}(),)
a1 = Agent(myspace)
......
using LightGraphs
using Test
using Revise,ABMEv
using Revise,EVOID
using UnPack
myspace = (GraphSpace(SimpleGraph(10,10)),RealSpace{1,Float64}())
myagents = [Agent(myspace,ancestors=true,rates=true) for i in 1:10]
......@@ -16,7 +16,7 @@ p = Dict{String,Any}();@pack! p = d,b,D,mu,NMax
@test eltype(myagents) <: AbstractAgentM
@test typeof(myagents) <: Vector{A} where {A<:AbstractAgentM}
w = ABMEv.World(myagents,myspace,p)
w = EVOID.World(myagents,myspace,p)
@test typeof(w.p["D"][1]) == Int64
@test size(w) 10
newa = give_birth(1,w)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment