Ticket #2252: GoodPerform.hs

File GoodPerform.hs, 1.4 KB (added by simona, 6 years ago)

The performance how it should be.

Line 
1-- Try running the convex hull algorithm.
2--import Abs.Domain.SparsePolyhedra
3--import Abs.Domain.SparsePolyhedra.Constraints
4--import Abs.Domain.SparsePolyhedra.Types
5--import Abs.Domain.SparsePolyhedra.Simplex
6--
7import Fake
8import System.Environment (getArgs)
9import Data.List (sort, sortBy)
10import Control.Monad (replicateM, replicateM_, liftM, unless) 
11
12-- Domain variables.
13
14-- | Size of the buffer
15s :: DomVar
16
17-- | The character read
18c :: DomVar
19
20-- | The NUL position
21sn :: DomVar
22
23-- | The pointer offset of u
24u :: DomVar
25
26-- | The NUL position of v
27vn :: DomVar
28
29-- | The NUL position of p
30tn :: DomVar
31
32-- | A flag determining if sn = 4 or 6
33f :: DomVar
34
35-- | The pointer offset of p
36p :: DomVar
37
38(s:c:sn:u:tn:p:f:vn:_) = [1..] :: [DomVar]
39
40main = do
41  let size = 8
42      initial = set u 0 $
43                top size
44  replicateM_ 1000 $ do
45    --res1 <- fixpoint initial bottom bottom vn 1
46    --unless (res1 `subset` res1) $ putStrLn "something's wrong"
47    res2 <- fixpoint initial bottom bottom vn 1
48    unless (res2 `subset` res2) $ putStrLn "something's wrong"
49
50
51fixpoint :: Poly -> Poly -> Poly -> DomVar -> Integer -> IO Poly
52fixpoint sU sT oldR sn fval = do
53  let sR = join sU sT
54  --putStrLn ("R:\n"++show sR)
55  let sV = meetAsym [Constraint (Terms [(1,u)]) 8] sR
56  if minimum [i+j | i <- [1..100], j <- [1..100]]<3 && sR `subset` sR then
57    return sV else error "not reached" {-do
58  let sT = assign 1 u (Constraint (Terms [(1,u)]) 1) sV
59  fixpoint sU sT sR sn fval-}
60
61