The RandomLotkaVolterraCavity Module

Module Index

Detailed API

RandomLotkaVolterraCavity.AbstractNoiseKindType
AbstractNoiseKind

An 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.
source
RandomLotkaVolterraCavity.CavityFPType
CavityFP{Deterministic, I, RT}

A type that represents a cavity in the fixed-point algorithm for deterministic dynamics.

Fields

  • i::Integer: Node index

  • j::Integer: Neighbor index

  • mu::Real: Cavity mean abundance

  • q::Real: Cavity correlation

  • chi::Real: Cavity susceptibility

  • psi::Real: Cavity survival probability

source
RandomLotkaVolterraCavity.CavityFP_BPType
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 index

  • j::Integer: Neighbor index

  • mu::Real: Cavity mean abundance

  • q::Real: Cavity correlation

source
RandomLotkaVolterraCavity.MarginalFPType
MarginalFP{Deterministic, I, RT}

A type that represents a marginal in the fixed-point algorithm for deterministic dynamics.

Fields

  • i::Integer: Node index

  • mu::Real: Marginal mean abundance

  • q::Real: Marginal correlation

  • chi::Real: Marginal susceptibility

  • psi::Real: Marginal survival probability

source
RandomLotkaVolterraCavity.MarginalFP_BPType
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 index

  • mu::Real: Marginal mean abundance

  • q::Real: Marginal correlation

source
RandomLotkaVolterraCavity.ModelType
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.
source
RandomLotkaVolterraCavity.ModelDisorderedType
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 matrix

  • deg_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 strength

  • sigma2::Real: Variance of the coupling strength

  • corr::Real: Correlation of the couplings strength

  • lam::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.

source
RandomLotkaVolterraCavity.ModelDisorderedFCType
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 strength

  • sigma2::Real: Variance of the coupling strength

  • corr::Real: Correlation of the couplings strength

  • lam::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.

source
RandomLotkaVolterraCavity.NodeFPType
NodeFP{Deterministic, I, RT}

A type that represents a node in the fixed-point algorithm for deterministic dynamics.

Fields

  • i::Integer: Node index

  • neighs::Vector{I} where I<:Integer: Neighbors' indices

  • neighs_idx::Dict{I, I} where I<:Integer: Dictionary to map neighbors' indices to their positions in the neighs vector

  • cavs::Array{CavityFP{Deterministic, I, RT}, 1} where {Deterministic, I<:Integer, RT<:Real}: Cavity messages

  • marg::MarginalFP: Marginal

source
RandomLotkaVolterraCavity.NodeFP_BPType
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 index

  • neighs::Vector{I} where I<:Integer: Neighbors' indices

  • neighs_idx::Dict{I, I} where I<:Integer: Dictionary to map neighbors' indices to their positions in the neighs vector

  • cavs::Array{CavityFP_BP{Deterministic, I, RT}, 1} where {Deterministic, I<:Integer, RT<:Real}: Cavity messages

  • marg::MarginalFP_BP: Marginal

source
RandomLotkaVolterraCavity.NodeFP_IBMFType
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 index

  • neighs::Vector{I} where I<:Integer: Neighbors' indices

  • x::Real: Fixed-point abundance

source
RandomLotkaVolterraCavity.PopFPType
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 averages

  • q_pop::Vector{RT} where RT<:Real: Population of cavity correlations

  • chi_pop::Vector{RT} where RT<:Real: Population of cavity susceptibilities

  • psi_pop::Vector{RT} where RT<:Real: Population of cavity survival probabilities

source
RandomLotkaVolterraCavity.PopFP_BPType
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 averages

  • q_pop::Vector{RT} where RT<:Real: Population of cavity correlations

source
RandomLotkaVolterraCavity.PopJType
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 J

  • Jp_pop::Vector{RT} where RT<:Real: Population of interaction strengths J'

source
RandomLotkaVolterraCavity.run_MCMethod
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, where NK is the noise kind, I is the integer type for indices, RT is the real type, MT is the matrix type, and D is 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 in TerminateSteadyState).
  • 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.
