Turned the power function to sum - was untractable with long bitstrings
This commit is contained in:
parent
9c6121604a
commit
d4da2d9f7d
1 changed files with 1 additions and 1 deletions
|
|
@ -12,7 +12,7 @@ template <class Chrom> float binary_value(const Chrom& _chrom)
|
|||
float sum = 0;
|
||||
for (unsigned i = 0; i < _chrom.size(); i++)
|
||||
if (_chrom[i])
|
||||
sum += pow(2, _chrom.size() - i - 1);
|
||||
sum += _chrom[i];
|
||||
return sum;
|
||||
}
|
||||
|
||||
|
|
|
|||
Reference in a new issue