Skip to content

msupernaw/FisheriesModelingFramework

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 

Repository files navigation

Generic Template library for NOAA NMFS fisheries stock assessment modeling.

Status: incomplete

Description:

Template based classes and routines provide reusable code. Template classes take two template arguments, BASE_TYPE and EVAL_TYPE. The default for EVAL_TYPE is a BASE_TYPE. This allows for flexible modeling when a non-primitive type is used for evaluations. Examples of non-primitive types are automatic differentiable types, such as ADNumbers or dvariables.

For instance:




//evaluation types will be double
AgeBasedPopulation<double> population;

//evaluation types will be dvariables
AgeBasedPopulation<double, dvariable> population; 

//evaluation types will be ADNumbers with a basetype of float
AgeBasedPopulation<float, ad::ADNumber<float> > population; 

//evaluation types will be BigFloat
AgeBasedPopulation<double, ad::BigFloat<double> > population; 

This code makes heavy use of polymorphism/inheritance to provide flexibility.

Fish populations are represented in the code by data modules derived from the base class PopulationDM, which hold relevant information about the fish population. Special functors are developed that make evaluations based on input in the form of a PopulationDM. Functors can be operations that evaluate mortality, recruitment, selectivity, etc. This design provides flexibility to accommodate many types of modeling efforts within NMFS.

For example:


  //create a population data module
    noaa::nmfs::AgeBasedPopulation<double> population;

    //create a functor list
    std::vector<noaa::nmfs::PopulationFunctor<double>* >functors;

    //make a recruitment functor and add it to the list
    noaa::nmfs::recruitment::agebased::BevertonHolt<double> beverton_holt;
    functors.push_back(&beverton_holt);

    //make a selectivity functor and add it to the list
    noaa::nmfs::selectivity::agebased::Logistic<double> logistic_selectivity;
    functors.push_back(&logistic_selectivity);

    //make a mortality functor and add it to the list
    noaa::nmfs::mortality::agebased::ConstantRateMortality<double> constant_rate_mortality;
    functors.push_back(&constant_rate_mortality);

    double ret = 0;

    //all functors provide the routine
    // const EVAL_TPYE Evaluate(noaa::nmfs::PopulationDM<BASE_TYPE,EVAL_TYPE>* population) 
    for (int i = 0; i < functors.size(); i++) {
        ret += functors[i]->Evaluate(&population);
    }

To-do:

  1. Make dvariable wrapper class(or just define cmath functions in namespace std).
  2. Define functors already present in stock synthesis
  3. Finish polygon/geo area class
  4. Write routine for nearest neighbor list building for populations
  5. Write SizeBasedPopulation class
  6. Define size based functors.
  7. Create unit tests
  8. Come up with a catchier name!

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published