Log In | Get Help   
Home My Page Projects Code Snippets Project Openings Mareframe
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files
[mareframe] Annotation of /trunk/gadget/surveydistribution.h
[mareframe] / trunk / gadget / surveydistribution.h Repository:
ViewVC logotype

Annotation of /trunk/gadget/surveydistribution.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1 - (view) (download)

1 : agomez 1 #ifndef surveydistribution_h
2 :     #define surveydistribution_h
3 :    
4 :     #include "likelihood.h"
5 :     #include "stockaggregator.h"
6 :     #include "doublematrixptrmatrix.h"
7 :     #include "actionattimes.h"
8 :     #include "formulavector.h"
9 :     #include "modelvariablevector.h"
10 :     #include "suitfunc.h"
11 :    
12 :     /**
13 :     * \class SurveyDistribution
14 :     * \brief This is the class used to calculate a likelihood score based on survey data compiled from the stocks caught by government surveys, including some form of a survey index calculation
15 :     *
16 :     * This class calculates a likelihood score based on the difference between survey data sampled from stocks caught according to the model and that caught by government surveys. The model will calculate the survey data for the stock that is caught according to the model parameters, and aggregate this into the specified age and length groups. This survey data is then compared to the corresponding data calculated from the observed data.
17 :     *
18 :     * \note This likelihood component assumes that catch-at-age data is available, and is used in the survey index calculations
19 :     * \note This likelihood component is based on the \b current population, where as most likelihood components are based on the population at the beginning of the timestep. It would be better if this likelihood component was changed to be based on the population at the beginning of the timestep.
20 :     */
21 :     class SurveyDistribution : public Likelihood {
22 :     public:
23 :     /**
24 :     * \brief This is the SurveyDistribution constructor
25 :     * \param infile is the CommentStream to read the SurveyDistribution data from
26 :     * \param Area is the AreaClass for the current model
27 :     * \param TimeInfo is the TimeClass for the current model
28 :     * \param keeper is the Keeper for the current model
29 :     * \param weight is the weight for the likelihood component
30 :     * \param name is the name for the likelihood component
31 :     */
32 :     SurveyDistribution(CommentStream& infile, const AreaClass* const Area,
33 :     const TimeClass* const TimeInfo, Keeper* const keeper, double weight, const char* name);
34 :     /**
35 :     * \brief This is the default SurveyDistribution destructor
36 :     */
37 :     virtual ~SurveyDistribution();
38 :     /**
39 :     * \brief This function will calculate the likelihood score for the SurveyDistribution component
40 :     * \param TimeInfo is the TimeClass for the current model
41 :     */
42 :     virtual void addLikelihood(const TimeClass* const TimeInfo);
43 :     /**
44 :     * \brief This function will reset the SurveyDistribution likelihood information
45 :     * \param keeper is the Keeper for the current model
46 :     */
47 :     virtual void Reset(const Keeper* const keeper);
48 :     /**
49 :     * \brief This function will print the summary SurveyDistribution likelihood information
50 :     * \param outfile is the ofstream that all the model information gets sent to
51 :     */
52 :     virtual void Print(ofstream& outfile) const;
53 :     /**
54 :     * \brief This will select the fleets and stocks required to calculate the SurveyDistribution likelihood score
55 :     * \param Fleets is the FleetPtrVector of all the available fleets
56 :     * \param Stocks is the StockPtrVector of all the available stocks
57 :     */
58 :     void setFleetsAndStocks(FleetPtrVector& Fleets, StockPtrVector& Stocks);
59 :     /**
60 :     * \brief This function will print information from each SurveyDistribution calculation
61 :     * \param outfile is the ofstream that all the model likelihood information gets sent to
62 :     * \param TimeInfo is the TimeClass for the current model
63 :     */
64 :     virtual void printLikelihood(ofstream& outfile, const TimeClass* const TimeInfo);
65 :     /**
66 :     * \brief This function will print summary information from each SurveyDistribution likelihood calculation
67 :     * \param outfile is the ofstream that all the model likelihood information gets sent to
68 :     */
69 :     virtual void printSummary(ofstream& outfile);
70 :     private:
71 :     /**
72 :     * \brief This function will read the SurveyDistribution data from the input file
73 :     * \param infile is the CommentStream to read the SurveyDistribution data from
74 :     * \param TimeInfo is the TimeClass for the current model
75 :     * \param numarea is the number of areas that the likelihood data covers
76 :     * \param numage is the number of age groups that the likelihood data covers
77 :     * \param numlen is the number of length groups that the likelihood data covers
78 :     */
79 :     void readDistributionData(CommentStream& infile, const TimeClass* TimeInfo,
80 :     int numarea, int numage, int numlen);
81 :     /**
82 :     * \brief This function will calculate the survey index based on the modelled population for the current timetsep
83 :     * \param TimeInfo is the TimeClass for the current model
84 :     */
85 :     void calcIndex(const TimeClass* const TimeInfo);
86 :     /**
87 :     * \brief This function will calculate the likelihood score for the current timestep based on a multinomial function
88 :     * \return likelihood score
89 :     */
90 :     double calcLikMultinomial();
91 :     /**
92 :     * \brief This function will calculate the likelihood score for the current timestep based on a Pearson function
93 :     * \return likelihood score
94 :     */
95 :     double calcLikPearson();
96 :     /**
97 :     * \brief This function will calculate the likelihood score for the current timestep based on a gamma function
98 :     * \return likelihood score
99 :     */
100 :     double calcLikGamma();
101 :     /**
102 :     * \brief This function will calculate the likelihood score for the current timestep based on a logarithmic function
103 :     * \return likelihood score
104 :     */
105 :     double calcLikLog();
106 :     /**
107 :     * \brief This is the StockAggregator used to collect information about the stocks
108 :     */
109 :     StockAggregator* aggregator;
110 :     /**
111 :     * \brief This is the CharPtrVector of the names of the stocks that will be used to calculate the likelihood score
112 :     */
113 :     CharPtrVector stocknames;
114 :     /**
115 :     * \brief This is the IntMatrix used to store area information
116 :     */
117 :     IntMatrix areas;
118 :     /**
119 :     * \brief This is the IntMatrix used to store age information
120 :     */
121 :     IntMatrix ages;
122 :     /**
123 :     * \brief This is the DoubleVector used to store length information
124 :     */
125 :     DoubleVector lengths;
126 :     /**
127 :     * \brief This is the CharPtrVector of the names of the areas
128 :     */
129 :     CharPtrVector areaindex;
130 :     /**
131 :     * \brief This is the CharPtrVector of the names of the age groups
132 :     */
133 :     CharPtrVector ageindex;
134 :     /**
135 :     * \brief This is the CharPtrVector of the names of the length groups
136 :     */
137 :     CharPtrVector lenindex;
138 :     /**
139 :     * \brief This is the LengthGroupDivision used to store length information
140 :     */
141 :     LengthGroupDivision* LgrpDiv;
142 :     /**
143 :     * \brief This is the name of the fit function to be used to calculate the index
144 :     */
145 :     char* fittype;
146 :     /**
147 :     * \brief This is the identifier of the fit function to be used to calculate the index
148 :     */
149 :     int fitnumber;
150 :     /**
151 :     * \brief This is the name of the likelihood function to be used to calculate the likelihood score
152 :     */
153 :     char* liketype;
154 :     /**
155 :     * \brief This is the identifier of the likelihood function to be used to calculate the likelihood score
156 :     */
157 :     int likenumber;
158 :     /**
159 :     * \brief This ActionAtTimes stores information about when the likelihood score should be calculated
160 :     */
161 :     ActionAtTimes AAT;
162 :     /**
163 :     * \brief This is the IntVector used to store information about the years when the likelihood score should be calculated
164 :     */
165 :     IntVector Years;
166 :     /**
167 :     * \brief This is the IntVector used to store information about the steps when the likelihood score should be calculated
168 :     */
169 :     IntVector Steps;
170 :     /**
171 :     * \brief This is the DoubleMatrixPtrMatrix used to store survey distribution information specified in the input file
172 :     * \note The indices for this object are [time][area][age][length]
173 :     */
174 :     DoubleMatrixPtrMatrix obsDistribution;
175 :     /**
176 :     * \brief This is the DoubleMatrixPtrMatrix used to store survey distribution information calculated in the model
177 :     * \note The indices for this object are [time][area][age][length]
178 :     */
179 :     DoubleMatrixPtrMatrix modelDistribution;
180 :     /**
181 :     * \brief This is the DoubleMatrix used to store the calculated likelihood information
182 :     */
183 :     DoubleMatrix likelihoodValues;
184 :     /**
185 :     * \brief This is the index of the timesteps for the likelihood component data
186 :     */
187 :     int timeindex;
188 :     /**
189 :     * \brief This is the value of epsilon used when calculating the likelihood score
190 :     */
191 :     double epsilon;
192 :     /**
193 :     * \brief This is the SuitFunc used when calculating the survey index
194 :     */
195 :     SuitFunc* suitfunction;
196 :     /**
197 :     * \brief This is the DoubleVector used to store the length dependent suitability factor when calculating the survey index
198 :     */
199 :     DoubleVector suit;
200 :     /**
201 :     * \brief This is the ModelVariableVector used to store the parameters when calculating the survey index
202 :     */
203 :     ModelVariableVector parameters;
204 :     /**
205 :     * \brief This is the AgeBandMatrixPtrVector used to temporarily store the information returned from the aggregatation function
206 :     */
207 :     const AgeBandMatrixPtrVector* alptr;
208 :     };
209 :    
210 :     #endif

root@forge.cesga.es
ViewVC Help
Powered by ViewVC 1.0.0  

Powered By FusionForge