Ejemplo n.º 1
0
        public void Push_More_Than_Capacity()
        {
            ExperienceReplay memory = new ExperienceReplay(10);

            AddRandomTransitions(memory, 15);
            Assert.AreEqual(memory.GetSize(), 10);
        }
Ejemplo n.º 2
0
        public void Push_Valid_Transition()
        {
            ExperienceReplay memory = new ExperienceReplay(1);

            Assert.AreEqual(memory.GetSize(), 0);
            AddRandomTransitions(memory, 1);
            Assert.AreEqual(memory.GetSize(), 1);
        }
Ejemplo n.º 3
0
        private void AddRandomTransitions(ExperienceReplay memory, int count)
        {
            Random random = new Random();

            for (int i = 0; i < count; ++i)
            {
                memory.Push(new Experience(new Tensor(new Shape(1)), new Tensor(new Shape(1)), (float)random.NextDouble(), new Tensor(new Shape(1)), false));
            }
        }
Ejemplo n.º 4
0
        public void Sample_2_Out_Of_5()
        {
            ExperienceReplay memory = new ExperienceReplay(5);

            AddRandomTransitions(memory, 5);
            var sample = memory.Sample(2);

            Assert.AreEqual(sample.Count, 2);
        }
Ejemplo n.º 5
0
        public void Push_Null()
        {
            ExperienceReplay memory = new ExperienceReplay(1);

            memory.Push(null);
        }