source
RandomLotkaVolterraCavity.run_MCMethod
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, where NK is 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 in TerminateSteadyState).
  • 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.
source
RandomLotkaVolterraCavity.run_MCMethod
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, where NK is 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 in TerminateSteadyState).
  • 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.
source
RandomLotkaVolterraCavity.sample_couplingsMethod
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)
source
RandomLotkaVolterraCavity.sample_couplingsMethod
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)
source
RandomLotkaVolterraCavity.analytic_FCMethod
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.
source
RandomLotkaVolterraCavity.run_GECaM_FPMethod
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 if init_type is :custom, default is 0.0).
  • q0::RT: Initial value for the correlation (used if init_type is :custom, default is 0.0).
  • chi0::RT: Initial value for the susceptibility (used if init_type is :custom, default is 0.0).
  • rng::AbstractRNG: Random number generator for random initialization (default is Xoshiro(1234)).
  • showprogress::Bool: Whether to show progress during the iterations (default is false).
  • verbose::Bool: Whether to print detailed information during the iterations (default is false).
  • divergence_threshold::RT: Threshold for detecting divergence in the algorithm (default is 1e6).
  • 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.
source
RandomLotkaVolterraCavity.run_GECaM_FPMethod
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 if init_type is :custom, default is 0.0).
  • q0::RT: Initial value for the correlation (used if init_type is :custom, default is 0.0).
  • chi0::RT: Initial value for the susceptibility (used if init_type is :custom, default is 0.0).
  • rng::AbstractRNG: Random number generator for random initialization (default is Xoshiro(1234)).
  • showprogress::Bool: Whether to show progress during the iterations (default is false).
  • verbose::Bool: Whether to print detailed information during the iterations (default is false).
  • divergence_threshold::RT: Threshold for detecting divergence in the algorithm (default is 1e6).
  • 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.
source
RandomLotkaVolterraCavity.run_BP_FPMethod
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 if init_type is :custom, default is 0.0).
  • q0::RT: Initial value for the correlation (used if init_type is :custom, default is 0.0).
  • rng::AbstractRNG: Random number generator for random initialization (default is Xoshiro(1234)).
  • showprogress::Bool: Whether to show progress during the iterations (default is false).
  • verbose::Bool: Whether to print detailed information during the iterations (default is false).
  • divergence_threshold::RT: Threshold for detecting divergence in the algorithm (default is 1e6).
  • 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.
source
RandomLotkaVolterraCavity.run_BP_FPMethod
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 if init_type is :custom, default is 0.0).
  • q0::RT: Initial correlation value for the abundance (used if init_type is :custom, default is 0.0).
  • rng::AbstractRNG: Random number generator for random initialization (default is Xoshiro(1234)).
  • showprogress::Bool: Whether to show progress during the iterations (default is false).
  • verbose::Bool: Whether to print detailed information during the iterations (default is false).
  • divergence_threshold::RT: Threshold for detecting divergence in the algorithm (default is 1e6).
  • 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.
source
RandomLotkaVolterraCavity.run_IBMF_FPMethod
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 if init_type is :custom, default is 0.0).
  • rng::AbstractRNG: Random number generator for random initialization (default is Xoshiro(1234)).
  • showprogress::Bool: Whether to show progress during the iterations (default is false).
  • verbose::Bool: Whether to print detailed information during the iterations (default is false).
  • divergence_threshold::RT: Threshold for detecting divergence in the algorithm (default is 1e6).
  • 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.
source
RandomLotkaVolterraCavity.run_IBMF_FPMethod
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 if init_type is :custom, default is 0.0).
  • rng::AbstractRNG: Random number generator for random initialization (default is Xoshiro(1234)).
  • showprogress::Bool: Whether to show progress during the iterations (default is false).
  • verbose::Bool: Whether to print detailed information during the iterations (default is false).
  • divergence_threshold::RT: Threshold for detecting divergence in the algorithm (default is 1e6).
  • 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.
source