public Mypermutation(Mypermutation item) { this.permutation = item.permutation; this.permutationLength = item.permutationLength; this.utility = item.utility; rnd = new Random(); }
private Mypermutation[] Populate(int permutationLength, int populationsize) { Mypermutation[] population = new Mypermutation[populationsize]; for (int i = 0; i < populationsize; i++) { population[i] = new Mypermutation(permutationLength); } return(population); }
private void CrossOver(Mypermutation first, Mypermutation second) { int crosspoint = rnd.Next(0, first.permutationLength); int[] temp = new int[first.permutationLength]; Array.Copy(second.permutation, 0, temp, 0, first.permutationLength); Array.Copy(first.permutation, 0, second.permutation, 0, crosspoint); Array.Copy(temp, 0, first.permutation, 0, crosspoint); }