Fix floating point precision problems in GA.worst
By using negate instead of (1 /).
This commit is contained in:
parent
939502e511
commit
3c45c206fc
|
@ -158,8 +158,7 @@ bestsBy k f =
|
||||||
The @k@ worst individuals in the population.
|
The @k@ worst individuals in the population.
|
||||||
-}
|
-}
|
||||||
worst :: (Individual i, Monad m) => N -> Population i -> m [i]
|
worst :: (Individual i, Monad m) => N -> Population i -> m [i]
|
||||||
-- TODO (1 /) might not be stable regarding floating point precision
|
worst = flip bestsBy (fmap negate . fitness)
|
||||||
worst = flip bestsBy (fmap (1 /) . fitness)
|
|
||||||
|
|
||||||
{-|
|
{-|
|
||||||
The @k@ best individuals in the population.
|
The @k@ best individuals in the population.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user