Rosenzweig–MacArthur consumer-resource model

b_rosenzweig_macarthur_tc and b_rosenzweig_macarthur_hopf · tipbox.models.RosenzweigMacArthur

Usage

from tipbox.models import RosenzweigMacArthur

model = RosenzweigMacArthur(bifurcation_type="transcritical", a_transcritical_max=10.0)
result = model.make_trajectory(num_samples=89951, dt_sample=0.02, noise=1.0, seed=43)
resource, consumer = result.trajectory.T

control = model.make_trajectory(num_samples=89951, dt_sample=0.02, noise=1.0, seed=43, null_simulation=True)
Consumer invasion under increasing attack rate, compared with a control. The example extends attack rate to 10; dashed lines mark the transcritical threshold.

Consumer invasion under increasing attack rate, compared with a control. The example extends attack rate to 10; dashed lines mark the transcritical threshold.

Select "hopf" for the oscillatory scenario:

model = RosenzweigMacArthur(bifurcation_type="hopf")
result = model.make_trajectory(num_samples=89951, dt_sample=0.02, noise=1.0, seed=43)

control = model.make_trajectory(num_samples=89951, dt_sample=0.02, noise=1.0, seed=43, null_simulation=True)
Resource fluctuations grow in the tipping trajectory; control forcing stays below the Hopf threshold.

Resource fluctuations grow in the tipping trajectory; control forcing stays below the Hopf threshold.

Equations and forcing

Resource \(x\) and consumer \(y\) obey

\[\begin{split}dx &= \left[r x(1-x/k)-\frac{a(t)xy}{1+a(t)hx}\right]dt +\sigma_1\eta\,dW_1,\\ dy &= \left[\frac{e a(t)xy}{1+a(t)hx}-my\right]dt +\sigma_2\eta\,dW_2.\end{split}\]

The attack rate uses the selected mode’s a_*_min and a_*_max. It ramps over \(T/\text{param_end_multiplier}\) and stays at its endpoint. The null cap defaults to \(\max(a_{\min},2a_c-a_{\max})\); a_*_null supplies an explicit alternative cap. Initial populations are sampled near the applicable initial equilibrium. Both population coordinates are projected to nonnegative values after each Euler–Maruyama step.

For positive \(k,e,h,m\) and \(e>mh\), the analytic thresholds are

\[a_{\rm TC}=\frac{m}{k(e-mh)},\qquad a_{\rm Hopf}=\frac{e+mh}{hk(e-mh)}.\]

These follow from the invasion eigenvalue and the coexistence-equilibrium Jacobian trace. Explicit a_*_bifurcation values override them. Invalid analytic regimes raise an error rather than reporting a spurious threshold.

TipBox uses capped null ramps and no burn-in. Bury et al. (2021) holds null attack rates at 2 (transcritical) or 12 (Hopf), uses a 100-time-unit burn-in, and ramps Hopf forcing to 16; TipBox’s Hopf endpoint is 17. The equations match, but the default simulation protocols differ.

Markers are continuous-system thresholds. At finite Euler–Maruyama step sizes, numerical oscillation onset can shift; refine dt when studying a Hopf onset.

Parameters and defaults

Both modes share these constructor defaults. bifurcation_type selects the a_transcritical_* or a_hopf_* forcing fields and analytic threshold.

Default critical parameter: 5.8823529.

Parameter

Default

Units

Meaning

r

4

1 / model time

Intrinsic resource growth rate.

k

1.7

resource

Resource carrying capacity.

e

0.5

consumer / resource

Conversion efficiency from resource consumption to consumer growth.

h

0.15

model time

Handling time in the Holling type-II response.

m

2

1 / model time

Consumer mortality rate.

sigma1

0.01

resource / sqrt(model time)

Resource diffusion amplitude before the noise multiplier.

sigma2

0.01

consumer / sqrt(model time)

Consumer diffusion amplitude before the noise multiplier.

bifurcation_type

transcritical

Selected mechanism: transcritical or hopf.

a_transcritical_null

automatic

attack rate

Optional null cap in transcritical mode; None uses max(a_min, 2*a_critical-a_max).

a_transcritical_min

2

attack rate

Initial attack rate in transcritical mode.

a_transcritical_max

6

attack rate

Forced ramp endpoint in transcritical mode.

a_transcritical_bifurcation

automatic

attack rate

Optional marker in transcritical mode; None computes m/[k(e-mh)].

a_hopf_null

automatic

attack rate

Optional null cap in Hopf mode; None uses max(a_min, 2*a_critical-a_max).

a_hopf_min

12

attack rate

Initial attack rate in Hopf mode.

a_hopf_max

17

attack rate

Forced ramp endpoint in Hopf mode.

a_hopf_bifurcation

automatic

attack rate

Optional marker in Hopf mode; None computes (e+mh)/[hk(e-mh)].

dt

0.01

model time

Default integration step.

t_start

0

model time

Simulation start time.

t_end

100

model time

End time when make_trajectory is called without num_samples; explicit num_samples sets the end time.

Reference: Rosenzweig and MacArthur (1963); benchmark parameterization follows Bury et al. (2021).