Question

I am in the process of writing a small genetic algorithm framework in C++. My chromosomes are encoded as bit strings, where each gene has a predetermined size. Each chromosome stores its genes one after the other in the bit string. Now, I am looking to implement the crossover operator.

My question is, when choosing a point after which to insert bits from the other chromosome, do I do this on a gene boundary or do I just treat the chromosome as a string of bits, and ignore the division into genes? In other words, do I treat the smallest swappable unit as a gene or a bit?

Was it helpful?

Solution

When two chromosome reproduce together, there is a random probability of the gene crossover. Therefore, you should only cross what you consider genes instead of the smaller units.

OTHER TIPS

The answer to this query would best be understood by looking at the biological processes on which GA is based.

Assuming what you're looking for is a single-point crossover, what you would need is as illustrated below; crossovers affect the entire chromosomes and not just "the smallest swappable unit".

enter image description here

Details about more complex crossover scenarios such as multi-point crossover or ring crossovers may be found at the Wikipedia resource here.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top