コード例 #1
0
        public void TestStoreInitalize()
        {
            var fileSystem = new MockFileSystem();
            var demoStore  = new DemonstrationStore(fileSystem);

            Assert.IsFalse(fileSystem.Directory.Exists(k_DemoDirecory));

            var brainParameters = new BrainParameters
            {
                vectorObservationSize        = 3,
                numStackedVectorObservations = 2,
                vectorActionDescriptions     = new[] { "TestActionA", "TestActionB" },
                vectorActionSize             = new[] { 2, 2 },
                vectorActionSpaceType        = SpaceType.Discrete
            };

            demoStore.Initialize(k_DemoName, brainParameters, "TestBrain");

            Assert.IsTrue(fileSystem.Directory.Exists(k_DemoDirecory));
            Assert.IsTrue(fileSystem.FileExists(k_DemoDirecory + k_DemoName + k_ExtensionType));

            var agentInfo = new AgentInfo
            {
                reward              = 1f,
                actionMasks         = new[] { false, true },
                done                = true,
                id                  = 5,
                maxStepReached      = true,
                storedVectorActions = new[] { 0f, 1f },
            };

            demoStore.Record(agentInfo);
            demoStore.Close();
        }
コード例 #2
0
ファイル: DemonstrationTests.cs プロジェクト: Mrgove10/snAIke
        public void TestStoreInitalize()
        {
            var fileSystem = new MockFileSystem();
            var demoStore  = new DemonstrationStore(fileSystem);

            Assert.IsFalse(fileSystem.Directory.Exists(DemoDirecory));

            var brainParameters = new BrainParameters
            {
                vectorObservationSize        = 3,
                numStackedVectorObservations = 2,
                cameraResolutions            = new [] { new Resolution() },
                vectorActionDescriptions     = new [] { "TestActionA", "TestActionB" },
                vectorActionSize             = new [] { 2, 2 },
                vectorActionSpaceType        = SpaceType.discrete
            };

            demoStore.Initialize(DemoName, brainParameters, "TestBrain");

            Assert.IsTrue(fileSystem.Directory.Exists(DemoDirecory));
            Assert.IsTrue(fileSystem.FileExists(DemoDirecory + DemoName + ExtensionType));

            var agentInfo = new AgentInfo
            {
                reward             = 1f,
                visualObservations = new List <Texture2D>(),
                actionMasks        = new [] { false, true },
                done                     = true,
                id                       = 5,
                maxStepReached           = true,
                memories                 = new List <float>(),
                stackedVectorObservation = new List <float>()
                {
                    1f, 1f, 1f
                },
                storedTextActions   = "TestAction",
                storedVectorActions = new [] { 0f, 1f },
                textObservation     = "TestAction",
            };

            demoStore.Record(agentInfo);
            demoStore.Close();
        }