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; } } }
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; }
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); }
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)); }
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); }