void EndRun(int[] _ids) { FinishedStop = true; print("End of simulation run"); string fileName = simulationType + "Pop " + population + " - Freq " + mutationFrequency + " - Amp " + mutationAmount + " - GenNo " + (generation - 1) + " " + System.DateTime.Now.ToString("dd-MM-yyyy_hh-mm-ss"); PerformanceRecorder.Save(performanceList.ToArray(), fileName); //store this generation to file SaveAndLoadParams.SaveData(fileName, currentGenParameters[_ids[0]], performanceList.ToArray()); }
void Start() { GameObject obj = GameObject.FindGameObjectWithTag("ohd"); if (obj != null) { displayInfo = obj.GetComponent <Text>(); } //create 0th generation of parameter sets currentGenParameters = new NetParameters[population]; //generate random weights and biases for 0th generation, set id and generation id //testParams = NetParameters.SetUniformValues(0, 0, 2f, 2f); for (int i = 0; i < currentGenParameters.Length; i++) { //currentGenParameters[i] = new NetParameters(NetParameters.SetRandomValues(i, generation, startVariation, 0)); //currentGenParameters[i] = new NetParameters(testParams); if (loadData) { currentGenParameters[i] = SaveAndLoadParams.LoadData(fileToLoad); } else { currentGenParameters[i] = new NetParameters(NetParameters.SetRandomValues(i, generation, startVariation, 0)); } } generation = currentGenParameters[0].generation; if (loadData) { performanceList = SaveAndLoadParams.LoadDataPerformanceHistory(fileToLoad).ToList(); } //spaun simulation with generation 00 paramters currentGeneration = SpaunNewGeneration(currentGenParameters); }