MeltThenFreezePolicyMutation extends TWEANNMutation { public void mutate(Genotype<TWEANN> genotype) { ((TWEANNGenotype) genotype).meltNetwork(); ((TWEANNGenotype) genotype).freezePolicyNeurons(); System.out.println("mtfpm " + genotype.toString()); } MeltThenFreezePolicyMutation(); void mutate(Genotype<TWEANN> genotype);  }
@Test public void test() { ArrayList<NodeGene> nodes = tg1.nodes; for(int i = 0; i < tg1.nodes.size(); i++) { NodeGene node = nodes.get(i); if(node.ntype == Node.NTYPE_INPUT || node.ntype == Node.NTYPE_HIDDEN) { node.freeze(); } } for(NodeGene node : nodes) { if(node.ntype == Node.NTYPE_INPUT || node.ntype == Node.NTYPE_HIDDEN) { assertEquals(node.isFrozen(), true); } } System.out.println("nodes before:" + tg1.nodes.toString()); mtfpm.mutate(tg1); nodes = tg1.nodes; int numFrozen = 0; for(NodeGene node : tg1.nodes) { if(node.isFrozen()) { numFrozen++; } } System.out.println("num outputs: " + tg1.numOut + " num policy as calculated: " + ((tg1.numIn * 2)- tg1.numModules) + " num modules: " + tg1.numModules); System.out.println("Nodes after:" + tg1.nodes.toString()); assertEquals(numFrozen, tg1.nodes.size() - tg1.numModules); }