The RandomLotkaVolterraCavity Module
RandomLotkaVolterraCavity.RandomLotkaVolterraCavity — Module
Module for "RandomLotkaVolterraCavity.jl" – A Julia package for the study of the fixed-point structure of the Lotka-Volterra model on random graphs with cavity method.
Exports
Module Index
RandomLotkaVolterraCavity.RandomLotkaVolterraCavityRandomLotkaVolterraCavity.AbstractNoiseKindRandomLotkaVolterraCavity.CavityFPRandomLotkaVolterraCavity.CavityFP_BPRandomLotkaVolterraCavity.DeterministicRandomLotkaVolterraCavity.MarginalFPRandomLotkaVolterraCavity.MarginalFP_BPRandomLotkaVolterraCavity.ModelRandomLotkaVolterraCavity.ModelDisorderedRandomLotkaVolterraCavity.ModelDisorderedFCRandomLotkaVolterraCavity.NodeFPRandomLotkaVolterraCavity.NodeFP_BPRandomLotkaVolterraCavity.NodeFP_IBMFRandomLotkaVolterraCavity.PopFPRandomLotkaVolterraCavity.PopFP_BPRandomLotkaVolterraCavity.PopJRandomLotkaVolterraCavity.analytic_FCRandomLotkaVolterraCavity.run_BP_FPRandomLotkaVolterraCavity.run_BP_FPRandomLotkaVolterraCavity.run_GECaM_FPRandomLotkaVolterraCavity.run_GECaM_FPRandomLotkaVolterraCavity.run_IBMF_FPRandomLotkaVolterraCavity.run_IBMF_FPRandomLotkaVolterraCavity.run_MCRandomLotkaVolterraCavity.run_MCRandomLotkaVolterraCavity.run_MCRandomLotkaVolterraCavity.sample_couplingsRandomLotkaVolterraCavity.sample_couplings
Detailed API
RandomLotkaVolterraCavity.AbstractNoiseKind — Type
AbstractNoiseKindAn abstract type that represents the kind of noise in the model. It can be one of the following:
Deterministic: Represents deterministic dynamics, i.e., no noise.Demographic: Represents demographic noise, i.e., emerging from birth and death processes.Environmental: Represents environmental noise, i.e., arising from external factors affecting the population dynamics.
RandomLotkaVolterraCavity.CavityFP — Type
CavityFP{Deterministic, I, RT}A type that represents a cavity in the fixed-point algorithm for deterministic dynamics.
Fields
i::Integer: Node indexj::Integer: Neighbor indexmu::Real: Cavity mean abundanceq::Real: Cavity correlationchi::Real: Cavity susceptibilitypsi::Real: Cavity survival probability
RandomLotkaVolterraCavity.CavityFP_BP — Type
CavityFP_BP{Deterministic, I, RT}A type that represents a cavity in the Belief Propagation (BP) fixed-point algorithm for deterministic dynamics, using the simplified version where Fluctuation Dissipation Theorem (FDT) holds, i.e. χ = βq.
Fields
i::Integer: Node indexj::Integer: Neighbor indexmu::Real: Cavity mean abundanceq::Real: Cavity correlation
RandomLotkaVolterraCavity.Deterministic — Type
Deterministic <: AbstractNoiseKindA type that represents deterministic dynamics, i.e., no noise.
RandomLotkaVolterraCavity.MarginalFP — Type
MarginalFP{Deterministic, I, RT}A type that represents a marginal in the fixed-point algorithm for deterministic dynamics.
Fields
i::Integer: Node indexmu::Real: Marginal mean abundanceq::Real: Marginal correlationchi::Real: Marginal susceptibilitypsi::Real: Marginal survival probability
RandomLotkaVolterraCavity.MarginalFP_BP — Type
MarginalFP_BP{Deterministic, I, RT}A type that represents a marginal in the Belief Propagation (BP) fixed-point algorithm for deterministic dynamics, using the simplified version where Fluctuation Dissipation Theorem (FDT) holds, i.e. χ = βq.
Fields
i::Integer: Node indexmu::Real: Marginal mean abundanceq::Real: Marginal correlation
RandomLotkaVolterraCavity.Model — Type
Model{NK<:AbstractNoiseKind, I<:Integer, RT<:Real, MT<:AbstractMatrix{RT}}<A type to store the main parameters for simulating a generalized Lotka-Volterra on a graph.
Fields
N::Integer: Number of nodes in the system.M::Integer: Number of discretized time steps for the simulation trajectories.J::AbstractMatrix{RT} where RT<:Real: Adjacency matrix representing the interactions between nodes. Can be a dense or sparse matrix with Real-valued elements.lam::Real: Immigration rate (lambda).p0::Distributions.Distribution: Distribution or sampler for initial conditions (p0) of trajectories. This could be a function (e.g.,rng -> initial_state), a distribution object from a package like Distributions.jl, or a custom sampler type.
noise::AbstractNoiseKind: Noise of the system.
RandomLotkaVolterraCavity.ModelDisordered — Type
ModelDisordered{NK<:AbstractNoiseKind, I<:Integer, RT<:Real, D1<:Distribution, D2<:Distribution, D3<:Distribution, FT<:Function}A type to store the main parameters for simulating a generalized Lotka-Volterra system with disordered couplings on a random graph.
Fields
N::Integer: Number of nodes in the system.K::Real: Average degree of the interaction graph.M::Integer: Number of discretized time steps for the simulation trajectories.generate_adj::Function: Function to generate the adjacency matrixdeg_pdf::Distributions.Distribution: Distribution or sampler for the degree of the nodes. This should be a distribution object from the package Distributions.jl.deg_cav_pdf::Distributions.Distribution: Distribution or sampler for the cavity degree of the nodes. This should be a distribution object from the package Distributions.jl.m::Real: Average coupling strengthsigma2::Real: Variance of the coupling strengthcorr::Real: Correlation of the couplings strengthlam::Real: Immigration rate (lambda).p0::Distributions.Distribution: Distribution or sampler for initial conditions (p0) of trajectories. This should be a distribution object from the package Distributions.jl.noise::AbstractNoiseKind: Noise of the system.
RandomLotkaVolterraCavity.ModelDisorderedFC — Type
ModelDisorderedFC{NK<:AbstractNoiseKind, I<:Integer, RT<:Real, D<:Distribution}A type to store the main parameters for simulating a generalized Lotka-Volterra system with disordered couplings on a fully-connected graph.
Fields
N::Integer: Number of nodes in the system.M::Integer: Number of discretized time steps for the simulation trajectories.m::Real: Average coupling strengthsigma2::Real: Variance of the coupling strengthcorr::Real: Correlation of the couplings strengthlam::Real: Immigration rate (lambda).p0::Distributions.Distribution: Distribution or sampler for initial conditions (p0) of trajectories. This should be a distribution object from the package Distributions.jl.noise::AbstractNoiseKind: Noise of the system.
RandomLotkaVolterraCavity.NodeFP — Type
NodeFP{Deterministic, I, RT}A type that represents a node in the fixed-point algorithm for deterministic dynamics.
Fields
i::Integer: Node indexneighs::Vector{I} where I<:Integer: Neighbors' indicesneighs_idx::Dict{I, I} where I<:Integer: Dictionary to map neighbors' indices to their positions in theneighsvectorcavs::Array{CavityFP{Deterministic, I, RT}, 1} where {Deterministic, I<:Integer, RT<:Real}: Cavity messagesmarg::MarginalFP: Marginal
RandomLotkaVolterraCavity.NodeFP_BP — Type
NodeFP_BP{Deterministic, I, RT}A type that represents a Belief Propagation (BP) node in the fixed-point algorithm for deterministic dynamics, using the simplified version where Fluctuation Dissipation Theorem (FDT) holds, i.e. χ = βq.
Fields
i::Integer: Node indexneighs::Vector{I} where I<:Integer: Neighbors' indicesneighs_idx::Dict{I, I} where I<:Integer: Dictionary to map neighbors' indices to their positions in theneighsvectorcavs::Array{CavityFP_BP{Deterministic, I, RT}, 1} where {Deterministic, I<:Integer, RT<:Real}: Cavity messagesmarg::MarginalFP_BP: Marginal
RandomLotkaVolterraCavity.NodeFP_IBMF — Type
NodeFP_IBMF{Deterministic, I, RT}A type that represents a node in the IBMF fixed-point algorithm for deterministic dynamics, using the simplified version where q = χ = 0, i.e. a first order approximation of the marginal distribution.
Fields
i::Integer: Node indexneighs::Vector{I} where I<:Integer: Neighbors' indicesx::Real: Fixed-point abundance
RandomLotkaVolterraCavity.PopFP — Type
PopFP{Deterministic, I, RT}A type that represents a population of messages for the fixed-point algorithm in deterministic dynamics.
Fields
mu_pop::Vector{RT} where RT<:Real: Population of averagesq_pop::Vector{RT} where RT<:Real: Population of cavity correlationschi_pop::Vector{RT} where RT<:Real: Population of cavity susceptibilitiespsi_pop::Vector{RT} where RT<:Real: Population of cavity survival probabilities
RandomLotkaVolterraCavity.PopFP_BP — Type
PopFP_BP{Deterministic, I, RT}A type that represents a population of messages for the Belief Propagation (BP) fixed-point algorithm in deterministic dynamics, using the simplified version where Fluctuation Dissipation Theorem (FDT) holds, i.e. χ = βq.
Fields
mu_pop::Vector{RT} where RT<:Real: Population of averagesq_pop::Vector{RT} where RT<:Real: Population of cavity correlations
RandomLotkaVolterraCavity.PopJ — Type
PopJ{Deterministic, I, RT}A type that represents a population of interaction strengths J and J' for a given number of nodes.
Fields
J_pop::Vector{RT} where RT<:Real: Population of interaction strengths JJp_pop::Vector{RT} where RT<:Real: Population of interaction strengths J'
RandomLotkaVolterraCavity.run_MC — Method
run_MC(model::Model{NK, I, RT, MT, D}, dt::RT; rng=Xoshiro(1234), tsave=nothing, divergence_threshold=1e6, stopateq=false, eq_threshold=1e-10, min_t_eq=nothing, verbose=false, integrator="adaptive", x0=nothing, tinit=0.0) where {NK<:AbstractNoiseKind, I<:Integer, RT<:Real, MT<:AbstractMatrix{RT}, D<:Distribution}Run a Monte Carlo simulation of the model for a given time step dt. It uses the OrdinaryDiffEq.jl package to integrate the ODEs. The function samples trajectories of the model and saves them at specified time indices.
Arguments
model::Model{NK, I, RT, MT, D}: The model to simulate, whereNKis the noise kind,Iis the integer type for indices,RTis the real type,MTis the matrix type, andDis the distribution type.dt::RT: Time step for the simulation.
Optional arguments
rng::AbstractRNG: Random number generator (default Xoshiro(1234)).tsave::Union{Nothing, Vector{RT}}: Vector of time points at which the trajectories are saved.divergence_threshold::RT: Threshold for divergence detection (default 1e6).stopateq::Bool: Whether to stop the simulation upon reaching a steady state (default false).eq_threshold::RT: Threshold for steady state detection (default 1e-10).min_t_eq::Union{Nothing, RT}: Minimum time before checking for steady state (default nothing, which uses the default inTerminateSteadyState).verbose::Bool: Whether to print information about the simulation (default false).integrator::String: Choice of integrator, either "adaptive" (automatically switching integrator with adaptive time-step) or "fixed" (Euler integrator with fixed time-step) (default "adaptive").x0::Union{Nothing, Vector{RT}}: Initial condition for the ODE (default nothing, which samples a random initial condition).tinit::RT: Initial time for the ODE integration (default 0.0).
Output
traj::Matrix{RT}: Matrix of sampled trajectories, where each column corresponds to a time point.tsave::Vector{RT}: Vector of time points at which the trajectories are saved.convergence::Bool: Boolean indicating whether the integration was successful (true) or diverged/failed (false).t_eq::RT: Equilibriation time. If stopateq is false, returns the final time of integration.
RandomLotkaVolterraCavity.run_MC — Method
run_MC(model_dis::ModelDisorderedFC{NK, I, RT, D}, dt::RT; rng=Xoshiro(1234), tsave=nothing, divergence_threshold=1e6, stopateq=false, eq_threshold=1e-10, min_t_eq=1e2, verbose=false, integrator="adaptive", x0=nothing, tinit=0.0) where {NK<:AbstractNoiseKind, I<:Integer, RT<:Real, D<:Distribution}Run a Monte Carlo simulation of the fully-connected disordered model for a given time step dt, by sampling an instance of disorder. It uses the OrdinaryDiffEq.jl package to integrate the ODEs. The function samples trajectories of the model and saves them at specified time indices.
Arguments
model_dis::ModelDisorderedFC{NK, I, RT, D}: The disordered model to simulate, whereNKis the noise kind.dt::RT: Time step for the simulation.
Optional arguments
rng::AbstractRNG: Random number generator (default Xoshiro(1234)).tsave::Union{Nothing, Vector{Int}}: Vector of time points at which the trajectories are saved.divergence_threshold::RT: Threshold for divergence detection (default 1e6).stopateq::Bool: Whether to stop the simulation upon reaching a steady state (default false).eq_threshold::RT: Threshold for steady state detection (default 1e-10).min_t_eq::Union{Nothing, RT}: Minimum time before checking for steady state (default nothing, which uses the default inTerminateSteadyState).verbose::Bool: Whether to print information about the simulation (default false).integrator::String: Choice of integrator, either "adaptive" (automatically switching integrator with adaptive time-step) or "fixed" (Euler integrator with fixed time-step) (default "adaptive").x0::Union{Nothing, Vector{RT}}: Initial condition for the ODE (default nothing, which samples a random initial condition).tinit::RT: Initial time for the ODE integration (default 0.0).
Output
traj::Matrix{RT}: Matrix of sampled trajectories, where each column corresponds to a time point.tsave::Vector{RT}: Vector of time points at which the trajectories are saved.convergence::Bool: Boolean indicating whether the integration was successful (true) or diverged/failed (false).t_eq::RT: Equilibriation time. If stopateq is false, returns the final time of integration.
RandomLotkaVolterraCavity.run_MC — Method
run_MC(model_dis::ModelDisordered{NK, I, RT, D1, D2, D3, FT}, dt::RT; rng=Xoshiro(1234), tsave=nothing, divergence_threshold=1e6, stopateq=false, eq_threshold=1e-10, min_t_eq=1e2, verbose=false, integrator="adaptive", x0=nothing, tinit=0.0) where {NK<:AbstractNoiseKind, I<:Integer, RT<:Real, D1<:Distribution, D2<:Distribution, D3<:Distribution, FT<:Function}Run a Monte Carlo simulation of the disordered model for a given time step dt by sampling an instance of disorder. It uses the OrdinaryDiffEq.jl package to integrate the ODEs. The function samples trajectories of the model and saves them at specified time indices.
Arguments
model_dis::ModelDisordered{NK, I, RT, D1, D2, D3, FT}: The disordered model to simulate, whereNKis the noise kind.dt::RT: Time step for the simulation.
Optional arguments
rng::AbstractRNG: Random number generator (default Xoshiro(1234)).tsave::Union{Nothing, Vector{Int}}: Vector of time points at which the trajectories are saved.divergence_threshold::RT: Threshold for divergence detection (default 1e6).stopateq::Bool: Whether to stop the simulation upon reaching a steady state (default false).eq_threshold::RT: Threshold for steady state detection (default 1e-10).min_t_eq::Union{Nothing, RT}: Minimum time before checking for steady state (default nothing, which uses the default inTerminateSteadyState).verbose::Bool: Whether to print information about the simulation (default false).integrator::String: Choice of integrator, either "adaptive" (automatically switching integrator with adaptive time-step) or "fixed" (Euler integrator with fixed time-step) (default "adaptive").x0::Union{Nothing, Vector{RT}}: Initial condition for the ODE (default nothing, which samples a random initial condition).tinit::RT: Initial time for the ODE integration (default 0.0).
Output
traj::Matrix{RT}: Matrix of sampled trajectories, where each column corresponds to a time point.tsave::Vector{RT}: Vector of time points at which the trajectories are saved.convergence::Bool: Boolean indicating whether the integration was successful (true) or diverged/failed (false).t_eq::RT: Equilibriation time. If stopateq is false, returns the final time of integration.
RandomLotkaVolterraCavity.sample_couplings — Method
sample_couplings(m::RT, sigma2::RT, corr::RT, K::IT; rng::AbstractRNG=Xoshiro(1234)) where {RT<:Real, IT<:Integer}Sample couplings J and Jp from a bivariate Gaussian distribution with means m/K, variances sigma2/K, and correlation corr.
Arguments
m::RT: Mean value of the couplings.sigma2::RT: Variance of the couplings.corr::RT: Correlation between the couplings.K::IT: Average degree of the network (used for proper scaling of the couplings).
Returns
J::RT: Sampled coupling J.Jp::RT: Sampled coupling J'.
Example
m = 1.0
sigma2 = 0.1
corr = 0.5
J, J_prime = sample_couplings(m, sigma2, corr, 10)RandomLotkaVolterraCavity.sample_couplings — Method
sample_couplings(m::RT, sigma2::RT, corr::RT, K::RT; rng::AbstractRNG=Xoshiro(1234)) where {RT<:Real}Sample couplings J and Jp from a bivariate Gaussian distribution with means m/K, variances sigma2/K, and correlation corr.
Arguments
m::RT: Mean value of the couplings.sigma2::RT: Variance of the couplings.corr::RT: Correlation between the couplings.K::RT: Average degree of the network (used for proper scaling of the couplings).
Returns
J::RT: Sampled coupling J.Jp::RT: Sampled coupling J'.
Example
m = 1.0
sigma2 = 0.1
corr = 0.5
J, J_prime = sample_couplings(m, sigma2, corr, 5.5)RandomLotkaVolterraCavity.analytic_FC — Method
analytic_FC(m::RT, gamma::RT, npoints::I, Delta_min::RT, Delta_max::RT) where {RT<:Real, I<:Integer}Returns the analytic solution of the fully-connected system for given parameters.
Arguments
m::RT: Average coupling strength.gamma::RT: Coupling strength.npoints::I: Number of points in the range.Delta_min::RT: Minimum value of the parameter Delta.Delta_max::RT: Maximum value of the parameter Delta.
Returns
Deltas::Vector{RT}: Values of the parameter Delta.mus::Vector{RT}: Fixed-point values of the mean abundances mu.qs::Vector{RT}: Fixed-point values of the mean squared abundances q.chis::Vector{RT}: Fixed-point values of the susceptibilities chi.sigma2s::Vector{RT}: Variances sigma2.phis::Vector{RT}: Fixed-point values of the survival probabilities phi.
RandomLotkaVolterraCavity.run_GECaM_FP — Method
run_GECaM_FP(model::Model{Deterministic, IT, RT, MT, D}, max_iter::IT, conv_threshold::RT, damp::RT; init_type::Symbol=:random, mu0::RT=0.0, q0::RT=0.0, chi0::RT=0.0, rng::AbstractRNG=Xoshiro(1234), showprogress::Bool=false, verbose::Bool=false, regularization::RT=-Inf) where {IT<:Integer, RT<:Real, MT<:AbstractMatrix{RT}, D<:Distribution}Run the Gaussian Expansion Cavity Method (GECaM) fixed-point algorithm for deterministic dynamics. It computes the fixed-point values of the mean abundances, correlations, and susceptibilities for a given instance of the disordered model.
Arguments
model::Model{Deterministic, IT, RT, MT, D}: The model to run the GECaM on.max_iter::IT: Maximum number of iterations to run.conv_threshold::RT: Convergence threshold for the fixed-point iterations.damp::RT: Damping factor for the updates.
Keyword Arguments
init_type::Symbol: Initialization type for the nodes. Supported types are:zero,:random, and:custom(default is:random).mu0::RT: Initial value for the mean (used ifinit_typeis:custom, default is0.0).q0::RT: Initial value for the correlation (used ifinit_typeis:custom, default is0.0).chi0::RT: Initial value for the susceptibility (used ifinit_typeis:custom, default is0.0).rng::AbstractRNG: Random number generator for random initialization (default isXoshiro(1234)).showprogress::Bool: Whether to show progress during the iterations (default isfalse).verbose::Bool: Whether to print detailed information during the iterations (default isfalse).divergence_threshold::RT: Threshold for detecting divergence in the algorithm (default is1e6).regularization::RT: Regularization parameter to avoid negative values (default is-Inf).
Output
nodes::Vector{NodeFP{Deterministic, IT, RT}}: The nodes with their updated cavity and marginal values after running the GECaM fixed-point algorithm.converged::Bool: Whether the algorithm converged within the specified number of iterations.diverged::Bool: Whether the algorithm diverged during the iterations.
RandomLotkaVolterraCavity.run_GECaM_FP — Method
run_GECaM_FP(model::ModelDisordered{Deterministic, IT, RT, D1, D2, D3, FT}, P::IT, max_iter::IT, conv_threshold::RT, damp::RT; init_type::Symbol=:random, mu0::RT=0.0, q0::RT=0.0, chi0::RT=0.0, rng::AbstractRNG=Xoshiro(1234), showprogress::Bool=false, verbose::Bool=false, divergence_threshold::RT=1e6, regularization::RT=-Inf) where {IT<:Integer, RT<:Real, D1<:Distribution, D2<:Distribution, D3<:Distribution, FT<:Function}Run the Gaussian Expansion Cavity Method (GECaM) fixed-point algorithm for a disordered model with deterministic dynamics. It computes through a population dynamics algorithm the fixed-point values of the mean abundances, correlations, and susceptibilities averaged over the disordered model.
Arguments
model::ModelDisordered{Deterministic, IT, RT, D1, D2, D3, FT}: The disordered model to run the GECaM on.P::IT: Number of elements of the populations.max_iter::IT: Maximum number of iterations to run.conv_threshold::RT: Convergence threshold for the algorithm.damp::RT: Damping factor for the updates.
Keyword Arguments
init_type::Symbol: Initialization type for the nodes. Supported types are:zero,:random, and:custom(default is:random).mu0::RT: Initial value for the mean (used ifinit_typeis:custom, default is0.0).q0::RT: Initial value for the correlation (used ifinit_typeis:custom, default is0.0).chi0::RT: Initial value for the susceptibility (used ifinit_typeis:custom, default is0.0).rng::AbstractRNG: Random number generator for random initialization (default isXoshiro(1234)).showprogress::Bool: Whether to show progress during the iterations (default isfalse).verbose::Bool: Whether to print detailed information during the iterations (default isfalse).divergence_threshold::RT: Threshold for detecting divergence in the algorithm (default is1e6).regularization::RT: Regularization parameter to avoid negative values (default is-Inf).
Output
cav_pop::PopFP{Deterministic, IT, RT}: The cavity population with updated values after running the GECaM fixed-point algorithm.marg_pop::PopFP{Deterministic, IT, RT}: The marginal population with updated values after running the GECaM fixed-point algorithm.converged::Bool: Whether the algorithm converged within the specified number of iterations.diverged::Bool: Whether the algorithm diverged during the iterations.
RandomLotkaVolterraCavity.run_BP_FP — Method
run_BP_FP(model::Model{Deterministic, IT, RT, MT, D}, max_iter::IT, conv_threshold::RT, damp::RT; init_type::Symbol=:random, mu0::RT=0.0, q0::RT=0.0, rng::AbstractRNG=Xoshiro(1234), showprogress::Bool=false, verbose::Bool=false, divergence_threshold::RT=1e6, regularization::RT=-Inf) where {IT<:Integer, RT<:Real, MT<:AbstractMatrix{RT}, D<:Distribution}Run the Belief Propagation (BP) fixed-point algorithm for deterministic dynamics, using the simplified case where Fluctuation Dissipation Theorem (FDT) holds, i.e. χ = βq. It computes the fixed-point values of the mean abundances and correlations for a given instance of the disordered model.
Arguments
model::Model{Deterministic, IT, RT, MT, D}: The model to run the GECaM on.max_iter::IT: Maximum number of iterations to run.conv_threshold::RT: Convergence threshold for the fixed-point iterations.damp::RT: Damping factor for the updates.
Keyword Arguments
init_type::Symbol: Initialization type for the nodes. Supported types are:zero,:random, and:custom(default is:random).mu0::RT: Initial value for the mean (used ifinit_typeis:custom, default is0.0).q0::RT: Initial value for the correlation (used ifinit_typeis:custom, default is0.0).rng::AbstractRNG: Random number generator for random initialization (default isXoshiro(1234)).showprogress::Bool: Whether to show progress during the iterations (default isfalse).verbose::Bool: Whether to print detailed information during the iterations (default isfalse).divergence_threshold::RT: Threshold for detecting divergence in the algorithm (default is1e6).regularization::RT: Regularization parameter to avoid negative values (default is-Inf).
Output
nodes::Vector{NodeFP_BP{Deterministic, IT, RT}}: The nodes with their updated cavity and marginal values after running the GECaM fixed-point algorithm.converged::Bool: Whether the algorithm converged within the specified number of iterations.diverged::Bool: Whether the algorithm diverged during the iterations.
RandomLotkaVolterraCavity.run_BP_FP — Method
run_BP_FP(model::ModelDisordered{Deterministic, IT, RT, D1, D2, D3, FT}, P::IT, max_iter::IT, conv_threshold::RT, damp::RT; init_type::Symbol=:random, mu0::RT=0.0, q0::RT=0.0, rng::AbstractRNG=Xoshiro(1234), showprogress::Bool=false, verbose::Bool=false, divergence_threshold::RT=1e6, regularization::RT=-Inf) where {IT<:Integer, RT<:Real, D1<:Distribution, D2<:Distribution, D3<:Distribution, FT<:Function}Run the Individual Based Mean Field (IBMF) fixed-point algorithm for a disordered model with deterministic dynamics and simplified case where Fluctuation Dissipation Theorem (FDT) holds, i.e. χ = βq. It computes through a population dynamics algorithm the fixed-point values of the abundances averaged over the disordered model.
Arguments
model::ModelDisordered{Deterministic, IT, RT, D1, D2, D3, FT}: The disordered model to run the GECaM on.P::IT: Number of elements of the populations.max_iter::IT: Maximum number of iterations to run.conv_threshold::RT: Convergence threshold for the algorithm.damp::RT: Damping factor for the updates.
Keyword Arguments
init_type::Symbol: Initialization type for the nodes. Supported types are:zero,:random, and:custom(default is:random).mu0::RT: Initial mean value for the abundance (used ifinit_typeis:custom, default is0.0).q0::RT: Initial correlation value for the abundance (used ifinit_typeis:custom, default is0.0).rng::AbstractRNG: Random number generator for random initialization (default isXoshiro(1234)).showprogress::Bool: Whether to show progress during the iterations (default isfalse).verbose::Bool: Whether to print detailed information during the iterations (default isfalse).divergence_threshold::RT: Threshold for detecting divergence in the algorithm (default is1e6).regularization::RT: Regularization parameter to avoid negative values (default is-Inf).
Output
pop::Vector{RT}: The population with updated values after running the IBMF fixed-point algorithm.converged::Bool: Whether the algorithm converged within the specified number of iterations.diverged::Bool: Whether the algorithm diverged during the iterations.
RandomLotkaVolterraCavity.run_IBMF_FP — Method
run_IBMF_FP(model::Model{Deterministic, IT, RT, MT, D}, max_iter::IT, conv_threshold::RT, damp::RT; init_type::Symbol=:random, x0::RT=0.0, rng::AbstractRNG=Xoshiro(1234), showprogress::Bool=false, verbose::Bool=false, divergence_threshold::RT=1e6, regularization::RT=-Inf) where {IT<:Integer, RT<:Real, MT<:AbstractMatrix{RT}, D<:Distribution}Run the Individual Based Mean Field (IBMF) fixed-point algorithm for deterministic dynamics, using the simplified case where q = χ = 0, i.e. a first order approximation of the marginal distribution. It computes through a population dynamics algorithm the fixed-point values for a given instance of the disordered model.
Arguments
model::Model{Deterministic, IT, RT, MT, D}: The model to run the GECaM on.max_iter::IT: Maximum number of iterations to run.conv_threshold::RT: Convergence threshold for the fixed-point iterations.damp::RT: Damping factor for the updates.
Keyword Arguments
init_type::Symbol: Initialization type for the nodes. Supported types are:zero,:random, and:custom(default is:random).x0::RT: Initial value for the mean (used ifinit_typeis:custom, default is0.0).rng::AbstractRNG: Random number generator for random initialization (default isXoshiro(1234)).showprogress::Bool: Whether to show progress during the iterations (default isfalse).verbose::Bool: Whether to print detailed information during the iterations (default isfalse).divergence_threshold::RT: Threshold for detecting divergence in the algorithm (default is1e6).regularization::RT: Regularization parameter to avoid negative values (default is-Inf).
Output
nodes::Vector{NodeFP_IBMF{Deterministic, IT, RT}}: The nodes with their updated cavity and marginal values after running the GECaM fixed-point algorithm.converged::Bool: Whether the algorithm converged within the specified number of iterations.diverged::Bool: Whether the algorithm diverged during the iterations.
RandomLotkaVolterraCavity.run_IBMF_FP — Method
run_IBMF_FP(model::ModelDisordered{Deterministic, IT, RT, D1, D2, D3, FT}, P::IT, max_iter::IT, conv_threshold::RT, damp::RT; init_type::Symbol=:random, x0::RT=0.0, rng::AbstractRNG=Xoshiro(1234), showprogress::Bool=false, verbose::Bool=false, divergence_threshold::RT=1e6, regularization::RT=-Inf) where {IT<:Integer, RT<:Real, D1<:Distribution, D2<:Distribution, D3<:Distribution, FT<:Function}Run the Individual Based Mean Field (IBMF) fixed-point algorithm for a disordered model with deterministic dynamics and simplified case where q = χ = 0, i.e. a first order approximation of the marginal distribution. It computes through a population dynamics algorithm the fixed-point values of the abundances averaged over the disordered model.
Arguments
model::ModelDisordered{Deterministic, IT, RT, D1, D2, D3, FT}: The disordered model to run the GECaM on.P::IT: Number of elements of the populations.max_iter::IT: Maximum number of iterations to run.conv_threshold::RT: Convergence threshold for the algorithm.damp::RT: Damping factor for the updates.
Keyword Arguments
init_type::Symbol: Initialization type for the nodes. Supported types are:zero,:random, and:custom(default is:random).x0::RT: Initial value for the abundance (used ifinit_typeis:custom, default is0.0).rng::AbstractRNG: Random number generator for random initialization (default isXoshiro(1234)).showprogress::Bool: Whether to show progress during the iterations (default isfalse).verbose::Bool: Whether to print detailed information during the iterations (default isfalse).divergence_threshold::RT: Threshold for detecting divergence in the algorithm (default is1e6).regularization::RT: Regularization parameter to avoid negative values (default is-Inf).
Output
pop::Vector{RT}: The population with updated values after running the IBMF fixed-point algorithm.converged::Bool: Whether the algorithm converged within the specified number of iterations.diverged::Bool: Whether the algorithm diverged during the iterations.