From af80388ff7bca2431f72720e6f25151a70130906 Mon Sep 17 00:00:00 2001 From: Masahiro Sakai Date: Tue, 19 Nov 2024 23:51:52 +0900 Subject: [PATCH 1/2] fix some warnings --- src/ToySolver/Converter/SAT2KSAT.hs | 3 --- src/ToySolver/FileFormat/CNF.hs | 2 +- src/ToySolver/SAT/Encoder/Cardinality/Internal/Totalizer.hs | 1 - src/ToySolver/SAT/PBO/BCD2.hs | 2 +- test/Test/GraphShortestPath.hs | 1 - test/Test/SAT.hs | 2 +- test/Test/SAT/MUS.hs | 2 +- 7 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/ToySolver/Converter/SAT2KSAT.hs b/src/ToySolver/Converter/SAT2KSAT.hs index 596c976b..5070fc8f 100644 --- a/src/ToySolver/Converter/SAT2KSAT.hs +++ b/src/ToySolver/Converter/SAT2KSAT.hs @@ -21,14 +21,11 @@ module ToySolver.Converter.SAT2KSAT import Control.Monad import Control.Monad.ST -import Data.Array.MArray -import Data.Array.ST import Data.Foldable (toList) import Data.Sequence ((<|), (|>)) import qualified Data.Sequence as Seq import Data.STRef -import ToySolver.Converter.Base import ToySolver.Converter.Tseitin import qualified ToySolver.FileFormat.CNF as CNF import ToySolver.SAT.Formula diff --git a/src/ToySolver/FileFormat/CNF.hs b/src/ToySolver/FileFormat/CNF.hs index a35d8b35..c4e37f78 100644 --- a/src/ToySolver/FileFormat/CNF.hs +++ b/src/ToySolver/FileFormat/CNF.hs @@ -239,7 +239,7 @@ toOldWCNF (NewWCNF cs) , wcnfClauses = [(fromMaybe top w, c) | (w, c) <- cs] } where - top = sum [w | (Just w, c) <- cs] + 1 + top = sum [w | (Just w, _c) <- cs] + 1 toNewWCNF :: WCNF -> NewWCNF toNewWCNF wcnf = NewWCNF [(if w >= wcnfTopCost wcnf then Nothing else Just w, c) | (w, c) <- wcnfClauses wcnf] diff --git a/src/ToySolver/SAT/Encoder/Cardinality/Internal/Totalizer.hs b/src/ToySolver/SAT/Encoder/Cardinality/Internal/Totalizer.hs index a588b62f..dadc18c7 100644 --- a/src/ToySolver/SAT/Encoder/Cardinality/Internal/Totalizer.hs +++ b/src/ToySolver/SAT/Encoder/Cardinality/Internal/Totalizer.hs @@ -34,7 +34,6 @@ module ToySolver.SAT.Encoder.Cardinality.Internal.Totalizer import Control.Monad import Control.Monad.Primitive -import Control.Monad.State.Strict import qualified Data.IntSet as IntSet import Data.Map.Strict (Map) import qualified Data.Map.Strict as Map diff --git a/src/ToySolver/SAT/PBO/BCD2.hs b/src/ToySolver/SAT/PBO/BCD2.hs index 171b2a24..296e77e2 100644 --- a/src/ToySolver/SAT/PBO/BCD2.hs +++ b/src/ToySolver/SAT/PBO/BCD2.hs @@ -217,7 +217,7 @@ solveWBO cxt solver opt = do _ -> do let torelax = unrelaxed `IntSet.intersection` failed intersected = IntMap.elems (IntMap.restrictKeys sels failed) - disjoint = [core | (sel,(core,_)) <- IntMap.toList (IntMap.withoutKeys sels failed)] + disjoint = [core | (_sel,(core,_)) <- IntMap.toList (IntMap.withoutKeys sels failed)] modifyIORef unrelaxedRef (`IntSet.difference` torelax) modifyIORef relaxedRef (`IntSet.union` torelax) delta <- do diff --git a/test/Test/GraphShortestPath.hs b/test/Test/GraphShortestPath.hs index 5412bbe2..dcc57df7 100644 --- a/test/Test/GraphShortestPath.hs +++ b/test/Test/GraphShortestPath.hs @@ -4,7 +4,6 @@ module Test.GraphShortestPath (graphShortestPathTestGroup) where import Control.Monad -import Data.Hashable import Data.Monoid import Test.Tasty import Test.Tasty.HUnit diff --git a/test/Test/SAT.hs b/test/Test/SAT.hs index ff69ea82..a0c9dc80 100644 --- a/test/Test/SAT.hs +++ b/test/Test/SAT.hs @@ -617,7 +617,7 @@ case_setTerminateCallback = do m <- try (SAT.solve solver) case m of - Left (e :: SAT.Canceled) -> return () + Left (_ :: SAT.Canceled) -> return () Right x -> assertFailure ("Canceled should be thrown: " ++ show x) case_clearTerminateCallback :: IO () diff --git a/test/Test/SAT/MUS.hs b/test/Test/SAT/MUS.hs index a22ada4d..12983ab1 100644 --- a/test/Test/SAT/MUS.hs +++ b/test/Test/SAT/MUS.hs @@ -215,7 +215,7 @@ case_allMUSAssumptions_2_HYCAM = do , [y2,y3,y5,y7,y8,y11] , [y2,y4,y5,y6,y7,y8] -- (*) ] - mcses = + _mcses = [ [y0,y1,y7] , [y0,y1,y8] , [y0,y3,y4] From 111b95b1be874933bb0860d95290ddf561321fa4 Mon Sep 17 00:00:00 2001 From: Masahiro Sakai Date: Thu, 21 Nov 2024 08:52:41 +0900 Subject: [PATCH 2/2] remove unnecessary blank line --- src/ToySolver/Converter/Tseitin.hs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/ToySolver/Converter/Tseitin.hs b/src/ToySolver/Converter/Tseitin.hs index d121cb51..37fa0a56 100644 --- a/src/ToySolver/Converter/Tseitin.hs +++ b/src/ToySolver/Converter/Tseitin.hs @@ -1,4 +1,3 @@ - {-# OPTIONS_GHC -Wall #-} {-# OPTIONS_HADDOCK show-extensions #-} {-# LANGUAGE TypeFamilies #-}