Skip to content

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

@prconlin

Description

@prconlin

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions