fix count discrepancy, thx Dr. Spector :)

This commit is contained in:
Rowan Torbitzky-Lane 2025-02-25 23:32:34 -06:00
parent db497a087c
commit 5383356791
2 changed files with 7 additions and 2 deletions

View File

@ -85,4 +85,3 @@ gpLoop' pushArgs generation evaluations population indexedTrainingData = do
bestIndPassesDownsample = False -- TODO: fix this later bestIndPassesDownsample = False -- TODO: fix this later
epsilonPushArgs :: PushArgs epsilonPushArgs :: PushArgs
epsilonPushArgs = pushArgs {epsilons = Nothing} -- TODO: And this epsilonPushArgs = pushArgs {epsilons = Nothing} -- TODO: And this
--gpLoop' _ _ _ _ _ = error "How did this happen?"

View File

@ -171,7 +171,13 @@ findContainer _ _ = Block []
-- |Utility Function: A helper function for instructionCodeDiscrepancy. The full description is there. -- |Utility Function: A helper function for instructionCodeDiscrepancy. The full description is there.
countDiscrepancy :: Gene -> Gene -> Integer countDiscrepancy :: Gene -> Gene -> Integer
countDiscrepancy (Block xs) (Block ys) = sum [if uncurry (==) tup then 0 else 1 | tup <- zip xs ys] + abs (toInteger (length xs) - toInteger (length ys)) -- countDiscrepancy (Block xs) (Block ys) = sum [if uncurry (==) tup then 0 else 1 | tup <- zip xs ys] + abs (toInteger (length xs) - toInteger (length ys))
-- countDiscrepancy (Block xs) (Block ys) = sum [if isBlock (fst tup) && isBlock (snd tup) then uncurry countDiscrepancy tup else if uncurry (==) tup then 0 else 1 | tup <- zip xs ys] + abs (toInteger (length xs) - toInteger (length ys))
countDiscrepancy (Block xs) (Block []) = codeRecursiveSize (Block xs)
countDiscrepancy (Block []) (Block ys) = codeRecursiveSize (Block ys)
countDiscrepancy (Block (x:xs)) (Block (y:ys)) = if x == y then 1 + countDiscrepancy (Block xs) (Block ys) else countDiscrepancy (Block xs) (Block ys)
countDiscrepancy _ (Block ys) = 1 + codeRecursiveSize (Block ys)
countDiscrepancy (Block xs) _ = 1 + codeRecursiveSize (Block xs)
countDiscrepancy xgene ygene = if xgene == ygene then 1 else 0 countDiscrepancy xgene ygene = if xgene == ygene then 1 else 0
-- |Utility Function: Extracts the first gene from a block. Returns itself if not a block -- |Utility Function: Extracts the first gene from a block. Returns itself if not a block