From 78bb8ef8239f6505addf38cc709d1ad45a785357 Mon Sep 17 00:00:00 2001 From: Joshua Moerman Date: Wed, 11 Nov 2020 16:46:18 +0100 Subject: [PATCH] added a benchmark --- bench/Bench.hs | 7 ++++--- src/Examples/Residual.hs | 13 ++++++------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/bench/Bench.hs b/bench/Bench.hs index ef2a3e9..05e80b1 100644 --- a/bench/Bench.hs +++ b/bench/Bench.hs @@ -15,8 +15,9 @@ myConfig = defaultConfig main = defaultMainWith myConfig [ bgroup "NomNLStar" - [ bench "NFA1 -" $ whnf (learnBollig 1 1) (teacherWithTargetNonDet 2 Examples.exampleNFA1) - , 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 "NFA1 " $ whnf (learnBollig 0 0) (teacherWithTargetNonDet 2 Examples.exampleNFA1) + , 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 "Residual" $ whnf (learnBollig 1 0) (teacherWithTargetNonDet 2 Examples.exampleResidual1) ] ] diff --git a/src/Examples/Residual.hs b/src/Examples/Residual.hs index 06dc3cf..1d348a2 100644 --- a/src/Examples/Residual.hs +++ b/src/Examples/Residual.hs @@ -12,26 +12,25 @@ import GHC.Generics (Generic) import Prelude (Eq, Ord, Read, Show) import qualified Prelude () -data Res1 a = QR1 a | QR2 | QAncStar +data Res1 a = QR1 a | QR2 | QEmpty 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 -- state space - (fromList [QR2, QAncStar] + (fromList [QR2, QEmpty] `union` map QR1 atoms) -- alphabet (map Put atoms `union` map Get atoms) -- transition relation (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` map (\a -> (QR1 a, Put a, QR2)) atoms - `union` map (\a -> (QAncStar, Put a, QAncStar)) atoms) + `union` map (\a -> (QR1 a, Put a, QR2)) atoms) -- initial states - (map QR1 atoms `union` singleton QAncStar) + (map QR1 atoms `union` singleton QEmpty) -- final states - (fromList [QR2, QAncStar]) + (fromList [QR2, QEmpty]) -- Example when learning breaks