ceandrade / brkga_mp_ipr_cpp

The Multi-Parent Biased Random-Key Genetic Algorithm with Implict Path Relink - C++ version
Other
16 stars 6 forks source link

Bug on direct path relink #6

Open luishpmendes opened 1 year ago

luishpmendes commented 1 year ago

Hi Carlos,

I think I've found a bug on the directPathRelink method. It looks like the best block exchange is never properly commited, so that the base and guide solution keep swapping place. (Also, the test_ipr.cpp file is pretty much outdated).

ceandrade commented 1 year ago

Hi Luis, thanks for reporting. Could you elaborate a little bit more? Do you have some simple case showing that? BTW, if you have a fix, you are most welcome to submit a patch and become a official collaborator :-)

Yes, the tests are outdated and inappropriate. The correct way to do this is to create test units using some testing framework. However, this means, first, choosing a good testing framework and, second, refactoring the code deeply. My experience writing test units for BRKGA in Julia and Python tells me it would be a HUGE work in the current C++ code. I will do it in the future.

Anyway, I am modernizing the code to C++20, little by little. I'm also planning to implement some facilities to use all BRKGA-IPR features (mainly the IPR) more easily (basically, implement the "main_complete" within the framework itself). However, I have no deadline for that.

ceandrade commented 11 months ago

I have pushed a revised code. Could you test and report if the same issue occurs?

luishpmendes commented 11 months ago

Hi Carlos,

Sorry for the delay in replying. I just saw the GitHub notification. I make the mistake of not elaborating more about the bug before, and now I do not remember well =( But I think the problem was related to the fact that the chromosome pointers were const (const Chromosome base and const Chromosome guide). In the permutation version, they are not const and it worked properly. I will try to test the code again, and this time I will submit a proper pull request. However, it will probably take some time =/