Ejemplo n.º 1
0
        private List <PhenotypeView> solve()
        {
            List <PhenotypeView> bestPhenotypesViews = new List <PhenotypeView>();

            // Tworzenie solvera
            Solver.getInstance().Configure(this.sudoku, (int)populationSizeBox.Value, (int)iterationCountBox.Value, (float)crossingProbabilityBox.Value, (float)mutationProbabilityBox.Value);


            List <List <Phenotype> > populations = new List <List <Phenotype> >();

            populations   = Solver.getInstance().Solve();
            bestPhenotype = populations[populations.Count - 1][0];

            int i = 1;

            foreach (List <Phenotype> population in populations)
            {
                bestPhenotypesViews.Add(new PhenotypeView(population[0], i));
                i++;
            }

            return(bestPhenotypesViews);
        }
Ejemplo n.º 2
0
 public static int Compare(Phenotype a, Phenotype b)
 {
     return(a.Fitness - b.Fitness < 0 ? -1 : 1);
 }
Ejemplo n.º 3
0
 public PhenotypeView(Phenotype phenotype, int iterationNumber)
 {
     this.Iteration = iterationNumber;
     this.Fitness   = phenotype.Fitness;
     this.Sudoku    = phenotype.Sudoku;
 }
Ejemplo n.º 4
0
 public Genotype(Phenotype phenotype)
 {
     this.ConstIndexes = new List <int>(phenotype.Genotype.ConstIndexes);
     this.GeneSequence = new List <int>(phenotype.Genotype.GeneSequence);
     this.Puzzle       = phenotype.Genotype.Puzzle;
 }
Ejemplo n.º 5
0
 public FitnessEvaluator(Phenotype phenotype)
 {
     this.Phenotype = phenotype;
 }