forked fromahmedfgad/GeneticAlgorithmPython
- Notifications
You must be signed in to change notification settings - Fork0
Commit1a8afc3
authored
Fixes when allow_duplicate_genes=False
There might be 2 duplicate genes where changing either of the 2 duplicating genes will not solve the problem.This problem can be solved by randomly changing one of the non-duplicating genes that may make a room for a unique value in one the 2 duplicating genes.For example, if gene_space=[[3, 0, 1], [4, 1, 2], [0, 2], [3, 2, 0]] and the solution is [3 2 0 0], then the values of the last 2 genes duplicate.There are no possible changes in the last 2 genes to solve the problem. But it could be solved by changing the second gene from 2 to 4.As a result, any of the last 2 genes can take the value 2 and solve the duplicates.1 parent5ed45bd commit1a8afc3
1 file changed
+451
-180
lines changed0 commit comments
Comments
(0)