0% found this document useful (0 votes)
23 views2 pages

TSP Dynamic Programming Assignment

Uploaded by

theintphyo159
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views2 pages

TSP Dynamic Programming Assignment

Uploaded by

theintphyo159
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Traveling Salesperson Problem (TSP) Using Dynamic Programming

Introduction
In this assignment, I am exploring how dynamic programming (DP) can be applied to solve the
Traveling Salesperson Problem (TSP). The TSP is a classic optimization problem where a
salesperson must visit a set of cities exactly once and return to the starting city while minimizing
the total distance traveled. This problem is highly relevant for real-world applications such as
logistics, delivery services, and routing for nationwide sales teams.

Implementing a Dynamic Programming Solution


Dynamic programming offers an efficient approach for solving the TSP compared to brute force.
The Held-Karp algorithm is a well-known DP technique for TSP, where the subproblems are
solved recursively. For example, if I have five offices to visit, I can calculate the shortest paths
for smaller subsets of cities and then build up to the final solution. The complexity of this
algorithm is O(n^2 * 2^n), which is significantly better than O(n!) in brute force (Cormen et al.,
2022).

Testing with Different Numbers of Regional Offices


To better understand how DP performs, I tested it with 5, 10, and 15 offices. With 5 offices, the
algorithm computed the minimum path almost instantly. When the number of offices increased to
10, the computation took noticeably longer but was still manageable. At 15 offices, the runtime
increased significantly, but it was still feasible compared to the brute-force approach, which
became nearly impossible to compute.

Comparison with Brute Force


Brute force involves generating all permutations of possible routes and calculating their total
distances. This method has a factorial time complexity, which makes it impractical for more than
10 offices. Dynamic programming, while still exponential, reduces redundant calculations by
storing intermediate results. For example, when testing with 12 offices, brute force would require
evaluating over 479 million routes, while DP can solve it with far fewer computations. Thus, DP
provides a realistic solution for medium-sized TSP problems (Abirami & Priya, 2023).

Advantages and Disadvantages of Using Dynamic Programming


The biggest advantage of DP is efficiency compared to brute force, as it avoids recalculating
subproblems. It also guarantees an optimal solution. However, DP still has limitations in terms of
scalability. For very large numbers of offices, even DP becomes computationally expensive. This
is why heuristics and approximation algorithms are often used in real-world large-scale
applications. In my view, DP strikes a balance between exactness and practicality for small to
medium problems, making it ideal for a nationwide sales team with a moderate number of offices.

Conclusion
Dynamic programming provides a powerful and efficient way to solve the Traveling Salesperson
Problem compared to brute force. It allows for optimal route planning while saving
computational resources. Although it has limitations for extremely large networks, its benefits
make it the best choice for scenarios like routing optimization in a nationwide sales team.

References
Abirami, A., & Priya R., L. (2023). Advanced data structures and algorithms: Learn how to
enhance data processing with more complex and advanced data structures (English edition). BPB
Publications.

Cormen, T. H., Leiserson, C. E., Rivest, R. L., & Stein, C. (2022). Introduction to algorithms (4th
ed.). The MIT Press.

You might also like