simple-genetic-algorithm 0.1.0.2 → 0.1.0.3
raw patch · 2 files changed
+4/−3 lines, 2 files
Files
- simple-genetic-algorithm.cabal +1/−1
- src/MainSin.hs +3/−2
simple-genetic-algorithm.cabal view
@@ -2,7 +2,7 @@ -- further documentation, see http://haskell.org/cabal/users-guide/ name: simple-genetic-algorithm-version: 0.1.0.2+version: 0.1.0.3 synopsis: Simple parallel genetic algorithm implementation description: Simple parallel genetic algorithm implementation homepage: http://eax.me/haskell-genetic-algorithm/
src/MainSin.hs view
@@ -7,7 +7,7 @@ import Data.List as L import Control.DeepSeq -data SinInt = SinInt [Double]+newtype SinInt = SinInt [Double] instance NFData SinInt where rnf (SinInt xs) = rnf xs `seq` ()@@ -48,9 +48,10 @@ ([], gen) [0..polynomialOrder] in (SinInt lst, gen') +stopf :: SinInt -> Int -> IO Bool stopf best gnum = do let e = err best- putStrLn $ "Generation: " ++ printf "%02d" gnum ++ ", Error: " ++ printf "%.8f" e+ _ <- printf "Generation: %02d, Error: %.8f\n" gnum e return $ e < 0.0002 || gnum > 20 main = do