public Hyperparameters Copy(Hyperparameters individ, string source, string destination) { Hyperparameters H = individ.Clone(); var algorithmBranches = H.getNodesByparentID(H.getNodeByName("committee")[0].ID); List <Hyperparameters> hs = new List <Hyperparameters>(); for (int j = 0; j < algorithmBranches.Count; j++) { var h = new Hyperparameters(H.toJSON(algorithmBranches[j].ID), form1); var new_save_folder = destination + "\\" + h.getValueByName("model_name") + "\\"; //новые пути прописываются в h.json автоматически, если передать объект Hyperparameters по ссылке, а не по значению Algorithm.CopyFiles(h, h.getValueByName("save_folder"), new_save_folder); hs.Add(h); } //удаление старых записей for (int i = 0; i < algorithmBranches.Count; i++) { H.deleteBranch(algorithmBranches[i].ID); } //приращение новых записей к узлу "committee" for (int i = 0; i < algorithmBranches.Count; i++) { H.addBranch(hs[i], hs[i].nodes[0].name(), H.getNodeByName("committee")[0].ID); } H.setValueByName("report_path", destination); H = H.Clone(); File.WriteAllText(destination + "\\h.json", H.toJSON(0), System.Text.Encoding.Default); return(H); }
private void refreshEOTree() { E = new Hyperparameters(form1, "Expert_Population"); for (int i = 0; i < population_value; i++) { E.addBranch(population[i], population[i].nodes[0].name(), 0); } }