#include <GeneticAlgorithm.h>
Public Member Functions | |
Individual () | |
Create the individual with the worst possible fitness. | |
Params::Size_t | Fitness () const |
Returns the individual's fitness. | |
void | Fitness (Params::Size_t f) |
Sets the individual's fitness. | |
bool | operator== (const Individual &i) const |
Compare two individuals. | |
BinSet & | Genome () |
Returns the individual's genome ( set of bins ). | |
const BinSet & | Genome () const |
Returns the individual's genome ( set of bins ); const version. | |
Bin & | Genome (int i) |
Returns the individual's ith genome (a bin). | |
const Bin & | Genome (int i) const |
Returns the individual's ith genome (a bin); const version. | |
Public Attributes | |
BinSet | m_genome |
Params::Size_t | m_fitness |
Friends | |
bool | operator> (Individual &a, Individual &b) |
Compare the fitness of two individuals. |
Basically, an Individual holds a particular set of bins, where each bin is a collection of items.
Individual::Individual | ( | ) | [inline] |
Create the individual with the worst possible fitness.
Params::Size_t Individual::Fitness | ( | ) | const [inline] |
Returns the individual's fitness.
References m_fitness.
Referenced by GeneticAlgorithm::Evaluate(), GeneticAlgorithm::Fitness(), and operator==().
void Individual::Fitness | ( | Params::Size_t | f | ) | [inline] |
bool Individual::operator== | ( | const Individual & | i | ) | const [inline] |
Compare two individuals.
First the fitness is compared; if they are equal, then compare their genomes.
References AlmostEqual(), Fitness(), and Genome().
BinSet& Individual::Genome | ( | ) | [inline] |
const BinSet& Individual::Genome | ( | ) | const [inline] |
Bin& Individual::Genome | ( | int | i | ) | [inline] |
const Bin& Individual::Genome | ( | int | i | ) | const [inline] |
bool operator> | ( | Individual & | a, | |
Individual & | b | |||
) | [friend] |
Compare the fitness of two individuals.
The genome is the genetic material (i.e., chromosomes) of an individual
Referenced by GeneticAlgorithm::Evaluate(), GeneticAlgorithm::Evolve(), and Genome().
The individual's fitness.
Referenced by GeneticAlgorithm::Evaluate(), and Fitness().