Example #1
0
 public AlgoSettings(SelectionStrategy strategy, StopCriterion stop, 
     uint populationSize, uint crossoverCount, float mutationRate, int crossover)
 {
     this.strategy = strategy;
         this.stop = stop;
         this.populationSize = populationSize;
         this.crossoverCount = crossoverCount;
         this.mutationRate = mutationRate;
         this.crossover = crossover;
     //Das ist ein Test
 }
        /// <summary>
        /// Author: Philipp Klein
        /// </summary>
        public void getParameter()
        {
            int count = 0;

            StopCriterion[] stop = new StopCriterion[3];
            AlgoSettings algoSettings = new AlgoSettings();

            algoSettings.strategy = (SelectionStrategy)sele.SelectedValue;
            algoSettings.populationSize = (uint)popu.Value;
            algoSettings.crossoverCount = Convert.ToUInt32(cross.Text);
            algoSettings.mutationRate = (float)muta.Value;

            if (Number_of_generations.IsChecked == true)
            {
                maxGeneration gen = new maxGeneration(Convert.ToUInt32(numGen.Text));
                stop[count] = gen;
                count++;
            }
            if (Runtime__s_.IsChecked == true)
            {
                Runtime run = new Runtime(Convert.ToUInt32(runTime.Text));
                stop[count] = run;
                count++;
            }
            if (Fitness__ms_.IsChecked == true)
            {
                Fitness fit = new Fitness(Convert.ToUInt32(fitness.Text));
                stop[count] = fit;
                count++;
            }
            StopCriterion[] s = new StopCriterion[count];

            for (int i = 0; i < count; i++)
                s[i] = stop[i];

            algoSettings.stop = s;
        }