/// <summary> /// Writes a list of genomes to the save file fitting the experiment name and the ExperimentFileType. /// </summary> private static bool WriteGenomes(INeatExperiment experiment, IList <NeatGenome> genomeList, ExperimentFileType fileType) { XmlWriterSettings _xwSettings = new XmlWriterSettings(); _xwSettings.Indent = true; string filePath = GetSaveFilePath(experiment.Name, fileType); DirectoryInfo dirInf = new DirectoryInfo(Application.persistentDataPath); if (!dirInf.Exists) { Debug.Log("ExperimentIO - Creating subdirectory"); dirInf.Create(); } try { using (XmlWriter xw = XmlWriter.Create(filePath, _xwSettings)) { NeatGenomeXmlIO.WriteComplete(xw, genomeList, false); Debug.Log("Successfully saved the genomes of the '" + fileType.ToString() + "' for the experiment '" + experiment.Name + "' to the location:\n" + filePath); } } catch (Exception e1) { Debug.Log("Error saving the genomes of the '" + fileType.ToString() + "' for the experiment '" + experiment.Name + "' to the location:\n" + filePath); return(false); } return(true); }
public void SavePopulation() { Debug.Assert(_GenomeList != null); XmlWriterSettings xwSettings = new XmlWriterSettings(); xwSettings.Indent = true; using (XmlWriter xw = XmlWriter.Create(_GenomeFile, xwSettings)) { NeatGenomeXmlIO.WriteComplete(xw, _GenomeList, false); } }
public void SavePopulation(string filename) { XmlWriterSettings _xwSettings = new XmlWriterSettings(); _xwSettings.Indent = true; Directory.CreateDirectory(Application.dataPath + HelperConstants.saveDirectory); using (XmlWriter xw = XmlWriter.Create(Application.dataPath + HelperConstants.saveDirectory + filename, _xwSettings)) { NeatGenomeXmlIO.WriteComplete(xw, _ea.GenomeList, false); } SaveLoad.Load(); }
public void Save() { var previouslyTraining = evolutionAlgorithm.RunState == RunState.Running; if (previouslyTraining) { PauseTraining(); } using (var writer = XmlWriter.Create("SavedProgress.xml")) NeatGenomeXmlIO.WriteComplete(writer, evolutionAlgorithm.GenomeList, true); if (previouslyTraining) { StartTraining(); } }
public void SavePopulation(XmlWriter xw, IList <NeatGenome> genomeList) { NeatGenomeXmlIO.WriteComplete(xw, genomeList, false); }
/// <summary> /// Save a population of genomes to an XmlWriter. /// </summary> public void SavePopulation(XmlWriter xw, IList <NeatGenome> genomeList) { // Writing node IDs is not necessary for NEAT. NeatGenomeXmlIO.WriteComplete(xw, genomeList, false); }
public void SavePopulation(XmlWriter xw, IList <NeatGenome> genomeList) { NeatGenomeXmlIO.WriteComplete(xw, genomeList, true); //true for hyper neat false for reg }