Exemplo n.º 1
0
        /// <summary>
        /// Attempts to simplify the structure of the automaton, reducing the number of states and transitions.
        /// </summary>
        public bool Simplify()
        {
            var builder        = Builder.FromAutomaton(this);
            var simplification = new Simplification(builder, this.PruneStatesWithLogEndWeightLessThan);

            if (simplification.Simplify())
            {
                this.Data = builder.GetData();
                return(true);
            }

            return(false);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Attempts to simplify the structure of the automaton, reducing the number of states and transitions.
        /// </summary>
        /// <param name="result">Result automaton. Simplified automaton, if the operation was successful, current automaton otherwise.</param>
        /// <returns><see langword="true"/> if the simplification was successful, <see langword="false"/> otherwise.</returns>
        public bool Simplify(out TThis result)
        {
            var builder        = Builder.FromAutomaton(this);
            var simplification = new Simplification(builder, this.PruneStatesWithLogEndWeightLessThan);

            if (simplification.Simplify())
            {
                result = WithData(builder.GetData());
                return(true);
            }

            result = (TThis)this;
            return(false);
        }