mirror of
https://github.com/Jaxan/nominal-lstar.git
synced 2025-04-27 14:47:45 +02:00
Improves performance by using more simplify
This commit is contained in:
parent
8946bc941e
commit
28145815c6
3 changed files with 9 additions and 4 deletions
|
@ -32,8 +32,8 @@ makeCompleteWith tests teacher state0 = go tests state0
|
||||||
Succes -> go ts state
|
Succes -> go ts state
|
||||||
-- Otherwise we add the changes
|
-- Otherwise we add the changes
|
||||||
Failed newRows newColumns ->
|
Failed newRows newColumns ->
|
||||||
let state2 = addRows teacher newRows state in
|
let state2 = simplify $ addRows teacher newRows state in
|
||||||
let state3 = addColumns teacher newColumns state2 in
|
let state3 = simplify $ addColumns teacher newColumns state2 in
|
||||||
-- restart the whole business
|
-- restart the whole business
|
||||||
makeCompleteWith tests teacher state3
|
makeCompleteWith tests teacher state3
|
||||||
|
|
||||||
|
|
|
@ -36,8 +36,8 @@ consistencyTestDirect State{..} = case solve (isEmpty defect) of
|
||||||
|
|
||||||
-- Given a C&C table, constructs an automaton. The states are given by 2^E (not
|
-- Given a C&C table, constructs an automaton. The states are given by 2^E (not
|
||||||
-- necessarily equivariant functions)
|
-- necessarily equivariant functions)
|
||||||
constructHypothesis :: NominalType i => State i -> Automaton (BRow i) i
|
constructHypothesis :: LearnableAlphabet i => State i -> Automaton (BRow i) i
|
||||||
constructHypothesis State{..} = automaton q a d i f
|
constructHypothesis State{..} = simplify $ automaton q a d i f
|
||||||
where
|
where
|
||||||
q = map (row t) ss
|
q = map (row t) ss
|
||||||
a = aa
|
a = aa
|
||||||
|
|
|
@ -88,6 +88,11 @@ instance NominalType i => Conditional (State i) where
|
||||||
toTup State{..} = (t,ss,ssa,ee,aa)
|
toTup State{..} = (t,ss,ssa,ee,aa)
|
||||||
fromTup (t,ss,ssa,ee,aa) = State{..}
|
fromTup (t,ss,ssa,ee,aa) = State{..}
|
||||||
|
|
||||||
|
instance (Ord i, Contextual i) => Contextual (State i) where
|
||||||
|
when f s = fromTup (when f (toTup s)) where
|
||||||
|
toTup State{..} = (t,ss,ssa,ee,aa)
|
||||||
|
fromTup (t,ss,ssa,ee,aa) = State{..}
|
||||||
|
|
||||||
-- Precondition: the set together with the current rows is prefix closed
|
-- Precondition: the set together with the current rows is prefix closed
|
||||||
addRows :: LearnableAlphabet i => Teacher i -> Set [i] -> State i -> State i
|
addRows :: LearnableAlphabet i => Teacher i -> Set [i] -> State i -> State i
|
||||||
addRows teacher ds0 state@State{..} =
|
addRows teacher ds0 state@State{..} =
|
||||||
|
|
Loading…
Add table
Reference in a new issue