Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Moved examples to the data directory and exposed them as data-files

  • Loading branch information...
commit ccd15d6f14d73b853edb0866b967ca3a9bb68fe0 1 parent b0cfd2c
@ekmett authored
Showing with 15 additions and 206 deletions.
  1. 0  {examples → data}/dimacs/bf/bf0432-007.cnf
  2. 0  {examples → data}/dimacs/bf/bf1355-075.cnf
  3. 0  {examples → data}/dimacs/bf/bf1355-638.cnf
  4. 0  {examples → data}/dimacs/bf/bf2670-001.cnf
  5. 0  {examples → data}/dimacs/bf/descr.html
  6. 0  {examples → data}/dimacs/bf/ssa0432-003.cnf
  7. 0  {examples → data}/dimacs/bf/ssa2670-130.cnf
  8. 0  {examples → data}/dimacs/bf/ssa2670-141.cnf
  9. 0  {examples → data}/dimacs/bf/ssa6288-047.cnf
  10. 0  {examples → data}/dimacs/bf/ssa7552-038.cnf
  11. 0  {examples → data}/dimacs/bf/ssa7552-158.cnf
  12. 0  {examples → data}/dimacs/bf/ssa7552-159.cnf
  13. 0  {examples → data}/dimacs/bf/ssa7552-160.cnf
  14. 0  {examples → data}/dimacs/blocksworld/anomaly.cnf
  15. 0  {examples → data}/dimacs/blocksworld/bw_large.a.cnf
  16. 0  {examples → data}/dimacs/blocksworld/bw_large.b.cnf
  17. 0  {examples → data}/dimacs/blocksworld/bw_large.c.cnf
  18. 0  {examples → data}/dimacs/blocksworld/descr.html
  19. 0  {examples → data}/dimacs/blocksworld/huge.cnf
  20. 0  {examples → data}/dimacs/blocksworld/medium.cnf
  21. 0  {examples → data}/dimacs/bmc/bmc-ibm-1.cnf
  22. 0  {examples → data}/dimacs/bmc/bmc-ibm-2.cnf
  23. 0  {examples → data}/dimacs/bmc/bmc-ibm-3.cnf
  24. 0  {examples → data}/dimacs/bmc/bmc-ibm-4.cnf
  25. 0  {examples → data}/dimacs/bmc/bmc-ibm-5.cnf
  26. 0  {examples → data}/dimacs/bmc/bmc-ibm-7.cnf
  27. 0  {examples → data}/dimacs/logistics/descr.html
  28. 0  {examples → data}/dimacs/logistics/logistics.a.cnf
  29. 0  {examples → data}/dimacs/logistics/logistics.b.cnf
  30. 0  {examples → data}/dimacs/logistics/logistics.c.cnf
  31. 0  {examples → data}/dimacs/logistics/logistics.d.cnf
  32. 0  {examples → data}/dimacs/parity/descr
  33. 0  {examples → data}/dimacs/parity/par16-1-c.cnf
  34. 0  {examples → data}/dimacs/parity/par16-1.cnf
  35. 0  {examples → data}/dimacs/parity/par16-2-c.cnf
  36. 0  {examples → data}/dimacs/parity/par16-2.cnf
  37. 0  {examples → data}/dimacs/parity/par16-3-c.cnf
  38. 0  {examples → data}/dimacs/parity/par16-3.cnf
  39. 0  {examples → data}/dimacs/parity/par16-4-c.cnf
  40. 0  {examples → data}/dimacs/parity/par16-4.cnf
  41. 0  {examples → data}/dimacs/parity/par16-5-c.cnf
  42. 0  {examples → data}/dimacs/parity/par16-5.cnf
  43. 0  {examples → data}/dimacs/parity/par8-1-c.cnf
  44. 0  {examples → data}/dimacs/parity/par8-1.cnf
  45. 0  {examples → data}/dimacs/parity/par8-2-c.cnf
  46. 0  {examples → data}/dimacs/parity/par8-2.cnf
  47. 0  {examples → data}/dimacs/parity/par8-3-c.cnf
  48. 0  {examples → data}/dimacs/parity/par8-3.cnf
  49. 0  {examples → data}/dimacs/parity/par8-4-c.cnf
  50. 0  {examples → data}/dimacs/parity/par8-4.cnf
  51. 0  {examples → data}/dimacs/parity/par8-5-c.cnf
  52. 0  {examples → data}/dimacs/parity/par8-5.cnf
  53. 0  {examples → data}/dimacs/phole/descr.html
  54. 0  {examples → data}/dimacs/phole/hole6.cnf
  55. 0  {examples → data}/dimacs/phole/hole7.cnf
  56. 0  {examples → data}/dimacs/phole/hole8.cnf
  57. +15 −0 ersatz.cabal
  58. +0 −206 examples/dimacs/GraphResult.hs
