From f80c1a7b34b3061235b080c05d964613976c0c63 Mon Sep 17 00:00:00 2001 From: Victor Date: Wed, 11 Nov 2020 11:00:56 +0100 Subject: [PATCH] updates on docs --- docs/src/examples/delta_competition_example.md | 4 ++-- docs/src/manual/gillepsie.md | 4 ++-- src/ABMEv_world.jl | 11 +++++++++++ src/algo/ABMEv_Gillepsie.jl | 9 --------- 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/docs/src/examples/delta_competition_example.md b/docs/src/examples/delta_competition_example.md index c6c4dbc..5ab1ce5 100644 --- a/docs/src/examples/delta_competition_example.md +++ b/docs/src/examples/delta_competition_example.md @@ -38,11 +38,11 @@ gplot(g, collect(1:nodes), collect(1:nodes)) ## Defining competition processes We propose that any individual have a constant birth rate, and competes with all the individuals present in the same patch. Assume there are N_t individuals at time t. -Let i \in \{ 1,2,\dots,N_t\}. x_{i,t} \in \{1,2,\dots,9\} denotes the position of the i-th individual at time t. +Let i \in \{ 1,2,\dots,N_t\}. x_{i} \in \{1,2,\dots,9\} denotes the position of the i-th individual. The competition pressure experienced by individual i is such that math -d(x_{i,t}) = \sum_j^{N(t)} \delta(x_{i,t}-x_{j,t}) +d(x_{i},t) = \sum_j^{N(t)} \delta(x_{i}-x_{j})  where \delta is the dirac function. diff --git a/docs/src/manual/gillepsie.md b/docs/src/manual/gillepsie.md index b7c875f..1ca0d5b 100644 --- a/docs/src/manual/gillepsie.md +++ b/docs/src/manual/gillepsie.md @@ -16,7 +16,7 @@ A particular event, birth or death, is chosen at random with a probability equal ### Time steps An event is exponentiallly distributed in time, with parameter \lambda = U(t). This makes events memoryless, meaning that the probability of having a birth or death event is always the same, no matter when (P(X > s_t | X > t) = P(X > s) . -!!! tip "Inversion method" + @autodocs Modules = [ABMEv] diff --git a/src/ABMEv_world.jl b/src/ABMEv_world.jl index df9114e..22f565d 100644 --- a/src/ABMEv_world.jl +++ b/src/ABMEv_world.jl @@ -91,3 +91,14 @@ function get_xarray(world::World,geotrait::Bool=false) return xarray end @deprecate get_xarray(world,geotrait=false) get_x(world,Colon()) + +""" + function give_birth(mum_idx::Int,w::World) +Copies agent within index mum_idx`, and increment it by dx. +Return new agent (offspring). +""" +function give_birth(mum_idx::Int,w::World) + new_a = copyxt(w[mum_idx]) + increment_x!(new_a,space(w),parameters(w),time(w)) + return new_a +end diff --git a/src/algo/ABMEv_Gillepsie.jl b/src/algo/ABMEv_Gillepsie.jl index 5d207d9..bb7ca38 100644 --- a/src/algo/ABMEv_Gillepsie.jl +++ b/src/algo/ABMEv_Gillepsie.jl @@ -5,15 +5,6 @@ \$(TYPEDEF) """ struct Gillepsie <: AbstractAlg end export Gillepsie -""" - function give_birth(a::Agent,t,p::Dict) -Used for Gillepsie setting -""" -function give_birth(mum_idx::Int,w::World) - new_a = copyxt(w[mum_idx]) - increment_x!(new_a,space(w),parameters(w),time(w)) - return new_a -end function updateBirthEvent!(w::World,::Gillepsie,mum_idx::Int,b,d) # updating competition only the two columns corresponding to agent idx -- GitLab