Esempio n. 1
0
        /// <summary>
        /// Substitution of a list of variablepairs in an Fdd
        /// </summary>
        /// <param name="t">The BDD to apply compose on</param>
        /// <param name="pairList">The list to substitute</param>
        /// <returns></returns>
        public static Bdd Compose(Bdd t, FddPairList pairList)
        {
            foreach (KeyValuePair <int, int> pair in pairList)
            {
                for (int i = 0; i < FddDictionary[pair.Key]; i++)
                {
                    t = Kernel.Compose(t, pair.Key + i, pair.Value + i);
                }
            }

            return(t);
        }
Esempio n. 2
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);
        }