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

Zero-index bug in recombination operators that use inmap #103

Open
zachdj opened this issue Dec 23, 2022 · 1 comment
Open

Zero-index bug in recombination operators that use inmap #103

zachdj opened this issue Dec 23, 2022 · 1 comment
Labels

Comments

@zachdj
Copy link

zachdj commented Dec 23, 2022

The combinatorial crossovers CX and OX2 will throw the following error if called on two individuals with no genes in common:

ERROR: BoundsError: attempt to access n-element Vector{Bool} at index [0]

Minimal reproducing example:

i1, i2 = zeros(Int, 5), ones(Int, 5)
Evolutionary.CX(i1, i2)
Evolutionary.OX2(i1, i2)

I'm no expert, but I think this is caused by the use of inmap without checking if the resulting index is 0

@zachdj
Copy link
Author

zachdj commented Dec 23, 2022

Possibly related issue, when OX1 is called with the input example, it results in an infinite loop

e.g.

i1, i2 = zeros(Int, 5), ones(Int, 5)
Evolutionary.OX1(i1, i2)  # runs forever

@wildart wildart added the bug label Jan 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants