Ejemplo n.º 1
0
        /// <summary>
        /// Crteate a Boolean decision tree.
        /// References to solver and domain are not saved in the resulting decision tree.
        /// </summary>
        /// <param name="solver">character alberbra</param>
        /// <param name="domain">elements that map to true</param>
        /// <param name="precomputeLimit">upper limit for block ids for characters to be precomputed in an array (default is 0xFF, i.e. extended ASCII)</param>
        /// <returns></returns>
        internal static BooleanDecisionTree Create(CharSetSolver solver, BDD domain, ushort precomputeLimit = 0xFF)
        {
            BDD domain_compl = solver.MkNot(domain);
            var partition    = new BDD[] { domain_compl, domain };

            if (precomputeLimit == 0)
            {
                return(new BooleanDecisionTree(new bool[] { }, MkBST(new DecisionTree.PartitionCut(solver, partition), 0, 0xFFFF)));
            }

            bool[]           precomp = Precompute(solver, domain, precomputeLimit);
            DecisionTree.BST bst     = null;
            if (precomputeLimit < ushort.MaxValue)
            {
                bst = MkBST(new DecisionTree.PartitionCut(solver, partition), precomputeLimit + 1, ushort.MaxValue);
            }

            return(new BooleanDecisionTree(precomp, bst));
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Deserialize
 /// </summary>
 public BooleanDecisionTree(SerializationInfo info, StreamingContext context)
 {
     precomputed = DeserializePrecomputed(info.GetString("p"));
     this.bst    = DecisionTree.BST.Deserialize(info.GetString("b"));
 }
Ejemplo n.º 3
0
 internal BooleanDecisionTree(bool[] precomputed, DecisionTree.BST bst)
 {
     this.precomputed = precomputed;
     this.bst         = bst;
 }
Ejemplo n.º 4
0
 private BooleanDecisionTree(bool[] precomputed, DecisionTree.BST bst, BDD domain)
 {
     this.precomputed = precomputed;
     this.bst         = bst;
     this.domain      = domain;
 }