예제 #1
0
        private double CalculateProbabilityOf(TState state, TAction action)
        {
            double den = 0.0;
            double num = 0.0;

            foreach (Pair <TState, TAction> stateActionPair in stateActionCount.GetStates())
            {
                if (stateActionPair.GetFirst().Equals(state))
                {
                    den += 1;
                    if (stateActionPair.GetSecond().Equals(action))
                    {
                        num += 1;
                    }
                }
            }
            return(num / den);
        }