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
cFibObjectFitnessBasic.h
Go to the documentation of this file.
1 /**
2  * @file cFibObjectFitnessBasic
3  * file name: cFibObjectFitnessBasic.h
4  * @author Betti Oesterholz
5  * @date 02.03.2010
6  * @mail webmaster@BioKom.info
7  *
8  * System: C++
9  *
10  * This header specifies the class of simple enviroment fib -object fitnesses.
11  * Copyright (C) @c GPL3 2010 Betti Oesterholz
12  *
13  * This program is free software: you can redistribute it and/or modify
14  * it under the terms of the GNU General Public License (GPL) as
15  * published by the Free Software Foundation, either version 3 of the
16  * License, or any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU Lesser General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program. If not, see <http://www.gnu.org/licenses/>.
25  *
26  *
27  * This header specifies the class of simple enviroment fib -object fitnesses.
28  * The fitness consists of tree parts the differnece to the original
29  * individual, the size of the fib -object and it's time value for
30  * evaluating it. This tree values are combined to a fitnessvalue.
31  * Each of the values are multiplyed with ther weight and then all tree
32  * are added to get the entire fitness.
33  *
34  * dFittness = -1 * ( dDistanceToOriginal * dWeightDistanceToOriginal +
35  * lSize * dWeightSize + lEvaluationTime * dWeightEvaluationTime )
36  */
37 /*
38 History:
39 02.03.2010 Oesterholz created
40 */
41 
42 #ifndef ___C_FIB_OBJECT_FITNESS_BASIC_H__
43 #define ___C_FIB_OBJECT_FITNESS_BASIC_H__
44 
45 #include "version.h"
46 
47 #include "cFibObjectFitness.h"
48 
49 #include <string>
50 
51 
52 using std::string;
53 
54 namespace enviroment{
55 namespace fib{
56 
57 //cyclic dependencies
58 class cFibObjectFitnessBasicAlgorithm;
59 
60 
62 
64 
65 protected:
66 
67  /**
68  * The distance to the original individual.
69  * It is the sum of the distances of all values of propertyvectorelements
70  * betwean the represented and original fib -object of all positions
71  * which are inside the dimension bounderies.
72  */
74 
75  /**
76  * The weight for the dDistanceToOriginal value.
77  */
79 
80  /**
81  * The (compressed) size of the represented fib -object.
82  *
83  * @see cFibElement::getCompressedSize()
84  */
85  unsigned long lSize;
86 
87  /**
88  * The weight for the lSize value.
89  */
90  double dWeightSize;
91 
92  /**
93  * The evaluating time of the represented fib -object.
94  *
95  * @see cFibElement::getTimeNeed()
96  */
97  unsigned long lEvaluationTime;
98 
99  /**
100  * The weight for the lEvaluationTime value.
101  */
103 
104 #ifdef TEST
105 public:
106 #endif
107 
108  /**
109  * constructor
110  *
111  * @param dInFittness a value for the fitness of the object;
112  * the higher this value is the better the fitness
113  * @param dInDistanceToOriginal the distance to the original individual
114  * @see dDistanceToOriginal
115  * @param lInSize the (compressed) size of the represented fib -object
116  * @param lInEvaluationTime the evaluating time of the represented fib -object
117  * @param dInWeightDistanceToOriginal the weight for the lInDistanceToOriginal value
118  * @param dInWeightSize the weight for the lInSize value
119  * @param dInWeightEvaluationTime the weight for the lInEvaluationTime value
120  * @param pInFibObjectFitnessAlgorithm the algorithm with which this
121  * fitness was created; if NULL no algorithm had created this object;
122  * Beware: this object won't be copied, if you delete it
123  * getFitnessAlgorithm() will return an invalid pointer
124  */
125  cFibObjectFitnessBasic( double dInDistanceToOriginal, unsigned long lInSize,
126  unsigned long lInEvaluationTime, double dInWeightDistanceToOriginal=1.0,
127  double dInWeightSize=1.0, double dInWeightEvaluationTime=1.0,
128  cFibObjectFitnessBasicAlgorithm * pInFibObjectFitnessAlgorithm=NULL );
129 
130 public:
131 
132  /**
133  * copyconstructor
134  *
135  * @param objectFitness the cObjectFitness object to copy
136  */
137  cFibObjectFitnessBasic( const cFibObjectFitnessBasic & objectFitness );
138 
139  /**
140  * Destructor of the class cFibObjectFitnessBasic.
141  */
142  virtual ~cFibObjectFitnessBasic();
143 
144  /**
145  * @return the name of this class
146  */
147  virtual string getClassName() const;
148 
149  /**
150  * @return the algorithm with which this fitness was created;
151  * if NULL no algorithm had created this object
152  */
154 
155  /**
156  * This Method clones this object.
157  *
158  * @return a clone of this object
159  */
160  virtual cFibObjectFitnessBasic * clone() const;
161 
162  /**
163  * Comparisson on equal operator for two fitness objects.
164  *
165  * @param fitness the fitnessobject to compare this fitnessobject to
166  * @return true if the fitness this object represents is equal to the
167  * fitness the given object fitness represents
168  */
169  virtual bool operator==( const cFibObjectFitnessBasic &fitness ) const;
170 
171  /**
172  * @see dDistanceToOriginal
173  * @return the distance to the original individual
174  */
175  double getDifferenceToOriginal() const;
176 
177  /**
178  * This method changes the dDistanceToOriginal value.
179  * dDistanceToOriginal += lDeltaToOriginal
180  *
181  * @see dDistanceToOriginal
182  * @param dDeltaToOriginal the value about which the
183  * dDistanceToOriginal is to change
184  * @return true if the dDistanceToOriginal is changed, else false
185  */
186  bool changeDifferenceToOriginal( double dDeltaToOriginal );
187 
188  /**
189  * @see dWeightDistanceToOriginal
190  * @return the weight for the dDistanceToOriginal value
191  */
192  double getWeightDistanceToOriginal() const;
193 
194  /**
195  * @see lSize
196  * @return the (compressed) size of the represented fib -object
197  */
198  unsigned long getSize() const;
199 
200  /**
201  * This method changes the lSize value.
202  * lSize += lDeltaSize
203  *
204  * @see lSize
205  * @param lDeltaSize the value about which the lSize is to change
206  * @return true if the lSize is changed, else false
207  */
208  bool changeSize( long lDeltaSize );
209 
210  /**
211  * @see dWeightSize
212  * @return the weight for the lSize value
213  */
214  double getWeightSize() const;
215 
216  /**
217  * @see lEvaluationTime
218  * @return he evaluating time of the represented fib -object
219  */
220  unsigned long getTime() const;
221 
222  /**
223  * This method changes the lEvaluationTime value.
224  * lEvaluationTime += lDeltaEvalueTime
225  *
226  * @see lEvaluationTime
227  * @param lDeltaSize the value about which the lEvaluationTime is to change
228  * @return true if the lEvaluationTime is changed, else false
229  */
230  bool changeTime( long lDeltaEvalueTime );
231 
232  /**
233  * @see dWeightEvaluationTime
234  * @return the weight for the lEvaluationTime value
235  */
236  double getWeightEvaluationTime() const;
237 
238 
239 protected:
240 
241  /**
242  * This method will update the whool fitness with the fitnessparts.
243  */
244  virtual void updateFitness();
245 
246 };//end class cFibObjectFitnessBasic
247 
248 };//end namespace fib
249 };//end namespace enviroment
250 
251 #endif //___C_FIB_OBJECT_FITNESS_BASIC_H__
252 
253 
254 
255 
256 
257 
258