WeightPurturbationMutation extends TWEANNMutation { public void mutate(Genotype<TWEANN> genotype) { ((TWEANNGenotype) genotype).weightMutation(); } WeightPurturbationMutation(); void mutate(Genotype<TWEANN> genotype);  }
@Test public void test() { ArrayList<LinkGene> links = tg1.links; System.out.println("tg1: " + links); WeightPurturbationMutation WPM = new WeightPurturbationMutation(); double[] originalWeights = new double[links.size()]; System.out.println(" Original: " + links.size()); int originalLength = links.size(); for(int i = 0; i < links.size(); i++) { originalWeights[i] = links.get(i).weight; System.out.println(" Weight at " + i + " is " + links.get(i).weight); } WPM.mutate(tg1); double[] mutatedWeights = new double[links.size()]; System.out.println(" Mutated: " + links.size()); for(int j = 0; j < links.size(); j++) { mutatedWeights[j] = links.get(j).weight; System.out.println(" Weight at " + j + " is " + links.get(j).weight); } System.out.println("original links: " + Arrays.toString(originalWeights)); System.out.println("new links: " + Arrays.toString(mutatedWeights)); assertEquals(originalLength, links.size()); assertFalse(originalWeights.equals(mutatedWeights)); }