예제 #1
0
파일: Simulator.cs 프로젝트: sondreluc/EA
 public Simulator(MinCogPhenotype phenotype)
 {
     InitializeComponent();
     _random = new Random();
     sim = new MinCogSimulator(phenotype);
     foreach (var h in phenotype.HiddenNodes)
     {
         System.Diagnostics.Debug.WriteLine("Hidden");
         System.Diagnostics.Debug.WriteLine("g:" + h.Gain);
         System.Diagnostics.Debug.WriteLine("t:" + h.TimeConstant);
         foreach (var v in h.UpstreamConnections)
         {
             System.Diagnostics.Debug.WriteLine(v.left.Name + " : " + v.right);
         }
     }
     foreach (var h in phenotype.OutputNodes)
     {
         System.Diagnostics.Debug.WriteLine("Output");
         System.Diagnostics.Debug.WriteLine("g:" + h.Gain);
         System.Diagnostics.Debug.WriteLine("t:" + h.TimeConstant);
         foreach (var v in h.UpstreamConnections)
         {
             System.Diagnostics.Debug.WriteLine(v.left.Name + " : " + v.right);
         }
     }
     testNet(phenotype);
 }
예제 #2
0
 public override void CalculateFitness(AbstractPhenotype phenotype)
 {
     var sim = new MinCogSimulator.MinCogSimulator((MinCogPhenotype)phenotype);
     sim.Simulate();
     double score = sim.GoodHits - sim.BadHits;
     phenotype.Fitness = (score > 0) ? score : 0;
 }