aarongarrett / inspyred

Python library for bio-inspired computational intelligence
MIT License
187 stars 58 forks source link

N-point crossover #14

Open JamesArruda opened 6 years ago

JamesArruda commented 6 years ago

This line was added in a commit a while ago:

https://github.com/aarongarrett/inspyred/blob/c16ffc357ce352ac0e3c787da6ae683aee117c23/inspyred/ec/variators/crossovers.py#L123

By changing the normal value back, the 'cut' only works at that one single point. In the version I have (1.0, before this commit), crossing over would look like the following:

ec.variators.n_point_crossover(random, [list('1234567890'), list('ABCDEFGHIJ')], {})

[['A', 'B', 'C', 'D', 'E', 'F', 'G', '8', '9', '0'], ['1', '2', '3', '4', '5', '6', '7', 'H', 'I', 'J']]

but now it will look like:

[['A', 'B', 'C', 'D', 'E', 'F', 'G', '8', 'I', 'J'], ['1', '2', '3', '4', '5', '6', '7', '8', 'I', '0']]

aarongarrett commented 6 years ago

Yes, that appears to be a mistake where a line got inserted where it shouldn't have.

On Thu, Jul 19, 2018 at 10:11 AM James Arruda notifications@github.com wrote:

This line was added in a commit a while ago:

https://github.com/aarongarrett/inspyred/blob/c16ffc357ce352ac0e3c787da6ae683aee117c23/inspyred/ec/variators/crossovers.py#L123

By changing the normal value back, the 'cut' only works at that one single point. In the version I have (1.0, before this commit), crossing over would look like the following:

ec.variators.n_point_crossover(random, [list('1234567890'), list('ABCDEFGHIJ')], {})

[['A', 'B', 'C', 'D', 'E', 'F', 'G', '8', '9', '0'], ['1', '2', '3', '4', '5', '6', '7', 'H', 'I', 'J']]

but now it will look like:

[['A', 'B', 'C', 'D', 'E', 'F', 'G', '8', 'I', 'J'], ['1', '2', '3', '4', '5', '6', '7', '8', 'I', '0']]

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/aarongarrett/inspyred/issues/14, or mute the thread https://github.com/notifications/unsubscribe-auth/ABcX3UGxX5jE_DXG1t266N5xyebXZXD7ks5uIJOpgaJpZM4VWeNE .

-- Aaron Garrett, Ph.D. Assistant Professor Computer Science Wofford College 429 North Church Street Spartanburg, SC 29303 garrettal@wofford.edu (864) 597-4529