From d4da2d9f7d787bb6d60a1ec397e681c852fd337d Mon Sep 17 00:00:00 2001 From: evomarc Date: Tue, 30 Apr 2002 05:10:49 +0000 Subject: [PATCH] Turned the power function to sum - was untractable with long bitstrings --- eo/tutorial/Lesson4/binary_value.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eo/tutorial/Lesson4/binary_value.h b/eo/tutorial/Lesson4/binary_value.h index e36ad50c7..0cd560073 100644 --- a/eo/tutorial/Lesson4/binary_value.h +++ b/eo/tutorial/Lesson4/binary_value.h @@ -12,7 +12,7 @@ template 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; }