add parallel computing features not sure if this is a real improvement
This commit is contained in:
+6
-3
@@ -7,6 +7,8 @@ module AI.Rulebased (
|
||||
mkAIEnv, testds, simplify
|
||||
) where
|
||||
|
||||
import Control.Parallel.Strategies
|
||||
|
||||
import Data.Ord
|
||||
import Data.Monoid ((<>))
|
||||
import Data.List
|
||||
@@ -163,6 +165,7 @@ compareGuess (c1, ops1) (c2, ops2)
|
||||
distributions :: Guess -> (Int, Int, Int, Int) -> [Distribution]
|
||||
distributions guess nos =
|
||||
helper (sortBy compareGuess $ M.toList guess) nos
|
||||
`using` parList rdeepseq
|
||||
where helper [] _ = []
|
||||
helper ((c, hs):[]) ns = map fst (distr c hs ns)
|
||||
helper ((c, hs):gs) ns =
|
||||
@@ -246,9 +249,9 @@ chooseStatistic = do
|
||||
2 -> 2
|
||||
3 -> 3
|
||||
-- simulate only partially
|
||||
4 -> 2
|
||||
5 -> 1
|
||||
6 -> 1
|
||||
4 -> 3
|
||||
5 -> 2
|
||||
6 -> 2
|
||||
7 -> 1
|
||||
8 -> 1
|
||||
9 -> 1
|
||||
|
||||
Reference in New Issue
Block a user