Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crossover functions not working as intended for integer sequences? #123

Open
prconlin opened this issue Jun 20, 2023 · 0 comments
Open

Crossover functions not working as intended for integer sequences? #123

prconlin opened this issue Jun 20, 2023 · 0 comments

Comments

@prconlin
Copy link

The following tests were conducted in Visual Studio Code v1.78.0 with the Julia language support extension v1.47.2, using Julia v1.9.0 and Evolutionary.jl v0.11.1

I ran a few basic tests on the crossover functions using a sequential parent and a null parent (see below). The results were not as expected.

a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
b = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

Evolutionary.DC(a,b) produces the following two children:

c = [0, 2, 3, 4, 0, 0, 0, 0, 0, 10]
d = [0, 2, 0, 4, 0, 6, 7, 8, 9, 0]

It's easy to see how c results from randomly assembling the elements of a and b. However, d is supposed to be the inverse of c, but this does not appear to be the case. Unless I misunderstand the concept, the two children produced from this operation should be:

c  = [0, 2, 3, 4, 0, 0, 0, 0, 0, 10]
d' = [1, 0, 0, 0, 5, 6, 7, 8, 9, 0]

Some of the other crossover functions appear to have more severe issues:
Evolutionary.CX(a,b) fails with: BoundsError: attempt to access 10-element Vector{Bool} at index [0]
Evolutionary.OX1(a,b) fails catastrophically and hangs the terminal, forcing me to kill it.
Evolutionary.OX2(a,b) fails with the same error as .CX

I can confirm that Evolutionary.PMX(a,b) works exactly as expected. Evolutionary.SSX(a,b) seems to work, although I'm admittedly unsure what the SSX function is supposed to produce.

I appreciate your development of this module and hope you can help sort out these issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant