Skip to content

Commit

Permalink
min value in effort for effscale was too low if F=0
Browse files Browse the repository at this point in the history
  • Loading branch information
iagomosqueira committed Nov 29, 2023
1 parent c21c691 commit 6c8d54f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '[email protected]'),
Expand Down
10 changes: 5 additions & 5 deletions R/fwd.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down Expand Up @@ -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") &
Expand Down
1 change: 1 addition & 0 deletions src/fwdSR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,7 @@ T bevholt(const T srp, const std::vector<double> 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]));
}

Expand Down

0 comments on commit 6c8d54f

Please sign in to comment.