Gadget
sionstep.h
Go to the documentation of this file.
1 #ifndef sionstep_h
2 #define sionstep_h
3 
4 #include "areatime.h"
6 #include "intmatrix.h"
7 #include "charptrvector.h"
8 #include "conversionindex.h"
9 #include "commentstream.h"
10 #include "actionattimes.h"
11 #include "agebandmatrix.h"
12 #include "stockaggregator.h"
13 #include "regressionline.h"
14 #include "hasname.h"
15 #include "gadget.h"
16 
23 
29 class SIOnStep : public HasName {
30 public:
43  SIOnStep(CommentStream& infile, const char* datafilename, const CharPtrVector& aindex,
44  const TimeClass* const TimeInfo, const IntMatrix& areas, const CharPtrVector& charindex,
45  const char* givenname, int bio, SIType type);
49  virtual ~SIOnStep();
54  virtual void Sum(const TimeClass* const TimeInfo) = 0;
60  virtual void setFleetsAndStocks(FleetPtrVector& Fleets, StockPtrVector& Stocks) = 0;
64  virtual void Reset();
69  virtual void Print(ofstream& outfile) const = 0;
75  virtual void printLikelihood(ofstream& outfile, const TimeClass* const TimeInfo);
81  virtual void printSummary(ofstream& outfile, const double weight);
86  virtual double calcSSE();
91  FitType getType() const { return fittype; };
96  SIType getSIType() const { return sitype; };
97 protected:
157  int biomass;
163 private:
169  void readSIData(CommentStream& infile, const TimeClass* const TimeInfo);
174  void readSIRegressionData(CommentStream& infile);
178  double slope;
182  double intercept;
186  DoubleMatrix slopes;
190  DoubleMatrix intercepts;
194  DoubleMatrix sse;
198  DoubleVector tmpModel;
202  DoubleVector tmpData;
206  DoubleVector tmpWeight;
210  CharPtrVector areaindex;
214  CharPtrVector colindex;
218  FitType fittype;
222  Regression* LR;
223 };
224 
225 #endif
This is the class used to associate actions with specific timesteps within the model.
Definition: actionattimes.h:14
This class implements a dynamic vector of AgeBandMatrix values.
Definition: agebandmatrixptrvector.h:12
This class implements a dynamic vector of char values.
Definition: charptrvector.h:8
This is the class used to strip comments (and whitespace) from any input stream.
Definition: commentstream.h:40
This class implements a dynamic vector of DoubleMatrix values.
Definition: doublematrixptrvector.h:10
This class implements a dynamic vector of DoubleVector values.
Definition: doublematrix.h:11
This class implements a dynamic vector of double values.
Definition: doublevector.h:11
This class implements a dynamic vector of Fleet values.
Definition: fleetptrvector.h:10
This is the base class for any object that has a name.
Definition: hasname.h:10
This class implements a dynamic vector of IntVector values.
Definition: intmatrix.h:10
This class implements a dynamic vector of int values.
Definition: intvector.h:11
This is the class used to store information about the length groups of the modelled stock population.
Definition: lengthgroup.h:10
This is the base class used to fit a regression line to compare 2 vectors.
Definition: regressionline.h:13
This is the base class used to calculate a likelihood score by fitting a regression line to the model...
Definition: sionstep.h:29
DoubleMatrixPtrVector obsIndex
This is the DoubleMatrixPtrVector used to store the survey indices specified in the input file.
Definition: sionstep.h:130
int useweight
This is the flag to denote whether weighted regression line should be used when calculating the fit t...
Definition: sionstep.h:162
LengthGroupDivision * LgrpDiv
This is the LengthGroupDivision used to store information about the lengths that the survey index sho...
Definition: sionstep.h:117
virtual void Sum(const TimeClass *const TimeInfo)=0
This function will sum the survey index data.
SIOnStep(CommentStream &infile, const char *datafilename, const CharPtrVector &aindex, const TimeClass *const TimeInfo, const IntMatrix &areas, const CharPtrVector &charindex, const char *givenname, int bio, SIType type)
This is the default SIOnStep constructor.
Definition: sionstep.cc:27
virtual void Reset()
This function will reset the SIOnStep information.
Definition: sionstep.cc:369
IntMatrix Areas
This is the IntMatrix used to store information about the areas that the survey index should be calcu...
Definition: sionstep.h:96
virtual void setFleetsAndStocks(FleetPtrVector &Fleets, StockPtrVector &Stocks)=0
This will select the fleets and stocks required to calculate the regression line.
int biomass
This is the flag to denote whether the index should be based on the biomass or not.
Definition: sionstep.h:157
IntVector Steps
This is the IntVector used to store information about the steps when the survey index should be calcu...
Definition: sionstep.h:109
SIType getSIType() const
This will return the type of survey index data to be used.
Definition: sionstep.h:96
virtual void printLikelihood(ofstream &outfile, const TimeClass *const TimeInfo)
This function will print information from each SIOnStep regression calculation.
Definition: sionstep.cc:278
ActionAtTimes AAT
This ActionAtTimes stores information about when the survey index should be calculated.
Definition: sionstep.h:125
const AgeBandMatrixPtrVector * alptr
This is the AgeBandMatrixPtrVector used to temporarily store the information returned from the aggreg...
Definition: sionstep.h:144
FitType getType() const
This will return the fit type for the regression line.
Definition: sionstep.h:91
DoubleMatrixPtrVector weightIndex
This is the DoubleMatrixPtrVector used to store the weights specified for the regression line.
Definition: sionstep.h:140
DoubleMatrixPtrVector modelIndex
This is the DoubleMatrixPtrVector used to store the survey indices calculated in the model.
Definition: sionstep.h:135
virtual ~SIOnStep()
This is the default SIOnStep destructor.
Definition: sionstep.cc:9
IntMatrix Ages
This is the IntMatrix used to store information about the ages that the survey index should be calcul...
Definition: sionstep.h:113
virtual void Print(ofstream &outfile) const =0
This function will print the SIOnStep information.
SIType sitype
This denotes what type of survey index data is to be used.
Definition: sionstep.h:148
IntVector Years
This is the IntVector used to store information about the years when the survey index should be calcu...
Definition: sionstep.h:105
virtual void printSummary(ofstream &outfile, const double weight)
This function will print summary information from each SIOnStep regression calculation.
Definition: sionstep.cc:359
DoubleVector likelihoodValues
This is the DoubleVector used to store the calculated likelihood information.
Definition: sionstep.h:121
virtual double calcSSE()
This function will calculate the SSE from the regression line.
Definition: sionstep.cc:319
int timeindex
This is the index of the timesteps for the survey index data.
Definition: sionstep.h:152
This class implements a dynamic vector of Stock values.
Definition: stockptrvector.h:10
This is the class used to store information about the timesteps used for the current model.
Definition: areatime.h:87
FitType
Definition: sionstep.h:17
@ LINEARFIT
Definition: sionstep.h:17
@ FIXEDLINEARFIT
Definition: sionstep.h:21
@ FIXEDSLOPEWEIGHTLINEARFIT
Definition: sionstep.h:18
@ FIXEDSLOPELINEARFIT
Definition: sionstep.h:18
@ FIXEDINTERCEPTLOGLINEARFIT
Definition: sionstep.h:19
@ LOGLINEARFIT
Definition: sionstep.h:17
@ FIXEDINTERCEPTLOGWEIGHTLINEARFIT
Definition: sionstep.h:20
@ LOGWEIGHTLINEARFIT
Definition: sionstep.h:17
@ WEIGHTLINEARFIT
Definition: sionstep.h:17
@ FIXEDLOGWEIGHTLINEARFIT
Definition: sionstep.h:21
@ FIXEDLOGLINEARFIT
Definition: sionstep.h:21
@ FIXEDWEIGHTLINEARFIT
Definition: sionstep.h:21
@ FIXEDSLOPELOGWEIGHTLINEARFIT
Definition: sionstep.h:19
@ FIXEDINTERCEPTWEIGHTLINEARFIT
Definition: sionstep.h:20
@ FIXEDINTERCEPTLINEARFIT
Definition: sionstep.h:19
@ FIXEDSLOPELOGLINEARFIT
Definition: sionstep.h:18
SIType
Definition: sionstep.h:22
@ SIACOUSTIC
Definition: sionstep.h:22
@ SIAGE
Definition: sionstep.h:22
@ SILENGTH
Definition: sionstep.h:22
@ SIFLEET
Definition: sionstep.h:22
@ SIEFFORT
Definition: sionstep.h:22