From cd1659d24f15d199a27b944ec50df622f4159e64 Mon Sep 17 00:00:00 2001 From: Richard Methot Date: Fri, 13 Feb 2026 20:52:10 -0800 Subject: [PATCH 1/4] Revert "another join approach using sqrt(square(" This reverts commit e36270c68d3afdf9e45035cb19772d97dc6e43d5. --- SS_recruit.tpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SS_recruit.tpl b/SS_recruit.tpl index 73f1d102..d03a96be 100644 --- a/SS_recruit.tpl +++ b/SS_recruit.tpl @@ -390,8 +390,8 @@ FUNCTION dvar_vector Equil_Spawn_Recr_Fxn(const dvar_vector& SRparm, // formula: pow( (1.0 - (log (SPR0 / SSBpR_current)) / (steepness * log (SPR0) )), (1. / SRparm(3))); // use a join fxn to keep the quantity positive dvariable temp = (1.0 - (log (SPR0 / SSBpR_current)) / (steepness * log (SPR0) )); - dvariable join1 = 1. / (1. + mfexp(40. * (-temp))); // steep logistic joiner - dvariable temp1 = sqrt( square( join1 * temp)); // to make small negative values positive + dvariable join1 = 1. / (1. + mfexp(100. * (-temp))); // steep logistic joiner + dvariable temp1 = join1 * temp + 1.0e-06; B_equil = Recr_virgin_use * SPR0 * pow( temp1, (1. / SRparm(3))); R_equil = B_equil / SSBpR_current; // warning << " log(SPR): " << log (SPR0 / SSBpR_current) << " denom " << steepness * log (SPR0) << " base: " << From 2eed827856822155dfc6b1c45d6904a8a2bfae5f Mon Sep 17 00:00:00 2001 From: Richard Methot Date: Fri, 13 Feb 2026 20:52:10 -0800 Subject: [PATCH 2/4] Revert "add tiny constant in join to prevent negatives" This reverts commit d1da0d14e38ead2f9d28854e6f4381fa5b5666fe. --- SS_recruit.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SS_recruit.tpl b/SS_recruit.tpl index d03a96be..924636fe 100644 --- a/SS_recruit.tpl +++ b/SS_recruit.tpl @@ -391,7 +391,7 @@ FUNCTION dvar_vector Equil_Spawn_Recr_Fxn(const dvar_vector& SRparm, // use a join fxn to keep the quantity positive dvariable temp = (1.0 - (log (SPR0 / SSBpR_current)) / (steepness * log (SPR0) )); dvariable join1 = 1. / (1. + mfexp(100. * (-temp))); // steep logistic joiner - dvariable temp1 = join1 * temp + 1.0e-06; + dvariable temp1 = join1 * temp; B_equil = Recr_virgin_use * SPR0 * pow( temp1, (1. / SRparm(3))); R_equil = B_equil / SSBpR_current; // warning << " log(SPR): " << log (SPR0 / SSBpR_current) << " denom " << steepness * log (SPR0) << " base: " << From 80c36f7f2823c1675edf229638e74de12cd9432e Mon Sep 17 00:00:00 2001 From: Richard Methot Date: Fri, 13 Feb 2026 20:52:10 -0800 Subject: [PATCH 3/4] Revert "revise join function in equil spawn-recr" This reverts commit fccf46d5b79390279c7c50c3e43af718b59c184e. --- SS_recruit.tpl | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/SS_recruit.tpl b/SS_recruit.tpl index 924636fe..ab75fa2b 100644 --- a/SS_recruit.tpl +++ b/SS_recruit.tpl @@ -388,14 +388,15 @@ FUNCTION dvar_vector Equil_Spawn_Recr_Fxn(const dvar_vector& SRparm, // warning << "SPR: " << SSBpR_current / SPR0 << " Old: " << B_equil << " " << R_equil; // formula: pow( (1.0 - (log (SPR0 / SSBpR_current)) / (steepness * log (SPR0) )), (1. / SRparm(3))); -// use a join fxn to keep the quantity positive +// use a join fxn to keep the quantity above 0.01, which is enough above 0.0 to assure no negative dvariable temp = (1.0 - (log (SPR0 / SSBpR_current)) / (steepness * log (SPR0) )); - dvariable join1 = 1. / (1. + mfexp(100. * (-temp))); // steep logistic joiner - dvariable temp1 = join1 * temp; - B_equil = Recr_virgin_use * SPR0 * pow( temp1, (1. / SRparm(3))); + dvariable join1 = 1. / (1. + mfexp(100. * (temp - 0.01))); // steep logistic joiner + dvariable temp1 = join1 * 0.01 + (1. - join1) * (temp - 0.01); + B_equil = Recr_virgin_use * SPR0 * + pow( temp1, (1. / SRparm(3))); R_equil = B_equil / SSBpR_current; // warning << " log(SPR): " << log (SPR0 / SSBpR_current) << " denom " << steepness * log (SPR0) << " base: " << -// (1.0 - (log (SPR0 / SSBpR_current)) / (steepness * log (SPR0) )) << " temp: " << temp << " join " << join1 << " temp1: " << temp1 << " New: " << B_equil << " " << R_equil << endl; +// (1.0 - (log (SPR0 / SSBpR_current)) / (steepness * log (SPR0) )) << " temp: " << temp << " " << join1 << " " << temp1 << " New: " << B_equil << " " << R_equil << endl; break; } From f5aef00f5efd200659750de36ad1103684e7a575 Mon Sep 17 00:00:00 2001 From: Richard Methot Date: Fri, 13 Feb 2026 20:52:10 -0800 Subject: [PATCH 4/4] Revert "revise benchmark code for SRR 7" This reverts commit 8c429d7d3d60c16b5b4b9775e727a56c062e15ba. --- SS_recruit.tpl | 25 +++++-------------------- SS_write_report.tpl | 4 ++-- 2 files changed, 7 insertions(+), 22 deletions(-) diff --git a/SS_recruit.tpl b/SS_recruit.tpl index ab75fa2b..9a1ab894 100644 --- a/SS_recruit.tpl +++ b/SS_recruit.tpl @@ -377,26 +377,11 @@ FUNCTION dvar_vector Equil_Spawn_Recr_Fxn(const dvar_vector& SRparm, // SS_Label_44.1.7 3 parameter survival based case 7: // survival { - // z_frac is steepness -// incorrect code below was used prior to Jan 2026 revision -// SRZ_0 = log(1.0 / (SSB_virgin_use / Recr_virgin_use)); -// srz_min = SRZ_0 * (1.0 - steepness); -// B_equil = SSB_virgin_use * (1. - (log(1. / SSBpR_current) - SRZ_0) / pow((srz_min - SRZ_0), (1. / SRparm(3)))); -// SRZ_surv = mfexp((1. - pow((B_equil / SSB_virgin_use), SRparm(3))) * (srz_min - SRZ_0) + SRZ_0); // survival -// R_equil = B_equil * SRZ_surv; - dvariable SPR0 = SSB_virgin_use / Recr_virgin_use; -// warning << "SPR: " << SSBpR_current / SPR0 << " Old: " << B_equil << " " << R_equil; - -// formula: pow( (1.0 - (log (SPR0 / SSBpR_current)) / (steepness * log (SPR0) )), (1. / SRparm(3))); -// use a join fxn to keep the quantity above 0.01, which is enough above 0.0 to assure no negative - dvariable temp = (1.0 - (log (SPR0 / SSBpR_current)) / (steepness * log (SPR0) )); - dvariable join1 = 1. / (1. + mfexp(100. * (temp - 0.01))); // steep logistic joiner - dvariable temp1 = join1 * 0.01 + (1. - join1) * (temp - 0.01); - B_equil = Recr_virgin_use * SPR0 * - pow( temp1, (1. / SRparm(3))); - R_equil = B_equil / SSBpR_current; -// warning << " log(SPR): " << log (SPR0 / SSBpR_current) << " denom " << steepness * log (SPR0) << " base: " << -// (1.0 - (log (SPR0 / SSBpR_current)) / (steepness * log (SPR0) )) << " temp: " << temp << " " << join1 << " " << temp1 << " New: " << B_equil << " " << R_equil << endl; + SRZ_0 = log(1.0 / (SSB_virgin_use / Recr_virgin_use)); + srz_min = SRZ_0 * (1.0 - steepness); + B_equil = SSB_virgin_use * (1. - (log(1. / SSBpR_current) - SRZ_0) / pow((srz_min - SRZ_0), (1. / SRparm(3)))); + SRZ_surv = mfexp((1. - pow((B_equil / SSB_virgin_use), SRparm(3))) * (srz_min - SRZ_0) + SRZ_0); // survival + R_equil = B_equil * SRZ_surv; break; } diff --git a/SS_write_report.tpl b/SS_write_report.tpl index 87cb8d21..c2242670 100644 --- a/SS_write_report.tpl +++ b/SS_write_report.tpl @@ -4754,7 +4754,7 @@ FUNCTION void SPR_profile() } // do not recalculate here so force using values from benchmark SS2out << "unfished values for SRR: SSB " << SSB0_4_SRR << " R " << R0_4_SRR << " SSBpR " << " SSBpR: " << SSB0_4_SRR / R0_4_SRR << endl; - SS2out << "SPRloop Iter Bycatch Fmult F_std SSBpR SPR YpR_dead YpR_dead*Recr YpR_ret*Recr Revenue Cost Profit SSB Recruits SSB/Bzero Tot_Catch "; + SS2out << "SPRloop Iter Bycatch Fmult F_std SSBpR YpR_dead YpR_dead*Recr YpR_ret*Recr Revenue Cost Profit SSB Recruits SSB/Bzero Tot_Catch "; for (f = 1; f <= Nfleet; f++) { if (fleet_type(f) <= 2) @@ -4921,7 +4921,7 @@ FUNCTION void SPR_profile() if (SPRloop1 == 0) Fcrash = Fmult2; } - SS2out << SPRloop1 << " " << SPRloop << " " << with_BYC << " " << Fmult2 << " " << equ_F_std << " " << SSB_equil << " " << SSB_equil / (SSB0_4_SRR / R0_4_SRR) << " " << YPR_dead << " " + SS2out << SPRloop1 << " " << SPRloop << " " << with_BYC << " " << Fmult2 << " " << equ_F_std << " " << SSB_equil / (SSB0_4_SRR / R0_4_SRR) << " " << YPR_dead << " " << YPR_dead * Btgt_prof_rec << " " << YPR_ret * Btgt_prof_rec << " " << (PricePerF * YPR_val_vec) * Btgt_prof_rec << " " << Cost << " " << (PricePerF * YPR_val_vec) * Btgt_prof_rec - Cost << " " << Btgt_prof << " " << Btgt_prof_rec << " " << Btgt_prof / SSB0_4_SRR << " " << value(sum(equ_catch_fleet(2)) * Btgt_prof_rec);