HyperNEATCPPNGenotype extends TWEANNGenotype { @Override public TWEANN getPhenotype() { TWEANNGenotype tg = getSubstrateGenotype((HyperNEATTask) MMNEAT.task) ; return tg.getPhenotype(); } HyperNEATCPPNGenotype();  HyperNEATCPPNGenotype(ArrayList<NodeGene> nodes, ArrayList<LinkGene> links, int neuronsPerModule, int archetypeIndex);  HyperNEATCPPNGenotype(int archetypeIndex, ArrayList<LinkGene> links, ArrayList<NodeGene> genes, int outputNeurons);  HyperNEATCPPNGenotype(int networkInputs, int networkOutputs, int archetypeIndex); TWEANN getCPPN(); @Override TWEANN getPhenotype(); TWEANNGenotype getSubstrateGenotype(HyperNEATTask hnt); TWEANNGenotype getSubstrateGenotypeForEvolution(HyperNEATTask hnt); @Override Genotype<TWEANN> copy(); ArrayList<NodeGene> createSubstrateNodes(HyperNEATTask hnt, TWEANN cppn, List<Substrate> subs, int layersWidth, int layersHeight); long getInnovationID(int x, int y, int sIndex, List<Substrate> subs); @Override Genotype<TWEANN> newInstance(); static int numCPPNOutputsPerLayerPair; static int numBiasOutputs; static final int LINK_INDEX; static final int LEO_INDEX; static final double BIAS; transient static boolean constructingNetwork; transient int innovationID; }
@Test public void testGetPhenotype() { hcppn.getPhenotype(); assertTrue(!hcppn.getPhenotype().equals(hcppn.getCPPN())); }
@Test public void testBias() { MMNEAT.clearClasses(); Parameters.initializeParameterCollections(new String[] { "io:false", "netio:false", "recurrency:false", "hyperNEAT:true", "task:edu.utexas.cs.nn.networks.hyperneat.HyperNEATDummyTask", "evolveHyperNEATBias:true", "linkExpressionThreshold:0.0"}); MMNEAT.loadClasses(); assertTrue(CommonConstants.evolveHyperNEATBias); hcppn = new HyperNEATCPPNGenotype(); TWEANN t = hcppn.getPhenotype(); ArrayList<Node> nodes = t.nodes; for(Node node : nodes) { if(node.ntype != TWEANN.Node.NTYPE_INPUT) assertTrue(node + " bias is " + node.bias, node.bias != 0.0); } t.flush(); nodes = t.nodes; double[] biases = new double[nodes.size()]; int x = 0; for(Node node: nodes) { if(node.ntype != TWEANN.Node.NTYPE_INPUT) assertTrue(node.bias != 0.0); biases[x++] = node.bias; } double[] inputs = {1, 2, 3, 4, 5, 6, 7, 8, 9}; t.process(inputs); nodes = t.nodes; int y = 0; for(Node node : nodes) { assertEquals(biases[y++], node.bias, .0001); } }