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
Gene Uniqueness - PMX/OX #31
Comments
Hey, thanks buddy. I'm not sure I understand. Did you start with a genome with unique values, use PMX/OX, and end up with a genome of non unique values? If so the implementations are wrong and I'll have to correct them. |
Indeed I end up with a genome that has a different set of genes than the parents. The fact is however that the genomes don't have all unique values. The idea is that I want all the genomes to have a certain amount of specific genes (e.g. 2 x
After the crosover using PMX/OX I however get genomes with different number of occurences (e.g. 5 x |
An implementation of OX as shown below yields the expected result for the case described above. In my case the
Do you agree this indeed results in the expected behaviour? If so I believe the same approach can be taken for PMX. |
PMX and OX were not designed to handle specific amounts of values, only unique values. It's an interesting use case and I'll to think about it. If you find a good implementation please tell me and we work on adding it to eaopt. |
That was indeed what I was afraid of. I believe the code above should work in both cases (unique values or a specific amount of values). A gnome with a specific amount of values is something that is heavily used in packing or nesting algorithms (e.g. fitting as many shapes as possible in a given space). |
Okay but are you sure this is still OX? If the algorithm is different then maybe it is listed here? I don't mind adding the algorithm to |
Indeed I believe this is the correct way to perform OX although the theory is rather limited for the case with repeating values. Your current implementation now performs the following steps in case of the repeated values: parents:
I believe in this case the current implementation, therefore, returns unlogical offspring. The code I posted seems to be a more generic version of OX that is also applicable to this situation. The original unittests should therefore also still pass. I will try to make a pull request over the weekend if I have time. |
Okay I'll wait for the pull request, thanks for taking the time to explain :) |
Fixed in pull/32 for OX. A generic version of PMX still has to be implemented. |
First of all, thank you for all the work on this amazing library!
Now using your predefined crossover functions it seems that if one wants to preserve gene uniqueness one could either use PMX or OX. In my case, however, trying to optimize the order of a set of pointers. Now the issue is that a single pointer can have several occurrences in a gnome, like here:
It seems in cases like this the uniqueness of the number of occurrences is not preserved between crossovers. Is this the intended behavior, as the gnome is not comprised out of unique genes?
The text was updated successfully, but these errors were encountered: