Esempio n. 1
0
        private void heuristicParams(GeneticAlgorithm GEForm)
        {
            int popSize;
            if (textBox10.Text == String.Empty) popSize = 100;
            else popSize = int.Parse(textBox10.Text);

            double mutRatio;
            if (textBox11.Text == String.Empty) mutRatio = 0.02;
            else mutRatio = double.Parse(textBox11.Text) / 100;

            double crossRatio;
            if (textBox9.Text == String.Empty) crossRatio = 0.99;
            else crossRatio = double.Parse(textBox9.Text) / 100;

            int takeBestC;
            if (textBox12.Text == String.Empty) takeBestC = 2;
            else takeBestC = int.Parse(textBox12.Text);

            GEForm.MutationRatio = mutRatio;
            GEForm.CrossingRatio = crossRatio;
            GEForm.TakeBestCount = takeBestC;
            GEForm.PopulationSize = popSize;
            GEForm.OptimalK = CutsCount;
        }
Esempio n. 2
0
 private void button4_Click(object sender, EventArgs e)
 {
     GeneticAlgorithm GEForm = new GeneticAlgorithm();
     GEForm.segments = allSegments;
     heuristicParams(GEForm);
     GEForm.Show();
 }