From 4b611a9d7446a8a21bd28182f60a61b5f78ea68b Mon Sep 17 00:00:00 2001 From: Rowan Torbitzky-Lane Date: Sat, 1 Mar 2025 23:22:07 -0600 Subject: [PATCH] starting some testing --- src/HushGP/PushTests/GP/Selection.hs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 src/HushGP/PushTests/GP/Selection.hs diff --git a/src/HushGP/PushTests/GP/Selection.hs b/src/HushGP/PushTests/GP/Selection.hs new file mode 100644 index 0000000..ccb2932 --- /dev/null +++ b/src/HushGP/PushTests/GP/Selection.hs @@ -0,0 +1,22 @@ +module HushGP.PushTests.GP.Selection where + +import Data.List +import HushGP.GP.Individual +import HushGP.State +import HushGP.Utility + +-- | One of the steps in the lexicase selection process for selecting initial survivors. +tempFunc0 :: [[Individual]] +tempFunc0 = groupBy (\x y -> fitnessCases x == fitnessCases y) testInds + +-- \| Another step forward in the lexicase selection process. +survivors :: IO [Individual] +survivors = mapM randElem tempFunc0 + +-- | A list of individuals used for testing. +testInds :: [Individual] +testInds = + [ Individual{plushy = [Close], totalFitness = Just 1000, fitnessCases = Just [500,500]} + , Individual{plushy = [Close], totalFitness = Just 1000, fitnessCases = Just [400,600]} + , Individual{plushy = [Close], totalFitness = Just 900, fitnessCases = Just [500,400]} + ]