/// \fn     public void MSetObservation(int _index, T _observation)
        ///
        /// \brief  Sets an observation's value
        ///
        /// \author Khoubaeib Klai | [email protected]
        /// \date   24/04/2014
        ///
        /// \param  _index       the concerned observation.
        /// \param  _observation observation's new value.
        public void MSetObservation(int _index, T _observation)
        {
            AKN_Node <T> node = (AKN_Node <T>)(_m_NodeDict[_m_ObservationsGUID[_index]].Clone());

            node.m_value = _observation;
            _m_NodeDict[_m_ObservationsGUID[_index]] = node;
        }
            /// \fn public AKN_Node<T> MAddNode(T _value)
            ///
            /// \brief  create a node with the value T and connect it.
            ///
            /// \author Ze Taupe
            /// \date   13/07/2011
            ///
            /// \param  _value  The value.
            ///
            /// \return The node added.
            public AKN_Node <T> MAddNode(T _value)
            {
                AKN_Node <T> nodeToAdd = new AKN_Node <T>(_value);

                _m_NodeDict.Add(nodeToAdd.m_id, nodeToAdd);

                return(nodeToAdd);
            }
Ejemplo n.º 3
0
 public AKN_State this[int _index]
 {
     get { return(((AKN_Node <AKN_State>)m_NodeDict[_m_StatesGUID[_index]]).m_value); }
     set
     {
         AKN_Node <AKN_State> nodeToSet = (AKN_Node <AKN_State>)_m_NodeDict[_m_StatesGUID[_index]].Clone();
         nodeToSet.m_value = value;
         _m_NodeDict[_m_StatesGUID[_index]] = nodeToSet;
     }
 }
 /// \fn     public AKN_HiddenMarkovModel(int _statesCount, int _observationsCount)
 ///
 /// \brief  HMM constructor, Creates an HMM with a defined numbers of states and observations.
 ///
 /// \author Khoubaeib Klai | [email protected]
 /// \date   24/04/2014
 ///
 /// \param  _statesCount       number of states in the HMM.
 /// \param  _observationsCount number of observations in the HMM.
 private void _MInitObservations(int _observationsCount)
 {
     _m_ObservationsGUID = new Guid[_observationsCount];
     for (int i = 0; i < _observationsCount; i++)
     {
         AKN_Node <T> observation = new AKN_Node <T>();
         _m_ObservationsGUID[i] = observation.m_id;
         MAddNode(observation);
     }
 }
Ejemplo n.º 5
0
 /// \fn     public void _MInitStates(int _statesCount)
 ///
 /// \brief  Inits Markov model states.
 ///
 /// \author Khoubaeib Klai | [email protected]
 /// \date   24/04/2014
 ///
 /// \version 1.0
 ///
 /// \param  _statesCount number of states in the MM.
 private void _MInitStates(int _statesCount)
 {
     _m_StatesGUID = new Guid[_statesCount];
     for (int i = 0; i < _statesCount; i++)
     {
         AKN_Node <AKN_State> state = new AKN_Node <AKN_State>();
         state.m_value    = new AKN_State(0, "");
         _m_StatesGUID[i] = state.m_id;
         MAddNode(state);
     }
 }
            /// \fn public List<AKN_Node<T>> MFindAllNodeWithValue(T _t)
            ///
            /// \brief  Searches for all node with the given t.
            ///
            /// \author Ze Taupe
            /// \date   13/07/2011
            ///
            /// \param  _t  The value to Find.
            ///
            /// \return the list of all the node with this value.
            public List <AKN_Node <T> > MFindAllNodeWithValue(T _t)
            {
                List <AKN_Node <T> > toReturn = new List <AKN_Node <T> >();

                foreach (KeyValuePair <Guid, AKN_Node_Base> kvp in _m_NodeDict)
                {
                    AKN_Node <T> toCheck = kvp.Value as AKN_Node <T>;
                    if (toCheck.m_value.Equals(_t))
                    {
                        toReturn.Add(toCheck);
                    }
                }
                return(toReturn);
            }
            /// \fn public T MGetValueAt(int _index)
            ///
            /// \brief  get the value at index.
            ///
            /// \author Ze Taupe
            /// \date   13/07/2011
            ///
            /// \param  _index  Zero-based index of the.
            ///
            /// \return The value at index.
            public T MGetValueAt(int _index)
            {
                AKN_Node <T> nodeBuffer = MGetNode(_index) as AKN_Node <T>;

                return(nodeBuffer.m_value);
            }