public void EndRound() { this.userIsWalking = false; if (this.simuMode == SimuMode.Test) { this.simuEnded = true; Debug.Log("User arrived at destination."); } else if (this.simuMode == SimulationManager.SimuMode.Learn) { this.ResetEpisode(); this.statisticsLogger.EndLogging(); // Stop when meets the max episode GridEnvironment grid_env = GameObject.Find("GridEnv").GetComponent(typeof(GridEnvironment)) as GridEnvironment; grid_env.done = true; if (grid_env.episodeCount == grid_env.episodeMax) { this.simuEnded = true; if (grid_env.saveQTable) { ((QLearningAgent)grid_env.agent).SaveQTable("Assets/Resources/qtable.txt"); } // Log All Summary Statistics To File this.statisticsLogger.LogExperimentSummaryStatisticsResultsSCSV(this.statisticsLogger.experimentResults); Debug.Log("Statistics complete"); } } }
// Start is called before the first frame update void Start() { Debug.Log("The QLearning Redirector has been created"); grid_env = GameObject.Find("GridEnv").GetComponent(typeof(GridEnvironment)) as GridEnvironment; gains = new List <float> { 0, -6f * Mathf.Deg2Rad, -15f * Mathf.Deg2Rad, 6f * Mathf.Deg2Rad, 15f * Mathf.Deg2Rad }; }
public void InitilizeGrid() { var grid = new GridEnvironment(3); var exepctedGrid = new List<ICell> { new Cell(new Position(0, 0)), new Cell(new Position(0, 1)), new Cell(new Position(0, 2)), new Cell(new Position(1, 0)), new Cell(new Position(1, 1)), new Cell(new Position(1, 2)), new Cell(new Position(2, 0)), new Cell(new Position(2, 1)), new Cell(new Position(2, 2)) }; var comparer = new CellComparer(); CollectionAssert.AreEqual(exepctedGrid, grid.Grid, comparer); }
public RecursiveSubdivision(GridEnvironment env) : base(env) { Env = env; if (Env.GetType() == typeof(HexagonGridEnvironment)) { MinGap = 2; } // change min gap to two if hex env Random = new Random(); Layers = new Stack <RecursiveSubdivisionParameter>(); NodesToChange = new Queue <Node>(); Layers.Push(new RecursiveSubdivisionParameter(true, 0, env.Shape.Item1, 0, env.Shape.Item2)); Run(); }
// Use this for initialization void Start() { simulatedTime = 0; this.redirectionManager.Initialize(); // Setting Random Seed UnityEngine.Random.InitState(VirtualPathGenerator.RANDOM_SEED); // Make sure VSync doesn't slow us down //Debug.Log("Application.targetFrameRate: " + Application.targetFrameRate); if (this.runAtFullSpeed && this.enabled) { //redirectionManager.topViewCamera.enabled = false; //drawVirtualPath = false; QualitySettings.vSyncCount = 0; } // Start Simulation // Setup Trail Drawing this.trailDrawer.enabled = !this.runAtFullSpeed; // Enable Waypoint userIsWalking = !(motionManager.movementController == MotionManager.MovementController.AutoPilot); this.motionManager.Initialize(); switch (this.simuMode) { case SimuMode.Test: GameObject.FindWithTag("LearningUI").SetActive(false); break; case SimuMode.Learn: GameObject.FindWithTag("LearningUI").SetActive(true); GridEnvironment grid_env = GameObject.Find("GridEnv").GetComponent(typeof(GridEnvironment)) as GridEnvironment; grid_env.Initialize(); break; case SimuMode.Experiment: break; } }
protected override void InnerInitialize() { environment = new GridEnvironment(Length, Width, this); }