diff options
| author | Mike Buland <mike@xagasoft.com> | 2012-07-09 08:39:37 -0600 | 
|---|---|---|
| committer | Mike Buland <mike@xagasoft.com> | 2012-07-09 08:39:37 -0600 | 
| commit | 40ee7ad5aeadeb9823e1cd6e1218a1999c608a65 (patch) | |
| tree | 6e819d8406d818eaa63cb6f04e2a129b8561c213 /src/phenotype.h | |
| download | libgenetic-40ee7ad5aeadeb9823e1cd6e1218a1999c608a65.tar.gz libgenetic-40ee7ad5aeadeb9823e1cd6e1218a1999c608a65.tar.bz2 libgenetic-40ee7ad5aeadeb9823e1cd6e1218a1999c608a65.tar.xz libgenetic-40ee7ad5aeadeb9823e1cd6e1218a1999c608a65.zip | |
New libgenetic.  Genetic algorithms, only good.
Diffstat (limited to 'src/phenotype.h')
| -rw-r--r-- | src/phenotype.h | 36 | 
1 files changed, 36 insertions, 0 deletions
| 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 @@ | |||
| 1 | #ifndef GENETIC_PHENOTYPE_H | ||
| 2 | #define GENETIC_PHENOTYPE_H | ||
| 3 | |||
| 4 | #include <bu/string.h> | ||
| 5 | |||
| 6 | namespace Genetic | ||
| 7 | { | ||
| 8 | class Phenotype | ||
| 9 | { | ||
| 10 | public: | ||
| 11 | Phenotype(); | ||
| 12 | virtual ~Phenotype(); | ||
| 13 | |||
| 14 | virtual int getSize()=0; | ||
| 15 | virtual Phenotype &randomize()=0; | ||
| 16 | /** | ||
| 17 | * Modify the given location by the given magnitude. The magnitude | ||
| 18 | * should be between -1.0 and 1.0 inclusive. A 0.0 indicates no | ||
| 19 | * change. | ||
| 20 | */ | ||
| 21 | virtual void mutate( int iLocation, float fMagnitude )=0; | ||
| 22 | virtual Phenotype ©From( const Phenotype &rSrc, int iStart, | ||
| 23 | int iSize, int iDest=-1 )=0; | ||
| 24 | /** | ||
| 25 | * Produces a Phenotype class that can be used to contain the data for | ||
| 26 | * an offspring. The produced phenotype will be compatible, but empty. | ||
| 27 | */ | ||
| 28 | virtual Phenotype *makeEmptyOffspring( int iNewSize=-1 )=0; | ||
| 29 | |||
| 30 | virtual Bu::String toString()=0; | ||
| 31 | |||
| 32 | private: | ||
| 33 | }; | ||
| 34 | }; | ||
| 35 | |||
| 36 | #endif | ||
