summaryrefslogtreecommitdiff
path: root/src/operatorbasic.h
diff options
context:
space:
mode:
authorMike Buland <mike@xagasoft.com>2012-07-09 08:39:37 -0600
committerMike Buland <mike@xagasoft.com>2012-07-09 08:39:37 -0600
commit40ee7ad5aeadeb9823e1cd6e1218a1999c608a65 (patch)
tree6e819d8406d818eaa63cb6f04e2a129b8561c213 /src/operatorbasic.h
downloadlibgenetic-40ee7ad5aeadeb9823e1cd6e1218a1999c608a65.tar.gz
libgenetic-40ee7ad5aeadeb9823e1cd6e1218a1999c608a65.tar.bz2
libgenetic-40ee7ad5aeadeb9823e1cd6e1218a1999c608a65.tar.xz
libgenetic-40ee7ad5aeadeb9823e1cd6e1218a1999c608a65.zip
New libgenetic. Genetic algorithms, only good.
Diffstat (limited to '')
-rw-r--r--src/operatorbasic.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/operatorbasic.h b/src/operatorbasic.h
new file mode 100644
index 0000000..2eaf198
--- /dev/null
+++ b/src/operatorbasic.h
@@ -0,0 +1,32 @@
1#ifndef GENETIC_OPERATOR_BASIC_H
2#define GENETIC_OPERATOR_BASIC_H
3
4#include "genetic/operator.h"
5
6namespace Genetic
7{
8 /**
9 * Very simple genetic operator that covers all the basics. It will do
10 * single cut Phenotype splicing between two parents, and random mutation
11 * on the child. All work is based on a progenitor Phenotype, which is the
12 * template for creating new, random Phenotypes. OperatorBasic takes
13 * ownership of the progenitor and will delete it when OperatorBasic is
14 * destroyed.
15 */
16 class OperatorBasic : public Operator
17 {
18 public:
19 OperatorBasic( Phenotype *pProgenitor, float fMutationRate );
20 virtual ~OperatorBasic();
21
22 virtual Phenotype *random();
23 virtual int parentCount() { return 2; }
24 virtual Phenotype *mate( const PhenotypeList &lParents );
25
26 private:
27 Phenotype *pProgenitor;
28 float fMutationRate;
29 };
30};
31
32#endif