Tuesday, 17 May 2011
Developer Journal 82 - On Boost Serialization
I'm still working on loading a vector of floats. I don't know why it won't work. I had a look at the Boost Numerics Library but I couldn't make sense of it.
I'm now converting the float to a string, reducing the number of decimal points to five or less, and converting back to a float.
Didn't work.
I removed the decimal points and the number after that.
Worked.
I kept the decimal point.
Worked.
I kept the decimal point and one number after that.
Worked.
Trying up to 4 decimal places.
Error.
Up to 3 decimal places.
Error.
Up to 2 decimal places.
Worked.
Strange. So strange.
I placed 0.596109 in every vector position.
Worked.
I'm tracking the min and max values as well as the min and max lengths.
min: 0.100061
max: 0.599588
minLength: 5
maxLength: 8
I placed 0.100061 into every vector position.
Worked.
I placed 0.599588 into every vector position.
Worked.
---
minBitProb 0.100000001
maxBitProb 0.600000024
I changed minBitProb and maxBitProb and that resulted in different min and max values.
minBitProb 0.0
maxBitProb 1.0
min: 0.000396741
max: 0.999969
minLength: 5
maxLength: 11
---
Strange. Serialization of the vector of floats only works if the genome has a maximum of two decimal points. Has to be enough for now.
Looks like I'm going to have to stick with two decimal points for now.
RELATED
Labels:
developer journal
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment