Develops a genetic algorithm in Java, which, like all of them, requires a crossover of two parent chromosomes. These chromosomes can be quite long, from 30 to 500 (but regardless of their length, they will be the same size, so if the length is 80, then for GA it is still 80).
I thought about development differently, but they all seem very ineffective to me, so I thought I could ask for new, different points of view and suggestions.
For example, one of the ways in which I thought was to convert the string to an array of characters and iterate from the start point to the end of the crossover trap (ie, from s1 & s2[25] to s1 & s2[40] ), copying into the temporary arrays each of the symbols of the array between these points, and then repeats again and replaces them with the symbols of the temporary array of the "partner". But, as I said, it seems that a program that will have about 1000 chromosomes and about 1000 generations will be very slow.
Here's an example of what a two-point crossover looks like:

There is also a simpler one-line crossover:

As Iβm not very advanced in Java at all, could you advise me which approach to take, maybe I donβt know the Java function or some algorithm that I could implement?
Carlos
source share