HawkTom / carp

1 stars 1 forks source link

Find a Bug in MAENS #1

Open tian-y-x opened 2 years ago

tian-y-x commented 2 years ago

In carp/MAENS/operators.c line 826 The code as below:


Individual tmp_indi;
indi_copy(&tmp_indi, c);

//traditional move lns(&tmp_indi, coef, 1, inst_tasks);

if (c->Fitness < tmp_indi.Fitness) imp = 1;

if (c->TotalVioLoad == 0 && c->TotalCost < best_fsb_solution->TotalCost) { indi_copy(best_fsb_solution, c); // check if assign or not }



According to the code, `lns(&tmp_indi, coef, 1, inst_tasks)` is used to apply local search on chromosome `tmp_indi`, and chromosome `c` is the origin. 

But the following code tends to compare chromosome `c` and the `best` chromosome. If chromosome `c`  is better than  `best` chromosome, then update `best` chromosome.

So the correct code would be apply local search on chromosome `c`.
HawkTom commented 2 years ago

Yes, you are right. Thanks for your reporting. The same expression in the third while condition of this function is also need to be modified.