-
Notifications
You must be signed in to change notification settings - Fork 1
/
model.R
105 lines (71 loc) · 2.46 KB
/
model.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# model.R - Running rebuilding MPs
# WKREBUILD_toolset/model.R
# Copyright (c) WUR, 2023.
# Author: Iago MOSQUEIRA (WMR) <[email protected]>
#
# Distributed under the terms of the EUPL-1.2
library(icesTAF)
mkdir("model")
library(mse)
# CHOOSE number of cores for doFuture
cores <- 2
source("utilities.R")
# LOAD oem and oem
load('data/data.rda')
# - RUN for F=0 as reference
runf0 <- fwd(om, control=fwdControl(year=seq(2024, 2042), quant="fbar",
value=0))
# - SET UP MP runs
# SET intermediate year + start of runs, lags and frequency
mseargs <- list(iy=2023, fy=2042, data_lag=1, management_lag=1, frq=1)
# SETUP standard ICES advice rule
arule <- mpCtrl(list(
# (est)imation method: shortcut.sa + SSB deviances
est = mseCtrl(method=shortcut.sa,
args=list(SSBdevs=sdevs$SSB)),
# hcr: hockeystick (fbar ~ ssb | lim, trigger, target, min)
hcr = mseCtrl(method=hockeystick.hcr,
args=list(lim=0, trigger=refpts(om)$Btrigger, target=refpts(om)$Fmsy,
min=0, metric="ssb", output="fbar")),
# (i)mplementation (sys)tem: tac.is (C ~ F) + F deviances
isys = mseCtrl(method=tac.is,
args=list(recyrs=-2, fmin=0, Fdevs=sdevs$F))
))
# plot HCR
plot_hockeystick.hcr(arule$hcr, labels=c(lim="Blim", trigger="MSYBtrigger",
min="", target="Ftarget")) +
xlab(expression(hat(SSB))) + ylab(expression(bar(F)))
# - RUN applying ICES advice rule
system.time(
advice <- mp(om, iem=iem, ctrl=arule, args=mseargs)
)
# PLOT
plot(runf0, advice, window=FALSE)
# --- MP runs changing slope and min F (AR_Steep + F below Blim)
# CREATE combinations of lim(Blim) and min(Fmin) values.
opts <- combinations(
lim=seq(0, c(refpts(om)$Btrigger) * 0.50, length=3),
min=c(0, 0.05))
# RUN for all options on 'hcr' control element
system.time(
plans <- mps(om, ctrl=arule, args=mseargs, hcr=opts)
)
# --- MP runs with TAC change limits
#
args(arule$isys)[c('dtaclow', 'dtacupp')] <- c(0.85, 1.15)
# RUN for all options on 'hcr' control element
system.time(
plans_lim <- mps(om, ctrl=arule, args=mseargs, hcr=opts)
)
# --- MP runs with fleet response to TAC decrease, keeps effort at 90%
# SET fleet behaviour response to TAC, !F_y < 0.90 * F_y-1
fleetBehaviour(om) <- mseCtrl(method=response.fb, args=list(min=0.90))
# RUN for all options on 'hcr' control element
system.time(
plans_fr <- mps(om, ctrl=arule, args=mseargs, hcr=opts)
)
# --- SAVE
save(runf0, advice, plans, plans_lim, plans_fr,
file="model/model.rda", compress="xz")
# CLOSE cluster
plan(sequential)