Пример #1
0
 static void OnBestArrived(object sender, BestBodyArrivedToPopulationEventArgs e)
 {
     lock (cl)
     {
         var plannedNetwork = (ConfiguredNeuralNetworkBody)e.Body;
         var network = plannedNetwork.CreateNetwork();
         string state = plannedNetwork.IsFunctional ? "*** PASSED ***" : "--- BEST ---";
         Console.WriteLine("\n{0}\n\nError: {1}, Synapses: {2}, Neurons: {3}, Genes: {4}",
                 state,
                 plannedNetwork.Error,
                 plannedNetwork.ConnectionCount,
                 plannedNetwork.NodeCount,
                 plannedNetwork.Plan.Genes.Count);
         Console.WriteLine("Connections: {0}", GetConnectionsAsString(network));
         Console.WriteLine("Nodes: {0}", GetNodesAsString(network));
     }
 }
Пример #2
0
 static void OnBestArrived(object sender, BestBodyArrivedToPopulationEventArgs e)
 {
     lock (cl)
     {
         var plannedNetwork = (AdjustedNeuralNetworkBody)e.Body;
         string state = plannedNetwork.Error <= 0.0001 ? "*** PASSED ***" : "--- BEST ---";
         Console.WriteLine("\n{0}\n\nError: {1}",
                 state,
                 plannedNetwork.Error.ToString("0.000000"));
         Console.WriteLine(
             plannedNetwork.TestResult.Computation.ComputeOutput(
             (NeuralNetwork)plannedNetwork.Parameters.Network,
             new List<double> { 4.4 })[0]); // 19.36
     }
 }
Пример #3
0
 static void OnBestArrived(object sender, BestBodyArrivedToPopulationEventArgs e)
 {
     lock (cl)
     {
         var plannedNetwork = (ConfiguredLogicalNetworkBody)e.Body;
         var network = plannedNetwork.CreateNetwork();
         string state = plannedNetwork.IsFunctional ? "*** PASSED ***" : "--- BEST ---";
         Console.WriteLine("\n{0}\n\nError: {1}, Connections: {2}, Gates: {3}, Genes: {4}, Time: {5}",
                 state,
                 plannedNetwork.TestResult.GetErrors().Sum(),
                 plannedNetwork.ConnectionCount,
                 plannedNetwork.NodeCount,
                 plannedNetwork.Plan.Genes.Count,
                 sw.Elapsed.TotalSeconds);
         //Console.WriteLine("Connections: {0}", GetConnectionsAsString(network));
         //Console.WriteLine("Nodes: {0}", GetNodesAsString(network));
     }
 }
Пример #4
0
 protected virtual void OnBestBodyArrived(BestBodyArrivedToPopulationEventArgs e)
 {
     var handler = BestBodyArrived;
     if (handler != null) handler(this, e);
 }