action_predate.Rd
Add predation to a g3 model
g3a_predate_catchability_totalfleet(E)
g3a_predate_catchability_numberfleet(E)
g3a_predate_catchability_linearfleet(E)
g3a_predate_catchability_effortfleet(catchability_fs, E)
g3a_predate_catchability_quotafleet(quota_table, E,
sum_stocks = list(),
recalc_f = NULL)
g3a_predate_maxconsumption(
m0 = g3_parameterized('consumption.m0', value = 1,
by_predator = TRUE, optimise = FALSE),
m1 = g3_parameterized('consumption.m1', value = 0,
by_predator = TRUE, optimise = FALSE),
m2 = g3_parameterized('consumption.m2', value = 0,
by_predator = TRUE, optimise = FALSE),
m3 = g3_parameterized('consumption.m3', value = 0,
by_predator = TRUE, optimise = FALSE),
temperature = 0 )
g3a_predate_catchability_predator(
prey_preferences = 1,
energycontent = g3_parameterized('energycontent', value = 1,
by_stock = TRUE, optimise = FALSE),
half_feeding_f = g3_parameterized('halffeeding',
by_predator = TRUE, optimise = FALSE),
max_consumption = g3a_predate_maxconsumption(temperature = temperature),
temperature = 0 )
g3a_predate(
predstock,
prey_stocks,
suitabilities,
catchability_f,
overconsumption_f = quote(
logspace_add_vec(stock__consratio * -1000, 0.95 * -1000)/-1000
),
report_suitability = TRUE,
run_f = ~TRUE,
run_at = g3_action_order$predate )
# NB: Deprecated interface, use g3a_predate()
g3a_predate_fleet(fleet_stock, prey_stocks, suitabilities, catchability_f,
overconsumption_f = quote(
logspace_add_vec(stock__consratio * -1e3, 0.95 * -1e3) / -1e3 ),
run_f = ~TRUE, run_at = g3_action_order$predate)
# NB: Deprecated interface, use g3a_predate() with g3a_predate_catchability_totalfleet
g3a_predate_totalfleet(fleet_stock, prey_stocks, suitabilities, amount_f,
overconsumption_f = quote(
logspace_add_vec(stock__consratio * -1e3, 0.95 * -1e3) / -1e3 ),
run_f = ~TRUE, run_at = g3_action_order$predate)
g3_stock
that describes the harvesting predators/fleet.
List of g3_stock
s that maturing stock should move into.
Either a list of stock names to formula objects, with an optional unnamed default option, or a formula object (which is always used).
Each formula should define suitability of a stock, for example
by using g3_suitability_exponentiall50
.
A list of formulas generated by one of the g3a_predate_catchability_*
functions,
which define the total biomass a fleet is able to catch.
A formula defining total catch a fleet can harvest at the current time/area (totalfleet/numberfleet), or a scaling factor used to define the stock caught (linearfleet/effortfleet/quotafleet).
Either a list of stock names to formula objects, with an optional unnamed default option, or a formula object (which is always used).
A data.frame with 'biomass' and 'quota' columns,
'biomass' a numeric column, an upper bound for total biomass amount, the final value always being Inf
.
'quota' being a list of formula
s, defining the quota for each, e.g. with g3_parameterized
.
Either a list of g3_stock objects to sum when choosing a value from quote_table,
or NULL
, in which case choose the quota based on the current prey.
A formula denoting when to recalculate the current quota. For example ~cur_step == 1
will ensure the quota is only recalculated at the beginning of the year.
Equivalent to E passed to g3a_predate_catchability_totalfleet.
Either 1, indicating a Type II functional response, or >1 for a Type III functional response. Either a list of stock names to numbers, with an optional unnamed default option, or a single number to be used for all stocks.
A formula object for the energy content of the current prey, in in kilojoules per kilogram.
The biomass of prey required to allow the predator to consume prey at half the maximum consumption level.
A formula for maximum consumption of the predator, in kilojoules per month.
Generally generated by g3a_predate_maxconsumption
Parameters for maximum possible consumption formula, see below.
A formula object for the current temperature, probably generated by g3_timeareadata
.
Overconsumption rule, a formula that should cap all values in stock__consratio to <= 95
If TRUE, Generate a suit_(prey)_(predator)__report
suitability array in the model report.
The dimensions in the report will vary depending on what the suitability function is dependent on, e.g. predator_length
.
NB: Currently cannot generate arrays for time-varying suitabilities.
formula specifying a condition for running this action, default always runs.
Integer order that actions will be run within model, see g3_action_order
.
g3a_predate
will, given a g3_fleet
"predator" and a set of g3_stock
preys,
add predation into a model. The behaviour is driven by 2 parameters:
Defines a predator's preference within a prey stock, normally one of the suitability functions, e.g. g3_suitability_exponentiall50
Defines a predator's overall requirements, set with one of the catchability functions, e.g. g3a_predate_catchability_totalfleet
For the definition of each catchability function, see the values section below.
The actions will define the following stock instance variables for each given fleet_stock and prey_stock:
Total suitable prey for (predstock), i.e. \( \sum_{\it preys}^p \sum_{\it lengths}^l F_{pl}\)
Suitability of (prey_stock) for (fleet_stock), i.e. \( F_{pl} \)
Biomass of (prey_stock) caught by (predstock), by predator & prey dimensions
Biomass of total consumed (prey_stock), in a prey array
Ratio of prey_stock__totalpredate / (current biomass), capped by overconsumption_f
In addition, g3a_predate_fleet
will generate prey_stock__predby_predstock, Biomass of (prey_stock) caught by (fleet_stock), in a prey array,
for compatibility with older models. It is otherwise identical to g3a_predate
.
A model can have any number of g3a_predate_*
actions, so long as the
calling arguments are different. For instance, run_f = ~age == 5
and
run_f = ~age == 7
.
formula objects that define a fleet's desired catch by total biomass (e.g. landings data): $$ F_{pl} = S N_{pl} W_{pl} $$ $$ C_{pl} = \frac{E F_{pl}}{\displaystyle \sum_{\it preys}^p \sum_{\it lengths}^l F_{pl}} $$
Suitability form suitabilities argument
E argument, biomass caught by fleet. Generally a g3_timeareadata
table containing landings data, with year/step/area/weight columns
Number of prey in length cell for prey \(p\), length \(l\)
Mean weight of prey in length cell for prey \(p\), length \(l\)
formula objects that define a fleet's desired catch by total number of stock landed (individuals, not biomass): $$ F_{pl} = S N_{pl} $$ $$ C_{pl} = \frac{E F_{pl} W_{pl}}{\displaystyle \sum_{\it preys}^p \sum_{\it lengths}^l F_{pl}} $$
Suitability form suitabilities argument
E argument, numbers caught by fleet. Generally a g3_timeareadata
table containing landings data, or a constant quota
Number of prey in length cell for prey \(p\), length \(l\)
Mean weight of prey in length cell for prey \(p\), length \(l\)
formula objects that define a linear relationship between desired catch and available biomass: $$ F_{pl} = S N_{pl} W_{pl} $$ $$ C_{pl} = E \Delta t F_{pl} $$
Suitability form suitabilities argument
E argument, scaling factor for the stock that is to be caught, per month
length of current timestep in months
Number of prey in length cell for prey \(p\), length \(l\)
Mean weight of prey in length cell for prey \(p\), length \(l\)
This is a multi-species extension to linearfleet, allowing differently-parameterized catchability per-stock: $$ F_{pl} = S N_{pl} W_{pl} $$ $$ C_{pl} = c_{s} E \Delta t F_{pl} $$
Suitability form suitabilities argument
catchability_fs argument for the current stock
E argument, scaling factor for the stock that is to be caught, per month
length of current timestep in months
Number of prey in length cell for prey \(p\), length \(l\)
Mean weight of prey in length cell for prey \(p\), length \(l\)
A formula onject that defines catch based on the available biomass of the stock multiplied by a scaling factor set according to a simple harvest control rule: $$ F_{pl} = S N_{pl} W_{pl} $$ $$ C_{pl} = q E \Delta t F_{pl} $$
quota selected from quota_table, corresponding to the total biomass of sum_stocks.
For example, given data.frame(biomass = c(10000, Inf), quota = I(list(g3_parameterized('quota.low'), g3_parameterized('quota.high'))))
,
'quota.low' will be chosen when total biomass is less than 10000, otherwise 'quota.high' will be used.
Suitability form suitabilities argument
E argument, scaling factor for the stock that is to be caught, per month
length of current timestep
Number of prey in length cell for prey \(p\), length \(l\)
Mean weight of prey in length cell for prey \(p\), length \(l\)
...if recalc_f is set, this will only be recaculated when true. Any other step will use the previous value.
formula objects that define a predator's maximum consumption: $$ M_{L} = m_0 \Delta t e^{(m_1T-m_2T^3)} L^{m_3} $$
mx parameter, for \(M_L\), maximum possible consumption for the predator on the current timestep
length of current timestep in months
temperature parameter, formula representing current temperature
formula objects that define the predator/prey relationship: $$ F_{pl} = (S E_{p} N_{pl} W_{pl})^{d_p} $$ $$ C_{pl} = \frac{ N_{L} M_{L} \psi_L F_{pl} }{ E_{p} \displaystyle \sum_{\it preys}^p \sum_{\it lengths}^l F_{pl} } $$ $$ \psi_{L} = \frac{ \displaystyle \sum_{\it preys}^p \sum_{\it lengths}^l F_{pl} }{ H \Delta t + \displaystyle \sum_{\it preys}^p \sum_{\it lengths}^l F_{pl} } $$
Suitability form suitabilities argument
length of current timestep in months
Number of prey in length cell for prey \(p\), length \(l\)
Mean weight of prey in length cell for prey \(p\), length \(l\)
Maximum possible consumption for the predator on the current timestep, in in kilojoules per month. See g3a_predate_maxconsumption
Length of the current predator
energycontent parameter, the energy content of prey
half_feeding_f parameter, the biomass of prey required to allow the predator to consume prey at half the maximum consumption level
temperature parameter, formula representing current temperature
An action (i.e. list of formula objects) that will...
For each prey, collect all suitable stock into a predstock_prey_stock__suit variable, using the catchability_f \(F_pl\) formula. The units here will depend on the catchability_f method used.
After all predator consumption is done, scale consumption using the catchability_f \(C_pl\) formula into predstock_prey_stock__cons, summed into prey_stock__totalpredate
Calculate prey_stock__consratio (ratio of consumed to available), capping using overconsumption_f. Update prey_stock__num
Recalculate predstock_prey_stock__cons, predstock_prey_stock__suit, post-overconsumption
areas <- c(a = 1, b = 2)
ling_imm <- g3_stock(c(species = 'ling', 'imm'), seq(20, 156, 4)) %>% g3s_age(3, 10)
ling_mat <- g3_stock(c(species = 'ling', 'mat'), seq(20, 156, 4)) %>% g3s_age(5, 15)
lln <- g3_fleet('lln') %>% g3s_livesonareas(areas[c('a', 'b')])
# Invent a lln_landings table
lln_landings <- expand.grid(
year = 1999:2000,
step = c(1, 2),
area = areas[c('a', 'b')])
lln_landings$total_weight <- floor(runif(nrow(lln_landings), min=100, max=999))
# g3a_predate_catchability_totalfleet(): Set catch accordings to landings data
predate_action <- g3a_predate_fleet(
lln,
list(ling_imm, ling_mat),
suitabilities = g3_suitability_exponentiall50(by_stock = 'species'),
catchability_f = g3a_predate_catchability_totalfleet(
g3_timeareadata('lln_landings', lln_landings, "total_weight") ))
# g3a_predate_catchability_numberfleet(): Fixed quota of 1000 fish
predate_action <- g3a_predate_fleet(
lln,
list(ling_imm, ling_mat),
suitabilities = g3_suitability_exponentiall50(by_stock = 'species'),
catchability_f = g3a_predate_catchability_numberfleet(
g3_parameterized(
'quota',
value = 1000,
by_predator = TRUE,
scale = 0.5,
optimise = FALSE) ))
attr(suppressWarnings(g3_to_r(list(predate_action))), 'parameter_template')
#> $ling.lln.alpha
#> [1] 0
#>
#> $ling.lln.l50
#> [1] 0
#>
#> $lln.quota
#> [1] 1000
#>