Gadget
likelihood.h
Go to the documentation of this file.
1 #ifndef likelihood_h
2 #define likelihood_h
3 
4 #include "stockptrvector.h"
5 #include "fleetptrvector.h"
6 #include "printinfo.h"
7 #include "hasname.h"
8 #include "gadget.h"
9 
10 
11 class TimeClass;
12 class Keeper;
13 
18 
24 class Likelihood : public HasName {
25 public:
32  Likelihood(LikelihoodType T, double w, const char* givenname) : HasName(givenname) {
33  likelihood = 0.0;
34  weight = w;
35  type = T;
36  };
40  virtual ~Likelihood() {};
45  virtual void addLikelihood(const TimeClass* const TimeInfo) = 0;
51  virtual void addLikelihoodKeeper(const TimeClass* const TimeInfo, Keeper* const keeper) {};
56  virtual void Reset(const Keeper* const keeper) { likelihood = 0.0; };
61  virtual void Reset(const TimeClass* const TimeInfo) {};
66  virtual void Print(ofstream& outfile) const = 0;
72  virtual void printLikelihood(ofstream& outfile, const TimeClass* const TimeInfo) {};
77  virtual void printSummary(ofstream& outfile) {};
82  double getLikelihood() const { return weight * likelihood; };
87  LikelihoodType getType() const { return type; };
92  double getUnweightedLikelihood() const { return likelihood; };
97  double getWeight() const { return weight; };
103  virtual void setFleetsAndStocks(FleetPtrVector& Fleets, StockPtrVector& Stocks) {};
104 protected:
108  double likelihood;
112  double weight;
113 private:
117  LikelihoodType type;
118 };
119 
120 #endif
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 is the class used to store information about the variables that are used in model simulation.
Definition: keeper.h:17
This is the base class used to calculate the likelihood scores used to compare the modelled data in t...
Definition: likelihood.h:24
double getWeight() const
This will return the weight applied to the likelihood component.
Definition: likelihood.h:97
virtual void addLikelihood(const TimeClass *const TimeInfo)=0
This function will calculate the likelihood score for the current model.
double getUnweightedLikelihood() const
This will return the unweighted likelihood score for the likelihood component.
Definition: likelihood.h:92
virtual void addLikelihoodKeeper(const TimeClass *const TimeInfo, Keeper *const keeper)
This function will calculate the likelihood score for the current model after adjusting the parameter...
Definition: likelihood.h:51
Likelihood(LikelihoodType T, double w, const char *givenname)
This is the default Likelihood constructor.
Definition: likelihood.h:32
virtual void printSummary(ofstream &outfile)
This function will print summary information from each likelihood calculation.
Definition: likelihood.h:77
virtual ~Likelihood()
This is the default Likelihood destructor.
Definition: likelihood.h:40
virtual void Reset(const TimeClass *const TimeInfo)
This function will reset the likelihood information.
Definition: likelihood.h:61
double likelihood
This stores the calculated score for the likelihood component.
Definition: likelihood.h:103
double getLikelihood() const
This will return the weighted likelihood score for the likelihood component.
Definition: likelihood.h:82
virtual void Reset(const Keeper *const keeper)
This function will reset the likelihood information.
Definition: likelihood.h:56
virtual void printLikelihood(ofstream &outfile, const TimeClass *const TimeInfo)
This function will print information from each likelihood calculation.
Definition: likelihood.h:72
double weight
This stores the weight to be applied to the likelihood component.
Definition: likelihood.h:112
LikelihoodType getType() const
This will return the type of likelihood class.
Definition: likelihood.h:87
virtual void setFleetsAndStocks(FleetPtrVector &Fleets, StockPtrVector &Stocks)
This will select the fleets and stocks required to calculate the likelihood score.
Definition: likelihood.h:103
virtual void Print(ofstream &outfile) const =0
This function will print the summary likelihood information.
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
LikelihoodType
Definition: likelihood.h:14
@ BOUNDLIKELIHOOD
Definition: likelihood.h:16
@ CATCHINKILOSLIKELIHOOD
Definition: likelihood.h:16
@ TAGLIKELIHOOD
Definition: likelihood.h:16
@ UNDERSTOCKINGLIKELIHOOD
Definition: likelihood.h:14
@ RECSTATISTICSLIKELIHOOD
Definition: likelihood.h:17
@ STOCKDISTRIBUTIONLIKELIHOOD
Definition: likelihood.h:16
@ SURVEYINDICESLIKELIHOOD
Definition: likelihood.h:14
@ SURVEYDISTRIBUTIONLIKELIHOOD
Definition: likelihood.h:17
@ PROGLIKELIHOOD
Definition: likelihood.h:17
@ STOMACHCONTENTLIKELIHOOD
Definition: likelihood.h:15
@ CATCHDISTRIBUTIONLIKELIHOOD
Definition: likelihood.h:15
@ CATCHSTATISTICSLIKELIHOOD
Definition: likelihood.h:15
@ MIGRATIONPENALTYLIKELIHOOD
Definition: likelihood.h:17
@ MIGRATIONPROPORTIONLIKELIHOOD
Definition: likelihood.h:17