From 2c8f5814d4d1de294a2c53d4992f43682d1c9403 Mon Sep 17 00:00:00 2001 From: John Date: Thu, 8 Feb 2024 06:18:15 -0500 Subject: [PATCH] fixed six_peaks.py bug --- mlrose_hiive/fitness/six_peaks.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mlrose_hiive/fitness/six_peaks.py b/mlrose_hiive/fitness/six_peaks.py index ac4dabdb..2e137049 100644 --- a/mlrose_hiive/fitness/six_peaks.py +++ b/mlrose_hiive/fitness/six_peaks.py @@ -87,7 +87,7 @@ def evaluate(self, state): # Calculate R(X, T) _r = 0 - _max_score = max(tail_0, head_1) + _max_score = max(head_0, head_1, tail_0, tail_1) if tail_0 > _t and head_1 > _t: _r = _n elif tail_1 > _t and head_0 > _t: @@ -95,7 +95,7 @@ def evaluate(self, state): _max_score = max(tail_1, head_0) # Evaluate function - fitness = max(tail_0, head_1) + _r + fitness = _max_score + _r return fitness