/// <summary> /// Add a new item to the collection. /// </summary> /// <param name="mi">Specifies the item to add.</param> public void Add(MemoryItem mi) { if (!m_bPreLoaded) { m_mem.Add(mi); } }
/// <summary> /// Add a new item to the collection. /// </summary> /// <param name="m">Specifies the item to add.</param> public void Add(MemoryItem m) { int nIdx = m_mem.NextIndex; m_mem.Add(m); int nVal = (int)Math.Pow(m_fMaxPriority, m_fAlpha); m_ItSum[nIdx] = nVal; m_ItMin[nIdx] = nVal; }
/// <summary> /// Adds a new memory item to the array of items and if at capacity, removes an item. /// </summary> /// <param name="item">Specifies the memory item to add.</param> public virtual void Add(MemoryItem item) { m_rgItems[m_nNextIdx] = item; m_nNextIdx++; if (m_nNextIdx == m_rgItems.Length) { m_nNextIdx = 0; } if (m_nCount < m_rgItems.Length) { m_nCount++; } }
/// <summary> /// Save the memory items to file. /// </summary> /// <param name="strFile">Specifies the file name.</param> public void Save(string strFile) { if (File.Exists(strFile)) { File.Delete(strFile); } using (StreamWriter sw = new StreamWriter(strFile)) { for (int i = 0; i < Count; i++) { MemoryItem mi = m_rgItems[i]; string strLine = mi.CurrentData.ToArrayAsString(4) + "," + mi.Action.ToString() + "," + mi.Reward.ToString() + "," + (mi.IsTerminated ? 1 : 0).ToString() + "," + mi.NextData.ToArrayAsString(4); sw.WriteLine(strLine); } } }
/// <summary> /// Add a new item to the collection. /// </summary> /// <param name="m">Specifies the item to add.</param> public void Add(MemoryItem m) { m_mem.Add(m); }