formatting

This commit is contained in:
Rowan Torbitzky-Lane 2025-03-01 16:23:19 -06:00
parent 690b4507b2
commit 27b29f8449
3 changed files with 10 additions and 7 deletions

View File

@ -46,9 +46,12 @@ gpLoop' pushArgs generation evaluations population indexedTrainingData = do
print "Put information about each generation here." print "Put information about each generation here."
when bestIndPassesDownsample $ print $ "Semi Success Generation: " <> show generation when bestIndPassesDownsample $ print $ "Semi Success Generation: " <> show generation
let nextAction let nextAction
| (bestIndPassesDownsample && | ( bestIndPassesDownsample
((case totalFitness (updateIndividual (errorFunction epsilonPushArgs epsilonPushArgs indexedTrainingData (plushy bestInd)) bestInd) of (Just x) -> x; _ -> error "Error: Best downsample individual has no fitness!") && ( (case totalFitness (updateIndividual (errorFunction epsilonPushArgs epsilonPushArgs indexedTrainingData (plushy bestInd)) bestInd) of (Just x) -> x; _ -> error "Error: Best downsample individual has no fitness!")
<= solutionErrorThreshold epsilonPushArgs)) || (not (enableDownsampling epsilonPushArgs) && ((case totalFitness bestInd of (Just x) -> x; _ -> error "error: Best non-downsample individual has no fitness!") <= solutionErrorThreshold epsilonPushArgs)) = <= solutionErrorThreshold epsilonPushArgs
)
)
|| (not (enableDownsampling epsilonPushArgs) && ((case totalFitness bestInd of (Just x) -> x; _ -> error "error: Best non-downsample individual has no fitness!") <= solutionErrorThreshold epsilonPushArgs)) =
do do
print $ "Successful generation: " <> show generation print $ "Successful generation: " <> show generation
print $ "Successful plushy: " <> show (plushy bestInd) print $ "Successful plushy: " <> show (plushy bestInd)

View File

@ -23,10 +23,10 @@ data Individual = Individual
instance Ord Individual where instance Ord Individual where
ind0 <= ind1 = totalFitness ind0 <= totalFitness ind1 ind0 <= ind1 = totalFitness ind0 <= totalFitness ind1
-- |Extracts the fitnessCases from an Individual. Errors if the field is empty. -- | Extracts the fitnessCases from an Individual. Errors if the field is empty.
extractFitnessCases :: Individual -> [Double] extractFitnessCases :: Individual -> [Double]
extractFitnessCases Individual{fitnessCases = Nothing} = error "Error: fitnessCases is empty!" extractFitnessCases Individual {fitnessCases = Nothing} = error "Error: fitnessCases is empty!"
extractFitnessCases Individual{fitnessCases = Just xs} = xs extractFitnessCases Individual {fitnessCases = Just xs} = xs
-- | Makes a random individual based on the variables in a passed PushArgs. -- | Makes a random individual based on the variables in a passed PushArgs.
makeRandomIndividual :: PushArgs -> IO Individual makeRandomIndividual :: PushArgs -> IO Individual

View File

@ -22,4 +22,4 @@ mapIndexed = mapIndexed' 0
-- with mapIndexed. -- with mapIndexed.
mapIndexed' :: Int -> (Int -> a -> b) -> [a] -> [b] mapIndexed' :: Int -> (Int -> a -> b) -> [a] -> [b]
mapIndexed' _ _ [] = [] mapIndexed' _ _ [] = []
mapIndexed' count f (x:xs) = f count x : mapIndexed' (count + 1) f xs mapIndexed' count f (x : xs) = f count x : mapIndexed' (count + 1) f xs