Lab 04
Lab 04
Lab 04
I. Objective
This lab manual introduces solving Traveling Salesman Problem (TSP) with Microsoft Excel Solver (Evolutionary
Method). At the end of today session, you should be able to perform the following:
• Develop a spreadsheet model for a TSP.
• Use Excel Solver (Evolutionary Method) to solve a TSP.
II. Introduction
TSP is a discrete combinatorial optimization problem. Suppose a salesman is given a set of n cities associated
with a traveling distance matrix from any city to any other cities. The salesman is required to allocate a
Hamiltonian path with minimum distance. The Hamiltonian tour is also referred to as a round trip tour
whereby the salesman must visit each city once and only once, and eventually return to the starting city.
TSP can be denoted by graph notations as follows. Let 𝐺 = (𝑉, 𝐸) be a weighted complete graph where V is a
set of n cities (𝑉 = {𝑣1 , ⋯ , 𝑣𝑛 }) and E is a set of arcs or edges(𝐸 = {(𝑟, 𝑠): 𝑟, 𝑠 ∈ 𝑉}). E is associated with a
distance matrix, 𝐷 = {𝑑𝑟,𝑠 } where 𝑑𝑟,𝑠 denotes the distance between city r and city s. For all the
combinations, if 𝑑𝑟,𝑠 = 𝑑𝑠,𝑟 the problem is a symmetric TSP (STSP). Otherwise, it becomes an asymmetric TSP
(ATSP). Let Π represents all possible permutations of set V. A solution of a TSP is to determine a permutation
𝜋 ∈ Π, which has the minimum total round trip distance as shown in the following equation, in which 𝜋(𝑖) ∈ 𝑉
indicates the i-th element in 𝜋.
𝑛−1
NAME: gr17
TYPE: TSP
COMMENT: 17-city problem (Groetschel)
DIMENSION: 17
EDGE_WEIGHT_TYPE: EXPLICIT
EDGE_WEIGHT_FORMAT: LOWER_DIAG_ROW
EDGE_WEIGHT_SECTION
0 633 0 257 390 0 91 661 228 0 412 227
169 383 0 150 488 112 120 267 0 80 572 196
77 351 63 0 134 530 154 105 309 34 29 0
259 555 372 175 338 264 232 249 0 505 289 262
476 196 360 444 402 495 0 353 282 110 324 61
208 292 250 352 154 0 324 638 437 240 421 329
297 314 95 578 435 0 70 567 191 27 346 83
47 68 189 439 287 254 0 211 466 74 182 243
105 150 108 326 336 184 391 145 0 268 420 53
239 199 123 207 165 383 240 140 448 202 57 0
246 745 472 237 528 364 332 349 202 685 542 157
289 426 483 0 121 518 142 84 297 35 29 36
236 390 238 301 55 96 153 336 0
EOF
c. Select Solver Add-in in the Add-ins window, then click OK as shown in Figure 4.
Figure 5: Solver Add-in is shown in the Analysis group on the Data tab.
In order to get the corresponding distance of a particular edge in a trial solution, the INDEX formula is used.
Figure 7 shows the formulas used in the spreadsheet model. The tour lengths of all the edges in a trial solution
will be added using a SUM formula at cell W19.
Figure 9: The Solver dialog box after specifying the entire model in terms of the spreadsheet.
i. Click the Solve button. This will start the process of solving the problem in the background. The Solver
Results dialog box will show that the Solver found a solution as shown in Figure 11. Click OK.
Figure 11: The Solver Results dialog box that indicates that a solution has been found.
Figure 12: The spreadsheet that shows a TSP tour after solving gr17 using Microsoft Solver (Evolutionary
method).
VII. Exercise
Download the swiss42 dataset from eLearn@USM. It is a CSV file. Create a spreadsheet model for swiss42 and
solve it using Microsoft Solver (Evolutionary method). The best-known optimal tour length of swiss42 is 1273
units of distance.
Tune the parameter of the Evolutionary method. Based on a particular setting, run the Evolutionary method
for five times. Get the average of the five tour lengths and compute the deviation percentage of the average
tour length from the best-known optimal tour length. In your lab report, you should report at least 3 set of
different parameter settings. Present the results nicely in a tabular format.
Good A comprehensive spreadsheet model as • Report the results based on at least 3 set
(3) follows: of different parameter settings.
• The TSP requirement, i.e. visit all the • Interpret and explain the results.
cities once and return to the starting • The explanation and the results are
city, is modelled and fulfilled. presented with good clarity,
• The decision variables are correctly comprehensiveness and organization.
modelled.
• The objective function in terms of tour
length is correctly modelled.
Satisfactory • Less than or exactly 5 errors are • Report the results based on at least 3 set
(2) observed in terms of data, constraints, of different parameter settings.
objective function, and decision • Interpret and explain the results.
variables. • The explanation and the results are
presented with satisfactory clarity,
comprehensiveness and organization.
Poor • More than 5 errors are observed in • Report the results based on at least 3 set
(1) terms of data, constraints, objective of different parameter settings.
function, and decision variables. • Interpret and explain the results.
• The explanation and the results are
presented with minimal clarity,
comprehensiveness and organization.
Fail • No submission or late submission. • No submission or late submission.
(0)