private void 开始神经网络训练ToolStripMenuItem_Click(object sender, EventArgs e) { Thread learning = new Thread(delegate() { GameAINeuroEvolutionaryLearning GANEL; if (File.Exists(Settings.DATA_FILENAME)) { FileStream file = new FileStream(Settings.DATA_FILENAME, FileMode.Open); GANEL = new GameAINeuroEvolutionaryLearning(Settings.POPULATION, file); } else { GANEL = new GameAINeuroEvolutionaryLearning(Settings.POPULATION); } for (int i = 0; i < Settings.EPOCH; i++) { GANEL.RunEpoch(); MultipleThread_MessageBox box = new MultipleThread_MessageBox(i, GANEL.BestChromosome.Fitness); Thread thread = new Thread(box.MessageBox); thread.Start(); } GANEL.BestChromosome.Save(Settings.DATA_FILENAME); GANEL.population[0].Save(Settings.DATA_FILENAME); MessageBox.Show("训练完成,数据已保存"); }); learning.Start(); }
private void 开始神经网络训练ToolStripMenuItem_Click(object sender, EventArgs e) { Thread learning = new Thread(delegate () { GameAINeuroEvolutionaryLearning GANEL; if (File.Exists(Settings.DATA_FILENAME)) { FileStream file = new FileStream(Settings.DATA_FILENAME, FileMode.Open); GANEL = new GameAINeuroEvolutionaryLearning(Settings.POPULATION, file); } else { GANEL = new GameAINeuroEvolutionaryLearning(Settings.POPULATION); } for (int i = 0; i < Settings.EPOCH; i++) { GANEL.RunEpoch(); MultipleThread_MessageBox box = new MultipleThread_MessageBox(i, GANEL.BestChromosome.Fitness); Thread thread = new Thread(box.MessageBox); thread.Start(); } GANEL.BestChromosome.Save(Settings.DATA_FILENAME); GANEL.population[0].Save(Settings.DATA_FILENAME); MessageBox.Show("训练完成,数据已保存"); }); learning.Start(); }