1

Some sources (linked below) say that mutation can add a new node or subtract a node or add a connection between two existing nodes. But if we do that doesn't it change the number of genes throughout the population.

Let's say there are 2 creatures and one of them mutates and adds a connection between 2 existing nodes this creature now has more genes than the other one right?

So how is it possible for us to make crossover between the two?

Or does adding the connection between the nodes mean there was already a connection between the two but the weight of that connection was 0 so it didn't have any effect and mutation changed it enabling it to have some sort of effect?

This has been in the back of my mind for quite a bit of time now.

Any help is appreciated.

Thanks

https://towardsdatascience.com/neat-an-awesome-approach-to-neuroevolution-3eca5cc7930f

1 Answers1

1

In brief: of course creating or destroying nodes and connections changes the size of the genome and this makes different genomes incompatible for comparison (and thus for sexual reproduction and crossover).

The key idea behind NEAT is to carefully label each new structure with its own ID. Typically, only nodes have unique IDs and connections are defined by the nodes they link together. In this way, crossover knows which parts of the genome are compatible and which are not.

Imagine these two genomes:

Genome A:
Nodes: 1, 2, 3, 5, 7
Connections: 1-2, 1-3, 2-5, 5-7, 3-7

Genome B:
Nodes: 1, 2, 3, 7
Connections: 1-2, 1-7, 2-3, 3-7

We know that nodes 1, 2, 3 and 7 are common, so crossover can happen directly (although very often nodes have no parameters so this step would do nothing really). Node 5 is unique to Genome A and would not take part in crossover.

Connections 1-2 and 3-7 are common, the rest are not, so only 1-2 and 3-7 would take place directly in crossover (typically taking the weight from one parent at random for each connection).

Normally there is a probability for the child genome to also inherit (after standard crossover) all unique elements from one of the two parents (or from the fittest parent or however you define this step).

Pablo
  • 1,373
  • 16
  • 36