#include <Individual.h>
Inheritance diagram for genetiK::ga::Individual:


Public Member Functions | |
| Individual (unsigned int length) | |
| creates an Individual by allocating length bits and filling them with random data. It should be called by subclasses' unsigned int constructors. | |
| Individual (const Individual &individual) | |
| Copy constructor. | |
| virtual | ~Individual (void) |
| destructor | |
| virtual double | fitness ()=0 |
| abstract fitness function | |
| virtual genetiK::Individual * | copy () const =0 |
| abstract copy function | |
| virtual int | mutate (const double mutationProbability) |
| standard one-point mutation | |
| virtual int | crossOver (genetiK::Individual *i, genetiK::Individual **child1, genetiK::Individual **child2) |
| standard one-point crossover | |
| unsigned int | getLength () |
| Returns Individual's length. | |
| bool | operator[] (unsigned int index) const |
| [] operator | |
| virtual std::string | toString () const |
| outputs the individual as a sequence of 0s and 1s. | |
Protected Attributes | |
| unsigned int | length |
| unsigned int * | bitArray |
| unsigned char | blockNum |
This class extends the generic genetiK::Individual. It represents an individual as a string of bits.
|
|
creates an Individual by allocating length bits and filling them with random data. It should be called by subclasses' unsigned int constructors.
|
|
|
Copy constructor. Creates this individual by copying individual. It should be called by subclasses' copy constructors.
|
|
|
destructor Destroys this instance, freeing the allocated bits Reimplemented from genetiK::Individual. |
|
|
abstract copy function This function must be extended by sublcasses to perform copy.
Implements genetiK::Individual. |
|
||||||||||||||||
|
standard one-point crossover Performs one-point crossover between this and individual i, saving the resulting children in child1 and child2.
Implements genetiK::Individual. |
|
|
abstract fitness function This function must be extended by sublcasses to calculate the fitness of the individual.
Implements genetiK::Individual. |
|
|
Returns Individual's length.
|
|
|
standard one-point mutation Performs one-point mutation: flips a each bit of the individual with mutationProbability probability.
Implements genetiK::Individual. |
|
|
[] operator Accesses a single bit of the individual bit string.
|
|
|
outputs the individual as a sequence of 0s and 1s.
Reimplemented from genetiK::Individual. |
|
|
array of the actual bits associated with the Individual (as array of int) |
|
|
number of int blocks allocated to store the Individual bits |
|
|
Invididual length (number of bits) |
1.4.6