Last city distance in TSPGA
Brought to you by:
troiano
Hi, I was following the tutorial3 at http://jenes.intelligentia.it/tutorials/tutorial3/jenes-tutorials-problem3-tspga. I think that there is something wrong at the end of the evaluate function:
the line
"count += matrix[size - 1][0];"
is used to add the distance from the last city to the starting city, so it should be correct in
"count += matrix[chrom.getValue(size-1)][0];"
otherwise it would always add the same value, that is the distance from the last city represented in the distance matrix to the starting city and not the distance from the last city to visit to the starting one.
Regards