private void RandomiseAgentNetwork(ListViewItem item) { if (item.Tag is NeuralSimulationPluginFactory pluginFactory) { var networkFile = Workspace.Instance.GetNetworkFile(pluginFactory.Network); var network = new AgentNetwork(networkFile); network.InitializeLayers(0); network.Save(networkFile); } }
public override void OnSimulationCompleted() { if (TrainingMode) { if (MessageBox.Show("Do you want to update neural network?", "Training", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { Network.Save(NetworkFile); } } }
public void SaveNetwork(string name, AgentNetwork network, bool overwrite) { if (string.IsNullOrWhiteSpace(name)) { throw new ArgumentException($"Name can't be empty."); } var fileName = GetNetworkFileName(name); var networkFile = NetworksDirectory.GetFile(fileName); if (networkFile.Exists && overwrite == false) { throw new ArgumentException($"File '{fileName}' already exists."); } else { network.Save(networkFile); } }