Setting a new recruit model via set_recruit_model does not affect the existing harvest_specifications.
Replication
create new agepro_model with 2 or more number of recruit models and assign it to value. For this example, we are assigning a new agepro_model with 3 recruitment models to test.
> test <- agepro_model$new(2019,2026,1,32,1000,4,3)
══ general ═════════════════════════════════════════════════════════════════════════════════════════════════════════════════
• First Year in Projection: 2019
• Last Year in Projection: 2026
• First Age Class: 1
• Last Age Class: 32
• Number of Population Simulations: 1000
• Number of Fleets: 4
• Number of Recruitment Model(s): 3
• Discards are present: FALSE
• Calculation Engine Random Number Seed: 40803224
[snipped rest of output]
Check its recruitment value of test using test$recruit. Recrcuitment Probablity is divided to 3 list items. Recruit data in list listed as 3 items.
> test$recruit
ℹ 3 recruitment models for 8 years.
• Recruitment Scaling Factor: 1000
• SSB Scaling Factor: 0
ℹ Recruit Data in recruitment's model collection list:
ℹ Recruit 1 of 3 : Recruitment Model #0
NULL Recruitment
! Replace with a valid recruitment model before processing to AGEPRO calcualtion engine
ℹ Recruit 2 of 3 : Recruitment Model #0
NULL Recruitment
! Replace with a valid recruitment model before processing to AGEPRO calcualtion engine
ℹ Recruit 3 of 3 : Recruitment Model #0
NULL Recruitment
! Replace with a valid recruitment model before processing to AGEPRO calcualtion engine
3. Use 'test' agepro model function `set_recruit_model` to create a single recruitment model 14 (Empirical CDF). The output will show new single recruitment data model, but shows the same 3 recruitment Probability list items
test$set_recruit_model(14)
══ recruit ════════════════════════════════════════════════════════════════════════════════════════════════════════
→ Recruitment Data Setup
→ Using Model Number 14
ℹ 1 recruitment model for 8 years.
• Recruitment Scaling Factor: 1000
• SSB Scaling Factor: 0
ℹ Recruit Data in recruitment's model collection list:
ℹ Recruit 1 of 1 : Recruitment Model #14
ℹ Empirical Cumulative Distribution Function of Recruitment
• Has SSB? FALSE
• Number of Recruitment Data Points: 2
ℹ Observations:
A tibble: 2 × 1
recruit
<dbl>
1 0
2 0
4. general options of `test` remain the same
test$general
• First Year in Projection: 2019
• Last Year in Projection: 2026
• First Age Class: 1
• Last Age Class: 32
• Number of Population Simulations: 1000
• Number of Fleets: 4
• Number of Recruitment Model(s): 3
• Discards are present: FALSE
• Calculation Engine Random Number Seed: 40803224
Questions
In AGEPRO-GUI, the user is can only change the number of recruitment model when they set a new agepro model. Here, there is a possibility to change the number of recruitment models after the agepro model's general parameters were set. A side effect will be is to alter general_params num_rec_models in the changes,
Solution
agepro_model's call to set_recruit_model creates a new recruitment model collection set, but does not update recruitment probability
GENERAL's number of recruitment models must be updated to the new count of new recruitment recruitment model set.
resolve potential function name ambiguity with recruitment functions set_recruit_data (this one should renamed set_recruit_model) and set_recruit_model(this is the function that initializes recruit model data classes; rename set_recruit_data_class?)
When using set_recruit_model, check the length of the model_num argument matches the current number of recruitment models, Throw an error if it doesn't match.
Issue
Setting a new recruit model via
set_recruit_model
does not affect the existing harvest_specifications.Replication
agepro_model
with 2 or more number of recruit models and assign it to value. For this example, we are assigning a new agepro_model with 3 recruitment models totest
.test
usingtest$recruit
. Recrcuitment Probablity is divided to 3 list items. Recruit data in list listed as 3 items.ℹ Recruitment Probability: [[1]] 2019 2020 2021 2022 2023 2024 2025 2026 0.125 0.125 0.125 0.125 0.125 0.125 0.125 0.125
[[2]] 2019 2020 2021 2022 2023 2024 2025 2026 0.125 0.125 0.125 0.125 0.125 0.125 0.125 0.125
[[3]] 2019 2020 2021 2022 2023 2024 2025 2026 0.125 0.125 0.125 0.125 0.125 0.125 0.125 0.125
ℹ Recruit Data in recruitment's model collection list: ℹ Recruit 1 of 3 : Recruitment Model #0 NULL Recruitment ! Replace with a valid recruitment model before processing to AGEPRO calcualtion engine
ℹ Recruit 2 of 3 : Recruitment Model #0 NULL Recruitment ! Replace with a valid recruitment model before processing to AGEPRO calcualtion engine
ℹ Recruit 3 of 3 : Recruitment Model #0 NULL Recruitment ! Replace with a valid recruitment model before processing to AGEPRO calcualtion engine
ℹ Recruitment Probability: [[1]] 2019 2020 2021 2022 2023 2024 2025 2026 0.125 0.125 0.125 0.125 0.125 0.125 0.125 0.125
[[2]] 2019 2020 2021 2022 2023 2024 2025 2026 0.125 0.125 0.125 0.125 0.125 0.125 0.125 0.125
[[3]] 2019 2020 2021 2022 2023 2024 2025 2026 0.125 0.125 0.125 0.125 0.125 0.125 0.125 0.125
ℹ Recruit Data in recruitment's model collection list: ℹ Recruit 1 of 1 : Recruitment Model #14 ℹ Empirical Cumulative Distribution Function of Recruitment • Has SSB? FALSE • Number of Recruitment Data Points: 2 ℹ Observations:
A tibble: 2 × 1
1 0 2 0
Questions
num_rec_models
in the changes,Solution
recruitment
functionsset_recruit_data
(this one should renamed set_recruit_model) andset_recruit_model
(this is the function that initializes recruit model data classes; rename set_recruit_data_class?)set_recruit_model
, check the length of themodel_num
argument matches the current number of recruitment models, Throw an error if it doesn't match.