Exemplo n.º 1
0
        public static Bdd InvImp(Bdd u1, Bdd u2)
        {
            int u = Apply(delegate(int b1, int b2) { return(Terminal(!(!ToBool(b1) && (ToBool(b2))))); }, u1.U, u2.U);

            AddRef(u);
            return(Bdd.CreateBdd(u));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Boolean operator not. Uses delegate to evaluate result.
        /// </summary>
        /// <param name="u1">Bdd</param>
        /// <returns>Resulting Bdd</returns>
        public static Bdd DelegateNot(Bdd u1)
        {
            int u = Apply(delegate(int b1, int b2) { return(Terminal(!ToBool(b1))); }, u1.U, u1.U);

            G2.Clear();
            return(Bdd.CreateBdd(u));
        }
Exemplo n.º 3
0
        public static Bdd Not(Bdd u1)
        {
            int u = Apply(delegate(int b1, int b2) { return(Terminal(!ToBool(b1))); }, u1.U, u1.U);

            AddRef(u);
            return(Bdd.CreateBdd(u));
        }
Exemplo n.º 4
0
        public static Bdd Less(Bdd u1, Bdd u2)
        {
            int u = Apply(delegate(int b1, int b2) { return(Terminal(b1 < b2)); }, u1.U, u2.U);

            AddRef(u);
            return(Bdd.CreateBdd(u));
        }
Exemplo n.º 5
0
        /// <summary>
        /// Boolean operator implication. Uses delegate to evaluate result.
        /// </summary>
        /// <param name="u1">Bdd</param>
        /// <param name="u2">Bdd</param>
        /// <returns>Resulting Bdd</returns>
        public static Bdd DelegateImp(Bdd u1, Bdd u2)
        {
            int u = Apply(delegate(int b1, int b2) { return(Terminal(!(ToBool(b1) && (!ToBool(b2))))); }, u1.U, u2.U);

            G2.Clear();
            return(Bdd.CreateBdd(u));
        }
Exemplo n.º 6
0
        /// <summary>
        /// Boolean operator lesser than. Uses delegate to evaluate result.
        /// </summary>
        /// <param name="u1">Bdd</param>
        /// <param name="u2">Bdd</param>
        /// <returns>Resulting Bdd</returns>
        public static Bdd DelegateLess(Bdd u1, Bdd u2)
        {
            int u = Apply(delegate(int b1, int b2) { return(Terminal(b1 < b2)); }, u1.U, u2.U);

            G2.Clear();
            return(Bdd.CreateBdd(u));
        }
Exemplo n.º 7
0
        public static Bdd Restrict(Bdd root, int restrictVar, bool restrictValue)
        {
            int u = Res(root.U, restrictVar, restrictValue);

            AddRef(u);
            R.Clear();
            return(Bdd.CreateBdd(u));
        }
Exemplo n.º 8
0
        public static Bdd Nand(Bdd u1, Bdd u2)
        {
            int u = Apply(delegate(int b1, int b2) { return(Terminal(!(ToBool(b1) && ToBool(b2)))); }, u1.U, u2.U);

            G.Clear();
            AddRef(u);
            return(Bdd.CreateBdd(u));
        }
Exemplo n.º 9
0
        public static Bdd Greater(Bdd u1, Bdd u2)
        {
            int u = Apply(delegate(int b1, int b2) { return(Terminal(b1 > b2)); }, u1.U, u2.U);

            G.Clear();
            AddRef(u);
            return(Bdd.CreateBdd(u));
        }
Exemplo n.º 10
0
 public static Bdd Not(Bdd u1)
 {
     lock (padlock)
     {
         int u = Apply(delegate(int b1, int b2) { return(Terminal(!ToBool(b1))); }, u1.U, u1.U);
         G.Clear();
         AddRef(u);
         //DelRef(u1.U);
         return(Bdd.CreateBdd(u));
     }
 }
Exemplo n.º 11
0
 public static Bdd Imp(Bdd u1, Bdd u2)
 {
     lock (padlock)
     {
         int u = Apply(delegate(int b1, int b2) { return(Terminal(!(ToBool(b1) && (!ToBool(b2))))); }, u1.U, u2.U);
         G.Clear();
         //AddRef(u);
         GarbageCollect(u, u1.U, u2.U);
         return(Bdd.CreateBdd(u));
     }
 }
Exemplo n.º 12
0
        /// <summary>
        /// If-Then-Else operator for Bdds.
        /// </summary>
        /// <param name="condition">Condition Bdd</param>
        /// <param name="then">Then Bdd</param>
        /// <param name="eLse">Else Bdd</param>
        /// <returns>Resulting Bdd</returns>
        public static Bdd IfThenElse(Bdd condition, Bdd then, Bdd eLse)
        {
            int u = Apply(Op.CON, Apply(Op.CON, condition.U, then.U), Apply(Op.CON, Apply(Op.NOT, condition.U, condition.U), eLse.U));

            return(Bdd.CreateBdd(u));
        }
Exemplo n.º 13
0
//#############################################################################################

        /// <summary>
        /// If-Then operator for Bdds.
        /// Implemented as conjunction.
        /// </summary>
        /// <param name="condition">Condition Bdd</param>
        /// <param name="then">Then Bdd</param>
        /// <returns>Resulting Bdd</returns>
        public static Bdd IfThen(Bdd condition, Bdd then)
        {
            int u = Apply(Op.CON, condition.U, then.U);

            return(Bdd.CreateBdd(u));
        }
Exemplo n.º 14
0
        /// <summary>
        /// Boolean operator conjunction.
        /// </summary>
        /// <param name="u1">Bdd</param>
        /// <param name="u2">Bdd</param>
        /// <returns>Resulting Bdd</returns>
        public static Bdd And(Bdd u1, Bdd u2)
        {
            int u = Apply(Op.CON, u1.U, u2.U);

            return(Bdd.CreateBdd(u));
        }
Exemplo n.º 15
0
//############################################################
        /// <summary>
        /// Boolean operator equal.
        /// </summary>
        /// <param name="u1">Bdd</param>
        /// <param name="u2">Bdd</param>
        /// <returns>Resulting Bdd</returns>
        public static Bdd Equal(Bdd u1, Bdd u2)
        {
            int u = Apply(Op.BIMP, u1.U, u2.U);

            return(Bdd.CreateBdd(u));
        }
Exemplo n.º 16
0
        /// <summary>
        /// Boolean operator Xor.
        /// </summary>
        /// <param name="u1">Bdd</param>
        /// <param name="u2">Bdd</param>
        /// <returns>Resulting Bdd</returns>
        public static Bdd Xor(Bdd u1, Bdd u2)
        {
            int u = Apply(Op.XOR, u1.U, u2.U);

            return(Bdd.CreateBdd(u));
        }
Exemplo n.º 17
0
        /// <summary>
        /// Boolean operator greater than.
        /// </summary>
        /// <param name="u1">Bdd</param>
        /// <param name="u2">Bdd</param>
        /// <returns>Resulting Bdd</returns>
        public static Bdd Greater(Bdd u1, Bdd u2)
        {
            int u = Apply(Op.GREATER, u1.U, u2.U);

            return(Bdd.CreateBdd(u));
        }
Exemplo n.º 18
0
        /// <summary>
        /// Existential quantification on one variable.
        /// </summary>
        /// <param name="var">Variable number</param>
        /// <param name="root">Bdd</param>
        /// <returns>Resulting Bdd</returns>
        public static Bdd Exists(int var, Bdd root)
        {
            int u = Exists(var, root.U);

            return(Bdd.CreateBdd(u));
        }
Exemplo n.º 19
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="operatoR">Boolean operator</param>
        /// <param name="root1">bdd</param>
        /// <param name="root2">bdd</param>
        /// <param name="varList">List of variables</param>
        /// <returns>Resulting Bdd</returns>
        public static Bdd ApplyExists(Op operatoR, Bdd root1, Bdd root2, BddPairList varList)
        {
            int u = AppEx(operatoR, root1.U, root2.U, ref varList);

            return(Bdd.CreateBdd(u));
        }
Exemplo n.º 20
0
        /// <summary>
        /// Boolean operator inverse implication.
        /// </summary>
        /// <param name="u1">Bdd</param>
        /// <param name="u2">Bdd</param>
        /// <returns>Resulting Bdd</returns>
        public static Bdd InvImp(Bdd u1, Bdd u2)
        {
            int u = Apply(Op.INV_IMPL, u1.U, u2.U);

            return(Bdd.CreateBdd(u));
        }
Exemplo n.º 21
0
//################################################################################################



        /// <summary>
        /// Existential quantification on a list of variables.
        /// </summary>
        /// <param name="varList">List of variables</param>
        /// <param name="root">bdd</param>
        /// <returns>Resulting Bdd</returns>
        public static Bdd VarListExists(BddPairList varList, Bdd root)
        {
            int u = VarListQuantification(ref varList, root.U, Op.DIS);

            return(Bdd.CreateBdd(u));
        }
Exemplo n.º 22
0
        /// <summary>
        /// Substitution of one variable with another variable in a Bdd.
        /// </summary>
        /// <param name="t">The Bdd the substitution is performed on.</param>
        /// <param name="replace">The variable number that is inserted.</param>
        /// <param name="x">The variable number that is substituted</param>
        /// <returns>Resulting Bdd</returns>
        public static Bdd Compose(Bdd t, int replace, int x)
        {
            int u = Compose(t.U, replace, x);

            return(Bdd.CreateBdd(u));
        }
Exemplo n.º 23
0
        /// <summary>
        /// Boolean operator lesser than.
        /// </summary>
        /// <param name="u1">Bdd</param>
        /// <param name="u2">Bdd</param>
        /// <returns>Resulting Bdd</returns>
        public static Bdd Lesser(Bdd u1, Bdd u2)
        {
            int u = Apply(Op.LESSER, u1.U, u2.U);

            return(Bdd.CreateBdd(u));
        }
Exemplo n.º 24
0
        /// <summary>
        /// Boolean operator not.
        /// </summary>
        /// <param name="u1">Bdd</param>
        /// <returns>Resulting Bdd</returns>
        public static Bdd Not(Bdd u1)
        {
            int u = Apply(Op.NOT, u1.U, u1.U);

            return(Bdd.CreateBdd(u));
        }
Exemplo n.º 25
0
        /// <summary>
        /// Substitution of a list of variablepairs in a Bdd.
        /// </summary>
        /// <param name="bpl">Variablepairlist</param>
        /// <param name="root">bdd</param>
        /// <returns>Resulting Bdd</returns>
        public static Bdd VarListCompose(BddPairList bpl, Bdd root)
        {
            int u = VarListCompose(ref bpl, root.U);

            return(Bdd.CreateBdd(u));
        }
Exemplo n.º 26
0
//#######################################################################################



        /// <summary>
        /// Universal quantification on a list of variables.
        /// </summary>
        /// <param name="varList">List of variables</param>
        /// <param name="root">bdd</param>
        /// <returns>Resulting Bdd</returns>
        public static Bdd VarListForAll(BddPairList varList, Bdd root)
        {
            int u = VarListQuantification(ref varList, root.U, Op.CON);

            return(Bdd.CreateBdd(u));
        }
Exemplo n.º 27
0
        /// <summary>
        /// Universal quatification on a variabel.
        /// </summary>
        /// <param name="var">Variable number</param>
        /// <param name="root">Bdd</param>
        /// <returns>Resulting Bdd</returns>
        public static Bdd ForAll(int var, Bdd root)
        {
            int u = ForAll(var, root.U);

            return(Bdd.CreateBdd(u));
        }
Exemplo n.º 28
0
        /// <summary>
        /// Boolean operator Nand.
        /// </summary>
        /// <param name="u1">Bdd</param>
        /// <param name="u2">Bdd</param>
        /// <returns>Resulting Bdd</returns>
        public static Bdd Nand(Bdd u1, Bdd u2)
        {
            int u = Apply(Op.NAND, u1.U, u2.U);

            return(Bdd.CreateBdd(u));
        }