1 : |
agomez |
1 |
#ifndef migrationproportion_h
|
2 : |
|
|
#define migrationproportion_h
|
3 : |
|
|
|
4 : |
|
|
#include "likelihood.h" |
5 : |
|
|
#include "intmatrix.h" |
6 : |
|
|
#include "doublematrix.h" |
7 : |
|
|
#include "actionattimes.h" |
8 : |
|
|
#include "charptrvector.h" |
9 : |
|
|
#include "stockptrvector.h" |
10 : |
|
|
|
11 : |
|
|
/**
|
12 : |
|
|
* \class MigrationProportion
|
13 : |
|
|
* \brief This is the class used to calculate a likelihood score based on the biomass of stocks caught by fleets
|
14 : |
|
|
*
|
15 : |
|
|
* This class calculates a likelihood score based on the difference between the biomass caught according to the model and the biomass caught by fleets, according to the landings data. This should lead to a zero likelihood score for a fleet that has been declared as a TotalPredator, since catch for that fleet should exactly match the landings data. However, for a fleet that has been declared as a LinearPredator, or a NumberPredator, the model will be calculating the catch based on model parameters and so will probably lead to a difference between the modelled landings biomass and actual landed catch.
|
16 : |
|
|
*/
|
17 : |
|
|
class MigrationProportion : public Likelihood {
|
18 : |
|
|
public:
|
19 : |
|
|
/**
|
20 : |
|
|
* \brief This is the MigrationProportion constructor
|
21 : |
|
|
* \param infile is the CommentStream to read the CatchDistribution data from
|
22 : |
|
|
* \param Area is the AreaClass for the current model
|
23 : |
|
|
* \param TimeInfo is the TimeClass for the current model
|
24 : |
|
|
* \param weight is the weight for the likelihood component
|
25 : |
|
|
* \param name is the name for the likelihood component
|
26 : |
|
|
*/
|
27 : |
|
|
MigrationProportion(CommentStream& infile, const AreaClass* const Area,
|
28 : |
|
|
const TimeClass* const TimeInfo, double weight, const char* name);
|
29 : |
|
|
/**
|
30 : |
|
|
* \brief This is the default MigrationProportion destructor
|
31 : |
|
|
*/
|
32 : |
|
|
virtual ~MigrationProportion();
|
33 : |
|
|
/**
|
34 : |
|
|
* \brief This function will calculate the likelihood score for the MigrationProportion component
|
35 : |
|
|
* \param TimeInfo is the TimeClass for the current model
|
36 : |
|
|
*/
|
37 : |
|
|
virtual void addLikelihood(const TimeClass* const TimeInfo);
|
38 : |
|
|
/**
|
39 : |
|
|
* \brief This function will reset the MigrationProportion likelihood information
|
40 : |
|
|
* \param keeper is the Keeper for the current model
|
41 : |
|
|
*/
|
42 : |
|
|
virtual void Reset(const Keeper* const keeper);
|
43 : |
|
|
/**
|
44 : |
|
|
* \brief This function will print the summary MigrationProportion likelihood information
|
45 : |
|
|
* \param outfile is the ofstream that all the model information gets sent to
|
46 : |
|
|
*/
|
47 : |
|
|
virtual void Print(ofstream& outfile) const;
|
48 : |
|
|
/**
|
49 : |
|
|
* \brief This will select the fleets and stocks required to calculate the MigrationProportion likelihood score
|
50 : |
|
|
* \param Fleets is the FleetPtrVector of all the available fleets
|
51 : |
|
|
* \param Stocks is the StockPtrVector of all the available stocks
|
52 : |
|
|
*/
|
53 : |
|
|
void setFleetsAndStocks(FleetPtrVector& Fleets, StockPtrVector& Stocks);
|
54 : |
|
|
/**
|
55 : |
|
|
* \brief This function will print information from each MigrationProportion calculation
|
56 : |
|
|
* \param outfile is the ofstream that all the model likelihood information gets sent to
|
57 : |
|
|
* \param TimeInfo is the TimeClass for the current model
|
58 : |
|
|
*/
|
59 : |
|
|
virtual void printLikelihood(ofstream& outfile, const TimeClass* const TimeInfo);
|
60 : |
|
|
/**
|
61 : |
|
|
* \brief This function will print summary information from each MigrationProportion likelihood calculation
|
62 : |
|
|
* \param outfile is the ofstream that all the model likelihood information gets sent to
|
63 : |
|
|
*/
|
64 : |
|
|
virtual void printSummary(ofstream& outfile);
|
65 : |
|
|
private:
|
66 : |
|
|
/**
|
67 : |
|
|
* \brief This function will read the MigrationProportion data from the input file
|
68 : |
|
|
* \param infile is the CommentStream to read the CatchDistribution data from
|
69 : |
|
|
* \param TimeInfo is the TimeClass for the current model
|
70 : |
|
|
* \param numarea is the number of areas that the likelihood data covers
|
71 : |
|
|
*/
|
72 : |
|
|
void readProportionData(CommentStream& infile, const TimeClass* TimeInfo, int numarea);
|
73 : |
|
|
/**
|
74 : |
|
|
* \brief This function will calculate the likelihood score for the current timestep based on a sum of squares function
|
75 : |
|
|
* \param TimeInfo is the TimeClass for the current model
|
76 : |
|
|
* \return likelihood score
|
77 : |
|
|
*/
|
78 : |
|
|
double calcLikSumSquares(const TimeClass* const TimeInfo);
|
79 : |
|
|
/**
|
80 : |
|
|
* \brief This is the DoubleMatrix used to store area distribution information specified in the input file
|
81 : |
|
|
* \note The indices for this object are [time][area]
|
82 : |
|
|
*/
|
83 : |
|
|
DoubleMatrix obsDistribution;
|
84 : |
|
|
/**
|
85 : |
|
|
* \brief This is the DoubleMatrix used to store area distribution information calculated in the model
|
86 : |
|
|
* \note The indices for this object are [time][area]
|
87 : |
|
|
*/
|
88 : |
|
|
DoubleMatrix modelDistribution;
|
89 : |
|
|
/**
|
90 : |
|
|
* \brief This is the DoubleVector used to store the calculated likelihood information
|
91 : |
|
|
* \note The indices for this object are [time]
|
92 : |
|
|
*/
|
93 : |
|
|
DoubleVector likelihoodValues;
|
94 : |
|
|
/**
|
95 : |
|
|
* \brief This is the CharPtrVector of the names of the stocks that will be used to calculate the likelihood score
|
96 : |
|
|
*/
|
97 : |
|
|
CharPtrVector stocknames;
|
98 : |
|
|
/**
|
99 : |
|
|
* \brief This is the IntMatrix used to store area information
|
100 : |
|
|
*/
|
101 : |
|
|
IntMatrix areas;
|
102 : |
|
|
/**
|
103 : |
|
|
* \brief This is the CharPtrVector of the names of the areas
|
104 : |
|
|
*/
|
105 : |
|
|
CharPtrVector areaindex;
|
106 : |
|
|
/**
|
107 : |
|
|
* \brief This is the identifier of the function to be used to calculate the likelihood component
|
108 : |
|
|
*/
|
109 : |
|
|
int functionnumber;
|
110 : |
|
|
/**
|
111 : |
|
|
* \brief This is the name of the function to be used to calculate the likelihood component
|
112 : |
|
|
*/
|
113 : |
|
|
char* functionname;
|
114 : |
|
|
/**
|
115 : |
|
|
* \brief This is the flag used to denote whether the biomass consumed or the numbers consumed is used to calculate the likelihood score (default is to print biomass)
|
116 : |
|
|
*/
|
117 : |
|
|
int biomass;
|
118 : |
|
|
/**
|
119 : |
|
|
* \brief This is the index of the timesteps for the likelihood component data
|
120 : |
|
|
*/
|
121 : |
|
|
int timeindex;
|
122 : |
|
|
/**
|
123 : |
|
|
* \brief This ActionAtTimes stores information about when the likelihood score should be calculated
|
124 : |
|
|
*/
|
125 : |
|
|
ActionAtTimes AAT;
|
126 : |
|
|
/**
|
127 : |
|
|
* \brief This is the IntVector used to store information about the years when the likelihood score should be calculated
|
128 : |
|
|
*/
|
129 : |
|
|
IntVector Years;
|
130 : |
|
|
/**
|
131 : |
|
|
* \brief This is the IntVector used to store information about the steps when the likelihood score should be calculated
|
132 : |
|
|
*/
|
133 : |
|
|
IntVector Steps;
|
134 : |
|
|
/**
|
135 : |
|
|
* \brief This is the StockPtrVector of the stocks that will be used to calculate the likelihood score
|
136 : |
|
|
*/
|
137 : |
|
|
StockPtrVector stocks;
|
138 : |
|
|
};
|
139 : |
|
|
|
140 : |
|
|
#endif
|