From a845a752ce7b1ed9f7c909a6186758c331e5e142 Mon Sep 17 00:00:00 2001 From: Richard Methot Date: Thu, 31 Jul 2025 16:22:30 -0700 Subject: [PATCH 1/4] bypass steepness calcs when steepness == 1 --- SS_prelim.tpl | 5 +++++ SS_readcontrol_330.tpl | 9 +++++++++ SS_recruit.tpl | 17 ++++++++++++++--- 3 files changed, 28 insertions(+), 3 deletions(-) diff --git a/SS_prelim.tpl b/SS_prelim.tpl index c37b8fc0..94b9ae21 100644 --- a/SS_prelim.tpl +++ b/SS_prelim.tpl @@ -859,6 +859,11 @@ echoinput << " MG_parms after check " << MGparm << endl; MGparm_use = value(MGparm); + if (SR_fxn == 3) + { + if (SRparm_PH(2) < 0 || SRparm(2) >= 0.999999) use_steepness = 0; + } + echoinput << endl << " now check SRparm bounds and priors and do jitter if requested " << endl; for (i = 1; i <= N_SRparm3; i++) diff --git a/SS_readcontrol_330.tpl b/SS_readcontrol_330.tpl index a8f871a3..d7f3f463 100644 --- a/SS_readcontrol_330.tpl +++ b/SS_readcontrol_330.tpl @@ -2191,6 +2191,7 @@ ivector SRparm_PRtype(1,N_SRparm3) vector SRparm_CV(1,N_SRparm3) ivector SRparm_PH(1,N_SRparm3) + int use_steepness // 0/1 to do full steepness calculations with Beverton-Holt; set to 0 if h = 1 and not estimated LOCAL_CALCS // clang-format on @@ -5956,6 +5957,14 @@ active_parm(active_count) = ParCount; } } + + // flag to bypass steepness calculations + use_steepness = 1; // default + // following test will occur in preliminary calcs such that it will work even if values are read from ss3.par + // if (SR_fxn == 3) + // { + // if (SRparm_PH(2) < 0 || SRparm(2) >= 0.999999) use_steepness = 0; + // } if (recdev_cycle > 0) { diff --git a/SS_recruit.tpl b/SS_recruit.tpl index b718fed4..49b8b93a 100644 --- a/SS_recruit.tpl +++ b/SS_recruit.tpl @@ -50,8 +50,13 @@ FUNCTION dvariable Spawn_Recr(const dvar_vector& SRparm_work, const prevariable& case 3: // Beverton-Holt { steepness = SRparm_work(2); - NewRecruits = (4. * steepness * Recr_virgin_use * SSB_curr_adj) / + if (use_steepness == 1) + { + NewRecruits = (4. * steepness * Recr_virgin_use * SSB_curr_adj) / (SSB_virgin_use * (1. - steepness) + (5. * steepness - 1.) * SSB_curr_adj); + } + else + {NewRecruits = Recr_virgin_use; } break; } @@ -318,16 +323,22 @@ FUNCTION dvar_vector Equil_Spawn_Recr_Fxn(const dvar_vector& SRparm, // SS3 previously used alternative formulation: R = A*S/(B+S) // converting SS3 to align with WHAM + if (use_steepness ==1) + { alpha = 4.0 * steepness / (SSBpR_virgin_use * (1. - steepness)); beta = (5.0 * steepness - 1.0) / ((1 - steepness) * SSB_virgin_use); - // " h " << steepness << " derive " << alpha * SSBpR_virgin / (4. + alpha * SSBpR_virgin) << " " << endl; - // " R0 " << Recr_virgin_use << " derive " << 1. / beta * (alpha - 1./SSBpR_virgin) << endl; // report5 <<" SSB_unf "< Date: Mon, 4 Aug 2025 12:33:15 -0400 Subject: [PATCH 2/4] try run-ss3-no-est.yml with pre-release run test models --- .github/workflows/run-ss3-no-est.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/run-ss3-no-est.yml b/.github/workflows/run-ss3-no-est.yml index b8d18e54..bf4a3edb 100644 --- a/.github/workflows/run-ss3-no-est.yml +++ b/.github/workflows/run-ss3-no-est.yml @@ -43,6 +43,7 @@ jobs: with: repository: 'nmfs-ost/ss3-test-models' path: test-models-repo + ref: update-test-models - name: Update Ubuntu packages run: | From 241aca8099dab34a9bb0c81934557766329aceb0 Mon Sep 17 00:00:00 2001 From: Elizabeth Perl Date: Wed, 6 Aug 2025 17:08:55 -0400 Subject: [PATCH 3/4] revert back to main branch for test models --- .github/workflows/run-ss3-no-est.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/run-ss3-no-est.yml b/.github/workflows/run-ss3-no-est.yml index bf4a3edb..b8d18e54 100644 --- a/.github/workflows/run-ss3-no-est.yml +++ b/.github/workflows/run-ss3-no-est.yml @@ -43,7 +43,6 @@ jobs: with: repository: 'nmfs-ost/ss3-test-models' path: test-models-repo - ref: update-test-models - name: Update Ubuntu packages run: | From a1d5b8df50d2b054f258dfda1ed2b71ff4407e02 Mon Sep 17 00:00:00 2001 From: Richard Methot Date: Thu, 7 Aug 2025 12:07:32 -0700 Subject: [PATCH 4/4] correct logic error regarding use of steepness --- SS_prelim.tpl | 2 +- SS_recruit.tpl | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/SS_prelim.tpl b/SS_prelim.tpl index 94b9ae21..736a698c 100644 --- a/SS_prelim.tpl +++ b/SS_prelim.tpl @@ -861,7 +861,7 @@ if (SR_fxn == 3) { - if (SRparm_PH(2) < 0 || SRparm(2) >= 0.999999) use_steepness = 0; + if (SRparm_PH(2) < 0 && SRparm(2) >= 0.999999) use_steepness = 0; } echoinput << endl diff --git a/SS_recruit.tpl b/SS_recruit.tpl index 49b8b93a..9a1ab894 100644 --- a/SS_recruit.tpl +++ b/SS_recruit.tpl @@ -56,7 +56,9 @@ FUNCTION dvariable Spawn_Recr(const dvar_vector& SRparm_work, const prevariable& (SSB_virgin_use * (1. - steepness) + (5. * steepness - 1.) * SSB_curr_adj); } else - {NewRecruits = Recr_virgin_use; } + { + NewRecruits = Recr_virgin_use; + } break; } @@ -323,7 +325,7 @@ FUNCTION dvar_vector Equil_Spawn_Recr_Fxn(const dvar_vector& SRparm, // SS3 previously used alternative formulation: R = A*S/(B+S) // converting SS3 to align with WHAM - if (use_steepness ==1) + if (use_steepness == 1) { alpha = 4.0 * steepness / (SSBpR_virgin_use * (1. - steepness)); beta = (5.0 * steepness - 1.0) / ((1 - steepness) * SSB_virgin_use);