From 62cf1acc6d127837837b3c936765f2c7f5336fb4 Mon Sep 17 00:00:00 2001 From: Johannes Merl Date: Mon, 12 Feb 2024 15:40:35 +0100 Subject: [PATCH] prevent duplicate sample of next generation --- src/GA.hs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/GA.hs b/src/GA.hs index 1f4d933..937190c 100644 --- a/src/GA.hs +++ b/src/GA.hs @@ -258,8 +258,7 @@ run select nParents nX pElite pop term = do then return currPop' else do let nextPop = stepSteady select nParents nX pElite currPop' - nextPop' <- lift $ sampleFrom mwc $ nextPop - let fBest = fitness $ NE.head $ fst $ bests 1 nextPop' + let fBest = fitness $ NE.head $ fst $ bests 1 currPop' Pipes.yield (generation, fBest) x nextPop (generation + 1) x pop 0