Skip to content

Commit

Permalink
merge copy and ad-hoc
Browse files Browse the repository at this point in the history
... as copy is an ad-hoc strategy
  • Loading branch information
rudymatela committed Feb 14, 2024
1 parent 5919bb7 commit 87290d3
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 58 deletions.
2 changes: 1 addition & 1 deletion bench/runtime/lapmatrud/bench/strategies.runtime
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.9
4.1
26 changes: 11 additions & 15 deletions bench/strategies.hs
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,23 @@ mkStrategy s = args
{ rewriting = r
, requireDescent = d
, adHocRedundancy = a
, copyBindings = c
, copyBindings = a -- previously c
, uniqueCandidates = u
}
where
itob 0 = False
itob _ = True
[r,d,a,c,u] = map itob $
[r,d,a,u] = map itob $
case s of
"unique candidates" -> [1,1,1,1,1]
"default" -> [1,1,1,1,0]
"without reasoning" -> [0,1,1,1,0]
"without descent" -> [1,0,1,1,0]
"without ad-hoc" -> [1,1,0,1,0]
"without copy" -> [1,1,1,0,0]
"only reasoning" -> [1,0,0,0,0]
"only descent" -> [0,1,0,0,0]
"only ad-hoc" -> [0,0,1,0,0]
"only copy" -> [0,0,0,1,0]
"only typed" -> [0,0,0,0,0]
"unique candidates" -> [1,1,1,1]
"default" -> [1,1,1,0]
"without reasoning" -> [0,1,1,0]
"without descent" -> [1,0,1,0]
"without ad-hoc" -> [1,1,0,0]
"only reasoning" -> [1,0,0,0]
"only descent" -> [0,1,0,0]
"only ad-hoc" -> [0,0,1,0]
"only typed" -> [0,0,0,0]
_ -> error "unknown strategy"

conjureStrategy :: Conjurable f => String -> String -> f -> [Prim] -> IO ()
Expand All @@ -49,11 +47,9 @@ strategies =
, "without reasoning"
, "without descent"
, "without ad-hoc"
, "without copy"
, "only reasoning"
, "only descent"
, "only ad-hoc"
, "only copy"
, "only typed"
]

Expand Down
54 changes: 12 additions & 42 deletions bench/strategies.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,27 +64,12 @@ factorial :: Int -> Int
-- pruning with 27/65 rules
-- looking through 3 candidates of size 1
-- looking through 6 candidates of size 2
-- looking through 9 candidates of size 3
-- looking through 18 candidates of size 4
-- looking through 31 candidates of size 5
-- looking through 59 candidates of size 6
-- looking through 183 candidates of size 7
-- tested 137 candidates
factorial 0 = 1
factorial x = x * factorial (x - 1)

-- strategy: without copy
factorial :: Int -> Int
-- testing 4 combinations of argument values
-- pruning with 27/65 rules
-- looking through 3 candidates of size 1
-- looking through 3 candidates of size 2
-- looking through 9 candidates of size 3
-- looking through 10 candidates of size 4
-- looking through 32 candidates of size 5
-- looking through 39 candidates of size 6
-- looking through 197 candidates of size 7
-- tested 107 candidates
-- looking through 12 candidates of size 3
-- looking through 24 candidates of size 4
-- looking through 37 candidates of size 5
-- looking through 72 candidates of size 6
-- looking through 208 candidates of size 7
-- tested 165 candidates
factorial 0 = 1
factorial x = x * factorial (x - 1)

Expand Down Expand Up @@ -124,27 +109,12 @@ factorial :: Int -> Int
-- pruning with 27/65 rules
-- looking through 3 candidates of size 1
-- looking through 3 candidates of size 2
-- looking through 18 candidates of size 3
-- looking through 19 candidates of size 4
-- looking through 289 candidates of size 5
-- looking through 323 candidates of size 6
-- looking through 6468 candidates of size 7
-- tested 1028 candidates
factorial 0 = 1
factorial x = x * factorial (x - 1)

-- strategy: only copy
factorial :: Int -> Int
-- testing 4 combinations of argument values
-- pruning with 27/65 rules
-- looking through 3 candidates of size 1
-- looking through 6 candidates of size 2
-- looking through 18 candidates of size 3
-- looking through 36 candidates of size 4
-- looking through 315 candidates of size 5
-- looking through 585 candidates of size 6
-- looking through 6915 candidates of size 7
-- tested 1876 candidates
-- looking through 16 candidates of size 3
-- looking through 17 candidates of size 4
-- looking through 279 candidates of size 5
-- looking through 313 candidates of size 6
-- looking through 6281 candidates of size 7
-- tested 1004 candidates
factorial 0 = 1
factorial x = x * factorial (x - 1)

Expand Down

0 comments on commit 87290d3

Please sign in to comment.