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); }
public static int Compare(Phenotype a, Phenotype b) { return(a.Fitness - b.Fitness < 0 ? -1 : 1); }
public PhenotypeView(Phenotype phenotype, int iterationNumber) { this.Iteration = iterationNumber; this.Fitness = phenotype.Fitness; this.Sudoku = phenotype.Sudoku; }
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; }
public FitnessEvaluator(Phenotype phenotype) { this.Phenotype = phenotype; }