You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If childGenesIndex is in the last position and the first AddChildGene increment it, the IndexOutOfRangeException will happen in the second AddChildGene call.
I added a second check to fix the problem:
for(inti=0;i<firstParent.Length&&childGenesIndex<firstParent.Length;i++){AddChildGene(childGenes,refchildGenesIndex,firstParent.GetGene(i));// The childGenesIndes could be incremented by the previous AddChildGene callif(childGenesIndex<secondParent.Length)AddChildGene(childGenes,refchildGenesIndex,secondParent.GetGene(i));}
A hotfix is on the way on to the AppVeyor, in a few minutes the 2.5.2 version will be available on NuGet.
Describe the bug
Using the
AlternatingPositionCrossover
causeSystem.IndexOutOfRangeException
To Reproduce
I've made a sample project, please give a look
GeneticSharpTest.zip
Expected behavior
Should not throw an exception
Version:
2.5.1
The text was updated successfully, but these errors were encountered: