From 6c8d54fd308abc6efb4bcb7908b39992032aa9d5 Mon Sep 17 00:00:00 2001 From: Iago Mosqueira Date: Wed, 29 Nov 2023 09:30:02 +0100 Subject: [PATCH] min value in effort for effscale was too low if F=0 --- DESCRIPTION | 2 +- R/fwd.R | 10 +++++----- src/fwdSR.cpp | 1 + 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index a7cffa9..55c2b82 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -6,7 +6,7 @@ Description: Projection of future population and fishery dynamics is carried (fleet) that will result in the required abundances, catches or fishing mortalities. X-schema.org-keywords: forecast, fisheries, flr, R -Version: 0.7.1.9218 +Version: 0.7.1.9219 Authors@R: c( person(given = 'Iago', family = 'Mosqueira', role = c('aut', 'cre'), email = 'iago.mosqueira@wur.nl'), diff --git a/R/fwd.R b/R/fwd.R index b5f10cf..297f0c7 100644 --- a/R/fwd.R +++ b/R/fwd.R @@ -288,13 +288,13 @@ setMethod("fwd", signature(object="FLBiols", fishery="FLFisheries", # CALCULATE max(effort) per fishery, using 1st year - 1 effscale <- unname(unlist(lapply(rfishery, function(x) - max(x@effort[, min(control$year) - 1])))) - + max(c(x@effort[, min(control$year) - 1], 1))))) + # CALL operatingModelRun # TODO: PASS to C++ only projection years of rfishery and biolscpp out <- operatingModelRun(rfishery, biolscpp, control, effort_max = c(effort_max * effscale), effort_mult_initial = 1.0, - indep_min = .Machine$double.xmin, indep_max = 1e12, nr_iters = 50) + indep_min = sqrt(.Machine$double.xmin), indep_max = 1e12, nr_iters = 50) # WARN of unsolved targets if(any(out$solver_codes != 1)) { @@ -682,15 +682,15 @@ setMethod("fwd", signature(object="FLStock", fishery="missing", } control <- add_target_order_fls(control) - + # RUN out <- fwd(Bs, Fs, control, deviances=FLQuants(B=deviances), effort_max=effort_max, ...) # PARSE output Fc <- out$fisheries[[1]][[1]] - eff <- out$fisheries[[1]]@effort Bo <- out$biols[[1]] + eff <- out$fisheries[[1]]@effort # RETURN one more year if ssb_flash and *.spwn == 0 if(any(control[control$year == maxy,]$quant == "ssb_flash") & diff --git a/src/fwdSR.cpp b/src/fwdSR.cpp index 47e1f4d..50ef16d 100644 --- a/src/fwdSR.cpp +++ b/src/fwdSR.cpp @@ -420,6 +420,7 @@ T bevholt(const T srp, const std::vector params){ rec = params[0] * srp / (params[1] + srp); if (params.size() > 2) { + // rec = a / (1 + (b / srp) ^ d) rec = params[0] / (1 + pow(params[1] / srp, params[2])); }