Example #1
0
        public void TestCheckModelValidContinuous(bool useDeprecatedNNModel)
        {
            var model = useDeprecatedNNModel ? ModelLoader.Load(continuousNNModel) : ModelLoader.Load(continuousONNXModel);
            var validBrainParameters = GetContinuous2vis8vec2actionBrainParameters();

            var errors = BarracudaModelParamLoader.CheckModel(
                model, validBrainParameters,
                new ISensor[] { new VectorSensor(8), sensor_21_20_3.CreateSensor(), sensor_20_22_3.CreateSensor() }, new ActuatorComponent[0]
                );

            Assert.AreEqual(0, errors.Count()); // There should not be any errors
        }
Example #2
0
        public void TestRunModel()
        {
            var actionSpec  = GetDiscrete1vis0vec_2_3action_recurrModelActionSpec();
            var modelRunner = new ModelRunner(discreteONNXModel, actionSpec);
            var info1       = new AgentInfo();

            info1.episodeId = 1;
            modelRunner.PutObservations(info1, new[] { sensor_21_20_3.CreateSensor() }.ToList());
            var info2 = new AgentInfo();

            info2.episodeId = 2;
            modelRunner.PutObservations(info2, new[] { sensor_21_20_3.CreateSensor() }.ToList());

            modelRunner.DecideBatch();

            Assert.IsFalse(modelRunner.GetAction(1).Equals(ActionBuffers.Empty));
            Assert.IsFalse(modelRunner.GetAction(2).Equals(ActionBuffers.Empty));
            Assert.IsTrue(modelRunner.GetAction(3).Equals(ActionBuffers.Empty));
            Assert.AreEqual(actionSpec.NumDiscreteActions, modelRunner.GetAction(1).DiscreteActions.Length);
            modelRunner.Dispose();
        }
Example #3
0
        public void TestRunModel()
        {
            var actionSpec  = GetDiscrete1vis0vec_2_3action_recurrModelActionSpec();
            var modelRunner = new ModelRunner(discrete1vis0vec_2_3action_recurrModel, actionSpec);
            var info1       = new AgentInfo();

            info1.episodeId = 1;
            modelRunner.PutObservations(info1, new[] { sensor_21_20_3.CreateSensor() }.ToList());
            var info2 = new AgentInfo();

            info2.episodeId = 2;
            modelRunner.PutObservations(info2, new[] { sensor_21_20_3.CreateSensor() }.ToList());

            modelRunner.DecideBatch();

            Assert.IsNotNull(modelRunner.GetAction(1));
            Assert.IsNotNull(modelRunner.GetAction(2));
            Assert.IsNull(modelRunner.GetAction(3));
            Assert.AreEqual(actionSpec.NumDiscreteActions, modelRunner.GetAction(1).Count());
            modelRunner.Dispose();
        }
Example #4
0
        public void TestRunModel()
        {
            var brainParameters = GetDiscrete1vis0vec_2_3action_recurrModelBrainParameters();
            var modelRunner     = new ModelRunner(discrete1vis0vec_2_3action_recurrModel, brainParameters);
            var info1           = new AgentInfo();

            info1.episodeId = 1;
            modelRunner.PutObservations(info1, new [] { sensor_21_20_3.CreateSensor() }.ToList());
            var info2 = new AgentInfo();

            info2.episodeId = 2;
            modelRunner.PutObservations(info2, new [] { sensor_21_20_3.CreateSensor() }.ToList());

            modelRunner.DecideBatch();

            Assert.IsNotNull(modelRunner.GetAction(1));
            Assert.IsNotNull(modelRunner.GetAction(2));
            Assert.IsNull(modelRunner.GetAction(3));
            Assert.AreEqual(brainParameters.VectorActionSize.Count(), modelRunner.GetAction(1).Count());
            modelRunner.Dispose();
        }