Esempio n. 1
0
 private void ShowNewNetworkDialog()
 {
     using (var form = new PropertyGridForm("New Network"))
     {
         var networkDefinition = new AgentNetworkDefinition(null, 2, 26, 12);
         form.PropertyGrid.SelectedObject = networkDefinition;
         form.FormClosing += (s, closingEvent) =>
         {
             if (form.DialogResult == DialogResult.OK)
             {
                 try
                 {
                     var network = new AgentNetwork(networkDefinition, new He(0));
                     Workspace.Instance.Add(networkDefinition.Name, network);
                 }
                 catch (Exception exception)
                 {
                     closingEvent.Cancel = true;
                     MessageBox.Show(exception.Message, "New Network", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 }
             }
         };
         form.ShowDialog();
     }
 }
Esempio n. 2
0
        public AgentNetwork(AgentNetworkDefinition definition, ILayerInitializer initializer)
        {
            InputCoder = new AgentNetworkInputCoder(definition.ViewRadius);
            var lastLayer         = new NetworkLayerDefinition(definition.LastLayerActivationFunction, 1);
            var networkDefinition = new NetworkDefinition(InputCoder.EncodedSize, definition.Layers.Concat(new[] { lastLayer }));

            Network = NetworkBuilder.Build(networkDefinition, initializer);
        }
Esempio n. 3
0
        public static void InitialiseNetwork(string networkName, NeuralAgentTrainerConfiguration configuration)
        {
            var networkFile   = Workspace.Instance.GetNetworkFile(networkName);
            var createNetwork = true;

            if (networkFile.Exists)
            {
                var overwrite = MessageBox.Show($"Do you want to reset existing network '{networkName}'?", "Training", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                createNetwork = overwrite == DialogResult.Yes;
            }

            if (createNetwork)
            {
                var networkDefinition = new AgentNetworkDefinition(networkName, configuration.ViewRadius, configuration.LayersSizes);
                var network           = new AgentNetwork(networkDefinition, new He(configuration.NetworkSeed));
                Workspace.Instance.SaveNetwork(networkName, network, overwrite: true);
            }
        }