Esempio n. 1
0
        private double calculateProbabilityOf(STATE_TYPE state, ACTION_TYPE action)
        {
            if (state == null)
            {
                return(0.0);
            }
            Double den = 0.0;
            Double num = 0.0;

            foreach (Pair <STATE_TYPE, ACTION_TYPE> stateActionPair in stateActionCount
                     .getStates())
            {
                if (stateActionPair.getFirst() == null)
                {
                    continue;
                }
                if (stateActionPair.getFirst().Equals(state))
                {
                    den += 1;
                    if (stateActionPair.getSecond().Equals(action))
                    {
                        num += 1;
                    }
                }
            }
            return(num / den);
        }