Chromosome_Binary Class Reference

Implement a binary-coded chromosome. More...

#include <Chromosome_Binary.h>

Inheritance diagram for Chromosome_Binary:

Chromosome< bool >

List of all members.

Public Member Functions

 Chromosome_Binary (const unsigned int nBitPerDimension, const unsigned int nDimension, vector< double > lowerBounds, vector< double > upperBounds)
 Constructor.
virtual void fromDoubleVector (vector< double > &phenotype)
 Convert a vector of double to a binary chromosome.
virtual vector< double > toDoubleVector ()
 Decode a binary string into a vector of double values.
virtual Chromosome_Binaryclone ()
 Clone function.


Detailed Description

Implement a binary-coded chromosome.

<Binary chromosome="" implemetation>="">

Copyright (c) 2008 by <Quang Huy / NTU>

See also:
Chromosome | Chromosome_Real

Constructor & Destructor Documentation

Chromosome_Binary::Chromosome_Binary ( const unsigned int  nBitPerDimension,
const unsigned int  nDimension,
vector< double >  lowerBounds,
vector< double >  upperBounds 
)

Constructor.

Parameters:
nBitPerDimension Number of bit used for each optimization(search) variable.
nDimension Number of optimization(search) variables.
lowerBounds Vector of lower bound values.
upperBounds Vector of upper bound values.
Implement a binary encoding chromosome.

Remarks:
Note that in binary chromosome, we actually descretize the search space. So be careful with precision loss.
See also:
Chromosome<T> | Chromosome_Real


Member Function Documentation

void Chromosome_Binary::fromDoubleVector ( vector< double > &  phenotype  )  [virtual]

Convert a vector of double to a binary chromosome.

Parameters:
phenotype The input phenotype.
For binary-encoded chromosome, we discretize the range [upperBound, lowerBound] to 2^n steps where n is the number of bits allocated for one dimension.

Remarks:
Be careful of precision loss.
See also:
Chromosome_Binary::toDoubleVector

Reimplemented from Chromosome< bool >.

vector< double > Chromosome_Binary::toDoubleVector (  )  [virtual]

Decode a binary string into a vector of double values.

Returns:
The decoded vector of doubles.
Convert the binary string to decimal, then scale it back to the range.

Remarks:
Optimized for fast calculation (using bit-shift operators).
See also:
Chromosome_Binary::fromDoubleVector()

Reimplemented from Chromosome< bool >.

virtual Chromosome_Binary* Chromosome_Binary::clone (  )  [inline, virtual]

Clone function.

Returns:
A "twin" of the current chromosome

Reimplemented from Chromosome< bool >.


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

Generated on Thu Aug 28 18:34:39 2008 for Dolphin by  doxygen 1.5.6