blob: 7c564d5cac067230b9de6fe50182f4827780016f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
#ifndef GENETIC_PHENOTYPE_H
#define GENETIC_PHENOTYPE_H
#include <bu/string.h>
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
|