public static void AdvanceGeneration() { Debug.Log("Advancing generation!"); if (GameObject.FindObjectOfType <UIStatusWindow>() == null) { Debug.Log("No ui window, so wont perform another run"); return; } GameObject[] braids = GameObject.FindGameObjectsWithTag("Braid"); string[] braidFiles = new string[populationSize]; int index = 0; foreach (GameObject braid in braids) { if (braid.GetComponent <MaterialScript>().selected) { braidFiles[index] = braid.name; } else { braidFiles[index] = ""; } Destroy(braid); index++; } StoryboardUtility.SaveGenerationData(braidFiles, generation++); ResetSimulationValues(); IECManager.SetUIToModellingState(populationSize); }
public void StopEA() { if (_ea != null && _ea.RunState == SharpNeat.Core.RunState.Running) { _ea.Stop(); Debug.Log("Stoping EA"); IECManager.SetUIToExitState(); BraidSimulationManager.SetShouldBraidsEvaluate(false); } }
public void SendMessageToGH() { Debug.Log("Starting to send messages, currently have: " + braids.Count); StartSendingMessages = true; IECManager.SetUIToModellingState(m_populationSize); //string s = JsonHelper.CreateJSONFromBraids(m_populationSize, m_braidList); //Debug.Log(s); //sender.SendString(s); }
public void InitializeEA() { // set up network structure from dropdown XmlDocument xmlConfig = new XmlDocument(); TextAsset textAsset = (TextAsset)Resources.Load("ExperimentSetups/experiment.config.braid.cppn.split"); // load in XML xmlConfig.LoadXml(textAsset.text); // set up experiment experiment = new CPPNExperiment(); experiment.Initialize("Braid Experiment", xmlConfig.DocumentElement, 0, 0); experiment.SetOptimizer(this); // set up network variables messenger = GameObject.FindObjectOfType <ModelMessenger>(); PopulationSize = XmlUtils.GetValueAsInt(xmlConfig.DocumentElement, "PopulationSize"); messenger.SetupEvolutionParameters(PopulationSize); UnitContainer = GameObject.Find("UnitContainer"); if (!UnitContainer) { UnitContainer = new GameObject("UnitContainer"); } // setup the relevant ui IECManager.SetUIToEvolvingState(); BraidSimulationManager.populationSize = PopulationSize; BraidSimulationManager.evaluationsMade = 0; // clean up folders FindObjectOfType <StoryboardUtility>().InitializeStoryboardUtility(); // start the EA Generation = 0; StartEA(); }
public void HideUI() { IECManager.HideUI(); }
protected void ea_UpdateEvent(object sender, EventArgs e) { Fitness = _ea.Statistics._maxFitness; Generation = _ea.CurrentGeneration; IECManager.SetGeneration(Generation); }