Ejemplo n.º 1
0
 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);
     }
 }
Ejemplo n.º 2
0
 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);
         }
     }
 }
Ejemplo n.º 3
0
        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);
            }
        }