Skip to content
Gavin Fay edited this page Jul 8, 2024 · 7 revisions

Running the MSE

The below outlines (minimal) workflow steps to run the MSE.

Downloading / installing the software

This repository contains the information needed to run the 2024 summer flounder recreational measures MSE.
Clone this repository to your computer. e.g. via

git clone https://github.com/thefaylab/mafmc-recmeasures.git

You will also want to download the sinatra MSE software itself, as it is preferable to compile this on your own machine to ensure things are working properly.
Thus, in a different location on your machine, download the newest update of the sinatra repo from the fluke-recdisc branch, e.g.

git clone -b fluke-recdisc --single-branch  https://github.com/gavinfay/sinatra.git

Assuming you have a FORTRAN compiler installed on your system, you can compile the sinatra executable. Two compilation shell scripts are available in the sinatra repo, one for linux and one for Mac. e.g. for compilation on Mac:

cd ~/parent-folder/sinatra
./compile_sinatra_mac.sh

or for linux:

cd ~/parent-folder/sinatra
./compile_sinatra.sh

If compilation is successful, this will produce the sinatra.exe program.
Errors during compilation get sunk to gav.junk. Please lodge an issue if you get these - they are likely a consequence of lazy programming by Gavin and variations in compiler strictness about such sloppiness.

R package dependencies

You will need to have the following R packages installed (for the recreational demand model and recreational measures control rules):

conflicted
copula
data.table
dplyr
magrittr
mgcv
rlist
tidyr

Workflow for running the MSE

The mse directory of this repo contains the files needed to run the MSE.
It is STRONGLY recommended that you not run the MSE in this directory, and instead create a separate directory within which to run your simulations (this tutorial steps through a simple application, and does not deal with possible workflows for batching multiple scenarios, etc.)

  1. Create a new directory where you will run the MSE, and copy the contents of the mse directory to that directory. e.g.
mkdir ~/mysims
cp -r ~/parent-folder/mafmc-recmeasures/mse/* ~/mysims/
  1. Copy your compiled sinatra program to the run directory
cp ~/parent-folder/sinatra/sinatra.exe ~/mysims/sinatra.exe

Then, once you are ready to run simulations, navigate to your run directory.

cd ~/mysims
  1. Adjust options for the scenario you want to run

Interaction with the various options for the MSE is controlled by a set of text files. These are quite numerous and reflect the frankenstein-like evolution and multiple applications of the software since (gasp) 2006 (or so).
However, only a small number are (mostly) relevant for the summer flounder rec measures simulations.

master.ctl: This file governs the overall number of simulations for the run. Line 2: adjust the number of simulations to run (e.g. set to 1 initially).
Line 9: (operating model scenario for each simulation) There needs to be at least as many entries in this row as simulations you wish to run (this tells the program which draw from the posterior to use in each simulation). If only doing a small number of simulations, you shouldn't need to change this.

hcr.ctl: This file contains information about the harvest control rules to be implemented, and other general properties for the run (number of years, frequency of MP application, etc.). Much of the detail about the MPs is covered in separate files (detailed below). Things of note to check/change:

  • Number of years for projection: duration of each simulation projection (length of time over which the MP is applied). Typical value, 25 or 30. Good to make a multiple of the next entry.
  • Frequency of assessment: how often the scientific advice for management is updated. 1 = every year, 2= every other year, etc.
  • Tier rule: This is the type of MP that is implemented. For the summer flounder rec measures MSE, option to choose is 63. (don't worry, there are not 63 distinct types of MP, rather GF tends to begin a new set of tens with each application)

fluke-recdisc.ctl: This is the main file that controls the details for the summer flounder MSE.

  • CV of simulated OFL (not used in MP 63)
  • CV of risk policy OFL: SSC CV used to derive ABC from the OFL
  • autocorrelation in assessment estimates: The degree of autocorrelation over time in the pseudo-stock assessment estimates
  • CV of stock assessment indicators estimates: The magnitude of the precision of the stock assessment. e.g. a value of 0.2 assumes all assessment indicators are lognormal with a 20% CV.
  • F type: set to 1 (FMSY proxy is FSPR)
  • M that is used in the assessment/MP
  • F reference point (FMSY) if F type is set to 1 then this is the SPR level for the target fishing mortality rate (e.g. 0.35 is F35)
  • Biomass refs (not used here)
  • Mbase (for Z type hcr) - not used here
  • Recreational sector allocation: Proportion of ABC allocated to recreational fishery (e.g. 0.45)
  • Mgmt type, Specific rec measure / HCR that is applied. Options 6+ are relevant for the 2024 rec measures MSE.
    (-1 = fixed regs, 1 = RHL, 2= F-based, 3 = RHL_risk, 4= F_risk, 6 = percent_change_RHL, 7 = percent_change_ACL [not coded], 8 = bioref_RHL, 9 = bioref_ACL [not coded], 10 = biomatrix_RHL, 11= nochange)
  • Implementation type: Set to 3 to use the RDM as the determinant of the recreational catches and discards.
  • Initial year regulations: Values for the regulations assumed to be in place in the first year of MP application. Ordered by (season length (in days), bag limit, minimum size (inches))
  • Regulation to change: what regulations are allowed to be adjusted by the HCR during the simulation (1 = bag limit, 2 = minimum size, 3= season length, 4 = all [not working yet])
  • Initial Bin: relevant for the reference point and bmatrix approaches (Mgmt types 8 & 10). Entry needed for others but not used. Current suggested value: 3
  1. Run the MSE Run the executable. e.g.
./sinatra.exe
  1. Output There are several main text output files

spawbio.out: Time series of OM spawning biomass totcatch.out: Time series of OM catch (by fleet) frate.out: Time series of OM F rbctrack.out: Output of management and assessment quantities recoutput.out: Time series of the recreational landings and discards at length recoutput2.out: Time series of the RDM performance measures by total and state

rbctrack.out is the most complicated one. It contains the output of each application of the HCR. Columns correspond to: GF FILL IN HERE

Additional files that are useful when beginning to set up simulations and checking things are available, and have the *.junk extension. A larger number of these (more verbose output) can be generated via the "Show detailed Diagnostic files?" switch at the top of Sinatra.CTL. It is recommended this set to 0 once happy with how the simulations are set up because writing to these files slows runtime (a bit).