1
Fork 0
mirror of https://github.com/Jaxan/nominal-lstar.git synced 2025-04-27 14:47:45 +02:00

added a benchmark

This commit is contained in:
Joshua Moerman 2020-11-11 16:46:18 +01:00
parent 1e092a319b
commit 78bb8ef823
2 changed files with 10 additions and 10 deletions

View file

@ -15,8 +15,9 @@ myConfig = defaultConfig
main = defaultMainWith myConfig [ main = defaultMainWith myConfig [
bgroup "NomNLStar" bgroup "NomNLStar"
[ bench "NFA1 -" $ whnf (learnBollig 1 1) (teacherWithTargetNonDet 2 Examples.exampleNFA1) [ bench "NFA1 " $ whnf (learnBollig 0 0) (teacherWithTargetNonDet 2 Examples.exampleNFA1)
, bench "NFA2 1" $ whnf (learnBollig 0 0) (teacherWithTargetNonDet 3 (Examples.exampleNFA2 1)) , bench "NFA2 1 " $ whnf (learnBollig 0 0) (teacherWithTargetNonDet 3 (Examples.exampleNFA2 1))
, bench "NFA2 2" $ whnf (learnBollig 0 0) (teacherWithTargetNonDet 4 (Examples.exampleNFA2 2)) , bench "NFA2 2 " $ whnf (learnBollig 0 0) (teacherWithTargetNonDet 4 (Examples.exampleNFA2 2))
, bench "Residual" $ whnf (learnBollig 1 0) (teacherWithTargetNonDet 2 Examples.exampleResidual1)
] ]
] ]

View file

@ -12,26 +12,25 @@ import GHC.Generics (Generic)
import Prelude (Eq, Ord, Read, Show) import Prelude (Eq, Ord, Read, Show)
import qualified Prelude () import qualified Prelude ()
data Res1 a = QR1 a | QR2 | QAncStar data Res1 a = QR1 a | QR2 | QEmpty
deriving (Eq, Ord, Show, Generic, NominalType, Contextual) deriving (Eq, Ord, Show, Generic, NominalType, Contextual)
-- Language L = { w a | a fresh for w }, but anchored with a new symbol -- Language L = { w a | a fresh for w } + {eps}, but anchored with a new symbol
exampleResidual1 :: Automaton (Res1 Atom) DataInput exampleResidual1 :: Automaton (Res1 Atom) DataInput
exampleResidual1 = automaton exampleResidual1 = automaton
-- state space -- state space
(fromList [QR2, QAncStar] (fromList [QR2, QEmpty]
`union` map QR1 atoms) `union` map QR1 atoms)
-- alphabet -- alphabet
(map Put atoms `union` map Get atoms) (map Put atoms `union` map Get atoms)
-- transition relation -- transition relation
(map (\a -> (QR1 a, Get a, QR1 a)) atoms (map (\a -> (QR1 a, Get a, QR1 a)) atoms
`union` pairsWithFilter (\a b -> maybeIf (a `neq` b) (QR1 a, Put b, QR1 a)) atoms atoms `union` pairsWithFilter (\a b -> maybeIf (a `neq` b) (QR1 a, Put b, QR1 a)) atoms atoms
`union` map (\a -> (QR1 a, Put a, QR2)) atoms `union` map (\a -> (QR1 a, Put a, QR2)) atoms)
`union` map (\a -> (QAncStar, Put a, QAncStar)) atoms)
-- initial states -- initial states
(map QR1 atoms `union` singleton QAncStar) (map QR1 atoms `union` singleton QEmpty)
-- final states -- final states
(fromList [QR2, QAncStar]) (fromList [QR2, QEmpty])
-- Example when learning breaks -- Example when learning breaks