Research Article
Developing Programming Tools to Handle Traveling Salesman Problem by the Three Object-Oriented Languages
Algorithm 7
Abstract pseudocodes for LK.
| | 1      List<Node> ActiveNodes;// to implement “don’t-look bits” |  | 2      void LK(Tour tour) |  | 3      { |  | 4       for each node X |  | 5         Add X to ActiveNodes List; |  | 6       while(active node is existed) |  | 7       { |  | 8         Node N = remove and return first node in ActiveNodes; |  | 9         if(inner-LK(tour, X) <= 0) |  | 10      inactive X; |  | 11    } |  | 12   } |  | 1      int inner-LK(Tour tour, Node x) |  | 2      { |  | 3       Y    neighbor of X; |  | 4       int partial-gain = |XY|; |  | 5       break XY from tour; |  | 6       Add Y to ActiveNodes List; |  | 7       for each Z    candidate set of X |  | 8       { |  | 9         add YZ to tour; |  | 10      Add Z to ActiveNodes List; |  | 11      partial-gain = partial-gain + |YZ|; |  | 12      if tour is feasible (tour closing up by one edge is possible) |  | 13      { |  | 14        if (partial-gain  −  last added edge cost > 0 then) |  | 15        { |  | 16          close up tour; |  | 17          return  partial-gain  −  last added edge cost; |  | 18        } |  | 19        else |  | 20        { |  | 21          int g = inner-LK(tour,  x); |  | 22          if (g < 0) |  | 23          { |  | 24             break YZ; //test another. |  | 25          } |  | 26          else |  | 27          { |  | 28            return g; |  | 29          } |  | 30        } |  | 31      } |  | 32    } |  | 33    add XY to tour; //breaking XY was unsuccessful. |  | (34)    remove Y from ActiveNodes List; |  | (35)    return 0; |  | (36)   } | 
 |