OK, this is a more important question: How to calculate the optimal paths for a bitonic tour for a salesman?
First of all, for the bittonic tour of the traveling salesman problem, I have the following recurrence relation:
(a) When i = 1 and j = 2, l(i; j) = dist(pi; pj )
(b) When i < j - 1; l(i; j) = l(i; j - 1) + dist(pj-1; pj)
(c) When i = j - 1 and j > 2, min 1<=k<i (l(k; i) + dist(pk; pj ))
l- table of previous results. My question is part C: Assuming that l(k,i)u are dist(pk,pj)defined, how to implement part C in Java? My initial thought was that I iterate kfrom 1to iand keep a minimal result (l(k,i) + dist(pk,pj)), but I don’t think it is right.
eg:
for (int k = 1; k < i; ++k) {
tmp = l(k,i) + dist(pk,pj);
if (tmp < min) {
min = tmp;
}
}
This may seem like a silly question (and probably there is, I miss it a lot), but I hope someone can help.