summaryrefslogtreecommitdiff
path: root/src/operatorbasic.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/operatorbasic.h')
-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