The Fib multimedia system
Fib is a system for storing multimedia data (like images or films).
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
cFibObjectFitnessAlgorithm.h
Go to the documentation of this file.
1 /**
2  * @file cFibObjectFitnessAlgorithm
3  * file name: cFibObjectFitnessAlgorithm.h
4  * @author Betti Oesterholz
5  * @date 26.02.2010
6  * @mail webmaster@BioKom.info
7  *
8  * System: C++
9  *
10  * This header specifies the abstract basisclass of fib -enviroment algorithm
11  * creating fib -fitness objects.
12  * Copyright (C) @c GPL3 2010 Betti Oesterholz
13  *
14  * This program is free software: you can redistribute it and/or modify
15  * it under the terms of the GNU General Public License (GPL) as
16  * published by the Free Software Foundation, either version 3 of the
17  * License, or any later version.
18  *
19  * This program is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22  * GNU Lesser General Public License for more details.
23  *
24  * You should have received a copy of the GNU General Public License
25  * along with this program. If not, see <http://www.gnu.org/licenses/>.
26  *
27  * @see cObjectFitness
28  * @see cObjectFitnessAlgorithm
29  * This header specifies the abstract basisclass of fib -enviroment algorithm
30  * for creating fib -fitness objects.
31  * The better (higher) the fitness the better the Fib object, the more likly
32  * it should live and children should be created from it.
33  *
34  */
35 /*
36 History:
37 26.02.2010 Oesterholz created
38 12.09.2010 Oesterholz getOriginalPositionList() method implemented
39 31.10.2012 Oesterholz cFibObjectFitnessAlgorithm() constructor with
40  input reference Fib object created
41 */
42 
43 #ifndef ___C_FIB_OBJECT_FITNESS_ALGORITHMUS_H__
44 #define ___C_FIB_OBJECT_FITNESS_ALGORITHMUS_H__
45 
46 #include "version.h"
47 
49 #include "cFibObjectFitness.h"
50 #include "cEvaluePositionList.h"
51 
52 
53 #include "cRoot.h"
54 
55 #include <string>
56 
57 
58 using std::string;
59 
60 namespace enviroment{
61 namespace fib{
62 
63 
64 class cFibIndividual;//cyclic dependencie
65 
66 
68 protected:
69 
70  /**
71  * the root -elements of original object, without ther
72  * main -Fib objects (they are replaced by empty points)
73  */
75 
76  /**
77  * if true the original individual is given as an fib object cFibElement
78  * and not an cFibIndividual
79  */
81 
82  /**
83  * The evalued position list of the original Fib object or NULL, if
84  * non exists.
85  */
87 
88  /**
89  * If true the positionsdata of the original Fib object
90  * liEvaluedPositionsDataOriginal was evalued, else false.
91  */
92  mutable bool bOriginalEvalued;
93 
94  /**
95  * The number of dimensions of the original fib object.
96  * This is evalued with the method @see evalueOriginalDimensions().
97  *
98  * @see pdDirectionMinimum
99  * @see pdDirectionMaximum
100  * @see pdDirectionScaling
101  * @see pdDirectionSize
102  * @see bStandardDimensionDomain
103  * @see pVecDomainDimension
104  */
105  mutable unsigned int uiNumberOfDimensions;
106 
107  /**
108  * The minimum value for the dimensions of the original fib object.
109  * This is evalued with the method @see evalueOriginalDimensions().
110  * This is an array of size @see uiNumberOfDimensions .
111  *
112  * @see uiNumberOfDimensions
113  * @see pdDirectionMaximum
114  * @see pdDirectionScaling
115  * @see pdDirectionSize
116  * @see bStandardDimensionDomain
117  * @see pVecDomainDimension
118  */
120 
121  /**
122  * The maximum value for the dimensions of the original fib object.
123  * This is evalued with the method @see evalueOriginalDimensions().
124  * This is an array of size @see uiNumberOfDimensions .
125  *
126  * @see uiNumberOfDimensions
127  * @see pdDirectionMinimum
128  * @see pdDirectionScaling
129  * @see pdDirectionSize
130  * @see bStandardDimensionDomain
131  * @see pVecDomainDimension
132  */
134 
135  /**
136  * The scalingfactor for the dimensions of the original fib object.
137  * This is evalued with the method @see evalueOriginalDimensions().
138  * This is an array of size @see uiNumberOfDimensions .
139  *
140  * @see uiNumberOfDimensions
141  * @see pdDirectionMinimum
142  * @see pdDirectionMaximum
143  * @see pdDirectionSize
144  * @see bStandardDimensionDomain
145  * @see pVecDomainDimension
146  */
148 
149  /**
150  * The number of values in the dimensions of the original fib object.
151  * This is evalued with the method @see evalueOriginalDimensions().
152  * This is an array of size @see uiNumberOfDimensions .
153  *
154  * @see uiNumberOfDimensions
155  * @see pdDirectionMinimum
156  * @see pdDirectionMaximum
157  * @see pdDirectionScaling
158  * @see bStandardDimensionDomain
159  * @see pVecDomainDimension
160  */
162 
163  /**
164  * This value is true if the dimension domain ( @see pVecDomainDimension )
165  * is the standarddomain for dimensions .
166  * This is evalued with the method @see evalueOriginalDimensions().
167  *
168  * @see uiNumberOfDimensions
169  * @see pdDirectionMinimum
170  * @see pdDirectionMaximum
171  * @see pdDirectionScaling
172  * @see pdDirectionSize
173  * @see pVecDomainDimension
174  */
176 
177  /**
178  * This is a pointer to the dimension domain.
179  * This is evalued with the method @see evalueOriginalDimensions().
180  *
181  * @see uiNumberOfDimensions
182  * @see pdDirectionMinimum
183  * @see pdDirectionMaximum
184  * @see pdDirectionScaling
185  * @see pdDirectionSize
186  * @see bStandardDimensionDomain
187  */
189 
190  /**
191  * The number of points in the original multimediaobject.
192  */
193  mutable unsigned long long ulNumberOfPoints;
194 
195 public:
196 
197  /**
198  * constructor
199  */
201 
202  /**
203  * constructor
204  *
205  * @param pInOriginalIndividual the individual with which the fitness
206  * should be evalued;
207  * Beware: this object won't be copied, so don't delete it as long
208  * as this object exists
209  */
210  cFibObjectFitnessAlgorithm( cFibIndividual * pInOriginalIndividual );
211 
212  /**
213  * constructor
214  *
215  * @param pInOriginalFibObject the Fib object with which the fitness
216  * should be evalued;
217  * Beware: this object won't be copied, so don't delete it as long
218  * as this object exists
219  */
220  cFibObjectFitnessAlgorithm( cFibElement * pInOriginalFibObject );
221 
222  /**
223  * constructor
224  *
225  * @param inOriginalFibObject the fib object with which the fitness
226  * should be evalued;
227  */
228  cFibObjectFitnessAlgorithm( const cFibElement & inOriginalFibObject );
229 
230  /**
231  * copyconstructor
232  *
233  * @param objectFitnessAlgorithm the cFibObjectFitnessAlgorithm object to copy
234  */
236  objectFitnessAlgorithm );
237 
238  /**
239  * destructor
240  */
241  virtual ~cFibObjectFitnessAlgorithm();
242 
243  /**
244  * This function evalues the fitness for the given fib -individual.
245  * Beware: You have to delete the returned fitness after usage.
246  *
247  * @see pOriginalIndividual
248  * @param individual the cFibIndividual for which a fitnessobject should
249  * be created
250  * @return the fitnessobject for the fitness of the given individual or
251  * NULL, if no fitness could be created
252  */
253  virtual cFibObjectFitness * evalueFitness( const cFibIndividual & individual ) const = 0;
254 
255  /**
256  * This function evalues the fitness for the given fib -individual.
257  * Beware: You have to delete the returned fitness after usage.
258  *
259  * @see pOriginalIndividual
260  * @param individual the cFibIndividual for which a fitnessobject should
261  * be created
262  * @return the fitnessobject for the fitness of the given individual or
263  * NULL, if no fitness could be created
264  */
265  virtual cFibObjectFitness * evalueFitness( const cFibElement * fibObject ) const = 0;
266 
267  /**
268  * @return the name of this class
269  */
270  virtual string getClassName() const;
271 
272  /**
273  * This method sets the originalindividual.
274  * The originalindividual is the individual with which the fitness
275  * should be evalued.
276  *
277  * @see getOriginalIndividual()
278  * @see pOriginalIndividual
279  * @param pInOriginalIndividual a point to the fib -originalindividual to set
280  * Beware: this object won't be copied, so don't delete it as long
281  * as this object exists
282  * @return true if the originalindividual is set to pInOriginalIndividual,
283  * else false
284  */
285  virtual bool setOriginalIndividual( cIndividual * pInOriginalIndividual );
286 
287  /**
288  * This method sets the originalindividual.
289  * The originalindividual is the individual with which the fitness
290  * should be evalued.
291  *
292  * @see getOriginalIndividual()
293  * @see pOriginalIndividual
294  * @param pInOriginalIndividual a point to the fib -originalindividual to set
295  * Beware: this object won't be copied, so don't delete it as long
296  * as this object exists
297  * @return true if the originalindividual is set to pInOriginalIndividual,
298  * else false
299  */
300  virtual bool setOriginalIndividual( cFibIndividual * pInOriginalIndividual );
301 
302  /**
303  * This method sets the originalindividual.
304  * The originalindividual is the individual with which the fitness
305  * should be evalued.
306  *
307  * @see getOriginalIndividual()
308  * @see pOriginalIndividual
309  * @param pInOriginalFibObject the Fib object with which the fitness
310  * should be evalued;
311  * Beware: this object won't be copied, so don't delete it as long
312  * as this object exists
313  * @return true if the originalindividual is set to pInOriginalFibObject,
314  * else false
315  */
316  virtual bool setOriginalFibObject( cFibElement * pInOriginalFibObject );
317 
318  /**
319  * @see setOriginalIndividual()
320  * @see getOriginalIndividual()
321  * @return a pointer to the originalindividual or NULL if non exists;
322  * The originalindividual is the individual with which the
323  * fitness is evalued.
324  */
326 
327  /**
328  * @see setOriginalFibObject()
329  * @see getOriginalIndividual()
330  * @return a pointer to the originalindividual or NULL if non exists
331  * The originalindividual is the individual with which the
332  * fitness is evalued.
333  */
335 
336  /**
337  * @see setOriginalIndividual()
338  * @see getOriginalIndividual()
339  * @see pOriginalIndividual
340  * @return a pointer to the originalindividual root -elements
341  * or NULL if non exists;
342  * The originalindividual is the individual with which the
343  * fitness is evalued. This methods will yust return ther
344  * root -elements, with the main -Fib objects set to NULL.
345  */
347 
348  /**
349  * This Method clones this object.
350  *
351  * @return a clone of this object
352  */
353  virtual cFibObjectFitnessAlgorithm * clone() const = 0;
354 
355  /**
356  * This Method returns the best possible fitness the algorithm can create.
357  * No individual with a better/ higher fitness can be created with this
358  * algorithm.
359  * Normaly this would be an indivudual which represents the original
360  * individual perfectly and don't use recources.
361  * If no best possible fitness can be evalued NULL is returned.
362  *
363  * @return a refernce to the best possible fitness or NULL, if non can be creted
364  */
365  virtual const cFibObjectFitness * getBestFitness() const = 0;
366 
367  /**
368  * This Method returns the worst case fitness for the algorithm and
369  * originalindividual.
370  * An individual with the worst case fitness can easyly be created.
371  * Normaly this would be the fitness of the originalindividual.
372  * If no worst case fitness can be evalued NULL is returned.
373  *
374  * @return a refernce to the worst case fitness or NULL, if non can be created
375  */
376  virtual const cFibObjectFitness * getWorstCaseFitness() const = 0;
377 
378  /**
379  * @return the evalued positionslist of the original Fib object or
380  * NULL, if no exists
381  */
383 
384 
385 protected:
386 
387  /**
388  * This function extracts the root -element tree from the Fib object.
389  * The root -elements will have the same structur as in the given
390  * Fib object, but empty points for ther main -Fib objects.
391  * Beware: delete the returnd fib object after usage.
392  *
393  * @param pFibObject the Fib object wher to extract the root -elements
394  * @return a Fib object with just root -elements of the given
395  * Fib object pFibObject
396  */
397  cRoot * createRootTree( const cFibElement * pFibObject );
398 
399  /**
400  * This method evalues the dimensions variables for the original Fib object.
401  *
402  * evalued class members are:
403  * @see uiNumberOfDimensions;
404  * @see pdDirectionMinimum;
405  * @see pdDirectionMaximum;
406  * @see pdDirectionScaling;
407  * @see pdDirectionSize;
408  * @see bStandardDimensionDomain
409  * @see pVecDomainDimension
410  *
411  * @return true if the evaluation was successfull, else false
412  */
413  bool evalueOriginalDimensions() const;
414 };//end class cFibObjectFitnessAlgorithm
415 
416 };//end namespace fib
417 };//end namespace enviroment
418 
419 #endif //___C_FIB_OBJECT_FITNESS_ALGORITHMUS_H__
420 
421 
422 
423 
424 
425 
426