Commit 47934404 authored by Victor Boussange's avatar Victor Boussange
Browse files

We have modified Agent file with carrying capacity and competition kernel...

We have modified Agent file with carrying capacity and competition kernel using pdf funtion from Distributions.jl
However this will soon change.
parent 50d1dfbc
......@@ -12,17 +12,25 @@ Pkg.activate("path_to_ABMEv")
```
## Birth and Death mechanisms
> We are always balanced between taking the integral of the competition and resource kernel as constant, or taking its maximum peak as constant.
:poop:
## Geotrait
The geotrait is calculated *a posteriori*, and is not taken into account during the simulation.
> It used to be but for the sake of simplicity we now forget about it.
### Mutation
If anisotropy in mutation, the following parameters should be declared as arrays where each entry corresponds to a dimension.
- ```mu``` The probability of mutation.
- ```D``` If mutation happens on the agent, the increment follows a Normal law $`\mathcal{N}_{\mu = 0, \sigma = D}`$
- ```D``` If mutation happens on the agent, the increment follows $\mathcal{N}_{ 0, D}$
### Birth
#### Growth
- Resource kernel is defined as
- Resource kernel for agent with trait $x$ is defined as
```math
K(x) = K_0 \exp(-\sum_i^{N(t)} \frac{1}{\sigma_{K)i}^{n_K}}\sum_j^T (x_{i,j} - \mu)^{n_K})
K_{\mu,\sigma}(x) = K_0 \mathcal{N}_{\mu,\sigma}(x)
```
with $\mu$ and $\sigma$ potentially vectors.
> We just modified this in ABMEv_Agent.jl so you should check if it works.
- Dirth coefficient is defined as $`b(x) = K(x)`$
### Death
#### Competition
......
......@@ -95,18 +95,27 @@ end
Gaussian competition kernel
"""
function α(a1::Array{Float64},a2::Array{Float64},n_alpha::Float64,sigma_a::Array{Float64})
return exp( - sum(sum((a1 .- a2).^n_alpha,dims=2)./ sigma_a[:].^n_alpha))
return exp( -.5 sum(sum((a1 .- a2).^n_alpha,dims=2)./ sigma_a[:].^n_alpha))
end
"""
function K(x::Array{Float64},K0::Float64,n_K::Float64,sigma_K::Array{Float64};μ::Float64=.0)
K(x::Array{Float64},K0::Float64,μ::Array{Float64},sigma_K::Array{Float64})
Gaussian resource kernel
"""
function K(x::Array{Float64},K0::Float64,n_K::Float64,sigma_K::Array{Float64};μ::Float64=.0)
return K0*exp(-sum(sum((x .- μ).^n_K,dims=2)./sigma_K[:].^n_K))
function K(x::Array{Float64},K0::Float64,μ::Array{Float64},sigma_K::Array{Float64})
# return K0*exp(-sum(sum((x .- μ).^n_K,dims=2)./sigma_K[:].^n_K))
return K0 * pdf(MvNormal(μ,sigma_K),x)
end
"""
K(x::Array{Float64},K0::Float64,sigma_K::Array{Float64})
Gaussian resource kernel with mean 0.
"""
function K(x::Array{Float64},K0::Float64,sigma_K::Array{Float64})
# return K0*exp(-sum(sum((x .- μ).^n_K,dims=2)./sigma_K[:].^n_K))
return K0 * pdf(MvNormal(sigma_K),x)
end
KK(x::Array{Float64},K0::Float64,n_K::Float64,sigma_K::Array{Float64},μ1::Float64,μ2::Float64) = K(x,K0,n_K,sigma_K,μ=μ1) + K(x,K0,n_K,sigma_K,μ=μ2)
KK(x::Array{Float64},K0::Float64,n_K::Float64,sigma_K::Array{Float64},μ1::Float64,μ2::Float64) = K(x,K0/2,μ1,sigma_K) + K(x,K0/2,μ2,sigma_K)
"""
function tin(t::Float64,a::Float64,b::Float64)
......
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