diff --git a/docs/src/examples/delta_competition_example.md b/docs/src/examples/delta_competition_example.md index c6c4dbc65dbed3342a85e3d804b323cd93ab7636..5ab1ce5a31abaa7c16499e8da912587c3de14ffc 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 b7c875f896f70ac5939d92d3740d39a510d96d9b..1ca0d5bb346cae1b166587550ebdc3924e667cc7 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 df9114ea2530fde51db321b31ddded4c2d4232b8..22f565d2ffa77fb6e08416fbbbc7856181c2c6c4 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 5d207d9ff4619b78b3a23f4b9699654e35dc431d..bb7ca382a1968866c8bad316328c16c3d6149645 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