# Populate a full operating model
OM <- Populate(OM)
# Populate a stock object independently
Stock <- Populate(Stock, nSim = 100, nYear = 40, pYear = 30)
# Populate a fleet using an already-populated stock
Fleet <- Populate(Fleet, Stock = Stock)17 Populating an Operating Model
Building an operating model in openMSE is a two-stage process. First, the user constructs the OM object and its sub-components by specifying parameter values as described in Chapter 3 and Chapter 16. Second, the Populate() function expands these compact inputs into the full arrays (e.g., Sim × Age × Year), samples any stochastic values, resolves model functions, builds derived quantities, and and checks the OM for internal consistency.
In normal use, Populate() is called automatically when running Simulate(), so most users will not need to call it directly. It can be useful, however, for inspecting what a set of parameter values produces before assembling a full operating model.
17.1 Populate()
Populate() is a generic dispatcher. It inspects the class of the object passed to it and calls the appropriate class-specific population function:
The primary class-specific functions called by Populate() are:
PopulateOM()PopulateStock()PopulateFleet()PopulateObs()PopulateImp()
These functions in turn call the population functions for their individual subcomponents (PopulateLength(), PopulateSelectivity(), etc.). See ?PopulateOM and related help pages for more information.
17.2 Using Populate
Although Populate() doesn’t need to be called directly, individual objects can be populated independently. This is sometimes useful for inspecting what a set of parameter values produces before assembling a full operating model, for example inspecting the length-at-age schedule produced by a set of parameters:
stock <- Populate(AlbacoreExStock, nSim = 100, nYear = 30, pYear = 20)
Length(stock) |> MeanAtAge() |> head(), , Year = 1997
Age
Sim 0 1 2 3 4 5 6 7
1 30.09642 46.06443 59.31781 70.31804 79.44818 87.02615 93.31583 98.53623
2 27.83775 43.20068 56.05402 66.80770 75.80472 83.33204 89.62973 94.89867
3 28.12018 43.40423 56.35658 67.33295 76.63479 84.51756 91.19776 96.85884
4 27.41332 42.58525 55.46988 66.41205 75.70459 83.59620 90.29809 95.98961
5 36.76521 53.00307 66.17223 76.85262 85.51458 92.53956 98.23693 102.85758
6 32.76818 49.89364 63.74051 74.93647 83.98902 91.30850 97.22671 102.01190
Age
Sim 8 9 10 11 12 13 14 15
1 102.8691 106.4654 109.4503 111.9278 113.9841 115.6908 117.1073 118.2831
2 99.3069 102.9950 106.0807 108.6623 110.8222 112.6292 114.1411 115.4060
3 101.6563 105.7218 109.1672 112.0869 114.5612 116.6580 118.4349 119.9408
4 100.8231 104.9279 108.4138 111.3742 113.8883 116.0234 117.8366 119.3765
5 106.6050 109.6442 112.1091 114.1081 115.7293 117.0442 118.1106 118.9754
6 105.8810 109.0094 111.5388 113.5840 115.2377 116.5748 117.6559 118.5300
Age
Sim 16 17 18 19 20
1 119.2589 120.0689 120.7411 121.2991 121.7622
2 116.4643 117.3497 118.0904 118.7102 119.2287
3 121.2169 122.2983 123.2148 123.9914 124.6496
4 120.6842 121.7947 122.7379 123.5388 124.2190
5 119.6768 120.2456 120.7070 121.0811 121.3846
6 119.2368 119.8083 120.2703 120.6439 120.9460
When populating a Fleet object, the paired Stock object must be provided so that quantities such as the length structure (e.g., the age-length key required for size-to-age conversions) are available:
fleet <- Populate(AsympExFleet, Stock = stock)17.3 Seeding and Reproducibility
Each subcomponent population function receives its own integer seed, derived by incrementing the base seed stored in OM@Seed. This ensures that:
- All stochastic draws are fully reproducible given a fixed
OM@Seed. - Population of one subcomponent does not affect the random state of another.
- All sub-objects (e.g.,
Stock,Fleet, etc) receive distinct seeds, so stochastic variation in one component is independent of another even when the same parameter ranges are specified.
To change the stochastic realisation of an operating model, update OM@Seed and call Populate() again:
Seed(OM) <- 42
OM <- Populate(OM)