Travelling Salesman Problem (TSP)
A person wants to travel all cities. The travel will start from a city, with each city visited only once, and return to the original city after all cities visited. The objective is to minimize the travel distance / cost.
The TSP problem is highly popular in computer science field. It was first defined in 1800. TSP problem is difficult to solve. It is an NP-hard problem. That means if there are n cities to travel, there are (n-1) factorial possibilities for the travel sequence. Assuming similar distance for both travel directions between two cities, for a 10-city problem there will be 9!/2 or 181,440 combinations to try.
The complete TSP formulation with sub-tour elimination can be written as follows:
Let’s try to solve 10 ASEAN capital cities problem. This is relatively a large problem but thanks to today’s powerful computing hardware and software, we can even solve this using Excel Solver.
The distances between the cities are as follow.
|Brunei||Bandar Seri Begawan||BWN||1330||1534||1977||1487||2603||1255||1278||1833||2060|
We enter these data into an Excel spreadsheet. We also setup a rectangle area in the Excel which will be used as decision variable in the model.
The formulations and named ranges required are shown below.
We need to enable Excel Solver before we can use it. From Excel, select File then Option. Select Add-Ins. The Add-Ins manager will then appear. At the bottom of the screen, hit the “Go” radio button next to Manage Excel Adds-Ins. Check the Solver Add-In box and Solver will be enabled. To access Excel Solver, go to Data and the Solver radio button will appear.
The TSP mathematical formulation are partially in the spreadsheet cells. We need to enter the objective cell, decision variables, and the constraints into Excel Solver dialog box as shown below.
Hit Solve to get the solution as shown below.
The solution above can be shown graphically as below:
The TSP textbook formulation can be applied directly to solve real-world problems. In electronic assembly, TSP is used to minimize drill head travel during PCB drilling and component placement time by surface mount machines. An extended version of TSP model is used by transportation companies to decide the routes of pickup and delivery vehicles.
Please send me email if you would like to learn more about this and keen to get the Excel Solver TSP model.