picosat 0.1.5 → 0.1.6
raw patch · 2 files changed
+26/−1 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- picosat.cabal +3/−1
- test/RandomCNF.hs +23/−0
picosat.cabal view
@@ -1,5 +1,5 @@ name: picosat-version: 0.1.5+version: 0.1.6 synopsis: Bindings to the PicoSAT solver homepage: https://github.com/sdiehl/haskell-picosat license: MIT@@ -70,3 +70,5 @@ main-is: Rand.hs default-language: Haskell2010 build-depends: base, picosat, transformers, random, rdtsc+ other-modules:+ RandomCNF
+ test/RandomCNF.hs view
@@ -0,0 +1,23 @@+module RandomCNF (randomLiteral,+ randomClause,+ randomCNF+ ) where++import System.Random++randomLiteral :: Int -> Double -> IO Int+randomLiteral num_vars negp =+ do s <- randomRIO(0.0, 1.0)+ let sign = if s < negp then -1 else 1+ n <- randomRIO(1, num_vars)+ return $ sign * n++randomClause :: Int -> Double -> Int -> IO [Int]+randomClause num_vars negp clause_size =+ mapM (\_ -> randomLiteral num_vars negp) [1..clause_size]+++randomCNF :: Int -> Double -> Int -> Int -> IO [[Int]]+randomCNF num_vars negp clause_size num_clauses =+ mapM (\_ -> randomClause num_vars negp clause_size) [1..num_clauses]+