More tests + GUI
[ltsps.git] / calculateHeuristics.m
blob7c6af31bf7d52b167145723ba9eceb02e65903cf
1 function [routeRandom, distanceRandom, routeNearest, distanceNearest, ...\r
2     routeFarthest, distanceFarthest, routeEnum, distanceEnum] ...\r
3     = calculateHeuristics (distanceMatrix)\r
4 % Calculate the best route and its distance using the different\r
5 % heuristics: Random, Nearest Neighbour, Farthest Neighbour and \r
6 % Enumerative (if the number of cities does not exceed ten).\r
7 \r
8 % Calculate the routes and distances using the three standard heuristics.\r
9 [routeRandom,distanceRandom] = ltspsRandomHeuristic(distanceMatrix);\r
10 [routeNearest,distanceNearest] = ltspsClosestNeighbourHeuristic(distanceMatrix);\r
11 [routeFarthest,distanceFarthest] = ltspsFurthestNeighbourHeuristic(distanceMatrix);\r
13 % Initialize the route and distance of the Enumerative solution.\r
14 routeEnum = 0;\r
15 distanceEnum = 0;\r
17 % Calculate using the Enumerative Solver if the number of cities does not\r
18 % exceed 10.\r
19 if size(distanceMatrix,1) <= 10\r
20     [routeEnum,distanceEnum] = ltspsEnumerativeSolver(distanceMatrix);\r
21 end\r
23 end\r