4 #include <boost/numeric/conversion/cast.hpp>
10 basevalues(base), stepsizes(step), genesizes(gene)
16 "Basevalues, Stepsizes and Genesizes do not have equal length !");
19 throw FatalException(
"Specified an empty base value vector for binary transcribe !");
29 unsigned int currentindex = 0;
34 for (
unsigned int i = 0; i <
genesizes.size(); ++i)
38 for (
unsigned int j = currentindex; j < currentindex +
genesizes(i); ++j)
43 currentvalue += member(j) * std::pow(2.0, boost::numeric_cast<int>(j - currentindex));
50 ReturnValues(i) = currentvalue;
56 basevalues(Old.basevalues), stepsizes(Old.stepsizes), genesizes(
BinaryTranscibe implements transcription for standard binary populations.
ublas::vector< double > ttranscribed
virtual ~BinaryTranscribe()
BinaryTranscribe(const ttranscribed &base, const ttranscribed &step, const tsizev &gene)
Without basevalues, stepsizes and genesizes BinaryTranscribe does not work, so we enforce their use b...
virtual ttranscribed GetValues(const tpopmember &member)
Implements the abstract function from GeneralTranscribe.
const ttranscribed stepsizes
The stepsize associated to a bit change for each parameter.
ublas::vector< bool > tpopmember
const tsizev genesizes
The number of bits for each parameter.
ublas::vector< int > tsizev
The basic exception class for all errors that arise in gplib.
const ttranscribed basevalues
The minimum value for each parameter.