View
0  examples/dimacs/bf/bf0432-007.cnf → data/dimacs/bf/bf0432-007.cnf
File renamed without changes
View
0  examples/dimacs/bf/bf1355-075.cnf → data/dimacs/bf/bf1355-075.cnf
File renamed without changes
View
0  examples/dimacs/bf/bf1355-638.cnf → data/dimacs/bf/bf1355-638.cnf
File renamed without changes
View
0  examples/dimacs/bf/bf2670-001.cnf → data/dimacs/bf/bf2670-001.cnf
File renamed without changes
View
0  examples/dimacs/bf/descr.html → data/dimacs/bf/descr.html
File renamed without changes
View
0  examples/dimacs/bf/ssa0432-003.cnf → data/dimacs/bf/ssa0432-003.cnf
File renamed without changes
View
0  examples/dimacs/bf/ssa2670-130.cnf → data/dimacs/bf/ssa2670-130.cnf
File renamed without changes
View
0  examples/dimacs/bf/ssa2670-141.cnf → data/dimacs/bf/ssa2670-141.cnf
File renamed without changes
View
0  examples/dimacs/bf/ssa6288-047.cnf → data/dimacs/bf/ssa6288-047.cnf
File renamed without changes
View
0  examples/dimacs/bf/ssa7552-038.cnf → data/dimacs/bf/ssa7552-038.cnf
File renamed without changes
View
0  examples/dimacs/bf/ssa7552-158.cnf → data/dimacs/bf/ssa7552-158.cnf
File renamed without changes
View
0  examples/dimacs/bf/ssa7552-159.cnf → data/dimacs/bf/ssa7552-159.cnf
File renamed without changes
View
0  examples/dimacs/bf/ssa7552-160.cnf → data/dimacs/bf/ssa7552-160.cnf
File renamed without changes
View
0  examples/dimacs/blocksworld/anomaly.cnf → data/dimacs/blocksworld/anomaly.cnf
File renamed without changes
View
0  examples/dimacs/blocksworld/bw_large.a.cnf → data/dimacs/blocksworld/bw_large.a.cnf
File renamed without changes
View
0  examples/dimacs/blocksworld/bw_large.b.cnf → data/dimacs/blocksworld/bw_large.b.cnf
File renamed without changes
View
0  examples/dimacs/blocksworld/bw_large.c.cnf → data/dimacs/blocksworld/bw_large.c.cnf
File renamed without changes
View
0  examples/dimacs/blocksworld/descr.html → data/dimacs/blocksworld/descr.html
File renamed without changes
View
0  examples/dimacs/blocksworld/huge.cnf → data/dimacs/blocksworld/huge.cnf
File renamed without changes
View
0  examples/dimacs/blocksworld/medium.cnf → data/dimacs/blocksworld/medium.cnf
File renamed without changes
View
0  examples/dimacs/bmc/bmc-ibm-1.cnf → data/dimacs/bmc/bmc-ibm-1.cnf
File renamed without changes
View
0  examples/dimacs/bmc/bmc-ibm-2.cnf → data/dimacs/bmc/bmc-ibm-2.cnf
File renamed without changes
View
0  examples/dimacs/bmc/bmc-ibm-3.cnf → data/dimacs/bmc/bmc-ibm-3.cnf
File renamed without changes
View
0  examples/dimacs/bmc/bmc-ibm-4.cnf → data/dimacs/bmc/bmc-ibm-4.cnf
File renamed without changes
View
0  examples/dimacs/bmc/bmc-ibm-5.cnf → data/dimacs/bmc/bmc-ibm-5.cnf
File renamed without changes
View
0  examples/dimacs/bmc/bmc-ibm-7.cnf → data/dimacs/bmc/bmc-ibm-7.cnf
File renamed without changes
View
0  examples/dimacs/logistics/descr.html → data/dimacs/logistics/descr.html
File renamed without changes
View
0  examples/dimacs/logistics/logistics.a.cnf → data/dimacs/logistics/logistics.a.cnf
File renamed without changes
View
0  examples/dimacs/logistics/logistics.b.cnf → data/dimacs/logistics/logistics.b.cnf
File renamed without changes
View
0  examples/dimacs/logistics/logistics.c.cnf → data/dimacs/logistics/logistics.c.cnf
File renamed without changes
View
0  examples/dimacs/logistics/logistics.d.cnf → data/dimacs/logistics/logistics.d.cnf
File renamed without changes
View
0  examples/dimacs/parity/descr → data/dimacs/parity/descr
File renamed without changes
View
0  examples/dimacs/parity/par16-1-c.cnf → data/dimacs/parity/par16-1-c.cnf
File renamed without changes
View
0  examples/dimacs/parity/par16-1.cnf → data/dimacs/parity/par16-1.cnf
File renamed without changes
View
0  examples/dimacs/parity/par16-2-c.cnf → data/dimacs/parity/par16-2-c.cnf
File renamed without changes
View
0  examples/dimacs/parity/par16-2.cnf → data/dimacs/parity/par16-2.cnf
File renamed without changes
View
0  examples/dimacs/parity/par16-3-c.cnf → data/dimacs/parity/par16-3-c.cnf
File renamed without changes
View
0  examples/dimacs/parity/par16-3.cnf → data/dimacs/parity/par16-3.cnf
File renamed without changes
View
0  examples/dimacs/parity/par16-4-c.cnf → data/dimacs/parity/par16-4-c.cnf
File renamed without changes
View
0  examples/dimacs/parity/par16-4.cnf → data/dimacs/parity/par16-4.cnf
File renamed without changes
View
0  examples/dimacs/parity/par16-5-c.cnf → data/dimacs/parity/par16-5-c.cnf
File renamed without changes
View
0  examples/dimacs/parity/par16-5.cnf → data/dimacs/parity/par16-5.cnf
File renamed without changes
View
0  examples/dimacs/parity/par8-1-c.cnf → data/dimacs/parity/par8-1-c.cnf
File renamed without changes
View
0  examples/dimacs/parity/par8-1.cnf → data/dimacs/parity/par8-1.cnf
File renamed without changes
View
0  examples/dimacs/parity/par8-2-c.cnf → data/dimacs/parity/par8-2-c.cnf
File renamed without changes
View
0  examples/dimacs/parity/par8-2.cnf → data/dimacs/parity/par8-2.cnf
File renamed without changes
View
0  examples/dimacs/parity/par8-3-c.cnf → data/dimacs/parity/par8-3-c.cnf
File renamed without changes
View
0  examples/dimacs/parity/par8-3.cnf → data/dimacs/parity/par8-3.cnf
File renamed without changes
View
0  examples/dimacs/parity/par8-4-c.cnf → data/dimacs/parity/par8-4-c.cnf
File renamed without changes
View
0  examples/dimacs/parity/par8-4.cnf → data/dimacs/parity/par8-4.cnf
File renamed without changes
View
0  examples/dimacs/parity/par8-5-c.cnf → data/dimacs/parity/par8-5-c.cnf
File renamed without changes
View
0  examples/dimacs/parity/par8-5.cnf → data/dimacs/parity/par8-5.cnf
File renamed without changes
View
0  examples/dimacs/phole/descr.html → data/dimacs/phole/descr.html
File renamed without changes
View
0  examples/dimacs/phole/hole6.cnf → data/dimacs/phole/hole6.cnf
File renamed without changes
View
0  examples/dimacs/phole/hole7.cnf → data/dimacs/phole/hole7.cnf
File renamed without changes
View
0  examples/dimacs/phole/hole8.cnf → data/dimacs/phole/hole8.cnf
File renamed without changes
View
15 ersatz.cabal
@@ -29,6 +29,21 @@ extra-source-files:
README.md
CHANGELOG.md
+data-files:
+ data/dimacs/bf/descr.html
+ data/dimacs/bf/*.cnf
+ data/dimacs/blocksworld/descr.html
+ data/dimacs/blocksworld/*.cnf
+ data/dimacs/bmc/*.cnf
+ data/dimacs/logistics/descr.html
+ data/dimacs/logistics/logistics.a.cnf
+ data/dimacs/logistics/logistics.b.cnf
+ data/dimacs/logistics/logistics.c.cnf
+ data/dimacs/logistics/logistics.d.cnf
+ data/dimacs/parity/descr
+ data/dimacs/parity/*.cnf
+ data/dimacs/phole/descr.html
+ data/dimacs/phole/*.cnf
source-repository head
type: git
View
206 examples/dimacs/GraphResult.hs
@@ -1,206 +0,0 @@
-{-# OPTIONS_GHC -fglasgow-exts #-}
-
--- | This file cooperates with @benchmark.sh@. This script grovels over the
--- result files produced by @benchmark.sh@ given on the command-line and outputs
--- a PNG graph comparison of the runtime data.
---
--- Example usage:
---
--- runghc GraphResult.hs /path/to/benchmark/date-1 ... /path/to/benchmark/date-n
-module Main where
-
-import Control.Monad
-import Data.List( foldl', intercalate, transpose, genericLength )
-import Graphics.Rendering.Chart
-import System.Console.GetOpt
-import System.Environment( getArgs )
-import System.Exit( exitWith, ExitCode(..) )
-import System.FilePath.Posix( pathSeparator )
-import Text.Regex
-
-type RegexGroup = ([String], String)
-
--- | Assume the input contains @n>0@ records delimited at the start by
--- whatever matches regexp. Each element @(xs, s)@ of @groups rx f s@ is such
--- that (1) @xs@ is a list of submatches of @rx@ and (2) @s@ is the string
--- from (and not including) the last match, up to and not including the next
--- match (if any).
---
--- If the regex fails to match at all (i.e. @n=0@), the empty list is
--- returned.
-groups :: Regex -> String -> [RegexGroup]
-groups markerRx s = snd $ groups' markerRx s
- where
- -- Returns the text before the match, if any match, in its first position.
- groups' markerRx s =
- case matchRegexAll markerRx s of
- Nothing -> (s, [])
- Just (beforeMatch, _matched, afterMatch, submatches) ->
- let (beforeNext, retList) = groups' markerRx afterMatch
- in ( beforeMatch, (submatches, beforeNext) : retList )
-
-------------------------------------------------------------------------------
--- Plots
-
-plotColumnPoints col s = defaultPlotPoints
- { plot_points_style = s
- , plot_points_values = zipWith Point [1..] col }
-
-plotLines col s = defaultPlotLines
- { plot_lines_style = s
- , plot_lines_values = [zipWith Point [1..] col] }
-
-verticalLines numTests s = defaultPlotLines
- { plot_lines_style = s
- , plot_lines_values = map (\p -> [Point (p_x p) 1, p]) $
- zipWith Point [1..numTests] (repeat 210) }
-
-manyTickAxis = defaultAxis
-
--- input matrix a list of rows of data; first row has test label
-myLayout header yLabel names matrix = defaultLayout1
- { layout1_title = header ++ intercalate " vs. " names
- , layout1_plots =
- -- Vertical lines.
- ("", HA_Bottom, VA_Right,
- toPlot (verticalLines (genericLength matrix) (gridLineStyle dimGray))):
- -- Show each column of data, not including the label column.
- concat
- [ [ ("", HA_Bottom, VA_Right, toPlot (plotLines col (lineStyle color)))
- , (yLabel ++ ": " ++ name ++ " (" ++ show i ++ ")", HA_Bottom, VA_Left,
- toPlot (plotColumnPoints col (pointStyle color))) ]
- | i <- [1..length names]
- | name <- names
- | col <- pointsRows
- | color <- map toColor colors ] }
- where
- pointStyle color = exes 7 2 color
- gridLineStyle color = dashedLine 0.3 [4.0] (toColor color)
- lineStyle color = solidLine 0.4 color --dashedLine 0.4 [7.0] color
-
- black = Color 0 0 0
- red = Color 1 0 0
- green = Color 0 1 0
- blue = Color 0 0 1
- dimGray = IntColor 105 105 105
- colors = [blue, red, green]
-
- -- remove label, convert to doubles, and turn into list of columns
- pointsRows = transpose . map (map read) . map tail $ matrix :: [[Double]]
-
-data IntColor = IntColor Int Int Int
-class ToColor a where
- toColor :: a -> Color
-instance ToColor Color where
- toColor = id
-instance ToColor IntColor where
- toColor (IntColor ri gi bi) = Color (r/255) (g/255) (b/255)
- where r = fromIntegral ri
- g = fromIntegral gi
- b = fromIntegral bi
-instance Show Color where
- show (Color r g b) = "Color " ++ intercalate " " [show r, show g, show b]
-
-savePNG filename header yLabel names matrix =
- renderableToPNGFile (toRenderable (myLayout header yLabel names matrix))
- 1024 768 filename
-
-------------------------------------------------------------------------------
--- Statistics
-
--- | @deltas xs ys@ produces a list @zs@ such that @zs!!i == (xs!!i - ys!!i)@
--- for all @i@ for which indexing @xs@ and @ys@ is correct.
---
--- @deltas xs (repeat 0) == xs@
-deltas :: (Num a) => [a] -> [a] -> [a]
-{-# INLINE deltas #-}
-deltas = zipWith (-)
-
-deltasF :: (Floating r) => [r] -> [r] -> [r]
-{-# INLINE deltasF #-}
-deltasF = zipWith (-)
-
-------------------------------------------------------------------------------
--- Main
-
--- group is filename at start of each run
-satrunRx = mkRegex $
- "Solving ([-_./a-zA-Z0-9]+[.]cnf)"-- ./bench/bf/bf0432-007.cnf
-
--- group is user time
-userTimeRx = mkRegex "([[:digit:]]+[.][[:digit:]]+) user"
-
-findUserTime s =
- head `fmap` matchRegex userTimeRx s
-
-
-
-
-main = do
- (opts, dirs) <- getArgs >>= parseOptions
- when (null dirs) $ do putStrLn "Nothing to do."
- putStrLn (usageInfo usageHeader validOptions)
- exitWith ExitSuccess
- groupList <- forM dirs (\dir -> groups satrunRx `liftM`
- readFile (dir ++ [pathSeparator] ++ "result.1"))
- :: IO [[RegexGroup]]
- titles <- forM dirs (\dir -> readFile (dir ++ [pathSeparator] ++ "info"))
- let benchFiles = map (head . fst) $ head groupList
- showTime maybeTime = case maybeTime of
- Nothing -> optionMax opts
- Just time -> time
- labelRow = replicate (length dirs + 1) "IGNOREDLABEL"
- dataMatrix =
- (labelRow :)
- . zipWith (:) benchFiles
- . transpose
- . reverse $
- foldl' (\matrix grouping ->
- (map showTime . map findUserTime . map snd $ grouping)
- : matrix)
- [] groupList
- :: [[String]]
- putStrLn $ "Saving '" ++ optionOutput opts ++ "'..."
- savePNG (optionOutput opts) (optionHeader opts) (optionYLabel opts) titles
- (tail dataMatrix)
--- forM_ dataMatrix $ putStrLn . intercalate " "
-
-
-
-validOptions :: [OptDescr (RunOptions -> RunOptions)]
-validOptions =
- [ Option [] ["header"] (ReqArg (\t opts -> opts{ optionHeader = t }) "STRING")
- "Header for the graph."
- , Option ['o'] ["output"]
- (ReqArg (\t opts -> opts{ optionOutput = t }) "FILENAME")
- "Output filename, a PNG."
- , Option [] ["ylabel"] (ReqArg (\t opts -> opts{ optionYLabel = t }) "STRING")
- "Label of the graphed value."
- , Option [] ["max"]
- (ReqArg (\t opts -> opts{ optionMax = t }) "NUMBER")
- "Height of y axis on graph." ]
-
-data RunOptions = RunOptions
- { optionHeader :: String
- , optionOutput :: String
- , optionMax :: String
- , optionYLabel :: String }
-defaultRunOptions = RunOptions
- { optionHeader = "funsat comparison: "
- , optionOutput = "result.png"
- , optionMax = "300.0"
- , optionYLabel = "y" }
-
--- Parse options, possibly exiting if there is nothing to do, or an error.
-parseOptions :: [String] -> IO (RunOptions, [FilePath])
-parseOptions args = do
- let (runOptTranss, filepaths, errors) = getOpt RequireOrder validOptions args
- when (not (null errors)) $ do { mapM_ putStr errors ;
- putStrLn (usageInfo usageHeader validOptions) ;
- exitWith (ExitFailure 1) }
- return (foldr id defaultRunOptions runOptTranss, filepaths)
-
-usageHeader =
- "Usage: GraphResult [options] <results-dir-1> <results-dir-2> ... <results-dir-n>\nOptions:\n"
-
-
Please sign in to comment.
Something went wrong with that request. Please try again.