Menu ▾ ▴

#3 Last city distance in TSPGA

Release_1.3
open
nobody
None
5
2013-11-27
2013-11-27
No

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

Discussion


Log in to post a comment.