Пример #1
0
        public override bool CanBeOptimized()
        {
            if (optimizeCalled)
            {
                return(sum != null);
            }

            optimizeCalled = true;
            if (!First.CanBeOptimized() || !Second.CanBeOptimized())
            {
                return(false);
            }

            var first  = First.Optimize();
            var second = Second.Optimize();

            Automaton <BDD> s = null;

            try
            {
                s = first.Complement().Intersect(second.Complement(), Manager.Timeout).Complement().Minimize();
                if (s.StateCount > Manager.MaxNrOfStates)
                {
                    return(false);
                }
            }
            catch
            {
                //timeout occured
                return(false);
            }

            sum = s;
            return(true);
        }
Пример #2
0
        public override bool CanBeOptimized()
        {
            if (optimizeCalled)
            {
                return(product != null);
            }

            optimizeCalled = true;
            if (!First.CanBeOptimized() || !Second.CanBeOptimized())
            {
                return(false);
            }

            var first  = First.Optimize();
            var second = Second.Optimize();

            Automaton <BDD> prod = null;

            try
            {
                //one second timeout for the intersection to complete
                prod = first.Intersect(second, Manager.Timeout).Minimize();
                if (prod.StateCount > Manager.MaxNrOfStates)
                {
                    return(false);
                }
            }
            catch
            {
                //timeout
                return(false);
            }

            product = prod;
            return(true);
        }