<?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 Sunny Amrat on Medium]]></title>
        <description><![CDATA[Stories by Sunny Amrat on Medium]]></description>
        <link>https://medium.com/@sunnya?source=rss-876548842e2e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*uMkuoeV9oTvwhCJFRSRDAg.jpeg</url>
            <title>Stories by Sunny Amrat on Medium</title>
            <link>https://medium.com/@sunnya?source=rss-876548842e2e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 14:41:29 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sunnya/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[The Financial Travelling Salesman Problem]]></title>
            <link>https://medium.com/sunnya/the-financial-travelling-salesman-problem-4a1d9636a069?source=rss-876548842e2e------2</link>
            <guid isPermaLink="false">https://medium.com/p/4a1d9636a069</guid>
            <category><![CDATA[wealth-management]]></category>
            <category><![CDATA[asset-management]]></category>
            <category><![CDATA[travelling-salesman]]></category>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[investment-management]]></category>
            <dc:creator><![CDATA[Sunny Amrat]]></dc:creator>
            <pubDate>Wed, 21 Mar 2018 07:02:05 GMT</pubDate>
            <atom:updated>2018-06-12T08:02:22.721Z</atom:updated>
            <content:encoded><![CDATA[<h4>A fresh perspective on a centuries-old curiosity</h4><p>The Travelling Salesman Problem (TSP) has been around for centuries and has been studied by mathematicians and scientists alike. It asks the following question:</p><blockquote>What is the shortest route through a list of cities in which you visit each city exactly once and return to the starting city?</blockquote><p>In computer science, the TSP is classed as an <em>NP-hard</em> problem and in simple terms, as the number of cities increases, it becomes harder to predict how long it will take to find the optimal route. There are, however, a number of approximate solutions which can return routes to within 3% of the optimal solution in polynomial time.</p><p>Asset and wealth management companies manage enormous amounts of money for their clients, which can range from government institutions to high net worth individuals. The salespeople in charge of managing the relationships with these clients travel a great deal as part of their role.</p><p>This leads us to an interesting crossroads between theoretical computer science and the investment management industry. To use the TSP in real life we’ll have to make a few considerations and adjust the problem statement to tailor it to the investment management space.</p><p>These adjustments will be covered by making the following considerations:</p><ol><li>We’re not using horse-drawn carriages or riding camels</li><li>We’re not travelling to a marketplace</li><li>Time matters more than distance</li><li>Visiting a client doesn’t necessarily imply co-location</li><li>Not all clients are equally valuable</li><li>Not all clients want to meet</li><li>Not everyone is a client yet</li></ol><p>In the following sections, these considerations will be discussed, allowing us to understand a new flavour of the TSP.</p><h4>We’re not using horse-drawn carriages or riding camels</h4><p>Although the origins of the Travelling Salesman Problem are unclear, we know that it is from a bygone era. The days of horse-drawn carriages and camels as the primary mode of transport are long gone.</p><p>With cars come traffic jams, and with trains and air travel come delays and cancellations. It’s no good giving a route which would be marred by traffic jams and delays simply because it’s the shortest route. A modern day TSP would not only have to consider multiple modes of transport, but it would also have to factor in traffic jams and delays into its dynamic route planning.</p><p>In addition to different modes of transport, a salesperson can’t simply set up a tent on the side of the road. Travel planning must therefore also be scheduled around the availability of suitable accommodation for the salesperson. Although this is a non-issue for most cities, major events can throw a spanner in the works. For example, an international sporting event in a city could make it infeasible to book a hotel room or drive through. Given this, our route planner must factor such anomalies and plan accordingly.</p><h4>We’re not travelling to a marketplace</h4><p>The TSP in its raw form is concerned with finding the shortest total distance for a salesperson’s route. This is a useful problem to solve for a salesperson travelling from marketplace to marketplace.</p><p>The concept of a physical marketplace isn’t as relevant in the investment management industry. There isn’t a fixed marketplace where a salesperson can set up shop and have customers approach. The onus is on the salesperson to visit their clients and so instead of a single marketplace in a city, the city itself is effectively comprised of a multitude of different marketplaces, one for each client.</p><p>The concept of a marketplace is also an evolving concept. It is not necessarily a physical location, and increasingly the marketplace has moved online. Sales pitches that traditionally take place face-to-face can now happen virtually. With the large amount of regulation and paperwork involved in onboarding a client, the industry has been slow to adopt a completely online process, but this marketplace is shifting. As this continues to occur, travelling to a marketplace will also take on a different shape.</p><h4>Time matters more than distance</h4><p>The TSP has practical applications in fields such as microchip design, where the shortest path must be laid out inside microprocessors. The nanoseconds it takes signals to traverse these silicon mazes affect the speed of the hardware so it’s of paramount importance to have the shortest route in place.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4WWzkcl1WOR_hrHR7UfVew.png" /><figcaption><strong>It is sometimes quicker to travel farther out due to transport links between certain locations. Above is a travel time map from Westminster, London </strong><em>(generated using TfL WebCAT) Key: Brown/Red/Orange — 0–45 minutes, Yellow — 45–60 minutes, Dark/Light Green — 60–90 minutes</em></figcaption></figure><p>Physical distance isn’t as important anymore. With multiple modes of transport, it sometimes takes the same amount of time to travel farther out due to the presence of train stations or regular flights between cities.</p><p>For a salesperson based in New York City, it takes slightly less time to fly to Washington DC as it does to take the train to Philadelphia. A naive application of a TSP algorithm might direct the salesperson to Philadelphia, thus highlighting the need for our route planning tool to consider <em>temporal </em>distance as opposed to <em>spatial </em>distance.</p><p>With this in mind, the TSP can now be restated as:</p><blockquote>Given a list of clients, what is the shortest <strong>amount of time</strong> it takes to meet each client exactly once and return back to my starting location?</blockquote><p>There are many pitfalls here that also need to be factored in. Flights have a significant amount of float time associated with them, such as travel to and from the airport and time lost in the boarding process. All of these factors must be accounted for when adjusting the TSP algorithm to work in the modern day.</p><h4>Not all clients are equally valuable</h4><p>For a salesperson with a large number of clients, it’s infeasible to go out and meet every single one. How does a salesperson choose? How does the salesperson create the list of clients to be fed into the TSP algorithm?</p><p>For asset and wealth managers, there are numerous ways of ranking their clients by order of precedence. The criteria by which clients are prioritized are typically of the following variety:</p><ul><li>Amount of money the client has: the higher the client’s assets or net worth, the higher they are prioritized</li><li>Amount of revenue generated from a client: linked to the point above, the more revenue a client brings in, the higher their priority</li><li>Business at risk: a salesperson will prioritize a client who is at risk of withdrawing their holdings with their investment manager</li></ul><p>In addition there are a large number of other factors which come into play, such as the client’s global presence and sales potential, number of employees, their product interests, marketing engagement… the list goes on.</p><p>Given these rankings (with appropriate weightings), our TSP algorithm must discard clients with a low rank from consideration to allow for both the effective use of the salesperson’s time, and the prioritization of which clients are seen in the given timeframe.</p><p>This is a classic machine learning problem. Given a corpus of data, a combination of algorithms could be used to determine and select the most appropriate criteria to be used in the ranking process. Then, using feature scaling this can be refined to produce intelligent rankings for clients.</p><p>Automating this process and leveraging machine learning techniques allow for a new twist on the TSP. Previously a salesperson would have to create a list of clients that they wanted to go and see. With the new ranking system, they would no longer be tasked with the manual process of finding the best clients to visit — machine learning could do the heavy lifting for them.</p><p>An extension of this is that a salesperson can reframe their query to the TSP. Instead of asking for the shortest route given a list of clients, a salesperson can now ask:</p><blockquote>Which clients should I see and what route should I take for a three-day trip to Boston next week?</blockquote><p>This is a vastly different question, which combines a sales planning tool with a route planning tool, but it starts to demonstrate the power and flexibility of modifying the TSP to fit the needs of a modern-day salesperson.</p><h4>Visiting a client doesn’t necessarily imply co-location</h4><p>Face-to-face meetings should be scheduled with only the highest ranked clients. This raises an interesting problem — which clients are worth the salesperson’s time? If a meeting is only going to take half an hour, but takes a four-hour round trip, our algorithm should allow the option to selectively deprioritize them and suggest alternatives.</p><p>A video or phone call may be the more appropriate mode of connecting with such clients, who could be ‘e-visited’ at any stage in the route, for example, the salesperson can talk to them while in transit, allowing them to squeeze more value out of their time.</p><p>The ability to filter clients out of a face-to-face meeting greatly improves the performance of the algorithm since it becomes much easier to find an efficient route when there are fewer stops to make.</p><p>In addition to this, the previously wasted float time (the time between two meetings, typically used to travel between locations) doubles up as time to meet clients via other avenues, be it phone calls, emails or video conferencing. This allows for new ways to increase the productivity and efficiency of salespeople.</p><h4>Not all clients want to meet</h4><p>Where some clients won’t have a face-to-face meeting due to the difficulty in planning a route around them, there are other reasons to not include a client in a route.</p><p>Each different client will have their preferred frequency of communication, both electronically and face-to-face. A client that was last met with one week ago should be ranked lower (in the list of clients by priority) than a client that was last met with 8 months ago. Meeting clients too regularly leads to a point of diminishing returns and may be off-putting. The inverse can also be true.</p><p>An extremely difficult addition to the Travelling Salesman Problem is to check that the client <em>can</em> meet. Assuming an optimized route, there is no indication that the client will actually be able to meet at the suggested time. This means that there will need to be multiple steps in defining an optimized route for the salesperson.</p><p>The availability of all clients will have to be determined and entered as an input, which is a difficult scheduling problem. If a client isn’t free, what happens then? Do we completely re-route so that we can coincide with the client when they are free? Or, do we de-prioritize them based on their lack of availability? Both, maybe.</p><p>There are multiple ways of solving this problem. The route planner could be run without client availability as a parameter. Then, given a first pass of the route, client’s availabilities at the set time can be determined. Based upon this, the route planner can swap people around or reroute accordingly.</p><p>If that re-routing fails, then a client can be pushed down the list of priorities and be saved until a later date. If a client is important enough that <em>even after </em>this de-prioritization they remain on the list, then they must be included in the route, resulting in other clients being pushed down the list to accommodate.</p><p>This is only one approach to solving the scheduling problem and may not be feasible in general (e.g. if a client isn’t available for the next month, but the salesperson is going on a trip next week). As previously discussed, the fallback could be to schedule a video conference or something of that sort, as opposed to relying on a physical meeting. The exact solution to the client’s availability is a hard one and in an industry where the client can dictate terms, there isn’t one simple solution.</p><p>The ideal TSP algorithm will highlight concerns in the route planning, but shouldn’t be over-burdened by it either.</p><h4>Not everyone is a client yet</h4><p>One thing we haven’t discussed yet is the importance for salespeople to travel to meet prospects and to close sales opportunities. Where we have previously discussed narrowing down the list, this will act to increase the size of the list.</p><p>As mentioned in the end of the ‘<em>Not all clients are equally valuable</em>’ section, a route can be planned given a set of criteria and parameters. An example would be a salesperson heading out to meet a prospect in a final stage of negotiation before closing a sale. The TSP algorithm would be able to suggest other clients/prospects to see along the way to maximize the utility in making the journey.</p><p>The result of all of our modifications to the TSP is that a salesperson could simply input a location and a time period, and an optimal route would be created, allowing the salesperson to meet with both clients and prospects along the way.</p><p>The Travelling Salesman Problem is an interesting mathematical curiosity and remains difficult problem to solve. The application and requisite modifications to fit it to the investment management industry lead us down many interesting avenues, turning it from a simple route planner into a fully fledged sales assistant.</p><p>Financial institutions of the future will have to race to build out this technology to remain competitive in an industry that is ripe for disruption.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4a1d9636a069" width="1" height="1" alt=""><hr><p><a href="https://medium.com/sunnya/the-financial-travelling-salesman-problem-4a1d9636a069">The Financial Travelling Salesman Problem</a> was originally published in <a href="https://medium.com/sunnya">Sunny’s Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Six Degrees of Kanye West]]></title>
            <link>https://medium.com/sunnya/six-degrees-of-kanye-west-4820737de1db?source=rss-876548842e2e------2</link>
            <guid isPermaLink="false">https://medium.com/p/4820737de1db</guid>
            <category><![CDATA[separation]]></category>
            <category><![CDATA[music]]></category>
            <category><![CDATA[six-degrees]]></category>
            <category><![CDATA[kanye-west]]></category>
            <category><![CDATA[sunny-projects]]></category>
            <dc:creator><![CDATA[Sunny Amrat]]></dc:creator>
            <pubDate>Sun, 04 Sep 2016 16:03:14 GMT</pubDate>
            <atom:updated>2016-12-26T23:29:58.173Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iiY-jV9KjcX_27Rd5pQi5g.png" /></figure><p><a href="http://sixdegreesofkanyewest.com/">Find your favourite artist&#39;s Kanye number</a></p><p>The theory of Six Degrees of Separation posits that everyone in the world is at most 6 degrees of separation away from everyone else. So that could be from things like friendship or family relations between people. Another way of thinking about this is that the network of everyone on Earth is a small world network where the average pair of people are connected by a small path length.</p><p>Some even suggest that due to the increase in modes of communication (telephone, internet) the average number of degrees of separation is below 5. This was explored in the context of actors and actresses with Six Degrees of Kevin Bacon. People who have been in a movie with Kevin Bacon have a Bacon number of 1 and people who have been in movies with them have a Bacon number of 2 and so on.</p><p>So what about music? A more general answer is already out there. WhoSampled have a brilliant tool to find the connections linking any two artists (<a href="http://www.whosampled.com/six-degrees/">link here</a>). I thought I’d remake the Kevin Bacon version but for music and with Kanye West at the centre.</p><h3>How does it work?</h3><p>I use the Spotify API to get info about artists and who they have collaborated with. Starting with Kanye, a list of all of his songs is gathered and then the songs which have multiple artists on them are picked out. A database is created and each artist is stored with the song that joins them and their predecessor (Kanye West if their Kanye number is 1).</p><p>The pseudo-code is as follows:</p><pre>Get artist songs<br>if song has more than one artist:<br>    add new artist to queue<br>    update database</pre><p>This is looped continuously to build up a database of artists which can be used to lookup names.</p><h3>What I used</h3><p>In the past when I’ve launched a site I’ve had big problems with performance and caching. I’m using a cheap $5 droplet on Digitalocean to host the website with nginx as the webserver acting as a reverse-proxy to Flask. It has surprisingly held up really well under the loads it has received. I also used Cloudflare for caching.</p><p>Although most days there are only about 50 hits, on the day it was shared to Reddit had about 50–100 active users for about 10 hours straight. It was running ever so slightly slower than would be ideal but it held up just fine. At the end of the trial by fire the website had accumulated over 200,000 hits and didn’t go down during any of that.</p><p>Proudest achievement, being featured on the <a href="https://developer.spotify.com/showcase/item/six-degrees-kanye-west/">Spotify showcase</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4820737de1db" width="1" height="1" alt=""><hr><p><a href="https://medium.com/sunnya/six-degrees-of-kanye-west-4820737de1db">Six Degrees of Kanye West</a> was originally published in <a href="https://medium.com/sunnya">Sunny’s Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>