Ejemplo n.º 1
0
        private double UpdateMemoizedProbability(Peg peg, Memoization memoization)
        {
            var updatedMemoizedProbability = memoization.Probability;

            if (_pegNodeStack.PeekPeg().Equals(peg))
            {
                _pegNodeStack.Pop();
            }

            foreach (var pegNode in _pegNodeStack.AsList())
            {
                updatedMemoizedProbability = updatedMemoizedProbability * pegNode.Peg.Probability;
                pegNode.SetMemoization(memoization.Column, updatedMemoizedProbability);
            }

            return(updatedMemoizedProbability);
        }
Ejemplo n.º 2
0
 public IEnumerable <Memoization> GetMemoization()
 {
     return(_probabilityMemoization.Select(keyValue => Memoization.Create(keyValue.Key, keyValue.Value)));
 }