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

Annotation of /trunk/gadget/boundlikelihood.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1 - (view) (download)

1 : agomez 1 #ifndef boundlikelihood_h
2 :     #define boundlikelihood_h
3 :    
4 :     #include "likelihood.h"
5 :     #include "areatime.h"
6 :     #include "commentstream.h"
7 :     #include "intvector.h"
8 :     #include "doublevector.h"
9 :     #include "parametervector.h"
10 :    
11 :     /**
12 :     * \class BoundLikelihood
13 :     * \brief This is the class used to calculate the likelihood scores based on the bounds of the parameters for the current model
14 :     *
15 :     * This class calculates a penalty that is applied if any parameters go outside the specified bounds during the optimisation process. The Simulated Annealing algorithm restricts the parameters to be within the bounds, so this component will give a zero likelihood score when that algorithm is being used. The Hooke & Jeeves algorithm doesn't have this restriction, so a penalty is applied to any parameter that is beyond the bound, and the parameter is moved back to the bounds. A 'reasonable' model will have a zero likelihood score from this component.
16 :     */
17 :     class BoundLikelihood : public Likelihood {
18 :     public:
19 :     /**
20 :     * \brief This is the default BoundLikelihood contructor
21 :     * \param infile is the CommentStream to read the likelihood parameters from
22 :     * \param Area is the AreaClass for the current model
23 :     * \param TimeInfo is the TimeClass for the current model
24 :     * \param keeper is the Keeper 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 :     BoundLikelihood(CommentStream& infile, const AreaClass* const Area,
29 :     const TimeClass* const TimeInfo, const Keeper* const keeper, double weight, const char* name);
30 :     /**
31 :     * \brief This is the default BoundLikelihood destructor
32 :     */
33 :     virtual ~BoundLikelihood() {};
34 :     /**
35 :     * \brief This function will reset the bounds information for the likelihood calculation
36 :     * \param keeper is the Keeper for the current model
37 :     */
38 :     void Reset(const Keeper* const keeper);
39 :     /**
40 :     * \brief This function will calculate the likelihood score for the current model
41 :     * \param TimeInfo is the TimeClass for the current model
42 :     * \note This function is not used for this likelihood component
43 :     */
44 :     virtual void addLikelihood(const TimeClass* const TimeInfo) {};
45 :     /**
46 :     * \brief This function will print summary information from the BoundLikelihood likelihood calculation
47 :     * \param outfile is the ofstream that all the model likelihood information gets sent to
48 :     */
49 :     virtual void printSummary(ofstream& outfile);
50 :     /**
51 :     * \brief This function will calculate the likelihood score for the current model after adjusting the parameters
52 :     * \param TimeInfo is the TimeClass for the current model
53 :     * \param keeper is the Keeper for the current model
54 :     * \note keeper can adjust the value of the parameters to ensure that they are within the bounds
55 :     */
56 :     virtual void addLikelihoodKeeper(const TimeClass* const TimeInfo, Keeper* const keeper);
57 :     /**
58 :     * \brief This function will print the summary MigrationPenalty likelihood information
59 :     * \param outfile is the ofstream that all the model information gets sent to
60 :     * \note This function is not used for this likelihood component
61 :     */
62 :     virtual void Print(ofstream& outfile) const;
63 :     protected:
64 :     /**
65 :     * \brief This is the IntVector of the index of the parameters
66 :     */
67 :     IntVector switchnr;
68 :     /**
69 :     * \brief This is the DoubleVector of the upper bounds
70 :     */
71 :     DoubleVector upperbound;
72 :     /**
73 :     * \brief This is the DoubleVector of the lower bounds
74 :     */
75 :     DoubleVector lowerbound;
76 :     /**
77 :     * \brief This is the DoubleVector of the power applied when the bound has been exceeded
78 :     */
79 :     DoubleVector powers;
80 :     /**
81 :     * \brief This is the DoubleVector of the weights applied when the lower bound has been exceeded
82 :     */
83 :     DoubleVector lowerweights;
84 :     /**
85 :     * \brief This is the DoubleVector of the weights applied when the upper bound has been exceeded
86 :     */
87 :     DoubleVector upperweights;
88 :     /**
89 :     * \brief This is the DoubleVector of the penalty applied when the bound has been exceeded
90 :     */
91 :     DoubleVector likelihoods;
92 :     /**
93 :     * \brief This is the ParameterVector of the names of the input parameters
94 :     */
95 :     ParameterVector switches;
96 :     /**
97 :     * \brief This is the DoubleVector used to temporarily store the values of the parameters
98 :     */
99 :     DoubleVector values;
100 :     /**
101 :     * \brief This is the default weight applied when the lower bound is exceeded
102 :     */
103 :     double defLW;
104 :     /**
105 :     * \brief This is the default weight applied when the upper bound is exceeded
106 :     */
107 :     double defUW;
108 :     /**
109 :     * \brief This is the default power applied when the bound is exceeded
110 :     */
111 :     double defPower;
112 :     private:
113 :     /**
114 :     * \brief This is the flag used to check whether the vectors have been initialised
115 :     */
116 :     int checkInitialised;
117 :     };
118 :    
119 :     #endif

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

Powered By FusionForge