예제 #1
0
        /// <summary>
        /// Boolean operation and existential quantification on a list of variables.
        /// The same operation as first using Apply() and then VarListExists().
        /// </summary>
        /// <param name="pairList">The list of pairs.</param>
        /// <param name="root">The BDD to do the Exists operation on.</param>
        /// <returns>The resulting Bdd</returns>
        public static Bdd Exists(FddPairList pairList, Bdd root)
        {
            IEnumerator <KeyValuePair <int, bool> > enumerator = pairList.GetEnumeratorExists();

            enumerator.MoveNext();
            while (enumerator.Current.Key != 0)      //safe because Fdd var always starts on 1.
            {
                for (int i = 0; i < FddDictionary[enumerator.Current.Key]; i++)
                {
                    root = Kernel.Exists(enumerator.Current.Key + i, root);
                }
                enumerator.MoveNext();
            }
            return(root);
        }