How can non-functional neural networks be avoided when the crossover produces a child with a disabled gene?

I am implementing NEAT (neuroevolution of augmenting topologies) by Stanley. I am facing a problem during the crossover of genomes.

Suppose two networks with connections

Genome1 = {
(1, Input1, Output), // numbers represent innovation numbers
(2, Input2, Output)
} // more fit

Genome2 = {
(1, Input1, Output),
(2, Input2, Output), // disabled
(3, Input2, Hidden1),
(4, Hidden1, Output)
}


are crossed over, then the connection (Input2, Output) in the fitter parent has a chance of being disabled (page 109, section 3.2, figure 4),

There's a preset chance that an inherited gene is disabled if it is disabled in either parent.

and thus producing the following offspring:

Child = {
(1, Input1, Output),
(2, Input2, Output) //Disabled
}


and thus render the network non-functional.

Similarly, by this chance, nodes can get left in a state of uselessness after crossover (as having no outgoing connections or no connections at all).

How can this be prevented or am I missing something here?

In your example, the output node would still get a value from Input1, even though Input2 is disabled.

If the child was:

Child = {
(1, Input1, Output1),
(2, Input2, Output2) //Disabled
}


Then Output2 would return 0, meaning it wasn't activated.

For your second question, it is up to your implementation. You could:

1.) Use only the connection genes in crossover, and derive your node genes from the connection genes

2.) Test if every node is in use, and delete the ones that are not

• Your 2nd suggestion is in my opinion the most logical solution to this problem. Thank you! Aug 28 '19 at 18:06