dlugolecki.net.pl
Dziennik
Polecane
Software
projects
/
genetic.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Improve comments and documentation.
[genetic.git]
/
src
/
fitness
/
fitness.h
diff --git
a/src/fitness/fitness.h
b/src/fitness/fitness.h
index 14b6487f18b8e83708e04c15286988a33ee974ab..66263f1bbc82363adfea48830cbccb148c607bfe 100644
(file)
--- a/
src/fitness/fitness.h
+++ b/
src/fitness/fitness.h
@@
-1,7
+1,7
@@
#ifndef __FITNESS_FITNESS_H
#define __FITNESS_FITNESS_H
#ifndef __FITNESS_FITNESS_H
#define __FITNESS_FITNESS_H
-#include "
../
chromosome.h"
+#include "chromosome.h"
namespace genetic {
/**
namespace genetic {
/**
@@
-10,25
+10,48
@@
namespace genetic {
*/
template < typename _Chromosome, typename _Value = double >
class Fitness {
*/
template < typename _Chromosome, typename _Value = double >
class Fitness {
- template<typename> friend class Selection
;
+ template<typename> friend class Selection;
public:
public:
+ /**
+ * Type representing Chromosome Gene
+ */
typedef typename _Chromosome::GeneType GeneType;
typedef typename _Chromosome::GeneType GeneType;
+
+ /**
+ * Value type returned by the Fitness function
+ */
typedef _Value ValueType;
protected:
typedef _Value ValueType;
protected:
+ /**
+ * Chromosome on which calculations are made
+ */
_Chromosome chromosome;
_Chromosome chromosome;
- /*
- * Some calculations here...
+ /**
+ * Calculations should be done here...
+ *
+ * @return Fitness value of the current Chromosome
*/
virtual _Value do_calculate() = 0;
public:
*/
virtual _Value do_calculate() = 0;
public:
+ /**
+ * Class constructor
+ */
Fitness() {}
Fitness() {}
+ /**
+ * Copy constructor
+ */
Fitness(_Chromosome& _chromosome)
: chromosome(_chromosome.get()) {
}
Fitness(_Chromosome& _chromosome)
: chromosome(_chromosome.get()) {
}
+ /**
+ * Invokes calculations
+ *
+ * @return Fitness value of the current Chromosome
+ */
_Value calculate() {
return this->do_calculate();
}
_Value calculate() {
return this->do_calculate();
}