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