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/likelihood.h
[mareframe] / trunk / gadget / likelihood.h Repository:
ViewVC logotype

Annotation of /trunk/gadget/likelihood.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1 - (view) (download)

1 : agomez 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 :     class TimeClass;
11 :     class Keeper;
12 :    
13 :     enum LikelihoodType { SURVEYINDICESLIKELIHOOD = 1, UNDERSTOCKINGLIKELIHOOD,
14 :     CATCHDISTRIBUTIONLIKELIHOOD, CATCHSTATISTICSLIKELIHOOD, STOMACHCONTENTLIKELIHOOD,
15 :     STOCKDISTRIBUTIONLIKELIHOOD, CATCHINKILOSLIKELIHOOD, BOUNDLIKELIHOOD, TAGLIKELIHOOD,
16 :     MIGRATIONPENALTYLIKELIHOOD, RECSTATISTICSLIKELIHOOD, SURVEYDISTRIBUTIONLIKELIHOOD, MIGRATIONPROPORTIONLIKELIHOOD };
17 :    
18 :     /**
19 :     * \class Likelihood
20 :     * \brief This is the base class used to calculate the likelihood scores used to compare the modelled data in the input data
21 :     * \note This will always be overridden by the derived classes that actually calculate the likelihood scores
22 :     */
23 :     class Likelihood : public HasName {
24 :     public:
25 :     /**
26 :     * \brief This is the default Likelihood constructor
27 :     * \param T is the LikelihoodType for the likelihood component
28 :     * \param w is the weight for the likelihood component
29 :     * \param givenname is the name of the likelihood component
30 :     */
31 :     Likelihood(LikelihoodType T, double w, const char* givenname) : HasName(givenname) {
32 :     likelihood = 0.0;
33 :     weight = w;
34 :     type = T;
35 :     };
36 :     /**
37 :     * \brief This is the default Likelihood destructor
38 :     */
39 :     virtual ~Likelihood() {};
40 :     /**
41 :     * \brief This function will calculate the likelihood score for the current model
42 :     * \param TimeInfo is the TimeClass for the current model
43 :     */
44 :     virtual void addLikelihood(const TimeClass* const TimeInfo) = 0;
45 :     /**
46 :     * \brief This function will calculate the likelihood score for the current model after adjusting the parameters
47 :     * \param TimeInfo is the TimeClass for the current model
48 :     * \param keeper is the Keeper for the current model
49 :     */
50 :     virtual void addLikelihoodKeeper(const TimeClass* const TimeInfo, Keeper* const keeper) {};
51 :     /**
52 :     * \brief This function will reset the likelihood information
53 :     * \param keeper is the Keeper for the current model
54 :     */
55 :     virtual void Reset(const Keeper* const keeper) { likelihood = 0.0; };
56 :     /**
57 :     * \brief This function will print the summary likelihood information
58 :     * \param outfile is the ofstream that all the model information gets sent to
59 :     */
60 :     virtual void Print(ofstream& outfile) const = 0;
61 :     /**
62 :     * \brief This function will print information from each likelihood calculation
63 :     * \param outfile is the ofstream that all the model likelihood information gets sent to
64 :     * \param TimeInfo is the TimeClass for the current model
65 :     */
66 :     virtual void printLikelihood(ofstream& outfile, const TimeClass* const TimeInfo) {};
67 :     /**
68 :     * \brief This function will print summary information from each likelihood calculation
69 :     * \param outfile is the ofstream that all the model likelihood information gets sent to
70 :     */
71 :     virtual void printSummary(ofstream& outfile) {};
72 :     /**
73 :     * \brief This will return the weighted likelihood score for the likelihood component
74 :     * \return weight*likelihood
75 :     */
76 :     double getLikelihood() const { return weight * likelihood; };
77 :     /**
78 :     * \brief This will return the type of likelihood class
79 :     * \return type
80 :     */
81 :     LikelihoodType getType() const { return type; };
82 :     /**
83 :     * \brief This will return the unweighted likelihood score for the likelihood component
84 :     * \return likelihood
85 :     */
86 :     double getUnweightedLikelihood() const { return likelihood; };
87 :     /**
88 :     * \brief This will return the weight applied to the likelihood component
89 :     * \return weight
90 :     */
91 :     double getWeight() const { return weight; };
92 :     /**
93 :     * \brief This will select the fleets and stocks required to calculate the likelihood score
94 :     * \param Fleets is the FleetPtrVector of all the available fleets
95 :     * \param Stocks is the StockPtrVector of all the available stocks
96 :     */
97 :     virtual void setFleetsAndStocks(FleetPtrVector& Fleets, StockPtrVector& Stocks) {};
98 :     protected:
99 :     /**
100 :     * \brief This stores the calculated score for the likelihood component
101 :     */
102 :     double likelihood;
103 :     /**
104 :     * \brief This stores the weight to be applied to the likelihood component
105 :     */
106 :     double weight;
107 :     private:
108 :     /**
109 :     * \brief This denotes what type of likelihood class has been created
110 :     */
111 :     LikelihoodType type;
112 :     };
113 :    
114 :     #endif

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

Powered By FusionForge