Research Article

Developing Programming Tools to Handle Traveling Salesman Problem by the Three Object-Oriented Languages

Algorithm 1

General algorithm for 2-opt.
Suppose tour with edges that is defined on graph G(V, E):
 (1) Suppose direction for .
 (2) If there are not nodes like A, B, C and D with below conditions then go to end.
  (i) AB, CD
   (a) In supposed direction, B and D are right nodes of A and C respectively.
  (ii) Cost(AB) + cost(CD) > cost(AC) + cost(BD)
 (3) Remove AB and CD form and add AC and BD to it (2-opt-move).
 (4) Go to (2).
 (5) End.