Added example fitness function template.
authorRafał Długołęcki <rafal@dlugolecki.net.pl>
Sun, 22 Mar 2015 16:44:57 +0000 (17:44 +0100)
committerRafał Długołęcki <rafal@dlugolecki.net.pl>
Sun, 22 Mar 2015 16:44:57 +0000 (17:44 +0100)
src/fitness/example.h [new file with mode: 0644]

diff --git a/src/fitness/example.h b/src/fitness/example.h
new file mode 100644 (file)
index 0000000..46d8907
--- /dev/null
@@ -0,0 +1,32 @@
+#ifndef __FITNESS_WSTI_H
+#define __FITNESS_WSTI_H
+
+#include <cmath>
+
+#include "../gene.h"
+
+using namespace std;
+
+namespace genetic {
+    /**
+     * Just an example Fitness function.
+     */
+    template < typename _Chromosome >
+    class FitnessExample {
+    protected:
+        _Chromosome chromosome;
+    public:
+        FitnessExample(_Chromosome& _chromosome)
+            : chromosome(_chromosome.get()) {
+        }
+
+        /*
+         * Some calculations here...
+         */
+        double calculate() {
+            return 0;
+        }
+    };
+}
+
+#endif /* __FITNESS_WSTI_H */