Esempio n. 1
0
        public Node(List <FinalLeaf> leaves, int numAlgs)
        {
            var prob = new Fraction(0, 1);

            foreach (var leaf in leaves)
            {
                prob += leaf.Probability;
            }
            Probability = prob;
            Leaves      = leaves.Select(x => new FinalLeaf(x.Cycles, x.Probability * prob.GetReciprical(), x.NumTwisted)).ToList();
            NumAlgs     = numAlgs;
        }
Esempio n. 2
0
        public CombinationNode(List <CombinationLeaf> leaves, int numAlgs)
        {
            var prob = new Fraction(0, 1);

            foreach (var leaf in leaves)
            {
                prob += leaf.Probability;
            }
            Probability = prob;
            foreach (var leaf in leaves)
            {
                leaf.Probability *= prob.GetReciprical();
            }
            NumAlgs = numAlgs;
            Leaves  = leaves;
        }