
Multiple-resource methods for model rescaling and reporting
Source:R/params_methods.R
params_methods.RdS3 methods that make mizer's scaleModel(), scaleRates(), setResource()
and summary() aware of the multiple-resource component. The base
MizerParams methods only know about the single built-in resource, which
setMultipleResources() silences, so they would otherwise ignore (or, for
scaleModel() and setResource(), error on) the resources stored in the
MR component.
Extends mizer::scaleModel() so that the resource carrying capacities and
abundances of all resources are rescaled consistently. The base method scales
the fish spectra and the resource abundances (held in initial_n_other),
but not the resource capacities and kappa coefficients, which live in the
MR component's parameters. The resource replenishment rate is left
unchanged, exactly as the built-in resource rate is in the base method, so
that the steady state is preserved.
Extends mizer::scaleRates() so that the resource replenishment rate of all
resources is rescaled by factor along with the consumer rates. Without this
the base method would scale only the silenced built-in resource rate, leaving
the active resource rates untouched and breaking the rescaling invariant
(resource replenishment keeping pace with the rescaled search volume).
Extends mizer::setResource(). In a multiple-resource model the built-in
single resource is silenced and plays no part in the dynamics, so changing
it with setResource() has no effect on the simulation. This method warns
when the user tries to change the resource rate, capacity or level, and
directs them to setMultipleResources() and the related setters. Calls that
only change, for example, the built-in resource dynamics (as mizer does
internally) pass through silently. The work is delegated to the base method
on the plain class so that the base accessors return the (vector-valued)
built-in resource instead of the resource-by-size arrays of the MR component.
Extends the summary() method for MizerParams objects. The base method
reports the resource size spectrum from the silenced built-in resource, which
is empty for a multiple-resource model. This method instead reports the
overall size range spanned by all resources combined.
Usage
# S3 method for class 'mizerMR'
scaleModel(params, factor, ...)
# S3 method for class 'mizerMR'
scaleRates(params, factor, ...)
# S3 method for class 'mizerMR'
setResource(params, ...)
# S3 method for class 'mizerMR'
summary(object, ...)Value
For scaleModel(), scaleRates() and setResource(): the updated
mizerMR object. For summary(): the object, invisibly.