public void Reproduction()
 {
     chromoGens = Crossover.doCrossover(crossoverType, chromoGens, probabilityCrossover, random);
     //chromoGens = Mutation.doMutation(1, chromoGens, probabilityMutation, random);
     chromoValue   = Chromossome.getPopulationValues(chromoGens, rangeMin, rangeMax, granularity, random);
     chromoFitness = Chromossome.getPopulationFitness(functionType, optimizationType, chromoValue);
 }
 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);
 }
示例#3
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;
     }
 }
 public void SelectParents()
 {
     chromoGens    = Selection.doSelection(selectionType, chromoGens, chromoFitness, random);
     chromoValue   = Chromossome.getPopulationValues(chromoGens, rangeMin, rangeMax, granularity, random);
     chromoFitness = Chromossome.getPopulationFitness(functionType, optimizationType, chromoValue);
 }