Пример #1
0
        public void TestWriteDiscreteActionMask()
        {
            var manager = new ActuatorManager(2);
            var va1     = new TestActuator(ActionSpec.MakeDiscrete(new[] { 1, 2, 3 }), "name");
            var va2     = new TestActuator(ActionSpec.MakeDiscrete(new[] { 3, 2, 1 }), "name1");

            manager.Add(va1);
            manager.Add(va2);

            var groundTruthMask = new[]
            {
                false,
                true, false,
                false, true, true,
                true, false, true,
                false, true,
                false
            };

            va1.Masks = new[]
            {
                Array.Empty <int>(),
                new[] { 0 },
                new[] { 1, 2 }
            };

            va2.Masks = new[]
            {
                new[] { 0, 2 },
                new[] { 1 },
                Array.Empty <int>()
            };
            manager.WriteActionMask();
            Assert.IsTrue(groundTruthMask.SequenceEqual(manager.DiscreteActionMask.GetMask()));
        }