FIMS  v0.8.0
Loading...
Searching...
No Matches
catch_at_age.hpp
Go to the documentation of this file.
1
8#ifndef FIMS_MODELS_CATCH_AT_AGE_HPP
9#define FIMS_MODELS_CATCH_AT_AGE_HPP
10
11#include <set>
12#include <regex>
13
15
16/* Dictionary block for shared parameter snippet documentations.
17 * Referenced in function docs via @snippet{doc} this snippet_id.
18 [param_population]
19 @param population Shared pointer to the population object.
20 [param_population]
21 [param_i_age_year]
22 @param i_age_year Dimension folded index for age and year.
23 [param_i_age_year]
24 [param_year]
25 @param year Year index.
26 [param_year]
27 [param_age]
28 @param age Age index.
29 [param_age]
30 [param_i_agem1_yearm1]
31 @param i_agem1_yearm1 Dimension folded index for age-1 and year-1.
32 [param_i_agem1_yearm1]
33 [param_i_dev]
34 @param i_dev Index to log_recruit_dev of vector length n_years-1.
35 [param_i_dev]
36 [param_other]
37 @param other The other CatchAtAge object to copy from.
38 [param_other]
39 */
40
41namespace fims_popdy {
42
43template <typename Type>
51class CatchAtAge : public FisheryModelBase<Type> {
52 public:
57 std::string name_m;
58
63 typedef typename std::map<std::string, fims::Vector<Type>>::iterator
65
70 typedef typename std::map<uint32_t,
71 std::map<std::string, fims::Vector<Type>>>::iterator
73
77 typedef
78 typename std::map<uint32_t,
79 std::map<std::string, fims::Vector<size_t>>>::iterator
85 typedef typename std::map<uint32_t,
86 std::map<std::string, fims::Vector<Type>>>::iterator
88
93 typedef
94 typename std::map<uint32_t,
95 std::map<std::string, fims::Vector<size_t>>>::iterator
97
102 typedef typename std::map<uint32_t,
103 std::shared_ptr<fims_popdy::Fleet<Type>>>::iterator
109 typedef
110 typename std::map<std::string, fims::Vector<Type>>::iterator dq_iterator;
116 std::map<std::string, fims::Vector<fims::Vector<Type>>> report_vectors;
117
118 public:
119 std::vector<Type> ages;
125 std::stringstream ss;
126 ss << "caa_" << this->GetId() << "_";
127 this->name_m = ss.str();
128 this->model_type_m = "caa";
129 }
130
140
145 virtual ~CatchAtAge() {}
146
151 virtual void Initialize() {
152 for (size_t p = 0; p < this->populations.size(); p++) {
153 this->populations[p]->proportion_female.resize(
154 this->populations[p]->n_ages);
155
156 this->populations[p]->M.resize(this->populations[p]->n_years *
157 this->populations[p]->n_ages);
158
159 this->populations[p]->f_multiplier.resize(this->populations[p]->n_years);
160
161 this->populations[p]->spawning_biomass_ratio.resize(
162 (this->populations[p]->n_years + 1));
163 }
164
165 for (fleet_iterator fit = this->fleets.begin(); fit != this->fleets.end();
166 ++fit) {
167 std::shared_ptr<fims_popdy::Fleet<Type>> &fleet = (*fit).second;
168
169 if (fleet->log_q.size() == 0) {
170 fleet->log_q.resize(1);
171 fleet->log_q[0] = static_cast<Type>(0.0);
172 }
173 fleet->q.resize(fleet->log_q.size());
174 fleet->Fmort.resize(fleet->n_years);
175 }
176 }
177
182 virtual void Prepare() {
183 for (size_t p = 0; p < this->populations.size(); p++) {
184 std::shared_ptr<fims_popdy::Population<Type>> &population =
185 this->populations[p];
186
187 auto &derived_quantities =
188 this->GetPopulationDerivedQuantities(population->GetId());
189
190 // Reset the derived quantities for the population
191 for (auto &kv : derived_quantities) {
192 this->ResetVector(kv.second);
193 }
194
195 // Prepare proportion_female
196 for (size_t age = 0; age < population->n_ages; age++) {
197 population->proportion_female[age] = 0.5;
198 }
199
200 // Transformation Section
201 for (size_t age = 0; age < population->n_ages; age++) {
202 for (size_t year = 0; year < population->n_years; year++) {
203 size_t i_age_year = age * population->n_years + year;
205 fims_math::exp(population->log_M[i_age_year]);
206 }
207 }
208
209 for (size_t year = 0; year < population->n_years; year++) {
210 population->f_multiplier[year] =
211 fims_math::exp(population->log_f_multiplier[year]);
212 }
213 }
214
215 for (fleet_iterator fit = this->fleets.begin(); fit != this->fleets.end();
216 ++fit) {
217 std::shared_ptr<fims_popdy::Fleet<Type>> &fleet = (*fit).second;
218 auto &derived_quantities =
219 this->GetFleetDerivedQuantities(fleet->GetId());
220
221 for (auto &kv : derived_quantities) {
222 this->ResetVector(kv.second);
223 }
224
225 // Transformation Section
226 for (size_t i = 0; i < fleet->log_q.size(); i++) {
227 fleet->q[i] = fims_math::exp(fleet->log_q[i]);
228 }
229
230 for (size_t year = 0; year < fleet->n_years; year++) {
231 fleet->Fmort[year] = fims_math::exp(fleet->log_Fmort[year]);
232 }
233 }
234 }
238 void AddPopulation(uint32_t id) { this->population_ids.insert(id); }
239
243 std::set<uint32_t> &GetPopulationIds() { return this->population_ids; }
244
250 std::vector<std::shared_ptr<fims_popdy::Population<Type>>> &GetPopulations() {
251 return this->populations;
252 }
253
268 size_t i_age_year, size_t age) {
269 std::map<std::string, fims::Vector<Type>> &dq_ =
271
272 dq_["numbers_at_age"][i_age_year] =
273 fims_math::exp(population->log_init_naa[age]);
274 }
275
300 size_t i_age_year, size_t i_agem1_yearm1, size_t age) {
301 // using Z from previous age/year
302
303 std::map<std::string, fims::Vector<Type>> &dq_ =
305
306 dq_["numbers_at_age"][i_age_year] =
307 dq_["numbers_at_age"][i_agem1_yearm1] *
308 (fims_math::exp(-dq_["mortality_Z"][i_agem1_yearm1]));
309
310 // Plus group calculation
311 if (age == (population->n_ages - 1)) {
312 dq_["numbers_at_age"][i_age_year] =
313 dq_["numbers_at_age"][i_age_year] +
314 dq_["numbers_at_age"][i_agem1_yearm1 + 1] *
315 (fims_math::exp(-dq_["mortality_Z"][i_agem1_yearm1 + 1]));
316 }
317 }
318
343 size_t i_age_year, size_t i_agem1_yearm1, size_t age) {
344 std::map<std::string, fims::Vector<Type>> &dq_ =
346
347 // using M from previous age/year
348 dq_["unfished_numbers_at_age"][i_age_year] =
349 dq_["unfished_numbers_at_age"][i_agem1_yearm1] *
350 (fims_math::exp(-population->M[i_agem1_yearm1]));
351
352 // Plus group calculation
353 if (age == (population->n_ages - 1)) {
354 dq_["unfished_numbers_at_age"][i_age_year] =
355 dq_["unfished_numbers_at_age"][i_age_year] +
356 dq_["unfished_numbers_at_age"][i_agem1_yearm1 + 1] *
357 (fims_math::exp(-population->M[i_agem1_yearm1 + 1]));
358 }
359 }
360
394 size_t i_age_year, size_t year, size_t age) {
395 std::map<std::string, fims::Vector<Type>> &dq_ =
397
398 for (size_t fleet_ = 0; fleet_ < population->n_fleets; fleet_++) {
399 // evaluate is a member function of the selectivity class
400 Type s = population->fleets[fleet_]->selectivity->evaluate(
401 population->ages[age]);
402
403 dq_["mortality_F"][i_age_year] +=
404 population->fleets[fleet_]->Fmort[year] *
405 population->f_multiplier[year] * s;
406
407 dq_["sum_selectivity"][i_age_year] += s;
408 }
409 dq_["mortality_M"][i_age_year] = population->M[i_age_year];
410
411 dq_["mortality_Z"][i_age_year] =
412 population->M[i_age_year] + dq_["mortality_F"][i_age_year];
413 }
414
431 size_t i_age_year, size_t year, size_t age) {
432 std::map<std::string, fims::Vector<Type>> &dq_ =
434
435 dq_["biomass"][year] += dq_["numbers_at_age"][i_age_year] *
436 population->growth->evaluate(population->ages[age]);
437 }
438
455 size_t i_age_year, size_t year, size_t age) {
456 std::map<std::string, fims::Vector<Type>> &dq_ =
458
459 dq_["unfished_biomass"][year] +=
460 dq_["unfished_numbers_at_age"][i_age_year] *
461 population->growth->evaluate(population->ages[age]);
462 }
463
482 size_t i_age_year, size_t year, size_t age) {
483 std::map<std::string, fims::Vector<Type>> &dq_ =
485
486 dq_["spawning_biomass"][year] +=
487 population->proportion_female[age] * dq_["numbers_at_age"][i_age_year] *
488 dq_["proportion_mature_at_age"][i_age_year] *
489 population->growth->evaluate(population->ages[age]);
490 }
491
509 size_t i_age_year, size_t year, size_t age) {
510 std::map<std::string, fims::Vector<Type>> &dq_ =
512
513 dq_["unfished_spawning_biomass"][year] +=
514 population->proportion_female[age] *
515 dq_["unfished_numbers_at_age"][i_age_year] *
516 dq_["proportion_mature_at_age"][i_age_year] *
517 population->growth->evaluate(population->ages[age]);
518 }
519
536 std::shared_ptr<fims_popdy::Population<Type>> &population, size_t year) {
537 std::map<std::string, fims::Vector<Type>> &dq_ =
539 population->spawning_biomass_ratio[year] =
540 dq_["spawning_biomass"][year] / dq_["unfished_spawning_biomass"][0];
541 }
542
567 std::shared_ptr<fims_popdy::Population<Type>> &population) {
568 std::map<std::string, fims::Vector<Type>> &dq_ =
570
571 std::vector<Type> numbers_spr(population->n_ages, 1.0);
572 Type phi_0 = 0.0;
573 phi_0 += numbers_spr[0] * population->proportion_female[0] *
574 dq_["proportion_mature_at_age"][0] *
575 population->growth->evaluate(population->ages[0]);
576 for (size_t a = 1; a < (population->n_ages - 1); a++) {
577 numbers_spr[a] = numbers_spr[a - 1] * fims_math::exp(-population->M[a]);
578 phi_0 += numbers_spr[a] * population->proportion_female[a] *
579 dq_["proportion_mature_at_age"][a] *
580 population->growth->evaluate(population->ages[a]);
581 }
582
583 numbers_spr[population->n_ages - 1] =
584 (numbers_spr[population->n_ages - 2] *
585 fims_math::exp(-population->M[population->n_ages - 2])) /
586 (1 - fims_math::exp(-population->M[population->n_ages - 1]));
587 phi_0 +=
588 numbers_spr[population->n_ages - 1] *
589 population->proportion_female[population->n_ages - 1] *
590 dq_["proportion_mature_at_age"][population->n_ages - 1] *
591 population->growth->evaluate(population->ages[population->n_ages - 1]);
592
593 return phi_0;
594 }
595
621 size_t i_age_year, size_t year, size_t i_dev) {
622 std::map<std::string, fims::Vector<Type>> &dq_ =
624
626
627 if (i_dev == population->n_years) {
628 dq_["numbers_at_age"][i_age_year] =
629 population->recruitment->evaluate_mean(
630 dq_["spawning_biomass"][year - 1], phi0);
631 /*the final year of the time series has no data to inform recruitment
632 devs, so this value is set to the mean recruitment.*/
633 } else {
634 // Why are we using evaluate_mean, how come a virtual function was
635 // changed? AMH: there are now two virtual functions: evaluate_mean and
636 // evaluate_process (see below)
637 population->recruitment->log_expected_recruitment[year - 1] =
638 fims_math::log(population->recruitment->evaluate_mean(
639 dq_["spawning_biomass"][year - 1], phi0));
640
641 dq_["numbers_at_age"][i_age_year] = fims_math::exp(
642 population->recruitment->process->evaluate_process(year - 1));
643 }
644
645 dq_["expected_recruitment"][year] = dq_["numbers_at_age"][i_age_year];
646 }
647
663 size_t i_age_year, size_t age) {
664 std::map<std::string, fims::Vector<Type>> &dq_ =
666
667 dq_["proportion_mature_at_age"][i_age_year] =
668 population->maturity->evaluate(population->ages[age]);
669 }
670
695 std::shared_ptr<fims_popdy::Population<Type>> &population, size_t year,
696 size_t age) {
697 std::map<std::string, fims::Vector<Type>> &pdq_ =
699
700 for (size_t fleet_ = 0; fleet_ < population->n_fleets; fleet_++) {
701 std::map<std::string, fims::Vector<Type>> &fdq_ =
702 this->GetFleetDerivedQuantities(population->fleets[fleet_]->GetId());
703 size_t i_age_year = year * population->n_ages + age;
704
705 pdq_["total_landings_weight"][year] +=
706 fdq_["landings_weight_at_age"][i_age_year];
707
708 fdq_["landings_weight"][year] +=
709 fdq_["landings_weight_at_age"][i_age_year];
710
711 pdq_["total_landings_numbers"][year] +=
712 fdq_["landings_numbers_at_age"][i_age_year];
713
714 fdq_["landings_numbers"][year] +=
715 fdq_["landings_numbers_at_age"][i_age_year];
716 }
717 }
718
738 std::shared_ptr<fims_popdy::Population<Type>> &population, size_t year,
739 size_t age) {
740 int i_age_year = year * population->n_ages + age;
741 for (size_t fleet_ = 0; fleet_ < population->n_fleets; fleet_++) {
742 std::map<std::string, fims::Vector<Type>> &fdq_ =
743 this->GetFleetDerivedQuantities(population->fleets[fleet_]->GetId());
744
745 fdq_["landings_weight_at_age"][i_age_year] =
746 fdq_["landings_numbers_at_age"][i_age_year] *
747 population->growth->evaluate(population->ages[age]);
748 }
749 }
750
779 size_t i_age_year, size_t year, size_t age) {
780 std::map<std::string, fims::Vector<Type>> &pdq_ =
782
783 for (size_t fleet_ = 0; fleet_ < population->n_fleets; fleet_++) {
784 std::map<std::string, fims::Vector<Type>> &fdq_ =
785 this->GetFleetDerivedQuantities(population->fleets[fleet_]->GetId());
786
787 // Baranov Catch Equation
788 fdq_["landings_numbers_at_age"][i_age_year] +=
789 (population->fleets[fleet_]->Fmort[year] *
790 population->f_multiplier[year] *
791 population->fleets[fleet_]->selectivity->evaluate(
792 population->ages[age])) /
793 pdq_["mortality_Z"][i_age_year] * pdq_["numbers_at_age"][i_age_year] *
794 (1 - fims_math::exp(-(pdq_["mortality_Z"][i_age_year])));
795 }
796 }
797
824 size_t i_age_year, size_t year, size_t age) {
825 for (size_t fleet_ = 0; fleet_ < population->n_fleets; fleet_++) {
826 std::map<std::string, fims::Vector<Type>> &fdq_ =
827 this->GetFleetDerivedQuantities(population->fleets[fleet_]->GetId());
828
829 fdq_["index_weight"][year] += fdq_["index_weight_at_age"][i_age_year];
830
831 fdq_["index_numbers"][year] += fdq_["index_numbers_at_age"][i_age_year];
832 }
833 }
834
864 size_t i_age_year, size_t year, size_t age) {
865 std::map<std::string, fims::Vector<Type>> &pdq_ =
867
868 for (size_t fleet_ = 0; fleet_ < population->n_fleets; fleet_++) {
869 std::map<std::string, fims::Vector<Type>> &fdq_ =
870 this->GetFleetDerivedQuantities(population->fleets[fleet_]->GetId());
871
872 fdq_["index_numbers_at_age"][i_age_year] +=
873 (population->fleets[fleet_]->q.get_force_scalar(year) *
874 population->fleets[fleet_]->selectivity->evaluate(
875 population->ages[age])) *
876 pdq_["numbers_at_age"][i_age_year];
877 }
878 }
879
898 std::shared_ptr<fims_popdy::Population<Type>> &population, size_t year,
899 size_t age) {
900 int i_age_year = year * population->n_ages + age;
901 for (size_t fleet_ = 0; fleet_ < population->n_fleets; fleet_++) {
902 std::map<std::string, fims::Vector<Type>> &fdq_ =
903 this->GetFleetDerivedQuantities(population->fleets[fleet_]->GetId());
904
905 fdq_["index_weight_at_age"][i_age_year] =
906 fdq_["index_numbers_at_age"][i_age_year] *
907 population->growth->evaluate(population->ages[age]);
908 }
909 }
910
916 for (fit = this->fleets.begin(); fit != this->fleets.end(); ++fit) {
917 std::map<std::string, fims::Vector<Type>> &fdq_ =
918 this->GetFleetDerivedQuantities((*fit).second->GetId());
919
920 std::shared_ptr<fims_popdy::Fleet<Type>> &fleet = (*fit).second;
921 for (size_t y = 0; y < fleet->n_years; y++) {
922 Type sum = static_cast<Type>(0.0);
923 Type sum_obs = static_cast<Type>(0.0);
924 // robust_add is a small value to add to expected composition
925 // proportions at age to stabilize likelihood calculations
926 // when the expected proportions are close to zero.
927 // Type robust_add = static_cast<Type>(0.0); // zeroed out before
928 // testing 0.0001; sum robust is used to calculate the total sum of
929 // robust additions to ensure that proportions sum to 1. Type robust_sum
930 // = static_cast<Type>(1.0);
931
932 for (size_t a = 0; a < fleet->n_ages; a++) {
933 size_t i_age_year = y * fleet->n_ages + a;
934 // Here we have a check to determine if the age comp
935 // should be calculated from the retained landings or
936 // the total population. These values are slightly different.
937 // In the future this will have more impact as we implement
938 // timing rather than everything occurring at the start of
939 // the year.
940 if (fleet->fleet_observed_landings_data_id_m == -999) {
941 fdq_["agecomp_expected"][i_age_year] =
942 fdq_["index_numbers_at_age"][i_age_year];
943 } else {
944 fdq_["agecomp_expected"][i_age_year] =
945 fdq_["landings_numbers_at_age"][i_age_year];
946 }
947 sum += fdq_["agecomp_expected"][i_age_year];
948 // robust_sum -= robust_add;
949
950 // This sums over the observed age composition data so that
951 // the expected age composition can be rescaled to match the
952 // total number observed. The check for na values should not
953 // be needed as individual years should not have missing data.
954 // This is need to be re-explored if/when we modify FIMS to
955 // allow for composition bins that do not match the population
956 // bins.
957 if (fleet->fleet_observed_agecomp_data_id_m != -999) {
958 if (fleet->observed_agecomp_data->at(i_age_year) !=
959 fleet->observed_agecomp_data->na_value) {
960 sum_obs += fleet->observed_agecomp_data->at(i_age_year);
961 }
962 }
963 }
964 for (size_t a = 0; a < fleet->n_ages; a++) {
965 size_t i_age_year = y * fleet->n_ages + a;
966 fdq_["agecomp_proportion"][i_age_year] =
967 fdq_["agecomp_expected"][i_age_year] / sum;
968 // robust_add + robust_sum * this->agecomp_expected[i_age_year] / sum;
969
970 if (fleet->fleet_observed_agecomp_data_id_m != -999) {
971 fdq_["agecomp_expected"][i_age_year] =
972 fdq_["agecomp_proportion"][i_age_year] * sum_obs;
973 }
974 }
975 }
976 }
977 }
978
984 for (fit = this->fleets.begin(); fit != this->fleets.end(); ++fit) {
985 std::map<std::string, fims::Vector<Type>> &fdq_ =
986 this->GetFleetDerivedQuantities((*fit).second->GetId());
987
988 std::shared_ptr<fims_popdy::Fleet<Type>> &fleet = (*fit).second;
989
990 if (fleet->n_lengths > 0) {
991 for (size_t y = 0; y < fleet->n_years; y++) {
992 Type sum = static_cast<Type>(0.0);
993 Type sum_obs = static_cast<Type>(0.0);
994 // robust_add is a small value to add to expected composition
995 // proportions at age to stabilize likelihood calculations
996 // when the expected proportions are close to zero.
997 // Type robust_add = static_cast<Type>(0.0); // 0.0001; zeroed out
998 // before testing sum robust is used to calculate the total sum of
999 // robust additions to ensure that proportions sum to 1. Type
1000 // robust_sum = static_cast<Type>(1.0);
1001 for (size_t l = 0; l < fleet->n_lengths; l++) {
1002 size_t i_length_year = y * fleet->n_lengths + l;
1003 for (size_t a = 0; a < fleet->n_ages; a++) {
1004 size_t i_age_year = y * fleet->n_ages + a;
1005 size_t i_length_age = a * fleet->n_lengths + l;
1006 fdq_["lengthcomp_expected"][i_length_year] +=
1007 fdq_["agecomp_expected"][i_age_year] *
1008 fleet->age_to_length_conversion[i_length_age];
1009
1010 fdq_["landings_numbers_at_length"][i_length_year] +=
1011 fdq_["landings_numbers_at_age"][i_age_year] *
1012 fleet->age_to_length_conversion[i_length_age];
1013
1014 fdq_["index_numbers_at_length"][i_length_year] +=
1015 fdq_["index_numbers_at_age"][i_age_year] *
1016 fleet->age_to_length_conversion[i_length_age];
1017 }
1018
1019 sum += fdq_["lengthcomp_expected"][i_length_year];
1020 // robust_sum -= robust_add;
1021
1022 if (fleet->fleet_observed_lengthcomp_data_id_m != -999) {
1023 if (fleet->observed_lengthcomp_data->at(i_length_year) !=
1024 fleet->observed_lengthcomp_data->na_value) {
1025 sum_obs += fleet->observed_lengthcomp_data->at(i_length_year);
1026 }
1027 }
1028 }
1029 for (size_t l = 0; l < fleet->n_lengths; l++) {
1030 size_t i_length_year = y * fleet->n_lengths + l;
1031 fdq_["lengthcomp_proportion"][i_length_year] =
1032 fdq_["lengthcomp_expected"][i_length_year] / sum;
1033 // robust_add + robust_sum *
1034 // this->lengthcomp_expected[i_length_year] / sum;
1035 if (fleet->fleet_observed_lengthcomp_data_id_m != -999) {
1036 fdq_["lengthcomp_expected"][i_length_year] =
1037 fdq_["lengthcomp_proportion"][i_length_year] * sum_obs;
1038 }
1039 }
1040 }
1041 }
1042 }
1043 }
1044
1050 for (fit = this->fleets.begin(); fit != this->fleets.end(); ++fit) {
1051 std::map<std::string, fims::Vector<Type>> &fdq_ =
1052 this->GetFleetDerivedQuantities((*fit).second->GetId());
1053 std::shared_ptr<fims_popdy::Fleet<Type>> &fleet = (*fit).second;
1054
1055 for (size_t i = 0; i < fdq_["index_numbers"].size(); i++) {
1056 if (fleet->observed_index_units == "number") {
1057 fdq_["index_expected"][i] = fdq_["index_numbers"][i];
1058 } else {
1059 fdq_["index_expected"][i] = fdq_["index_weight"][i];
1060 }
1061 fdq_["log_index_expected"][i] = log(fdq_["index_expected"][i]);
1062 }
1063 }
1064 }
1065
1071 for (fit = this->fleets.begin(); fit != this->fleets.end(); ++fit) {
1072 std::map<std::string, fims::Vector<Type>> &fdq_ =
1073 this->GetFleetDerivedQuantities((*fit).second->GetId());
1074 std::shared_ptr<fims_popdy::Fleet<Type>> &fleet = (*fit).second;
1075
1076 for (size_t i = 0; i < fdq_["landings_weight"].size(); i++) {
1077 if (fleet->observed_landings_units == "number") {
1078 fdq_["landings_expected"][i] = fdq_["landings_numbers"][i];
1079 } else {
1080 fdq_["landings_expected"][i] = fdq_["landings_weight"][i];
1081 }
1082 fdq_["log_landings_expected"][i] = log(fdq_["landings_expected"][i]);
1083 }
1084 }
1085 }
1086
1087 virtual void Evaluate() {
1088 /*
1089 Sets derived vectors to zero
1090 Performs parameters transformations
1091 Sets recruitment deviations to mean 0.
1092 */
1093 Prepare();
1094 /*
1095 start at year=0, age=0;
1096 here year 0 is the estimated initial population structure and age 0 are
1097 recruits loops start at zero with if statements inside to specify unique
1098 code for initial structure and recruitment 0 loops. Could also have started
1099 loops at 1 with initial structure and recruitment setup outside the loops.
1100
1101 year loop is extended to <= n_years because SSB is calculated as the start
1102 of the year value and by extending one extra year we get estimates of the
1103 population structure at the end of the final year. An alternative approach
1104 would be to keep initial numbers at age in it's own vector and each year to
1105 include the population structure at the end of the year. This is likely a
1106 null point given that we are planning to modify to an event/stanza based
1107 structure in later milestones which will eliminate this confusion by
1108 explicitly referencing the exact date (or period of averaging) at which any
1109 calculation or output is being made.
1110 */
1111 for (size_t p = 0; p < this->populations.size(); p++) {
1112 std::shared_ptr<fims_popdy::Population<Type>> &population =
1113 this->populations[p];
1114 std::map<std::string, fims::Vector<Type>> &pdq_ =
1115 this->GetPopulationDerivedQuantities(population->GetId());
1116 // CAAPopulationProxy<Type>& population = this->populations_proxies[p];
1117
1118 for (size_t y = 0; y <= population->n_years; y++) {
1119 for (size_t a = 0; a < population->n_ages; a++) {
1120 /*
1121 index naming defines the dimensional folding structure
1122 i.e. i_age_year is referencing folding over years and ages.
1123 */
1124 size_t i_age_year = y * population->n_ages + a;
1125 /*
1126 Mortality rates are not estimated in the final year which is
1127 used to show expected population structure at the end of the model
1128 period. This is because biomass in year i represents biomass at the
1129 start of the year. Should we add complexity to track more values such
1130 as start, mid, and end biomass in all years where, start biomass=end
1131 biomass of the previous year? Referenced above, this is probably not
1132 worth exploring as later milestone changes will eliminate this
1133 confusion.
1134 */
1135 if (y < population->n_years) {
1136 /*
1137 First thing we need is total mortality aggregated across all fleets
1138 to inform the subsequent catch and change in numbers at age
1139 calculations. This is only calculated for years < n_years as these
1140 are the model estimated years with data. The year loop extends to
1141 y=n_years so that population numbers at age and SSB can be
1142 calculated at the end of the last year of the model
1143 */
1145 }
1147 /* if statements needed because some quantities are only needed
1148 for the first year and/or age, so these steps are included here.
1149 */
1150 if (y == 0) {
1151 // Initial numbers at age is a user input or estimated parameter
1152 // vector.
1154
1155 if (a == 0) {
1156 /*
1157 Expected recruitment in year 0 is numbers at age 0 in year 0.
1158 */
1159 pdq_["expected_recruitment"][y] =
1160 pdq_["numbers_at_age"][i_age_year];
1161 pdq_["unfished_numbers_at_age"][i_age_year] =
1162 fims_math::exp(population->recruitment->log_rzero[0]);
1163 } else {
1165 }
1166
1167 } else {
1168 if (a == 0) {
1169 // Set the nrecruits for age a=0 year y (use pointers instead of
1170 // functional returns) assuming fecundity = 1 and 50:50 sex ratio
1172 pdq_["unfished_numbers_at_age"][i_age_year] =
1173 fims_math::exp(population->recruitment->log_rzero[0]);
1174 } else {
1175 size_t i_agem1_yearm1 = (y - 1) * population->n_ages + (a - 1);
1178 a);
1179 }
1180 }
1181
1182 /*
1183 Fished and unfished biomass vectors are summing biomass at
1184 age across ages.
1185 */
1186
1188
1190
1191 /*
1192 Fished and unfished spawning biomass vectors are summing biomass at
1193 age across ages to allow calculation of recruitment in the next
1194 year.
1195 */
1196
1198
1200
1201 /*
1202 Here composition, total catch, and index values are calculated for all
1203 years with reference data. They are not calculated for y=n_years as
1204 there is this is just to get final population structure at the end of
1205 the terminal year.
1206 */
1207 if (y < population->n_years) {
1211
1215 }
1216 }
1217 /* Calculate spawning biomass depletion ratio */
1219 }
1220 }
1225 }
1230 virtual void Report() {
1231 int n_fleets = this->fleets.size();
1232 int n_pops = this->populations.size();
1233#ifdef TMB_MODEL
1234 if (this->do_reporting == true) {
1235 report_vectors.clear();
1236 // std::shared_ptr<UncertaintyReportInfoMap>
1237 // population_uncertainty_report_info_map =
1238 // this->GetPopulationUncertaintyReportInfoMap();
1239
1240 // std::shared_ptr<UncertaintyReportInfoMap>
1241 // fleet_uncertainty_report_info_map =
1242 // this->GetFleetUncertaintyReportInfoMap();
1243
1244 // initialize population vectors
1263
1264 // initialize fleet vectors
1284
1285 // initiate population index for structuring report out objects
1286 int pop_idx = 0;
1287 for (size_t p = 0; p < this->populations.size(); p++) {
1288 this->populations[p]->create_report_vectors(report_vectors);
1289 // std::shared_ptr<fims_popdy::Population<Type>> &population =
1290 // this->populations[p];
1291 std::map<std::string, fims::Vector<Type>> &derived_quantities =
1293 this->populations[p]->maturity->create_report_vectors(report_vectors);
1294 this->populations[p]->growth->create_report_vectors(report_vectors);
1295 this->populations[p]->recruitment->create_report_vectors(
1296 report_vectors);
1297 biomass_p(pop_idx) = derived_quantities["biomass"].to_tmb();
1299 derived_quantities["expected_recruitment"].to_tmb();
1300 mortality_F_p(pop_idx) = derived_quantities["mortality_F"].to_tmb();
1301 mortality_M_p(pop_idx) = derived_quantities["mortality_M"].to_tmb();
1302 mortality_Z_p(pop_idx) = derived_quantities["mortality_Z"].to_tmb();
1304 derived_quantities["numbers_at_age"].to_tmb();
1306 derived_quantities["proportion_mature_at_age"].to_tmb();
1308 derived_quantities["spawning_biomass"].to_tmb();
1310 derived_quantities["sum_selectivity"].to_tmb();
1312 derived_quantities["total_landings_numbers"].to_tmb();
1314 derived_quantities["total_landings_weight"].to_tmb();
1316 derived_quantities["unfished_biomass"].to_tmb();
1318 derived_quantities["unfished_numbers_at_age"].to_tmb();
1320 derived_quantities["unfished_spawning_biomass"].to_tmb();
1321 log_M_p(pop_idx) = this->populations[pop_idx]->log_M.to_tmb();
1322 log_init_naa_p(pop_idx) =
1323 this->populations[pop_idx]->log_init_naa.to_tmb();
1324 spawning_biomass_ratio_p(pop_idx) =
1325 this->populations[pop_idx]->spawning_biomass_ratio.to_tmb();
1326 log_f_multiplier_p(pop_idx) =
1327 this->populations[pop_idx]->log_f_multiplier.to_tmb();
1328
1329 pop_idx += 1;
1330 }
1331
1332 // initiate fleet index for structuring report out objects
1333 int fleet_idx = 0;
1335 for (fit = this->fleets.begin(); fit != this->fleets.end(); ++fit) {
1336 std::shared_ptr<fims_popdy::Fleet<Type>> &fleet = (*fit).second;
1337 fleet->create_report_vectors(report_vectors);
1338 fleet->selectivity->create_report_vectors(report_vectors);
1339 std::map<std::string, fims::Vector<Type>> &derived_quantities =
1340 this->GetFleetDerivedQuantities(fleet->GetId());
1341
1343 derived_quantities["agecomp_expected"].to_tmb();
1345 derived_quantities["agecomp_proportion"].to_tmb();
1346 catch_index_f(fleet_idx) = derived_quantities["catch_index"].to_tmb();
1348 derived_quantities["index_expected"].to_tmb();
1350 derived_quantities["index_numbers"].to_tmb();
1352 derived_quantities["index_numbers_at_age"].to_tmb();
1354 derived_quantities["index_numbers_at_length"].to_tmb();
1355 index_weight_f(fleet_idx) = derived_quantities["index_weight"].to_tmb();
1357 derived_quantities["index_weight_at_age"].to_tmb();
1359 derived_quantities["landings_expected"].to_tmb();
1361 derived_quantities["landings_numbers"].to_tmb();
1363 derived_quantities["landings_numbers_at_age"].to_tmb();
1365 derived_quantities["landings_numbers_at_length"].to_tmb();
1367 derived_quantities["landings_weight"].to_tmb();
1369 derived_quantities["landings_weight_at_age"].to_tmb();
1370 // length_comp_expected_f(fleet_idx) =
1371 // derived_quantities["length_comp_expected"];
1372 // length_comp_proportion_f(fleet_idx) =
1373 // derived_quantities["length_comp_proportion"];
1375 derived_quantities["lengthcomp_expected"].to_tmb();
1377 derived_quantities["lengthcomp_proportion"].to_tmb();
1379 derived_quantities["log_index_expected"].to_tmb();
1381 derived_quantities["log_landings_expected"].to_tmb();
1382 fleet_idx += 1;
1383 }
1384
1385 vector<Type> biomass = ADREPORTvector(biomass_p);
1386 vector<Type> expected_recruitment =
1392 vector<Type> proportion_mature_at_age =
1396 vector<Type> total_landings_numbers =
1398 vector<Type> total_landings_weight =
1401 vector<Type> unfished_numbers_at_age =
1403 vector<Type> unfished_spawning_biomass =
1405 vector<Type> spawning_biomass_ratio =
1407 vector<Type> log_f_multiplier = ADREPORTvector(log_f_multiplier_p);
1408
1409 vector<Type> agecomp_expected = ADREPORTvector(agecomp_expected_f);
1410 vector<Type> agecomp_proportion = ADREPORTvector(agecomp_proportion_f);
1414 vector<Type> index_numbers_at_age =
1416 vector<Type> index_numbers_at_length =
1422 vector<Type> landings_numbers_at_age =
1424 vector<Type> landings_numbers_at_length =
1427 vector<Type> landings_weight_at_age =
1429 // vector<Type> length_comp_expected =
1430 // ADREPORTvector(length_comp_expected_f); vector<Type>
1431 // length_comp_proportion = ADREPORTvector(length_comp_proportion_f);
1432 vector<Type> lengthcomp_expected = ADREPORTvector(lengthcomp_expected_f);
1433 vector<Type> lengthcomp_proportion =
1435 vector<Type> log_index_expected = ADREPORTvector(log_index_expected_f);
1436 vector<Type> log_landings_expected =
1438 // populations
1439 // report
1440 FIMS_REPORT_F_("biomass", biomass_p, this->of);
1441 FIMS_REPORT_F_("expected_recruitment", expected_recruitment_p, this->of);
1442 FIMS_REPORT_F_("mortality_F", mortality_F_p, this->of);
1443 FIMS_REPORT_F_("mortality_M", mortality_M_p, this->of);
1444 FIMS_REPORT_F_("mortality_Z", mortality_Z_p, this->of);
1445 FIMS_REPORT_F_("numbers_at_age", numbers_at_age_p, this->of);
1446 FIMS_REPORT_F_("proportion_mature_at_age", proportion_mature_at_age_p,
1447 this->of);
1448 FIMS_REPORT_F_("spawning_biomass", spawning_biomass_p, this->of);
1449 FIMS_REPORT_F_("sum_selectivity", sum_selectivity_p, this->of);
1450 FIMS_REPORT_F_("total_landings_numbers", total_landings_numbers_p,
1451 this->of);
1452 FIMS_REPORT_F_("total_landings_weight", total_landings_weight_p,
1453 this->of);
1454 FIMS_REPORT_F_("unfished_biomass", unfished_biomass_p, this->of);
1455 FIMS_REPORT_F_("unfished_numbers_at_age", unfished_numbers_at_age_p,
1456 this->of);
1457 FIMS_REPORT_F_("unfished_spawning_biomass", unfished_spawning_biomass_p,
1458 this->of);
1459 FIMS_REPORT_F_("log_M", log_M_p, this->of);
1460 FIMS_REPORT_F_("log_init_naa", log_init_naa_p, this->of);
1461 FIMS_REPORT_F_("spawning_biomass_ratio", spawning_biomass_ratio_p,
1462 this->of);
1463 FIMS_REPORT_F_("log_f_multiplier", log_f_multiplier_p, this->of);
1464
1465 // adreport
1466 ADREPORT_F(biomass, this->of);
1467 ADREPORT_F(expected_recruitment, this->of);
1468 ADREPORT_F(mortality_F, this->of);
1469 ADREPORT_F(mortality_M, this->of);
1470 ADREPORT_F(mortality_Z, this->of);
1471 ADREPORT_F(numbers_at_age, this->of);
1472 ADREPORT_F(proportion_mature_at_age, this->of);
1473 ADREPORT_F(spawning_biomass, this->of);
1474 ADREPORT_F(sum_selectivity, this->of);
1475 ADREPORT_F(total_landings_numbers, this->of);
1476 ADREPORT_F(total_landings_weight, this->of);
1477 ADREPORT_F(unfished_biomass, this->of);
1478 ADREPORT_F(unfished_numbers_at_age, this->of);
1479 ADREPORT_F(unfished_spawning_biomass, this->of);
1480 ADREPORT_F(spawning_biomass_ratio, this->of);
1481 ADREPORT_F(log_f_multiplier, this->of);
1482
1483 // fleets
1484 // report
1485 FIMS_REPORT_F_("agecomp_expected", agecomp_expected_f, this->of);
1486 FIMS_REPORT_F_("agecomp_proportion", agecomp_proportion_f, this->of);
1487 FIMS_REPORT_F_("catch_index", catch_index_f, this->of);
1488 FIMS_REPORT_F_("index_expected", index_expected_f, this->of);
1489 FIMS_REPORT_F_("index_numbers", index_numbers_f, this->of);
1490 FIMS_REPORT_F_("index_numbers_at_age", index_numbers_at_age_f, this->of);
1491 FIMS_REPORT_F_("index_numbers_at_length", index_numbers_at_length_f,
1492 this->of);
1493 FIMS_REPORT_F_("index_weight", index_weight_f, this->of);
1494 FIMS_REPORT_F_("index_weight_at_age", index_weight_at_age_f, this->of);
1495 FIMS_REPORT_F_("landings_expected", landings_expected_f, this->of);
1496 FIMS_REPORT_F_("landings_numbers", landings_numbers_f, this->of);
1497 FIMS_REPORT_F_("landings_numbers_at_age", landings_numbers_at_age_f,
1498 this->of);
1499 FIMS_REPORT_F_("landings_numbers_at_length", landings_numbers_at_length_f,
1500 this->of);
1501 FIMS_REPORT_F_("landings_weight", landings_weight_f, this->of);
1502 FIMS_REPORT_F_("landings_weight_at_age", landings_weight_at_age_f,
1503 this->of);
1504 FIMS_REPORT_F_("lengthcomp_expected", lengthcomp_expected_f, this->of);
1505 FIMS_REPORT_F_("lengthcomp_proportion", lengthcomp_proportion_f,
1506 this->of);
1507 FIMS_REPORT_F_("log_index_expected", log_index_expected_f, this->of);
1508 FIMS_REPORT_F_("log_landings_expected", log_landings_expected_f,
1509 this->of);
1510 // adreport
1511 ADREPORT_F(agecomp_expected, this->of);
1512 ADREPORT_F(agecomp_proportion, this->of);
1513 ADREPORT_F(catch_index, this->of);
1514 ADREPORT_F(index_expected, this->of);
1515 ADREPORT_F(index_numbers, this->of);
1516 ADREPORT_F(index_numbers_at_age, this->of);
1517 ADREPORT_F(index_numbers_at_length, this->of);
1518 ADREPORT_F(index_weight, this->of);
1519 ADREPORT_F(index_weight_at_age, this->of);
1520 ADREPORT_F(landings_expected, this->of);
1521 ADREPORT_F(landings_numbers, this->of);
1522 ADREPORT_F(landings_numbers_at_age, this->of);
1523 ADREPORT_F(landings_numbers_at_length, this->of);
1524 ADREPORT_F(landings_weight, this->of);
1525 ADREPORT_F(landings_weight_at_age, this->of);
1526 ADREPORT_F(lengthcomp_expected, this->of);
1527 ADREPORT_F(lengthcomp_proportion, this->of);
1528 ADREPORT_F(log_index_expected, this->of);
1529 ADREPORT_F(log_landings_expected, this->of);
1530 std::stringstream var_name;
1531 typename std::map<std::string, fims::Vector<fims::Vector<Type>>>::iterator
1532 rvit;
1533 for (rvit = report_vectors.begin(); rvit != report_vectors.end();
1534 ++rvit) {
1535 auto &x = rvit->second;
1536
1537 int outer_dim = x.size();
1538 int dim = 0;
1539 for (int i = 0; i < outer_dim; i++) {
1540 dim += x[i].size();
1541 }
1542 vector<Type> res(dim);
1543 int idx = 0;
1544 for (int i = 0; i < outer_dim; i++) {
1545 int inner_dim = x[i].size();
1546 for (int j = 0; j < inner_dim; j++) {
1547 res(idx) = x[i][j];
1548 idx += 1;
1549 }
1550 }
1551 this->of->reportvector.push(res, rvit->first.c_str());
1552 }
1553 }
1554#endif
1555 }
1556};
1557
1558} // namespace fims_popdy
1559
1560#endif
CatchAtAge is a class containing a catch-at-age model, which is just one of many potential fishery mo...
Definition catch_at_age.hpp:51
void CalculateSpawningBiomassRatio(std::shared_ptr< fims_popdy::Population< Type > > &population, size_t year)
Calculate the spawning biomass ratio for a population and year.
Definition catch_at_age.hpp:535
std::map< std::string, fims::Vector< Type > >::iterator dq_iterator
Iterate through derived quantities.
Definition catch_at_age.hpp:110
std::map< std::string, fims::Vector< Type > >::iterator derived_quantities_iterator
Iterate the derived quantities.
Definition catch_at_age.hpp:64
Type CalculateSBPR0(std::shared_ptr< fims_popdy::Population< Type > > &population)
Calculates equilibrium spawning biomass per recruit.
Definition catch_at_age.hpp:566
virtual void Initialize()
Definition catch_at_age.hpp:151
std::vector< Type > ages
Definition catch_at_age.hpp:119
void CalculateUnfishedNumbersAA(std::shared_ptr< fims_popdy::Population< Type > > &population, size_t i_age_year, size_t i_agem1_yearm1, size_t age)
Calculates unfished numbers at age at year and age specific indices.
Definition catch_at_age.hpp:341
void CalculateBiomass(std::shared_ptr< fims_popdy::Population< Type > > &population, size_t i_age_year, size_t year, size_t age)
Calculates biomass for a population.
Definition catch_at_age.hpp:429
std::map< std::string, fims::Vector< fims::Vector< Type > > > report_vectors
A map of report vectors for the object. used to populate the report_vectors map in for submodule para...
Definition catch_at_age.hpp:116
std::set< uint32_t > & GetPopulationIds()
Get the population ids of the model.
Definition catch_at_age.hpp:243
std::map< uint32_t, std::map< std::string, fims::Vector< size_t > > >::iterator population_derived_quantities_dims_iterator
Used to iterate through population-based derived quantities dimensions.
Definition catch_at_age.hpp:96
std::map< uint32_t, std::shared_ptr< fims_popdy::Fleet< Type > > >::iterator fleet_iterator
Iterate through fleets.
Definition catch_at_age.hpp:104
void CalculateIndexWeightAA(std::shared_ptr< fims_popdy::Population< Type > > &population, size_t year, size_t age)
Calculates biomass of fish for the index for a given fleet from a population.
Definition catch_at_age.hpp:897
void evaluate_age_comp()
Definition catch_at_age.hpp:914
void evaluate_length_comp()
Definition catch_at_age.hpp:982
virtual ~CatchAtAge()
Destroy the Catch At Age object.
Definition catch_at_age.hpp:145
CatchAtAge(const CatchAtAge &other)
Copy constructor for the CatchAtAge class.
Definition catch_at_age.hpp:136
void CalculateSpawningBiomass(std::shared_ptr< fims_popdy::Population< Type > > &population, size_t i_age_year, size_t year, size_t age)
Calculates spawning biomass for a population.
Definition catch_at_age.hpp:480
CatchAtAge()
Definition catch_at_age.hpp:124
virtual void Evaluate()
Evaluate the model.
Definition catch_at_age.hpp:1087
std::string name_m
The name of the model.
Definition catch_at_age.hpp:57
void CalculateUnfishedSpawningBiomass(std::shared_ptr< fims_popdy::Population< Type > > &population, size_t i_age_year, size_t year, size_t age)
Calculated unfished spawning biomass for a population.
Definition catch_at_age.hpp:507
void CalculateIndex(std::shared_ptr< fims_popdy::Population< Type > > &population, size_t i_age_year, size_t year, size_t age)
Calculates the index for a fleet from a population.
Definition catch_at_age.hpp:823
void CalculateUnfishedBiomass(std::shared_ptr< fims_popdy::Population< Type > > &population, size_t i_age_year, size_t year, size_t age)
Calculates the unfished biomass for a population.
Definition catch_at_age.hpp:453
std::map< uint32_t, std::map< std::string, fims::Vector< Type > > >::iterator fleet_derived_quantities_iterator
Used to iterate through fleet-based derived quantities.
Definition catch_at_age.hpp:72
void CalculateMaturityAA(std::shared_ptr< fims_popdy::Population< Type > > &population, size_t i_age_year, size_t age)
Calculates maturity at age, in proportion, for a population.
Definition catch_at_age.hpp:661
std::map< uint32_t, std::map< std::string, fims::Vector< Type > > >::iterator population_derived_quantities_iterator
Used to iterate through population-based derived quantities.
Definition catch_at_age.hpp:87
void CalculateNumbersAA(std::shared_ptr< fims_popdy::Population< Type > > &population, size_t i_age_year, size_t i_agem1_yearm1, size_t age)
Calculates numbers at age for a population.
Definition catch_at_age.hpp:298
void CalculateLandingsNumbersAA(std::shared_ptr< fims_popdy::Population< Type > > &population, size_t i_age_year, size_t year, size_t age)
Calculates numbers of fish for the landings for a given fleet from a population, year and age.
Definition catch_at_age.hpp:777
void CalculateRecruitment(std::shared_ptr< fims_popdy::Population< Type > > &population, size_t i_age_year, size_t year, size_t i_dev)
Calculates expected recruitment for a population.
Definition catch_at_age.hpp:619
void evaluate_landings()
Definition catch_at_age.hpp:1069
virtual void Report()
Definition catch_at_age.hpp:1230
void AddPopulation(uint32_t id)
Definition catch_at_age.hpp:238
void CalculateLandingsWeightAA(std::shared_ptr< fims_popdy::Population< Type > > &population, size_t year, size_t age)
Calculates weight at age of the landings for a given fleet from a population.
Definition catch_at_age.hpp:737
std::vector< std::shared_ptr< fims_popdy::Population< Type > > > & GetPopulations()
Definition catch_at_age.hpp:250
std::map< uint32_t, std::map< std::string, fims::Vector< size_t > > >::iterator fleet_derived_quantities_dims_iterator
Used to iterate through fleet-based derived quantities dimensions.
Definition catch_at_age.hpp:80
void CalculateLandings(std::shared_ptr< fims_popdy::Population< Type > > &population, size_t year, size_t age)
Calculates total catch (landings) by fleet and population for a given year by aggregating age-specifi...
Definition catch_at_age.hpp:694
void CalculateMortality(std::shared_ptr< fims_popdy::Population< Type > > &population, size_t i_age_year, size_t year, size_t age)
Calculates total mortality for a population.
Definition catch_at_age.hpp:392
void CalculateIndexNumbersAA(std::shared_ptr< fims_popdy::Population< Type > > &population, size_t i_age_year, size_t year, size_t age)
Calculates the numbers for the index for a fleet from a population.
Definition catch_at_age.hpp:862
void CalculateInitialNumbersAA(std::shared_ptr< fims_popdy::Population< Type > > &population, size_t i_age_year, size_t age)
Calculates initial numbers at age for index and age.
Definition catch_at_age.hpp:266
virtual void Prepare()
Definition catch_at_age.hpp:182
void evaluate_index()
Definition catch_at_age.hpp:1048
FisheryModelBase is a base class for fishery models in FIMS.
Definition fishery_model_base.hpp:129
uint32_t GetId()
Get the Id object.
Definition fishery_model_base.hpp:489
std::map< uint32_t, std::shared_ptr< fims_popdy::Fleet< Type > > > fleets
A map of fleets in the fishery model, indexed by fleet id. Unique instances to eliminate duplicate in...
Definition fishery_model_base.hpp:159
std::vector< std::shared_ptr< fims_popdy::Population< Type > > > populations
A vector of populations in the fishery model.
Definition fishery_model_base.hpp:153
std::string model_type_m
A string specifying the model type.
Definition fishery_model_base.hpp:143
DerivedQuantitiesMap & GetFleetDerivedQuantities()
Get the fleet derived quantities.
Definition fishery_model_base.hpp:283
std::set< uint32_t > population_ids
Unique identifier for the fishery model.
Definition fishery_model_base.hpp:148
DerivedQuantitiesMap & GetPopulationDerivedQuantities()
Get the population derived quantities.
Definition fishery_model_base.hpp:292
virtual void ResetVector(fims::Vector< Type > &v, Type value=0.0)
Reset a vector from start to end with a value.
Definition fishery_model_base.hpp:468
Defines the base class for all fishery models within the FIMS framework.
#define ADREPORT_F(name, F)
TMB macro that reports variables and uncertainties.
Definition interface.hpp:78
The population dynamics of FIMS.
Definition catch_at_age.hpp:41
void clear_internal()
Clears the internal objects.
Definition rcpp_interface.hpp:279
Population class. Contains subpopulations that are divided into generic partitions (e....
Definition population.hpp:25