• Main Page
  • Namespaces
  • Classes
  • Files
  • Class List
  • Class Hierarchy
  • Class Members

BinaryGene Class Reference

Abstract class representing a binary gene.

#include <BinaryGene.h>

Inheritance diagram for BinaryGene:

Gene List of all members.

Public Member Functions

 BinaryGene (int bits, Random *random)
 Constructor.
 BinaryGene (BinaryGene &binaryGene)
 Copy constructor.
 BinaryGene (BinaryGene *binaryGene)
 Copy constructor.
 ~BinaryGene ()
 Destructor.
int bitFlipMutation (double mutationProbability)
void singlePointCrossover (int point, Gene *gene)
 Bitwise crossover between two genes.
int getNumberOfBits ()
void writeGenotype (ofstream &outputFile)
void printGenotype ()
BinaryGene & operator= (const BinaryGene &binaryGene)
bool operator== (const BinaryGene &binaryGene)
bool operator!= (const BinaryGene &binaryGene)

Public Attributes

bitset< MAX_LENGTH > allele_
int numberOfBits_

Static Private Attributes

static const int MAX_LENGTH = 512

Friends

ostream & operator<< (ostream &outputStream, BinaryGene &gene)

Detailed Description

Definition at line 20 of file BinaryGene.h.


Constructor & Destructor Documentation

BinaryGene::BinaryGene (  int  numberOfBits,
Random *  random
) 
 

Parameters:
numberOfBits Bits of the binary gen
random Pointer to the random number generator
Constructor of the class

Definition at line 18 of file BinaryGene.cpp.

References allele_, MAX_LENGTH, numberOfBits_, Gene::random_, and Random::rnd().

BinaryGene::BinaryGene (  BinaryGene &  binaryGene  ) 
 

Parameters:
binaryGene The gene to copy
Constructor of the class

Definition at line 45 of file BinaryGene.cpp.

References allele_, and numberOfBits_.

BinaryGene::BinaryGene (  BinaryGene *  binaryGene  ) 
 

Parameters:
binaryGene The gene to copy
Constructor of the class

Definition at line 63 of file BinaryGene.cpp.

References allele_, and numberOfBits_.

BinaryGene::~BinaryGene (   ) 
 

Destructor of the class

Definition at line 80 of file BinaryGene.cpp.


Member Function Documentation

int BinaryGene::bitFlipMutation (  double  mutationProbability  )  [virtual]
 

Reimplemented from Gene.

Definition at line 103 of file BinaryGene.cpp.

References allele_, Random::flip(), numberOfBits_, and Gene::random_.

int BinaryGene::getNumberOfBits (   )  [virtual]
 

Reimplemented from Gene.

Definition at line 84 of file BinaryGene.cpp.

References numberOfBits_.

bool BinaryGene::operator!= (  const BinaryGene &  binaryGene  ) 
 

Definition at line 154 of file BinaryGene.cpp.

References allele_, and numberOfBits_.

BinaryGene & BinaryGene::operator= (  const BinaryGene &  binaryGene  ) 
 

Definition at line 137 of file BinaryGene.cpp.

References allele_, and numberOfBits_.

bool BinaryGene::operator== (  const BinaryGene &  binaryGene  ) 
 

Definition at line 146 of file BinaryGene.cpp.

References allele_, and numberOfBits_.

void BinaryGene::printGenotype (   )  [virtual]
 

Implements Gene.

Definition at line 129 of file BinaryGene.cpp.

References allele_, and numberOfBits_.

void BinaryGene::singlePointCrossover (  int  point,
Gene *  gene
)  [virtual]
 

Parameters:
point The crossover point
gene The other gene

Reimplemented from Gene.

Definition at line 93 of file BinaryGene.cpp.

References allele_, and numberOfBits_.

void BinaryGene::writeGenotype (  ofstream &  outputFile  )  [virtual]
 

Implements Gene.

Definition at line 120 of file BinaryGene.cpp.

References allele_, and numberOfBits_.


Friends And Related Function Documentation

ostream& operator<< (  ostream &  outputStream,
BinaryGene &  gene
)  [friend]
 

Definition at line 162 of file BinaryGene.cpp.


Member Data Documentation

bitset<MAX_LENGTH> BinaryGene::allele_
 

Definition at line 24 of file BinaryGene.h.

Referenced by BinaryGene(), bitFlipMutation(), operator!=(), operator<<(), operator=(), operator==(), printGenotype(), singlePointCrossover(), and writeGenotype().

const int BinaryGene::MAX_LENGTH = 512 [static, private]
 

Definition at line 22 of file BinaryGene.h.

Referenced by BinaryGene().

int BinaryGene::numberOfBits_
 

Definition at line 25 of file BinaryGene.h.

Referenced by BinaryGene(), bitFlipMutation(), getNumberOfBits(), operator!=(), operator<<(), operator=(), operator==(), printGenotype(), singlePointCrossover(), and writeGenotype().


The documentation for this class was generated from the following files:
  • BinaryGene.h
  • BinaryGene.cpp

Our Software

orangebox Mallba

orangebox ssGA

orangebox JGDS

orangebox xxGA

orangebox JCell

orangebox MHTB

orangebox DEME

orangebox JMetal

orangebox More...

orangebox Go Back