Main Page   Class Hierarchy   Alphabetical List   Compound List   Compound Members  

prapi::ga::Individual< T > Class Template Reference

#include <Individual.h>

Inheritance diagram for prapi::ga::Individual< T >:

List< Gene< T > > Iterator< T > Object List of all members.

Detailed Description

template<class T = double>
class prapi::ga::Individual< T >

An Individual consists of a sequence of genes, i.e.

the genotype, and a couple of other properties like fitness and age. The reason why an Individual consists of a list of genes instead of a single list of values is that crossing over can only occur between genes. If genes were handled as a one-dimesional sequence, one had to figure out some un-userfriendly ways to define borders for genes.


Public Methods

 Individual ()
 Create a new individual with fitness and age set to zero.

 Individual (const util::List< Gene< T > > &other)
 Create a new individual with the given list as its genotype and fitness and age set to zero.

 Individual (const Individual &other)
 Create a copy of another individual.

 Individual (const util::List< T > &values)
 Create a new individual with the given genes.

Individual & operator= (const Individual &other)
 Copy the contents of another individual.


Public Attributes

int age
 The age of an individual.

double fitness
 The fitness of an individual.


Friends

template<class U> bool operator< (const Individual< U > &i1, const Individual< U > &i2)
template<class U> bool operator> (const Individual< U > &i1, const Individual< U > &i2)
template<class U> bool operator<= (const Individual< U > &i1, const Individual< U > &i2)
template<class U> bool operator>= (const Individual< U > &i1, const Individual< U > &i2)


Constructor & Destructor Documentation

template<class T>
prapi::ga::Individual< T >::Individual const util::List< T > &    values
 

Create a new individual with the given genes.

This constructor assumes that each value in values represents one gene. That is, each gene is represented by a single value. A gene is created for each value and appended to the internal genotype of this individual.


The documentation for this class was generated from the following file:
Documentation generated on 11.09.2003 with Doxygen.
The documentation is copyrighted material.
Copyright © Topi Mäenpää 2003. All rights reserved.