Individual Class Reference

This class represents an Individual, i.e., an entity representing a candidate solution. More...

#include <GeneticAlgorithm.h>

Collaboration diagram for Individual:

Collaboration graph
[legend]

List of all members.

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.
BinSetGenome ()
 Returns the individual's genome ( set of bins ).
const BinSetGenome () const
 Returns the individual's genome ( set of bins ); const version.
BinGenome (int i)
 Returns the individual's ith genome (a bin).
const BinGenome (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.


Detailed Description

This class represents an Individual, i.e., an entity representing a candidate solution.

Basically, an Individual holds a particular set of bins, where each bin is a collection of items.


Constructor & Destructor Documentation

Individual::Individual (  )  [inline]

Create the individual with the worst possible fitness.


Member Function Documentation

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]

Sets the individual's fitness.

References m_fitness.

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]

Returns the individual's genome ( set of bins ).

References m_genome.

Referenced by operator==().

const BinSet& Individual::Genome (  )  const [inline]

Returns the individual's genome ( set of bins ); const version.

References m_genome.

Bin& Individual::Genome ( int  i  )  [inline]

Returns the individual's ith genome (a bin).

References m_genome.

const Bin& Individual::Genome ( int  i  )  const [inline]

Returns the individual's ith genome (a bin); const version.

References m_genome.


Friends And Related Function Documentation

bool operator> ( Individual a,
Individual b 
) [friend]

Compare the fitness of two individuals.


Member Data Documentation

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().


The documentation for this class was generated from the following file: