#include <ValueGenome.h>
Inheritance diagram for Teem::BitGenome:
Public Member Functions | |
BitGenome (Ishtar::InputStream *stream) | |
Constructor, deserialize from stream. | |
BitGenome (size_t size) | |
Constructor, size bits. | |
bool | getBit (size_t pos) |
Returns bit at pos. | |
bool | operator[] (size_t pos) |
[] operator to get bit at pos, convenient | |
void | setBit (size_t pos, bool bit) |
Set bit at pos. | |
void | seek (size_t pos) |
Seel to pos. | |
size_t | getLength () |
Returns the length in bits. | |
size_t | getWordCount () |
Returns the number of unsigned in the bits storage. Usefull for specific implementations. | |
void | setWord (size_t pos, unsigned val) |
Directly set an unsigned in the bits storage. Usefull for specific implementations. | |
unsigned | getWord (size_t pos) |
Directly get an unsigned in the bits storage. Usefull for specific implementations. | |
unsigned | getUnsignedIntRaw (unsigned precision) |
Get a value of type unsigned int on range [0..2^precision-1] by directly reading bit per bit, increment reading position. | |
template<typename T> | |
T | getValue (unsigned bitCount) |
Get a value of type T on range [0..1] using bitCount bits, increment reading position. | |
template<typename T> | |
T | getValueRange (unsigned bitCount, T min, T max) |
Get a value of type T on range [min..max] using bitCount bits, increment reading position. | |
virtual double | getDouble (double min, double max) |
Get a value of type double on range [min..max] using defaultPrecision bits, increment reading position. | |
virtual float | getFloat (float min, float max) |
Get a value of type float on range [min..max] using defaultPrecision bits, increment reading position. | |
virtual int | getSignedInt (unsigned precision, int min, int max) |
Get a value of type signed int on range [min..max] using precision bits, increment reading position. | |
virtual unsigned | getUnsignedInt (unsigned precision, unsigned min, unsigned max) |
Get a value of type unsigned int on range [min..max] using precision bits, increment reading position. | |
virtual void | resetReading (void) |
Set reading position to 0. | |
void | setDefaultPrecision (unsigned p) |
Number of bits used for floats and doubles. | |
virtual void | randomize (void) |
Randomize genome content. | |
virtual void | mutate (void) |
Mutate genome content. | |
virtual void | cross (const Genome *other) |
Cross genome content over other. | |
virtual Genome * | clone (void) |
Clone this genome, returns the new genome. | |
virtual void | save (Ishtar::OutputStream *stream) |
Save the genome to a stream. | |
Protected Member Functions | |
bool | checkBoundWord (size_t pos) |
return true if word pos is within bound, returns false or assert otherwise depending on Genome::disableAssertion | |
Protected Attributes | |
std::valarray< unsigned > | bits |
real datas of the genome | |
size_t | length |
length in bits of the genome | |
Ishtar::Variable< double > | mutationProbability |
cached ishtar parameters | |
Ishtar::Variable< unsigned > | defaultPrecision |
cached ishtar parameters | |
size_t | readPos |
positiong for reading, internal machinery |