From 40ee7ad5aeadeb9823e1cd6e1218a1999c608a65 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Mon, 9 Jul 2012 08:39:37 -0600 Subject: New libgenetic. Genetic algorithms, only good. --- src/phenotype.h | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 src/phenotype.h (limited to 'src/phenotype.h') diff --git a/src/phenotype.h b/src/phenotype.h new file mode 100644 index 0000000..7c564d5 --- /dev/null +++ b/src/phenotype.h @@ -0,0 +1,36 @@ +#ifndef GENETIC_PHENOTYPE_H +#define GENETIC_PHENOTYPE_H + +#include + +namespace Genetic +{ + class Phenotype + { + public: + Phenotype(); + virtual ~Phenotype(); + + virtual int getSize()=0; + virtual Phenotype &randomize()=0; + /** + * Modify the given location by the given magnitude. The magnitude + * should be between -1.0 and 1.0 inclusive. A 0.0 indicates no + * change. + */ + virtual void mutate( int iLocation, float fMagnitude )=0; + virtual Phenotype ©From( const Phenotype &rSrc, int iStart, + int iSize, int iDest=-1 )=0; + /** + * Produces a Phenotype class that can be used to contain the data for + * an offspring. The produced phenotype will be compatible, but empty. + */ + virtual Phenotype *makeEmptyOffspring( int iNewSize=-1 )=0; + + virtual Bu::String toString()=0; + + private: + }; +}; + +#endif -- cgit v1.2.3