Research Article

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

Algorithm 4

Heuristics ADT.
/  We implement this class function according to LKH  [18]  that is free for academic use./
1    class Heuristics
2  {
3  public:
  /  Heuristic object compute candidate sets as soon as created, second argument in
       constructor is the number of candidates in each set./
4  Heuristics(Graph    graph, int NumberOfCandidates);
5  ~Heuristics();
  /  Both of lines  6  and  7  shows the 2-OPT but function in line  6  consider all of nodes
      as active but function  7  supposes only nodes in ActiveNodes array are active /
6  void TwoOpt(Tour    tour);
7  void TwoOpt (Tour    tour, int    ActiveNodes, int NumberOfActiveNodes);
       /  Both of lines  8  and  9  shows the 3-OPT but function in line  8  consider all of nodes
      as active but function  9  supposes only nodes in ActiveNodes array are active /
8  void ThreeOpt(Tour    tour);
9  void ThreeOpt (Tour    tour, int    ActiveNodes, int NumberOfActiveNodes);
    /  Both of lines  10  and  11  shows the LK but function in line  10  consider all of nodes
        as active but function  11  supposes only nodes in ActiveNodes array are active /
10void LinKernighan(Tour    tour);
11void LinKernighan(Tour    tour, int   ActiveNodes, int NumberOfActiveNodes);
12void DoubleBridge(Tour    tour);
13Tour    Q_Boruvka();
14int SetCandidates(int node, int candidate, int index);
15int GetCandidates(int node, int index);
16void SetBestTour(Tour    best_tour);
17};