<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Shreyas Singh on Medium]]></title>
        <description><![CDATA[Stories by Shreyas Singh on Medium]]></description>
        <link>https://medium.com/@shreyas.10.singh?source=rss-86fd673e15ef------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*-ZqbmYmRGrW0dinf</url>
            <title>Stories by Shreyas Singh on Medium</title>
            <link>https://medium.com/@shreyas.10.singh?source=rss-86fd673e15ef------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 09:15:25 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@shreyas.10.singh/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[A Theoretical Overview Of The Traveling Salesman Problem]]></title>
            <link>https://medium.com/sigma-xi-vit/a-theoretical-overview-of-the-traveling-salesman-problem-bdea659c2e76?source=rss-86fd673e15ef------2</link>
            <guid isPermaLink="false">https://medium.com/p/bdea659c2e76</guid>
            <category><![CDATA[logistics]]></category>
            <category><![CDATA[engineering]]></category>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[computer-science]]></category>
            <dc:creator><![CDATA[Shreyas Singh]]></dc:creator>
            <pubDate>Sat, 18 Jun 2022 11:50:48 GMT</pubDate>
            <atom:updated>2023-07-24T14:29:31.802Z</atom:updated>
            <content:encoded><![CDATA[<p>Suppose a traveling salesman is given a list of cities with the distances between every two cities, then what would be the shortest path such that, the salesman travels to all the cities exactly once, and returns back to the starting point once again.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*GiDVU9fdTocibO7V" /><figcaption>Photo by <a href="https://unsplash.com/@anniespratt?utm_source=medium&amp;utm_medium=referral">Annie Spratt</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>Applications of The Traveling Salesman Problem</h3><p>Traveling Salesman Problem(TSP) plays a larger role in our lives than we think, here are some practical real-life applications of TSP</p><ol><li>A school bus driver planning out a route to minimize fuel consumption, here, the stops act plays the role of ‘cities’ in TSP, this example could be extrapolated to delivery agents, tourists, etc.</li><li>Laying out fiber optic cables, fiber optic cables are not at all cheap, hence it is extremely important to devise a path that is most cost-efficient, and this is done using the traveling salesman method.</li><li>Drilling holes in a printed circuit board (PCB). In a PCB, holes of various sizes have to be drilled in order to affix electrical components into it. Randomly drilling roles will be inefficient as it will take up a lot of time in changing the drill again and again. This drilling problem can be viewed as a TSP problem, where the ‘cities’ are the initial position and the set of all holes that can be drilled with one and the same drill. The ‘distance’ between two cities is given by the time it takes to move the drilling head from one position to the other.</li><li>Even in astronomy, we find the application of TSP, a team of engineers at Hernandez Engineering in Houston and at Brigham Young University have experimented to optimize the sequence of celestial objects to be imaged. The goal of the study is to minimize the use of fuel in targeting and imaging maneuvers for the pair of satellites involved in the mission (the cities in the TSP are the celestial objects to be imaged, and the cost of travel is the amount of fuel needed to reposition the two satellites from one image to the next).</li><li>It should be hardly surprising now if I say TSP finds its application even in biology. A collection of DNA strings, each of length <em>k</em>, were embedded in one universal string, with the goal of minimizing the length of the universal string. (The cities of the TSP are the target strings, and the cost of travel is <em>k </em>minus the maximum overlap of the corresponding strings.). Genome sequencing is also one of the oldest applications of TSP.</li></ol><p><strong>As we have seen now, TSP is not only limited to salesmen, but to all of us practically. With its application in electrical engineering, telecommunication, delivery logistics, astronomy, and even biology, it would make sense for us to explore it further.</strong></p><h3>Brute Force Approach</h3><p>Let us consider that the school bus driver in the first example starting from the school has to stop at a total of 3 bus stops. He does a quick small calculation, finding all the possible ways in which he can go about, and choosing the best path. On observing we should notice that this is essentially combinatorics, the ways in which the driver can stop at the stops from a circular combination, and the number of permutations is given by (n-1)!/2.</p><h3>Complexity</h3><p>n! is defined as (n)(n-1)(n-2)…(n-(n-1)), i.e., of the order n^n.<br><strong><em>We get O(n^n).</em></strong></p><h3>Other methods to solve the problem</h3><p>Welp, we already have a method so why do we need other methods? Best illustrated using an example.</p><p>Now let&#39;s assume that the bus driver has instead of 3, 15 stops, how many permutations does that make? Over 600 billion possibilities.<br>With just 15 stops, we have 600 billion possibilities.</p><p><strong><em>Industrial applications might require the value of n to be in hundreds of thousands, and it should be pretty obvious now why this method cannot be used.</em></strong></p><h3>Greedy method</h3><blockquote><em>Algorithm:</em></blockquote><blockquote><em>1. Sort all edges. <br>2. Select the shortest edge and add it to our tour if it doesn’t violate any of the above constraints.<br>3. Do we have N edges in our tour? If no, repeat step 2</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1011/1*fJqMreh-CwG_EmHXX00vbA.png" /></figure><p>The Greedy method is really useful to find an approximate answer, it brings down the complexity to <strong>O(n²log ₂n),</strong> so the 15 stops will require only 900 computations. So our simplest algorithm even though gives us a sub-optimal solution, decreases the computation from 600 billion to 900 only.</p><h3>Branch and Bound</h3><p>The fundamental principle of Branch and Bound is:</p><ol><li>Recursively divide the status space into smaller spaces and minimize “costs” on these spaces. This process is called branching.</li><li>Branching will be equivalent to brute-force enumeration. To improve performance, a bound is used to limit the space in the status that is generated, eliminating potential solutions that are proven to not contain optimal solutions.</li></ol><p>To solve the TSP using the Branch and Bound method, you must choose a start node and then set the bound to a very large value. Select the cheapest arch between the unvisited and current node and then add the distance to the current distance. Repeat the process while the current distance is less than the bound. If the current distance is less than the bound, you’re done. You may add up the distance so that the bound will equal the current distance. Repeat this process until all the arcs have been covered.</p><p><strong>The complexity of the Branch and Bound technique is O(n²*2ⁿ), this might be much more in comparison to the greedy method, but it’s much more reliable and accurate.</strong></p><p>To learn more about how to solve this problem using branch and bound, refer <a href="https://turcomat.org/index.php/turkbilmat/article/download/3031/2603/5715">here</a>.</p><p>There are many more algorithms to solve TSP, like using dynamic programming, and backtracking, but<strong> they share a fundamental flow,</strong> <strong>they are all in the order of n.</strong></p><p>For increasingly large values of n, the number of computations to be done will be very very large, and therefore, their application in the industry is limited.</p><p>The algorithm, frequently used for industrial application purposes, needs to be accurate as well as efficient, one such algorithm is the Lin &amp; Kernighan algorithm, with the complexity of approximately <strong>O(n^2.2 )</strong> and though not exact, gives a good enough approximation.</p><p>The traveling salesman problem, which first surfaced in 1930, has now become one of the most popular and standard optimization problems and has found its way into almost every field of science, thus making it a necessity for us to have a basic theoretical overview of the problem and its solution, which I hope to have provided.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bdea659c2e76" width="1" height="1" alt=""><hr><p><a href="https://medium.com/sigma-xi-vit/a-theoretical-overview-of-the-traveling-salesman-problem-bdea659c2e76">A Theoretical Overview Of The Traveling Salesman Problem</a> was originally published in <a href="https://medium.com/sigma-xi-vit">SIGMA XI VIT</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>