コード例 #1
0
 public void StartsPopulation()
 {
     chromoGens.Clear();
     chromoGens    = Chromossome.Creates(populationSize, rangeMin, rangeMax, granularity, random);
     chromoValue   = Chromossome.getPopulationValues(chromoGens, rangeMin, rangeMax, granularity, random);
     chromoFitness = Chromossome.getPopulationFitness(functionType, optimizationType, chromoValue);
 }
コード例 #2
0
 private void button2_Click(object sender, EventArgs e)
 {
     if (initflag == true)
     {
         chromoC = Crossover.TwoPoints(chromoP, 50, _random);
         richTextBox1.Clear();
         richTextBox2.Clear();
         for (int i = 0; i < chromoP.Count(); i++)
         {
             richTextBox1.AppendText(chromoP[i] + "\n");
             richTextBox2.AppendText(chromoC[i] + "\n");
         }
         chromoP = chromoC;
     }
     else
     {
         chromoP  = Chromossome.Creates(6, 0, 63, 0, _random);
         initflag = true;
     }
 }