Traveling quilt projects

Image thumbnail

This is one of the most well known difficult problems of time. A salesperson must visit n cities, passing through each city only once, beginning from one of the city that is considered as a base or starting city and returns to it. The cost of the transportation among the cities is given. The problem is to find the order of minimum cost route that is, the order of visiting the cities in such a way that the cost is the minimum.

Let's number the cities from 1 to and city 1 be the start-city of the salesperson. Also let's assume that c(, ) is the visiting cost from any city to any other city . Here is the systematic way of solving this problem:

Algorithm TSP

  1. First, find out all ( -1)! Possible solutions, where is the number of cities.
  2. Next, determine the minimum cost by finding out the cost of everyone of these ( -1)! Solutions.
  3. Finally, keep the one with the minimum cost.

Clearly, this requires at least (-1)! Steps.

If we try to determine the solution of this problem systematically, we would ended up with ( - 1)! possible solutions. For example if there were 21 cities the steps required are ( - 1)! = (21 - 1)! = 20! steps. If each step required a 1msec we would need about 770 centuries to calculate the minimum cost route. (My life is too short for this crap.) Clearly we cannot examine all possible solutions for minimum cost.

Outline of TSP Heuristic

Whenever the salesman is in town he chooses as his next city i.e., the city for which the (, ) cost, is the minimum among all (, ) costs, where are the pointers of the city the salesman has not visited yet. In case more than one cities give the minimum cost, the city with the smaller will be chosen. This greedy algorithm selects the cheapest visit in every step and does not care whether this will lead to a wrong result or not.

Heuristic

Input

  • Number of cities
  • Cost of traveling between the cities.
  • (, ) , = 1. .← 0
  • Cost ← 0
  • visits ← 0
  • = 1 /* pointer of the visited city */
  • For 1 ≤ ≤
  • minimum = (, ) = min{ (, ); visits () = 0 and 1 ≤ ≤ }
  • cost ← cost + minimum - cost
  • =

You might also like

sBAM in solving Traveling Salesman Problem: A Cost Efficient Algorithm sBAM in Comparison to Genetic Algorithm for Solving the Traveling Salesman Problem
Book (LAP LAMBERT Academic Publishing)

Copyright © . All Rights Reserved