COPASI API  4.16.103
CExperimentSet.h
Go to the documentation of this file.
1 // Copyright (C) 2010 - 2015 by Pedro Mendes, Virginia Tech Intellectual
2 // Properties, Inc., University of Heidelberg, and The University
3 // of Manchester.
4 // All rights reserved.
5 
6 // Copyright (C) 2008 - 2009 by Pedro Mendes, Virginia Tech Intellectual
7 // Properties, Inc., EML Research, gGmbH, University of Heidelberg,
8 // and The University of Manchester.
9 // All rights reserved.
10 
11 // Copyright (C) 2005 - 2007 by Pedro Mendes, Virginia Tech Intellectual
12 // Properties, Inc. and EML Research, gGmbH.
13 // All rights reserved.
14 
15 #ifndef COPASI_CExperimentSet
16 #define COPASI_CExperimentSet
17 
18 #include <string>
19 
21 #include "utilities/CCopasiTask.h"
22 #include "utilities/CMatrix.h"
23 
24 class CExperiment;
25 
27 {
28 public:
29  /**
30  * Default constructor
31  * @param const CCopasiContainer * pParent
32  * @param const std::string & name (default: Experiment Set)
33  */
34  CExperimentSet(const CCopasiContainer * pParent,
35  const std::string & name = "Experiment Set");
36 
37  /**
38  * Copy constructor
39  * @param const CExperimentSet & src
40  * @param const CCopasiContainer * pParent (default: src data model)
41  */
42  CExperimentSet(const CExperimentSet & src,
43  const CCopasiContainer * pParent = NULL);
44 
45  /**
46  * Specific constructor used for reading COPASI files
47  * @param const CCopasiParameterGroup & group
48  * @param const CCopasiContainer * pParent (default: group data model)
49  */
51  const CCopasiContainer * pParent = NULL);
52 
53  /**
54  * Destructor
55  */
56  virtual ~CExperimentSet();
57 
58  /**
59  * This methods must be called to elevate subgroups to
60  * derived objects. The default implementation does nothing.
61  * @return bool success
62  */
63  virtual bool elevateChildren();
64 
65  /**
66  * Compile the experiment set. This function must be called
67  * before any evaluations can be performed.
68  * @param const std::vector< CCopasiContainer * > listOfContainer
69  * @return bool success
70  */
71  bool compile(const std::vector< CCopasiContainer * > listOfContainer =
73 
74  /**
75  * Calculate statistics across all experiments.
76  * @return bool success
77  */
78  bool calculateStatistics();
79 
80  /**
81  * Retrieve the number of the experiments in the set
82  * @return size_t experimentCount
83  */
84  size_t getExperimentCount() const;
85 
86 public:
87  /**
88  * Add an experiment
89  * @return CExperiment * experiment
90  */
91  CExperiment * addExperiment(const CExperiment & experiment);
92 
93  /**
94  * Remove an experiment from the set
95  * @param const size_t & index
96  */
97  void removeExperiment(const size_t & index);
98 
99  /**
100  * Retrieve the indexed experiment
101  * @param const size_t & index,
102  * @return CExperiment * experiment
103  */
104  CExperiment * getExperiment(const size_t & index);
105 
106  /**
107  * Retrieve the indexed experiment
108  * @param const size_t & index,
109  * @return const CExperiment * experiment
110  */
111  const CExperiment * getExperiment(const size_t & index) const;
112 
113  /**
114  * Retrieve the indexed experiment
115  * @param const std::string & name,
116  * @return CExperiment * experiment
117  */
118  CExperiment * getExperiment(const std::string & name);
119 
120  /**
121  * Retrieve the indexed experiment
122  * @param const std::string & name,
123  * @return const CExperiment * experiment
124  */
125  const CExperiment * getExperiment(const std::string & name) const;
126 
127  /**
128  * Check whether the set contains data for the the given task type
129  * @param const CCopasiTask::Type & type
130  * @return bool hasDataForTaskType
131  */
132  bool hasDataForTaskType(const CCopasiTask::Type & type) const;
133 
134  /**
135  * Retrieve the indexed experiment type
136  * @param const size_t & index,
137  * @return const CCopasiTasK::Type & experimentType
138  */
139  const CCopasiTask::Type & getExperimentType(const size_t & index) const;
140 
141  /**
142  * Retrieve the independent data of the indexed experiment.
143  * @param const size_t & index,
144  * @return const CMatrix< C_FLOAT64 > & independentData
145  */
146  const CMatrix< C_FLOAT64 > & getIndependentData(const size_t & index) const;
147 
148  /**
149  * Retrieve the dependent data of the indexed experiment.
150  * @param const size_t & index,
151  * @return const CMatrix< C_FLOAT64 > & dependentData
152  */
153  const CMatrix< C_FLOAT64 > & getDependentData(const size_t & index) const;
154 
155  /**
156  * Convert an experiment key to an index
157  * @param const std::string & key
158  * @return size_t index
159  */
160  size_t keyToIndex(const std::string & key) const;
161 
162  /**
163  * Sort the experiments in the set
164  */
165  void sort();
166 
167  /**
168  * Retrieve the list of file names
169  * @return std::vector< std::string > fileNames
170  */
171  std::vector< std::string > getFileNames() const;
172 
173  /**
174  * Retrieve the number of data points of all experiments combined.
175  * @return size_t dataPointCount
176  */
177  size_t getDataPointCount() const;
178 
179  /**
180  * Retrieve the count of valid data points of all experiments combined.
181  * @return size_t count
182  */
183  const size_t & getValidValueCount() const;
184 
185  /**
186  * Retrieve the list of dependent data objects
187  * @return const std::vector< CCopasiObject * > & dependentObjects
188  */
190 
191  /**
192  * Retrieve all dependent data objective values.
193  * @return const CVector< C_FLOAT64 > & dependentObjectiveValues
194  */
196 
197  /**
198  * Retrieve all dependent data objective values.
199  * @return const CVector< C_FLOAT64 > & dependentRMS
200  */
201  const CVector< C_FLOAT64 > & getDependentRMS() const;
202 
203  /**
204  * Retrieve all dependent data error mean values.
205  * @return const CVector< C_FLOAT64 > & dependentErrorMean
206  */
208 
209  /**
210  * Retrieve all dependent data error mean std. deviations.
211  * @return const CVector< C_FLOAT64 > & dependentErrorMeanSD
212  */
214 
215  /**
216  * Fix files written with Version 4.10.55, which wrote the square root of user defined weights for the
217  * parameter fitting task
218  */
219  void fixBuild55();
220 
221 private:
222  /**
223  * Allocates all group parameters and assures that they are
224  * properly initialized.
225  */
226  void initializeParameter();
227 
228 private:
229  // Attributes
230  /**
231  * This is realized a CCopasiParameter type GROUP
232  */
233  std::vector< CExperiment * > * mpExperiments;
234 
235  /**
236  * The number of parameters which are not of type CExperiment
237  */
239 
240  /**
241  * A set of all dependent data objects;
242  */
244 
245  /**
246  * A list of all dependent data objective values;
247  */
249 
250  /**
251  * A list of all dependent data objective values;
252  */
254 
255  /**
256  * A list of all dependent data error mean values;
257  */
259 
260  /**
261  * A list of all dependent data error mean std. deviations;
262  */
264 
265  /**
266  * A list of the number of data points for each dependent object;
267  */
269 
270  /**
271  * The total count of valid data values.
272  */
274 };
275 
277 {
278 public:
279  /**
280  * Default constructor
281  * @param const std::string & name (default: Cross Validation Set)
282  * @param const CCopasiContainer * pParent (default: NULL)
283  */
284  CCrossValidationSet(const CCopasiContainer * pParent,
285  const std::string & name = "Validation Set");
286 
287  /**
288  * Copy constructor
289  * @param const CCrossValidationSet & src
290  * @param const CCopasiContainer * pParent (default: src data model)
291  */
293  const CCopasiContainer * pParent = NULL);
294 
295  /**
296  * Specific constructor used for reading COPASI files
297  * @param const CCopasiParameterGroup & group
298  * @param const CCopasiContainer * pParent (default: group data model)
299  */
301  const CCopasiContainer * pParent = NULL);
302 
303  /**
304  * Destructor
305  */
306  virtual ~CCrossValidationSet();
307 
308  /**
309  * Set the weight
310  * @param const C_FLOAT64 & weight
311  */
312  void setWeight(const C_FLOAT64 & weight);
313 
314  /**
315  * Retreive the weight
316  * @return const C_FLOAT64 & weight
317  */
318  const C_FLOAT64 & getWeight() const;
319 
320  /**
321  * Set the threshold
322  * @param const unsigned C_INT32 & threshold
323  */
324  void setThreshold(const unsigned C_INT32 & threshold);
325 
326  /**
327  * Retreive the threshold
328  * @return const unsigned C_INT32 & threshold
329  */
330  const unsigned C_INT32 & getThreshold() const;
331 
332 private:
333  /**
334  * Allocates all group parameters and assures that they are
335  * properly initialized.
336  */
337  void initializeParameter();
338 
339 private:
340  // Attributes
341  /**
342  * The weight of each datapoint relative to a data point of the
343  * experiment set, i.e. 1 gives each point the same weight
344  */
346 
347  /**
348  * The threshold indicates the number of failed successive checks for which
349  * the objective function has not improved needed to terminate the
350  * parameter estimation.
351  */
352  unsigned C_INT32 * mpThreshold;
353 };
354 
355 #endif // COPASI_CExperimentSet
std::vector< std::string > getFileNames() const
const CVector< CCopasiObject * > & getDependentObjects() const
CCrossValidationSet(const CCopasiContainer *pParent, const std::string &name="Validation Set")
CVector< C_FLOAT64 > mDependentRMS
CExperiment * getExperiment(const size_t &index)
const CVector< C_FLOAT64 > & getDependentRMS() const
#define C_INT32
Definition: copasi.h:90
bool calculateStatistics()
size_t mValidValueCount
const size_t & getValidValueCount() const
CVector< CCopasiObject * > mDependentObjects
virtual bool elevateChildren()
static const std::vector< CCopasiContainer * > EmptyList
const C_FLOAT64 & getWeight() const
CVector< C_FLOAT64 > mDependentErrorMeanSD
const CVector< C_FLOAT64 > & getDependentObjectiveValues() const
CExperiment * addExperiment(const CExperiment &experiment)
const CVector< C_FLOAT64 > & getDependentErrorMean() const
void setWeight(const C_FLOAT64 &weight)
bool hasDataForTaskType(const CCopasiTask::Type &type) const
bool compile(const std::vector< CCopasiContainer * > listOfContainer=CCopasiContainer::EmptyList)
const CCopasiTask::Type & getExperimentType(const size_t &index) const
CExperimentSet(const CCopasiContainer *pParent, const std::string &name="Experiment Set")
unsigned C_INT32 * mpThreshold
size_t keyToIndex(const std::string &key) const
virtual ~CExperimentSet()
void initializeParameter()
CVector< C_FLOAT64 > mDependentObjectiveValues
const CVector< C_FLOAT64 > & getDependentErrorMeanSD() const
void setThreshold(const unsigned C_INT32 &threshold)
#define C_FLOAT64
Definition: copasi.h:92
size_t getDataPointCount() const
const unsigned C_INT32 & getThreshold() const
std::vector< CExperiment * > * mpExperiments
size_t mNonExperiments
const CMatrix< C_FLOAT64 > & getDependentData(const size_t &index) const
virtual ~CCrossValidationSet()
const CMatrix< C_FLOAT64 > & getIndependentData(const size_t &index) const
size_t getExperimentCount() const
CVector< C_FLOAT64 > mDependentErrorMean
CVector< size_t > mDependentDataCount
void removeExperiment(const size_t &index)