ECF 1.7
Binary::Binary Class Reference

Binary class - implements genotype as a vector of binary coded real values with variable interval and precision. More...

#include <Binary.h>

Inheritance diagram for Binary::Binary:
RealValueGenotype Genotype

Public Member Functions

uint getNumBits ()
 Return number of bits used in a single dimension in real domain.
bool initialize (StateP state)
 Initialize a genotype object (read parameters, perform sanity check, build data).
void registerParameters (StateP state)
 Register genotype's parameters (called before Genotype::initialize).
bool update (void)
 Update genotype after genetic material change via genetic operators.
Binary * copy ()
 Create an identical copy of the genotype object.
std::vector< CrossoverOpP > getCrossoverOp ()
 Create and return a vector of crossover operators.
std::vector< MutationOpP > getMutationOp ()
 Create and return a vector of mutation operators.
void write (XMLNode &xBinary)
 Write genotype data to XMLNode.
void read (XMLNode &xBinary)
 Read genotype data from XMLNode.
Public Member Functions inherited from RealValueGenotype
double getLBound ()
 return lower bound of the defined interval
double getUBound ()
 return upper bound of the defined interval
Public Member Functions inherited from Genotype
bool registerParameter (StateP state, std::string name, voidP value, enum ECF::type T, std::string description="")
 Register a single parameter.
voidP getParameterValue (StateP state, std::string name)
 Read single parameter value from Registry.
bool setParameterValue (StateP state, std::string name, voidP value)
 Write single parameter value to Registry.
bool isParameterDefined (StateP state, std::string name)
 Check if parameter is defined in the configuration.
virtual uint getGenomeSize ()
std::string getName ()
 Return genotype's name (each genotype is uniquely identified with its name).
uint getGenotypeId ()
 Return this genotype's index in individual structure.
void setGenotypeId (uint id)
 Set genotype index in an individual.
std::string toString ()
 Output genotype to string.

Public Attributes

std::vector< long int > decValue
 integer values of bit representation
std::vector< v_bool > variables
 vector of bit vectors
Public Attributes inherited from RealValueGenotype
std::vector< double > realValue
 vector of floating point values

Protected Types

typedef std::vector< bool > v_bool

Protected Member Functions

double logbase (double a, double base)
double round (double, int)

Protected Attributes

uint nDecimal_
 number of digits after the decimal point
uint nBits_
 number of bits for a single dimension
long potention_
bool bRounding_
 use rounding with 'precision' digits on real values in the chromosome
v_bool vBool_
 temporary bool vector
Protected Attributes inherited from RealValueGenotype
double minValue_
 lower bound
double maxValue_
 upper bound
uint nDimension_
 dimensionality
Protected Attributes inherited from Genotype
std::string name_
 genotype's name
uint genotypeId_
 this genotype's unique index in individual structure

Friends

class BinaryMutSimple

Detailed Description

Binary class - implements genotype as a vector of binary coded real values with variable interval and precision.

Binary genotype parameters are (the first 3 are inherited from RealValueGenoptype):

  • lbound: lower bound of represented real value
  • ubound: upper bound of represented real value
  • dimension: number of distinct real values, each coded with previous 3 parameters
  • precision: desired number of digits (after the decimal point) to be represented
  • rounding: whether the represented real value is rounded to 'precision' digits (false by default)

Definition at line 38 of file Binary.h.

Member Typedef Documentation

◆ v_bool

typedef std::vector<bool> Binary::Binary::v_bool
protected

Definition at line 45 of file Binary.h.

Constructor & Destructor Documentation

◆ Binary()

Binary::Binary::Binary ( )
inline

Definition at line 55 of file Binary.h.

Member Function Documentation

◆ copy()

Binary * Binary::Binary::copy ( )
inlinevirtual

Create an identical copy of the genotype object.

Implements Genotype.

Definition at line 69 of file Binary.h.

◆ getCrossoverOp()

std::vector< CrossoverOpP > Binary::Binary::getCrossoverOp ( )
inlinevirtual

Create and return a vector of crossover operators.

Reimplemented from Genotype.

Definition at line 75 of file Binary.h.

◆ getMutationOp()

std::vector< MutationOpP > Binary::Binary::getMutationOp ( )
inlinevirtual

Create and return a vector of mutation operators.

Reimplemented from Genotype.

Definition at line 92 of file Binary.h.

◆ getNumBits()

uint Binary::Binary::getNumBits ( )
inline

Return number of bits used in a single dimension in real domain.

Definition at line 59 of file Binary.h.

◆ initialize()

bool Binary::Binary::initialize ( StateP state)
virtual

Initialize a genotype object (read parameters, perform sanity check, build data).

Implements Genotype.

Definition at line 38 of file Binary.cpp.

◆ logbase()

double Binary::Binary::logbase ( double a,
double base )
protected

Definition at line 9 of file Binary.cpp.

◆ read()

void Binary::Binary::read ( XMLNode & xBinary)
virtual

Read genotype data from XMLNode.

Implements Genotype.

Definition at line 143 of file Binary.cpp.

◆ registerParameters()

void Binary::Binary::registerParameters ( StateP state)
virtual

Register genotype's parameters (called before Genotype::initialize).

Reimplemented from Genotype.

Definition at line 23 of file Binary.cpp.

◆ round()

double Binary::Binary::round ( double val,
int decimals )
protected

Definition at line 15 of file Binary.cpp.

◆ update()

bool Binary::Binary::update ( void )
virtual

Update genotype after genetic material change via genetic operators.

Reimplemented from RealValueGenotype.

Definition at line 108 of file Binary.cpp.

◆ write()

void Binary::Binary::write ( XMLNode & xBinary)
virtual

Write genotype data to XMLNode.

Implements Genotype.

Definition at line 129 of file Binary.cpp.

◆ BinaryMutSimple

friend class BinaryMutSimple
friend

Definition at line 39 of file Binary.h.

Member Data Documentation

◆ bRounding_

bool Binary::Binary::bRounding_
protected

use rounding with 'precision' digits on real values in the chromosome

Definition at line 44 of file Binary.h.

◆ decValue

std::vector<long int> Binary::Binary::decValue

integer values of bit representation

Definition at line 52 of file Binary.h.

◆ nBits_

uint Binary::Binary::nBits_
protected

number of bits for a single dimension

Definition at line 42 of file Binary.h.

◆ nDecimal_

uint Binary::Binary::nDecimal_
protected

number of digits after the decimal point

Definition at line 41 of file Binary.h.

◆ potention_

long Binary::Binary::potention_
protected

Definition at line 43 of file Binary.h.

◆ variables

std::vector<v_bool> Binary::Binary::variables

vector of bit vectors

Definition at line 53 of file Binary.h.

◆ vBool_

v_bool Binary::Binary::vBool_
protected

temporary bool vector

Definition at line 46 of file Binary.h.


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