FIMS  v0.10.0
Loading...
Searching...
No Matches
growth_model_adapter.hpp
Go to the documentation of this file.
1
6#ifndef POPULATION_DYNAMICS_GROWTH_MODEL_ADAPTER_HPP
7#define POPULATION_DYNAMICS_GROWTH_MODEL_ADAPTER_HPP
8
9#include <cmath>
10#include <memory>
11#include <stdexcept>
12
13#include "../../common/fims_vector.hpp"
14#include "../../common/fims_math.hpp"
15#include "growth_model.hpp"
18
19namespace fims_popdy {
20
25template <typename Type>
27 public:
29 virtual ~GrowthDerivedObservationBase() = default;
30
35 virtual void SetAgeOffset(double min_age) = 0;
36
43 virtual void Initialize(std::size_t n_years, std::size_t n_ages,
44 std::size_t n_sexes = 1) = 0;
45
52 virtual bool SupportsAgeToLengthConversionDerived() const = 0;
53
57 virtual void PrepareGrowthProducts() = 0;
58
64
70 virtual Type EvaluateWeightAtLength(const Type& length) const = 0;
71};
72
77template <typename Type>
79 : public GrowthDerivedObservationBase<Type> {
80 public:
83
88 kEstimatedReferenceLengths = 0,
89 kConstantLengthYoungEstimatedLengthOld,
90 kEstimatedLengthYoungBelowConstantLengthOld,
91 kBothConstant
92 };
93
98 length_reference_parameterization_ =
99 LengthReferenceParameterization::kEstimatedReferenceLengths;
100 growth_products_prepared_ = false;
101 }
102
111 length_reference_parameterization_ =
112 LengthReferenceParameterization::kConstantLengthYoungEstimatedLengthOld;
113 constant_mean_length_young_ = constant_mean_length_young;
114 growth_products_prepared_ = false;
115 }
116
125 length_reference_parameterization_ = LengthReferenceParameterization::
126 kEstimatedLengthYoungBelowConstantLengthOld;
127 constant_mean_length_old_ = constant_mean_length_old;
128 growth_products_prepared_ = false;
129 }
130
141 length_reference_parameterization_ =
142 LengthReferenceParameterization::kBothConstant;
143 constant_mean_length_young_ = constant_mean_length_young;
144 constant_mean_length_old_ = constant_mean_length_old;
145 growth_products_prepared_ = false;
146 }
147
154 use_param_vectors_ = true;
155 vb_params_set_ = true;
156 growth_products_prepared_ = false;
157 return mean_length_young_vector_;
158 }
159
165 use_param_vectors_ = true;
166 vb_params_set_ = true;
167 growth_products_prepared_ = false;
168 return mean_length_old_vector_;
169 }
170
177 use_param_vectors_ = true;
178 vb_params_set_ = true;
179 growth_products_prepared_ = false;
180 return growth_coefficient_vector_;
181 }
182
188 use_param_vectors_ = true;
189 vb_params_set_ = true;
190 growth_products_prepared_ = false;
191 return reference_age_for_length_young_vector_;
192 }
193
199 use_param_vectors_ = true;
200 vb_params_set_ = true;
201 growth_products_prepared_ = false;
202 return reference_age_for_length_old_vector_;
203 }
204
210 use_param_vectors_ = true;
211 lw_params_set_ = true;
212 growth_products_prepared_ = false;
213 return length_weight_a_vector_;
214 }
215
221 use_param_vectors_ = true;
222 lw_params_set_ = true;
223 growth_products_prepared_ = false;
224 return length_weight_b_vector_;
225 }
226
233 use_param_vectors_ = true;
234 growth_products_prepared_ = false;
235 return length_at_age_sd_at_reference_ages_vector_;
236 }
237
243 use_param_vectors_ = true;
244 growth_products_prepared_ = false;
245 return log_sd_mean_length_young_vector_;
246 }
247
253 use_param_vectors_ = true;
254 growth_products_prepared_ = false;
255 return log_sd_mean_length_old_vector_;
256 }
257
263 use_param_vectors_ = true;
264 growth_products_prepared_ = false;
265 return log_sd_growth_coefficient_vector_;
266 }
267
274 use_param_vectors_ = true;
275 growth_products_prepared_ = false;
276 return mean_length_young_mean_length_old_logit_corr_vector_;
277 }
278
285 use_param_vectors_ = true;
286 growth_products_prepared_ = false;
287 return mean_length_young_growth_coefficient_logit_corr_vector_;
288 }
289
296 use_param_vectors_ = true;
297 growth_products_prepared_ = false;
298 return mean_length_old_growth_coefficient_logit_corr_vector_;
299 }
300
305 void SetAgeOffset(double min_age) override {
306 age_offset_ = min_age;
307 age_offset_set_ = true;
308 growth_products_prepared_ = false;
309 if (model_) {
310 model_->SetAgeOffset(static_cast<Type>(age_offset_));
311 }
312 }
313
320 void Initialize(std::size_t n_years, std::size_t n_ages,
321 std::size_t n_sexes = 1) override {
322 EnsureParamsSet();
323 if (n_sexes != 1) {
324 throw std::runtime_error(
325 "VonBertalanffySchnuteGrowthModelAdapter currently supports n_sexes "
326 "== 1");
327 }
328 n_years_ = n_years;
329 n_ages_ = n_ages;
330 n_sexes_ = n_sexes;
331 growth_products_prepared_ = false;
332 model_ = std::make_shared<GrowthModel<Type>>(n_years, n_ages, n_sexes);
333 SyncParamsToModel();
334 if (age_offset_set_) {
335 model_->SetAgeOffset(static_cast<Type>(age_offset_));
336 }
337 }
338
344 bool SupportsAgeToLengthConversionDerived() const override { return true; }
345
346 virtual const Type evaluate(int year, const double& a) override {
347 if (a < 0.0) {
348 throw std::runtime_error("Negative age not supported");
349 }
350 const double a_round = std::round(a);
351 const double tol = 1e-8;
352 if (std::fabs(a - a_round) > tol) {
353 throw std::runtime_error("Non-integer age not supported yet");
354 }
355 EnsureParamsSet();
356 const Type ref_age_young = CurrentReferenceAgeForLengthYoung();
357 const Type ref_age_old = CurrentReferenceAgeForLengthOld();
358 if (ref_age_old <= ref_age_young) {
359 throw std::runtime_error(
360 "VonBertalanffySchnuteGrowth reference_age_for_length_old must be > "
361 "reference_age_for_length_young");
362 }
363
364 if (!model_) {
365 return EvaluateWithFunctor(year, a);
366 }
367
368 SyncParamsToModel();
369 model_->Prepare();
370 const auto& p = model_->GetProducts();
371 const double offset = age_offset_set_ ? age_offset_ : 0.0;
372 const double age_index_raw = a_round - offset;
373 const double age_index_round = std::round(age_index_raw);
374 if (std::fabs(age_index_raw - age_index_round) <= tol &&
375 age_index_round >= 0.0) {
376 const std::size_t age_index = static_cast<std::size_t>(age_index_round);
377 if (age_index < p.n_ages) {
378 const std::size_t year_index =
379 (year >= 0 && static_cast<std::size_t>(year) < p.n_years)
380 ? static_cast<std::size_t>(year)
381 : static_cast<std::size_t>(0);
382 return p.MeanWAA(year_index, age_index, 0);
383 }
384 }
385
386 // Outside cached model age bins: fall back to direct functor evaluation.
387 return EvaluateWithFunctor(year, a);
388 }
389
393 void PrepareGrowthProducts() override {
394 growth_products_prepared_ = false;
395 if (!model_) {
396 if (n_ages_ == 0) {
397 throw std::runtime_error("Growth model not initialized; n_ages is 0");
398 }
399 Initialize(n_years_ == 0 ? 1 : n_years_, n_ages_,
400 n_sexes_ == 0 ? 1 : n_sexes_);
401 }
402 SyncParamsToModel();
403 model_->Prepare();
404 growth_products_prepared_ = true;
405 }
406
412 if (!model_ || !growth_products_prepared_) {
413 return nullptr;
414 }
415 return &(model_->GetProducts());
416 }
417
428 Type EvaluateWeightAtLength(const Type& length) const override {
429 EnsureParamsSet();
430 const Type length_safe = fims_math::ad_max(length, static_cast<Type>(1e-8));
431 return CurrentLengthWeightA() *
432 fims_math::pow(length_safe, CurrentLengthWeightB());
433 }
434
435 private:
436 // Stored parameter vectors on their working scales. Positive parameters
437 // use log scale, reference ages stay on the natural scale, and
438 // correlation terms use transformed working-scale values.
439 fims::Vector<Type> mean_length_young_vector_;
440 fims::Vector<Type> mean_length_old_vector_;
441 fims::Vector<Type> growth_coefficient_vector_;
442 fims::Vector<Type> reference_age_for_length_young_vector_;
443 fims::Vector<Type> reference_age_for_length_old_vector_;
444 fims::Vector<Type> length_weight_a_vector_;
445 fims::Vector<Type> length_weight_b_vector_;
446 fims::Vector<Type> length_at_age_sd_at_reference_ages_vector_;
447 fims::Vector<Type> log_sd_mean_length_young_vector_;
448 fims::Vector<Type> log_sd_mean_length_old_vector_;
449 fims::Vector<Type> log_sd_growth_coefficient_vector_;
450 fims::Vector<Type> mean_length_young_mean_length_old_logit_corr_vector_;
451 fims::Vector<Type> mean_length_young_growth_coefficient_logit_corr_vector_;
452 fims::Vector<Type> mean_length_old_growth_coefficient_logit_corr_vector_;
453 bool use_param_vectors_ = false;
454 LengthReferenceParameterization length_reference_parameterization_ =
455 LengthReferenceParameterization::kEstimatedReferenceLengths;
456 Type constant_mean_length_young_ = Type(0.0);
457 Type constant_mean_length_old_ = Type(0.0);
458 std::size_t n_years_ = 0;
459 std::size_t n_ages_ = 0;
460 std::size_t n_sexes_ = 1;
461 double age_offset_ = 0.0;
462 bool age_offset_set_ = false;
463 bool vb_params_set_ = false;
464 bool lw_params_set_ = false;
465 bool growth_products_prepared_ = false;
466
467 mutable std::shared_ptr<GrowthModel<Type>> model_;
468
469 Type EvaluateWithFunctor(int year, const double& a) const {
470 EnsureParamsSet();
472 vb.mean_length_young = CurrentMeanLengthYoung();
473 vb.mean_length_old = CurrentMeanLengthOld();
474 vb.growth_coefficient = CurrentGrowthCoefficient();
475 vb.reference_age_for_length_young = CurrentReferenceAgeForLengthYoung();
476 vb.reference_age_for_length_old = CurrentReferenceAgeForLengthOld();
477 vb.length_weight_a = CurrentLengthWeightA();
478 vb.length_weight_b = CurrentLengthWeightB();
479 return vb.evaluate(year, a);
480 }
481
482 void SyncParamsToModel() const {
483 if (!model_) return;
484 EnsureParamsSet();
485
486 model_->SetVonBertalanffySchnuteParameters(
487 CurrentMeanLengthYoung(), CurrentMeanLengthOld(),
488 CurrentGrowthCoefficient(), CurrentReferenceAgeForLengthYoung(),
489 CurrentReferenceAgeForLengthOld());
490 model_->SetLengthWeightParameters(CurrentLengthWeightA(),
491 CurrentLengthWeightB());
492
493 if (HasInterpolationSdInputs()) {
494 model_->SetLengthSdParams(CurrentLengthAtAgeSdAtReferenceAge1(),
495 CurrentLengthAtAgeSdAtReferenceAge2());
496 }
497
498 if (HasStructuredDeltaMethodInputs()) {
499 model_->SetGrowthParameterCovariance(
500 CurrentMeanLengthYoungVariance(),
501 CurrentMeanLengthYoungLengthAtRefAgeOldCovariance(),
502 CurrentMeanLengthYoungKCovariance(), CurrentMeanLengthOldVariance(),
503 CurrentMeanLengthOldKCovariance(),
504 CurrentGrowthCoefficientVariance());
505 } else {
506 model_->ClearGrowthParameterCovariance();
507 }
508 }
509
510 Type CurrentMeanLengthYoungStorage() const {
511 return fims_math::exp(mean_length_young_vector_[0]);
512 }
513
514 Type CurrentMeanLengthOldStorage() const {
515 return fims_math::exp(mean_length_old_vector_[0]);
516 }
517
518 Type CurrentMeanLengthYoung() const {
519 switch (length_reference_parameterization_) {
520 case LengthReferenceParameterization::kEstimatedReferenceLengths:
521 return CurrentMeanLengthYoungStorage();
522
523 case LengthReferenceParameterization::
524 kConstantLengthYoungEstimatedLengthOld:
525 return constant_mean_length_young_;
526
527 case LengthReferenceParameterization::
528 kEstimatedLengthYoungBelowConstantLengthOld:
529 return fims_math::inv_logit(static_cast<Type>(0.0),
530 constant_mean_length_old_,
531 mean_length_young_vector_[0]);
532
533 case LengthReferenceParameterization::kBothConstant:
534 return constant_mean_length_young_;
535 }
536
537 return CurrentMeanLengthYoungStorage();
538 }
539
540 Type CurrentMeanLengthOld() const {
541 switch (length_reference_parameterization_) {
542 case LengthReferenceParameterization::kEstimatedReferenceLengths:
543 case LengthReferenceParameterization::
544 kConstantLengthYoungEstimatedLengthOld:
545 return CurrentMeanLengthOldStorage();
546
547 case LengthReferenceParameterization::
548 kEstimatedLengthYoungBelowConstantLengthOld:
549 return constant_mean_length_old_;
550
551 case LengthReferenceParameterization::kBothConstant:
552 return constant_mean_length_old_;
553 }
554
555 return CurrentMeanLengthOldStorage();
556 }
557
558 Type CurrentGrowthCoefficient() const {
559 return fims_math::exp(growth_coefficient_vector_[0]);
560 }
561 Type CurrentReferenceAgeForLengthYoung() const {
562 return reference_age_for_length_young_vector_[0];
563 }
564 Type CurrentReferenceAgeForLengthOld() const {
565 return reference_age_for_length_old_vector_[0];
566 }
567 Type CurrentLengthWeightA() const {
568 return fims_math::exp(length_weight_a_vector_[0]);
569 }
570 Type CurrentLengthWeightB() const {
571 return fims_math::exp(length_weight_b_vector_[0]);
572 }
573 Type CurrentLengthAtAgeSdAtReferenceAge1() const {
574 return fims_math::exp(length_at_age_sd_at_reference_ages_vector_[0]);
575 }
576 Type CurrentLengthAtAgeSdAtReferenceAge2() const {
577 return fims_math::exp(length_at_age_sd_at_reference_ages_vector_[1]);
578 }
579 Type CurrentSdLengthAtRefAgeYoung() const {
580 return fims_math::exp(log_sd_mean_length_young_vector_[0]);
581 }
582
583 Type CurrentSdLengthAtRefAgeOld() const {
584 return fims_math::exp(log_sd_mean_length_old_vector_[0]);
585 }
586
587 Type CurrentSdGrowthCoefficient() const {
588 return fims_math::exp(log_sd_growth_coefficient_vector_[0]);
589 }
590
591 Type CurrentCorrLengthAtRefAgeYoungLengthAtRefAgeOld() const {
593 static_cast<Type>(-1.0), static_cast<Type>(1.0),
594 mean_length_young_mean_length_old_logit_corr_vector_[0]);
595 }
596
597 Type CurrentCorrLengthAtRefAgeYoungK() const {
599 static_cast<Type>(-1.0), static_cast<Type>(1.0),
600 mean_length_young_growth_coefficient_logit_corr_vector_[0]);
601 }
602
603 Type CurrentCorrLengthAtRefAgeOldK() const {
605 static_cast<Type>(-1.0), static_cast<Type>(1.0),
606 mean_length_old_growth_coefficient_logit_corr_vector_[0]);
607 }
608
609 Type CurrentMeanLengthYoungVariance() const {
610 const Type sd = CurrentSdLengthAtRefAgeYoung();
611 return sd * sd;
612 }
613
614 Type CurrentMeanLengthOldVariance() const {
615 const Type sd = CurrentSdLengthAtRefAgeOld();
616 return sd * sd;
617 }
618
619 Type CurrentGrowthCoefficientVariance() const {
620 const Type sd = CurrentSdGrowthCoefficient();
621 return sd * sd;
622 }
623
624 Type CurrentMeanLengthYoungLengthAtRefAgeOldCovariance() const {
625 return CurrentCorrLengthAtRefAgeYoungLengthAtRefAgeOld() *
626 CurrentSdLengthAtRefAgeYoung() * CurrentSdLengthAtRefAgeOld();
627 }
628
629 Type CurrentMeanLengthYoungKCovariance() const {
630 return CurrentCorrLengthAtRefAgeYoungK() * CurrentSdLengthAtRefAgeYoung() *
631 CurrentSdGrowthCoefficient();
632 }
633
634 Type CurrentMeanLengthOldKCovariance() const {
635 return CurrentCorrLengthAtRefAgeOldK() * CurrentSdLengthAtRefAgeOld() *
636 CurrentSdGrowthCoefficient();
637 }
638
639 bool HasInterpolationSdInputs() const {
640 return length_at_age_sd_at_reference_ages_vector_.size() > 0;
641 }
642
643 bool HasAnyStructuredDeltaMethodInput() const {
644 return log_sd_mean_length_young_vector_.size() > 0 ||
645 log_sd_mean_length_old_vector_.size() > 0 ||
646 log_sd_growth_coefficient_vector_.size() > 0 ||
647 mean_length_young_mean_length_old_logit_corr_vector_.size() > 0 ||
648 mean_length_young_growth_coefficient_logit_corr_vector_.size() > 0 ||
649 mean_length_old_growth_coefficient_logit_corr_vector_.size() > 0;
650 }
651
652 bool HasStructuredDeltaMethodInputs() const {
653 return log_sd_mean_length_young_vector_.size() > 0 &&
654 log_sd_mean_length_old_vector_.size() > 0 &&
655 log_sd_growth_coefficient_vector_.size() > 0 &&
656 mean_length_young_mean_length_old_logit_corr_vector_.size() > 0 &&
657 mean_length_young_growth_coefficient_logit_corr_vector_.size() > 0 &&
658 mean_length_old_growth_coefficient_logit_corr_vector_.size() > 0;
659 }
660
661 void EnsureParamsSet() const {
662 if (!use_param_vectors_ || mean_length_young_vector_.size() < 1 ||
663 mean_length_old_vector_.size() < 1 ||
664 growth_coefficient_vector_.size() < 1 ||
665 reference_age_for_length_young_vector_.size() < 1 ||
666 reference_age_for_length_old_vector_.size() < 1 ||
667 length_weight_a_vector_.size() < 1 ||
668 length_weight_b_vector_.size() < 1) {
669 throw std::runtime_error(
670 "VonBertalanffySchnuteGrowth parameters not set");
671 }
672
673 if (mean_length_young_vector_.size() != 1 ||
674 mean_length_old_vector_.size() != 1 ||
675 growth_coefficient_vector_.size() != 1 ||
676 reference_age_for_length_young_vector_.size() != 1 ||
677 reference_age_for_length_old_vector_.size() != 1 ||
678 length_weight_a_vector_.size() != 1 ||
679 length_weight_b_vector_.size() != 1) {
680 throw std::runtime_error(
681 "VonBertalanffySchnuteGrowthModelAdapter currently supports a single "
682 "growth pattern; expected size 1 for von Bertalanffy--Schnute and "
683 "length-weight parameter vectors");
684 }
685
686 const bool has_sd = HasInterpolationSdInputs();
687 const bool has_any_structured_delta = HasAnyStructuredDeltaMethodInput();
688 const bool has_structured_delta = HasStructuredDeltaMethodInputs();
689
691 throw std::runtime_error(
692 "VonBertalanffySchnuteGrowthModelAdapter requires either "
693 "length_at_age_sd_at_reference_ages or the structured delta-method "
694 "growth variability inputs");
695 }
696
698 throw std::runtime_error(
699 "VonBertalanffySchnuteGrowthModelAdapter requires all six structured "
700 "delta-method variability inputs when using that path");
701 }
702
704 throw std::runtime_error(
705 "von Bertalanffy--Schnute growth adapter requires variability inputs "
706 "for exactly one supported path. Supply either the interpolation "
707 "inputs length_at_age_sd_at_reference_ages or the full delta-method "
708 "variability inputs, but not both");
709 }
710
711 if (has_sd && length_at_age_sd_at_reference_ages_vector_.size() != 2) {
712 throw std::runtime_error(
713 "VonBertalanffySchnuteGrowthModelAdapter expected exactly 2 "
714 "length_at_age_sd_at_reference_ages values");
715 }
716
718 (log_sd_mean_length_young_vector_.size() != 1 ||
719 log_sd_mean_length_old_vector_.size() != 1 ||
720 log_sd_growth_coefficient_vector_.size() != 1 ||
721 mean_length_young_mean_length_old_logit_corr_vector_.size() != 1 ||
722 mean_length_young_growth_coefficient_logit_corr_vector_.size() != 1 ||
723 mean_length_old_growth_coefficient_logit_corr_vector_.size() != 1)) {
724 throw std::runtime_error(
725 "VonBertalanffySchnuteGrowthModelAdapter currently supports a single "
726 "structured delta-method variability parameter set; expected "
727 "size 1 for each structured uncertainty input");
728 }
729 }
730};
731
732} // namespace fims_popdy
733
734#endif // POPULATION_DYNAMICS_GROWTH_MODEL_ADAPTER_HPP
Definition fims_vector.hpp:27
size_type size() const
Returns the number of elements.
Definition fims_vector.hpp:299
Generic capability interface for growth models that can feed the growth-derived age-to-length convers...
Definition growth_model_adapter.hpp:26
virtual bool SupportsAgeToLengthConversionDerived() const =0
Report whether this growth object can support the dynamic age-to-length conversion path.
virtual void Initialize(std::size_t n_years, std::size_t n_ages, std::size_t n_sexes=1)=0
Initialize any cached growth products.
virtual void SetAgeOffset(double min_age)=0
Set the minimum modeled age used to translate cached age indices.
virtual void PrepareGrowthProducts()=0
Prepare growth products for the current model state.
virtual Type EvaluateWeightAtLength(const Type &length) const =0
Evaluate weight at a supplied length.
virtual const GrowthProducts< Type > * TryGetPreparedGrowthProducts() const =0
Return prepared growth products without triggering preparation.
von Bertalanffy–Schnute growth model adapter implementing the generic growth-derived observation capa...
Definition growth_model_adapter.hpp:79
LengthReferenceParameterization
Options for how the two reference lengths are supplied.
Definition growth_model_adapter.hpp:87
void UseConstantReferenceMeanLengths(Type constant_mean_length_young, Type constant_mean_length_old)
Fix both young and old reference mean lengths.
Definition growth_model_adapter.hpp:139
fims::Vector< Type > & LogSdGrowthCoefficientVector()
Access the log-SD vector for growth_coefficient.
Definition growth_model_adapter.hpp:262
fims::Vector< Type > & LengthAtAgeSdAtRefAgesVector()
Access the log-scale length-at-age SD vector at the two reference ages.
Definition growth_model_adapter.hpp:232
virtual const Type evaluate(int year, const double &a) override
Calculates the growth at the independent variable value.
Definition growth_model_adapter.hpp:346
fims::Vector< Type > & LogitCorrLengthAtRefAgeYoungKVector()
Access the transformed correlation vector for mean_length_young and growth_coefficient.
Definition growth_model_adapter.hpp:284
fims::Vector< Type > & LogSdLengthAtRefAgeOldVector()
Access the log-SD vector for mean_length_old.
Definition growth_model_adapter.hpp:252
fims::Vector< Type > & ReferenceAgeForLengthYoungVector()
Access the first reference-age vector.
Definition growth_model_adapter.hpp:187
void SetAgeOffset(double min_age) override
Set the minimum modeled age used by cached growth products.
Definition growth_model_adapter.hpp:305
bool SupportsAgeToLengthConversionDerived() const override
Report that the adapter supports growth-derived age-to-length conversion calculations.
Definition growth_model_adapter.hpp:344
fims::Vector< Type > & LengthWeightAVector()
Access the log-scale length-weight-a vector.
Definition growth_model_adapter.hpp:209
void Initialize(std::size_t n_years, std::size_t n_ages, std::size_t n_sexes=1) override
Initialize the backing growth model and cache dimensions.
Definition growth_model_adapter.hpp:320
fims::Vector< Type > & LogitCorrLengthAtRefAgeOldKVector()
Access the transformed correlation vector for mean_length_old and growth_coefficient.
Definition growth_model_adapter.hpp:295
fims::Vector< Type > & ReferenceAgeForLengthOldVector()
Access the second reference-age vector.
Definition growth_model_adapter.hpp:198
void UseEstimatedMeanLengthYoungBelowConstantMeanLengthOld(Type constant_mean_length_old)
Estimate young reference length below a fixed old reference length.
Definition growth_model_adapter.hpp:123
Type EvaluateWeightAtLength(const Type &length) const override
Evaluate the length-weight relationship at a supplied length.
Definition growth_model_adapter.hpp:428
fims::Vector< Type > & MeanLengthOldVector()
Access the log-scale length-at-reference-age-2 parameter vector.
Definition growth_model_adapter.hpp:164
fims::Vector< Type > & LengthWeightBVector()
Access the log-scale length-weight-b vector.
Definition growth_model_adapter.hpp:220
fims::Vector< Type > & LogitCorrLengthAtRefAgeYoungLengthAtRefAgeOldVector()
Access the transformed correlation vector for mean_length_young and mean_length_old.
Definition growth_model_adapter.hpp:273
void UseEstimatedReferenceMeanLengths()
Estimate both reference mean lengths.
Definition growth_model_adapter.hpp:97
void PrepareGrowthProducts() override
Prepare growth products for the current model state.
Definition growth_model_adapter.hpp:393
fims::Vector< Type > & MeanLengthYoungVector()
Access the working-scale storage for the first reference-length parameter.
Definition growth_model_adapter.hpp:153
const GrowthProducts< Type > * TryGetPreparedGrowthProducts() const override
Return prepared growth products without triggering preparation.
Definition growth_model_adapter.hpp:411
fims::Vector< Type > & LogSdLengthAtRefAgeYoungVector()
Access the log-SD vector for mean_length_young.
Definition growth_model_adapter.hpp:242
fims::Vector< Type > & GrowthCoefficientVector()
Access the log-scale VonBertalanffySchnute growth coefficient vector.
Definition growth_model_adapter.hpp:176
void UseConstantMeanLengthYoungWithEstimatedMeanLengthOld(Type constant_mean_length_young)
Fix young reference length and estimate older reference mean length.
Definition growth_model_adapter.hpp:109
const Type inv_logit(const Type &a, const Type &b, const Type &logit_x)
An inverse logit function for bounding of parameters.
Definition fims_math.hpp:276
Declares the GrowthBase class which is the base class for all growth functors.
Concrete growth model implementation (Phase 1).
The population dynamics of FIMS.
Definition catch_at_age.hpp:45
std::shared_ptr< AgeToLengthConversionBase< Type > > BuildAgeToLengthConversionFleet(const std::shared_ptr< Population< Type > > &population, const std::shared_ptr< Fleet< Type > > &fleet)
Build the active age-to-length conversion for a fleet from the current population and fleet state.
Definition runtime.hpp:44
Base class for all growth functors.
Definition growth_base.hpp:24
Growth "products" in a consistent (year, age, sex) space.
Definition growth_products.hpp:26
VonBertalanffySchnute growth functor for length-at-age and weight-at-age.
Definition vonb_schnute.hpp:32
Type mean_length_young
Expected length at the first reference age.
Definition vonb_schnute.hpp:34
Defines the VonBertalanffySchnuteGrowth class, which inherits from the GrowthBase class.