AllWeightMutation extends TWEANNMutation { @Override public void mutate(Genotype<TWEANN> genotype) { ((TWEANNGenotype) genotype).allWeightMutation(rand, perLinkMutateRate); } AllWeightMutation();  AllWeightMutation(RandomGenerator rand, double perLinkMutateRate); @Override void mutate(Genotype<TWEANN> genotype);  }
@Test public void test() { ArrayList<LinkGene> links = tg1.links; System.out.println("tg1.links: " + links); AllWeightMutation AWM = new AllWeightMutation(); double[] linkes = new double[links.size()]; System.out.println(" Original: " + links.size()); int originalLength = links.size(); for(int i = 0; i < links.size(); i++) { linkes[i] = links.get(i).weight; System.out.println(" Weight at " + i + " is " + links.get(i).weight); } for(int m = 0; m < MUTATION_NUM; m++) { AWM.mutate(tg1); } double[] newLinkes = new double[links.size()]; System.out.println(" Mutated: " + links.size()); for(int j = 0; j < links.size(); j++) { newLinkes[j] = links.get(j).weight; System.out.println(" Weight at " + j + " is " + links.get(j).weight); } System.out.println("original links: " + Arrays.toString(linkes)); System.out.println("new links: " + Arrays.toString(newLinkes)); assertEquals(originalLength, links.size()); assertFalse(linkes.equals(newLinkes)); }