1 : |
agomez |
1 |
#ifndef maininfo_h
|
2 : |
|
|
#define maininfo_h
|
3 : |
|
|
|
4 : |
|
|
#include "gadget.h" |
5 : |
|
|
#include "commentstream.h" |
6 : |
|
|
#include "printinfo.h" |
7 : |
|
|
|
8 : |
|
|
/**
|
9 : |
|
|
* \class MainInfo
|
10 : |
|
|
* \brief This is the class used to store information for the current model given from the command-line
|
11 : |
|
|
*/
|
12 : |
|
|
class MainInfo {
|
13 : |
|
|
public:
|
14 : |
|
|
/**
|
15 : |
|
|
* \brief This is the MainInfo constructor
|
16 : |
|
|
*/
|
17 : |
|
|
MainInfo();
|
18 : |
|
|
/**
|
19 : |
|
|
* \brief This is the default MainInfo destructor
|
20 : |
|
|
*/
|
21 : |
|
|
~MainInfo();
|
22 : |
|
|
/**
|
23 : |
|
|
* \brief This function will print an error message, brief help information and then exit
|
24 : |
|
|
* \param error is the error message
|
25 : |
|
|
*/
|
26 : |
|
|
void showCorrectUsage(char* error);
|
27 : |
|
|
/**
|
28 : |
|
|
* \brief This function will print help information and then exit
|
29 : |
|
|
*/
|
30 : |
|
|
void showUsage();
|
31 : |
|
|
/**
|
32 : |
|
|
* \brief This function will check the options that have been specified on the commandline
|
33 : |
|
|
* \param inputdir is the name of the directory containing the input files to the model
|
34 : |
|
|
* \param workingdir is the name of the directory used for the output from the model
|
35 : |
|
|
*/
|
36 : |
|
|
void checkUsage(const char* const inputdir, const char* const workingdir);
|
37 : |
|
|
/**
|
38 : |
|
|
* \brief This function will read input from the command line
|
39 : |
|
|
* \param aNumber is the number of command line entries
|
40 : |
|
|
* \param aVector contains the command line entries
|
41 : |
|
|
*/
|
42 : |
|
|
void read(int aNumber, char* const aVector[]);
|
43 : |
|
|
/**
|
44 : |
|
|
* \brief This function will store the filename that the initial model information will be written to
|
45 : |
|
|
* \param filename is the name of the file
|
46 : |
|
|
*/
|
47 : |
|
|
void setPrintInitialFile(char* filename);
|
48 : |
|
|
/**
|
49 : |
|
|
* \brief This function will store the filename that the final model information will be written to
|
50 : |
|
|
* \param filename is the name of the file
|
51 : |
|
|
*/
|
52 : |
|
|
void setPrintFinalFile(char* filename);
|
53 : |
agomez |
20 |
#ifdef _OPENMP
|
54 : |
agomez |
1 |
/**
|
55 : |
agomez |
20 |
* \brief This function will store parallel options
|
56 : |
|
|
*/
|
57 : |
|
|
void setParallel(char* filename);
|
58 : |
|
|
#endif
|
59 : |
|
|
/**
|
60 : |
agomez |
1 |
* \brief This function will store the filename that the initial values for the model parameters will be read from
|
61 : |
|
|
* \param filename is the name of the file
|
62 : |
|
|
*/
|
63 : |
|
|
void setInitialParamFile(char* filename);
|
64 : |
|
|
/**
|
65 : |
|
|
* \brief This function will store the filename that the main model information will be read from
|
66 : |
|
|
* \param filename is the name of the file
|
67 : |
|
|
*/
|
68 : |
|
|
void setMainGadgetFile(char* filename);
|
69 : |
|
|
/**
|
70 : |
|
|
* \brief This function will store the filename that the optimisation information will be read from
|
71 : |
|
|
* \param filename is the name of the file
|
72 : |
|
|
*/
|
73 : |
|
|
void setOptInfoFile(char* filename);
|
74 : |
|
|
/**
|
75 : |
|
|
* \brief This function will return the flag used to determine whether the likelihood score should be optimised
|
76 : |
|
|
* \return flag
|
77 : |
|
|
*/
|
78 : |
|
|
int runOptimise() const { return runoptimise; };
|
79 : |
|
|
/**
|
80 : |
|
|
* \brief This function will return the flag used to determine whether a simulation run should be performed
|
81 : |
|
|
* \return flag
|
82 : |
|
|
*/
|
83 : |
|
|
int runStochastic() const { return runstochastic; };
|
84 : |
|
|
/**
|
85 : |
|
|
* \brief This function will return the flag used to determine whether the current simulation has been started using paramin
|
86 : |
|
|
* \return flag
|
87 : |
|
|
*/
|
88 : |
|
|
int runNetwork() const { return runnetwork; };
|
89 : |
|
|
/**
|
90 : |
|
|
* \brief This function will return the flag used to determine whether the current simulation should print the model output
|
91 : |
|
|
* \return flag
|
92 : |
|
|
*/
|
93 : |
|
|
int runPrint() const { return runprint; };
|
94 : |
agomez |
20 |
#ifdef _OPENMP
|
95 : |
agomez |
1 |
/**
|
96 : |
agomez |
20 |
* \brief This function will return the flag used to determine whether the current simulation should print the model output
|
97 : |
|
|
* \return flag
|
98 : |
|
|
*/
|
99 : |
|
|
int runParallel() const { return runparallel; };
|
100 : |
|
|
#endif
|
101 : |
|
|
/**
|
102 : |
agomez |
1 |
* \brief This function will return the flag used to determine whether the optimisation parameters have been given
|
103 : |
|
|
* \return flag
|
104 : |
|
|
*/
|
105 : |
|
|
int getOptInfoGiven() const { return givenOptInfo; };
|
106 : |
|
|
/**
|
107 : |
|
|
* \brief This function will return the flag used to determine whether the initial values for the model parameters have been given
|
108 : |
|
|
* \return flag
|
109 : |
|
|
*/
|
110 : |
|
|
int getInitialParamGiven() const { return givenInitialParam; };
|
111 : |
|
|
/**
|
112 : |
|
|
* \brief This function will return the flag used to force the model to print the model output to file
|
113 : |
|
|
* \return flag
|
114 : |
|
|
*/
|
115 : |
|
|
int getForcePrint() const { return forceprint; };
|
116 : |
|
|
/**
|
117 : |
|
|
* \brief This function will return the PrintInfo used to store printing information
|
118 : |
|
|
* \return pi, the PrintInfo containing the printing information
|
119 : |
|
|
*/
|
120 : |
|
|
PrintInfo getPI() const { return printinfo; };
|
121 : |
|
|
/**
|
122 : |
|
|
* \brief This function will return the flag used to determine whether the initial model information should be printed to file
|
123 : |
|
|
* \return flag
|
124 : |
|
|
*/
|
125 : |
|
|
int printInitial() const { return printInitialInfo; };
|
126 : |
|
|
/**
|
127 : |
|
|
* \brief This function will return the flag used to determine whether the final model information should be printed to file
|
128 : |
|
|
* \return flag
|
129 : |
|
|
*/
|
130 : |
|
|
int printFinal() const { return printFinalInfo; };
|
131 : |
|
|
/**
|
132 : |
|
|
* \brief This function will return the filename that the initial values for the model parameters will be read from
|
133 : |
|
|
* \return filename
|
134 : |
|
|
*/
|
135 : |
|
|
char* getInitialParamFile() const { return strInitialParamFile; };
|
136 : |
|
|
/**
|
137 : |
|
|
* \brief This function will return the filename that the initial model information will be written to
|
138 : |
|
|
* \return filename
|
139 : |
|
|
*/
|
140 : |
|
|
char* getPrintInitialFile() const { return strPrintInitialFile; };
|
141 : |
|
|
/**
|
142 : |
|
|
* \brief This function will return the filename that the final model information will be written to
|
143 : |
|
|
* \return filename
|
144 : |
|
|
*/
|
145 : |
|
|
char* getPrintFinalFile() const { return strPrintFinalFile; };
|
146 : |
|
|
/**
|
147 : |
|
|
* \brief This function will return the filename that the main model information will be read from
|
148 : |
|
|
* \return filename
|
149 : |
|
|
*/
|
150 : |
|
|
char* getMainGadgetFile() const { return strMainGadgetFile; };
|
151 : |
|
|
/**
|
152 : |
|
|
* \brief This function will return the filename that the optimisation information will be read from
|
153 : |
|
|
* \return filename
|
154 : |
|
|
*/
|
155 : |
|
|
char* getOptInfoFile() const { return strOptInfoFile; };
|
156 : |
|
|
/**
|
157 : |
|
|
* \brief This function will return the maximum ratio of a stock that can be consumed on any given timestep
|
158 : |
|
|
* \return maxratio
|
159 : |
|
|
*/
|
160 : |
ulcessvp |
12 |
double getMaxRatio() const {
|
161 : |
|
|
return maxratio;
|
162 : |
|
|
}
|
163 : |
|
|
/**
|
164 : |
|
|
* \brief This function will return seeds used in SA
|
165 : |
|
|
* \return seed array of unsigned int with the seeds used in SA
|
166 : |
|
|
*/
|
167 : |
|
|
unsigned* getSeed() const {return seed;};
|
168 : |
ulcessvp |
11 |
|
169 : |
|
|
|
170 : |
agomez |
1 |
private:
|
171 : |
|
|
/**
|
172 : |
|
|
* \brief This function will read input from a file instead of the command line
|
173 : |
|
|
* \param file is the CommentStream to read from
|
174 : |
|
|
*/
|
175 : |
|
|
void read(CommentStream& file);
|
176 : |
|
|
/**
|
177 : |
|
|
* \brief This is the name of the file that optimisation parameters will be read from
|
178 : |
|
|
*/
|
179 : |
|
|
char* strOptInfoFile;
|
180 : |
|
|
/**
|
181 : |
|
|
* \brief This is the name of the file that initial values for the model parameters will be read from
|
182 : |
|
|
*/
|
183 : |
|
|
char* strInitialParamFile;
|
184 : |
|
|
/**
|
185 : |
|
|
* \brief This is the name of the file that the initial model information will be written to
|
186 : |
|
|
*/
|
187 : |
|
|
char* strPrintInitialFile;
|
188 : |
|
|
/**
|
189 : |
|
|
* \brief This is the name of the file that the final model information will be written to
|
190 : |
|
|
*/
|
191 : |
|
|
char* strPrintFinalFile;
|
192 : |
|
|
/**
|
193 : |
|
|
* \brief This is the name of the file that the main model information will be read from
|
194 : |
|
|
*/
|
195 : |
|
|
char* strMainGadgetFile;
|
196 : |
|
|
/**
|
197 : |
|
|
* \brief This is the PrintInfo used to store information about the format the model parameters should be written to file
|
198 : |
|
|
*/
|
199 : |
|
|
PrintInfo printinfo;
|
200 : |
|
|
/**
|
201 : |
|
|
* \brief This is the flag used to denote whether the optimisation parameters have been given or not
|
202 : |
|
|
*/
|
203 : |
|
|
int givenOptInfo;
|
204 : |
|
|
/**
|
205 : |
|
|
* \brief This is the flag used to denote whether the initial values for the model parameters have been given or not
|
206 : |
|
|
*/
|
207 : |
|
|
int givenInitialParam;
|
208 : |
|
|
/**
|
209 : |
|
|
* \brief This is the flag used to denote whether the likelihood score should be optimised or not
|
210 : |
|
|
*/
|
211 : |
|
|
int runoptimise;
|
212 : |
|
|
/**
|
213 : |
|
|
* \brief This is the flag used to denote whether a simulation run should be performed or not
|
214 : |
|
|
*/
|
215 : |
|
|
int runstochastic;
|
216 : |
|
|
/**
|
217 : |
|
|
* \brief This is the flag used to denote whether the current simulation has been started using paramin (PVM) or not
|
218 : |
|
|
*/
|
219 : |
|
|
int runnetwork;
|
220 : |
|
|
/**
|
221 : |
|
|
* \brief This is the flag used to denote whether the current simulation should print model output or not
|
222 : |
|
|
*/
|
223 : |
|
|
int runprint;
|
224 : |
|
|
/**
|
225 : |
|
|
* \brief This is the flag used to override the default settings and force the model to print model output at the end of an optimisation run
|
226 : |
|
|
*/
|
227 : |
|
|
int forceprint;
|
228 : |
|
|
/**
|
229 : |
|
|
* \brief This is the flag used to denote whether the initial model information should be printed or not
|
230 : |
|
|
*/
|
231 : |
|
|
int printInitialInfo;
|
232 : |
|
|
/**
|
233 : |
|
|
* \brief This is the flag used to denote whether the final model information should be printed or not
|
234 : |
|
|
*/
|
235 : |
|
|
int printFinalInfo;
|
236 : |
|
|
/**
|
237 : |
|
|
* \brief This is the value used to decide on the level of warnings displayed during the model run
|
238 : |
|
|
*/
|
239 : |
|
|
int printLogLevel;
|
240 : |
|
|
/**
|
241 : |
|
|
* \brief This is the maximum ratio of a stock that can be consumed on any given timestep
|
242 : |
|
|
*/
|
243 : |
|
|
double maxratio;
|
244 : |
ulcessvp |
12 |
/**
|
245 : |
|
|
* \brief vector with the seeds used in SA
|
246 : |
|
|
* \note see[0] = seed | see[1] = seedM | see[2] = seedP
|
247 : |
|
|
*/
|
248 : |
ulcessvp |
11 |
unsigned* seed;
|
249 : |
agomez |
20 |
#ifdef _OPENMP
|
250 : |
|
|
/**
|
251 : |
|
|
* \brief This is the flag used to denote whether the likelihood score should be optimised in pararrel */
|
252 : |
|
|
int runparallel;
|
253 : |
|
|
#endif
|
254 : |
agomez |
1 |
};
|
255 : |
|
|
|
256 : |
|
|
#endif
|
257 : |
ulcessvp |
11 |
|