Skip to content

Commit e3d5a32

Browse files
committed
minor bug fix
1 parent 07c0d9f commit e3d5a32

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

replication/org/cicirello/replication/bict2019/BICT2019.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ private static double tourCostAsymmetric(double[][] cities, Permutation p) {
475475
int end = p.get((i+1)%p.length());
476476
double deltaX = cities[start][0] - cities[end][0];
477477
double deltaY = cities[start][1] - cities[end][1];
478-
double edgeCost = start < end ? Math.sqrt(deltaX*deltaX + deltaY*deltaY) : 2.0;
478+
double edgeCost = start < end || (end==0 && start==p.length()-1) ? Math.sqrt(deltaX*deltaX + deltaY*deltaY) : 2.0;
479479
cost = cost + edgeCost;
480480
}
481481
return cost;

0 commit comments

Comments
 (0)