Exemple #1
0
            /// <summary>
            /// 次の状態を記録する
            /// </summary>
            /// <param name="state">次の状態</param>
            /// <param name="appended">次の状態に紐付く添付オブジェクト</param>
            /// <remarks></remarks>
            private void Memorize(string state, object appended = null)
            {
                if (!_pastToExpected.ContainsKey(_currentState))
                {
                    _pastToExpected.Add(_currentState, new ExpectedStates());
                }
                _pastToExpected[_currentState].AddExpectedState(state, appended);

                _currentState = _currentState.GetNextPastStates(state);
            }
Exemple #2
0
            private ExpectedState[] GetExpectedStateRank(PastStates currentState, double provably, int depth)
            {
                if (depth <= 0)
                {
                    return(new ExpectedState[] { });
                }

                if (!_pastToExpected.ContainsKey(currentState))
                {
                    return(new ExpectedState[] { });
                }

                ExpectedState[] nextExpectedStates = _pastToExpected[currentState].GetExpectedStateRank(provably, _predictWidth);
                foreach (ExpectedState nextExpectedState in nextExpectedStates)
                {
                    _bestRank.AddRange(this.GetExpectedStateRank(currentState.GetNextPastStates(nextExpectedState.State), nextExpectedState.Provably, depth - 1));
                }

                return(nextExpectedStates);
            }
Exemple #3
0
 /// <summary>
 /// コンストラクタ
 /// </summary>
 /// <param name="stateNumber">保持する状態数</param>
 /// <param name="predictDepth">予測範囲とする遷移回数</param>
 /// <remarks></remarks>
 public MarkovPredictor(int stateNumber, int predictDepth)
 {
     _stateNumber  = stateNumber;
     _predictDepth = predictDepth;
     _currentState = new PastStates(_stateNumber);
 }