Beispiel #1
0
        private void SetupTest()
        {
            var sceneSetup = Tester.SetupNextTest(Agent);

            //Run Test if tester have set up scene
            if (sceneSetup)
            {
                _testIsRunning = true;
                //End test run if tester says its over.
            }
            else
            {
                Tester.OnRunComplete();
                _testIsOver = true;
                if (Benchmark && BenchmarkSave.HaveRunsLeft)
                {
                    RemakeManager();
                    ModeOverride = QAIMode.Learning;
                    Mode         = QAIMode.Learning;
                    BenchmarkSave.NextRun();
                    Application.LoadLevel(Application.loadedLevel);
                }
                else
                {
                    EditorApplication.isPlaying = false;
                }
            }
        }
Beispiel #2
0
        private void EndOfEpisode()
        {
            if (_sceneIsOver)
            {
                return;
            }
            if (_qlearning.Iteration >= Terminator)
            {
                _qlearning.SaveModel();
                BenchmarkSave.WriteRunTime(_stopwatch.Elapsed.TotalSeconds);
                Debug.Log("Learning over after " + _stopwatch.Elapsed.TotalSeconds + " secounds");
                if (Benchmark)
                {
                    Debug.Log("Running Tester");

                    ModeOverride = QAIMode.Testing;
                    _qlearning.LoadModel();
                    Application.LoadLevel(Application.loadedLevel);
                }
                else
                {
                    EditorApplication.isPlaying = false;
                    EditorApplication.Beep();
                }
            }
            else
            {
                Application.LoadLevel(Application.loadedLevel);
                _qlearning.Iteration++;
            }
            _sceneIsOver = true;
        }
Beispiel #3
0
        public override void OnRunComplete()
        {
            var accuracy     = _results.Select(p => p.Value.Reward > 0.9 ? 1 : 0).Average();
            var avgDistScore = _results.Select(r => r.Value.DistScore).Average();

            Debug.Log(string.Format("Accuracy: {0:P} Avg. Distance Score: {1:F}", accuracy, avgDistScore));
            BenchmarkSave.WriteGridResult(accuracy, avgDistScore);
        }
Beispiel #4
0
        public override void OnRunComplete()
        {
            Running = false;
            var hits    = _scores.Select(ts => ts.Hits).Sum();
            var wins    = _scores.Select(ts => ts.GameWon ? 1 : 0).Sum();
            var avgDist = _scores.Select(ts => ts.BallDistance).Average();

            BenchmarkSave.WritePongResult(hits, wins, avgDist);
            Debug.Log(string.Format("Hits:{0:D} AvgDist:{1:F3} Wins:{2:D}", hits, avgDist, wins));
        }
Beispiel #5
0
 public override void OnRunComplete()
 {
     Debug.Log(string.Format("Time: {0:F} Crashes: {1:D} Distance: {2:F}", Time.time - _timeStart, _crashes, _maxDist));
     BenchmarkSave.WriteSlotResult(Time.time - _timeStart, _crashes, _maxDist);
 }