TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

The Traveling Salesman with Simulated Annealing, R, and Shiny

158 点作者 lil_tee超过 10 年前

11 条评论

cm2012超过 10 年前
I once had a real life issue with the travelling salesman problem - I wanted to invite boutique fashion retailers to a conference in '09, and I thought the best way would be to tell them about it face to face. I mapped out the address of every single one on some app on top of Google Maps, and ended up optimizing based on how clustered different groups of businesses were, to minimize my walking time while maximizing number of visits.
评论 #8332134 未加载
graycat超过 10 年前
Of course the traveling salesman problem is <i>combinatorial optimization,</i> and of course Uber, Lyft, Sidecar, etc. have such problems, as has long been the case for <i>dial a ride</i>.<p>And, for the case of trips regularly planned, e.g., using one car to get the same several people to work each day, would have a <i>deterministic</i> problem. Of course, part of the problem would be which people shared which car.<p>Otherwise there is something of a <i>probabilistic</i> problem where the driver gets a travel request at some random time for some random origin and destination and has to decide what to do, e.g., accept the offer or not and how to fit the offer in with what else he is doing.<p>Might be a lot of work, but might save some money and&#x2F;or give better service to the customers.<p>At one time, my Ph.D. advisor wanted me to work on dial a ride scheduling. But I already had a problem I&#x27;d made good progress on and used that for my dissertation instead! One reason: For the problem I used, I could claim to have a solution that was <i>optimal</i> in a quite strong sense, but for dial a ride any solution would be only a big mess probabilistically, some big mess that was just heuristic, and that could be evaluated only empirically. Bummer.<p>Now, I also have another problem! So, anyone who wants to work on combinatorial optimization and hope to get interest from Uber, Lyft, Sidecar, etc. -- go for it!
graycat超过 10 年前
Nice visualization of an application of simulated annealing.<p>We should keep in mind that the OP is doing the traveling salesman problem (TSP) in the plane. So we should recall the nice Karp result in about 1972: With meager assumptions on the probability distribution of the cities, for any number x, no matter how small, as the number of cities n goes to infinity, there is a simple approach that will come within x% of optimality with probability 1 - x.<p>This simple approach? Start by connecting the cities with a minimum spanning tree. Then for the TSP tour, just traverse the spanning tree except going directly to the next city in the tree traversal not already visited. That is, when following the tree would cause visiting a city a second time, just go directly, not following an arc in the tree, to the next city in the tree traversal not yet visited.<p>So intuitively the value is, for large n, get about as close, about as often as wish, and for small n just enumerate!<p>Intuitively what is going on is that one of the main challenges is identifying the appropriate <i>clusters</i> of cities and, then, connecting the clusters, and the minimum spanning tree tends to find the right clusters.<p>Of course, there are at least two algorithms for finding minimum spanning trees, and as I recall both run in time proportional to n^2. So, we have a polynomial algorithm that is, for large n, for TSP in the plane, as close as we please.<p>For the &quot;plane&quot;, I meant R^2, where R is the set of real numbers, that is, ordinary Euclidean 2-space. But Karp&#x27;s approach also works the same in R^m for any positive integer m.
startupfounder超过 10 年前
This is awesome and I can see so many use cases with logistics in cities like NYC by using addresses, and not capitals, as waypoints.<p>I would love to see this applied to the NYC taxi data to see how to optimise taxi movements and see how much ridesharing would decrease car traffic.<p>Code is here: <a href="https://github.com/toddwschneider/shiny-salesman" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;toddwschneider&#x2F;shiny-salesman</a>
评论 #8331132 未加载
HCIdivision17超过 10 年前
I enjoy finding retrospectively obvious details from essays like this: an optimal solution won&#x27;t have any crossing paths, and simply swapping cities is a handy way to try detangling the path! The animated graphs make this plain, but is it required? Having never thought about the TSP much (and not really having the mathematical chops to prove it myself) I looked it up, and sure enough SO user lhf [0,1] had a link to a grindingly in-depth article about the problem [2].<p>[0] <a href="http://stackoverflow.com/questions/2444125/crossing-edges-in-the-travelling-salesman-problem" rel="nofollow">http:&#x2F;&#x2F;stackoverflow.com&#x2F;questions&#x2F;2444125&#x2F;crossing-edges-in...</a> [1] <a href="http://stackoverflow.com/a/2444288" rel="nofollow">http:&#x2F;&#x2F;stackoverflow.com&#x2F;a&#x2F;2444288</a> [2] <a href="http://www.ams.org/samplings/feature-column/fcarc-tsp" rel="nofollow">http:&#x2F;&#x2F;www.ams.org&#x2F;samplings&#x2F;feature-column&#x2F;fcarc-tsp</a>
pushedx超过 10 年前
Simulated annealing is used heavily in chip design automation (EDA). I first used it when writing a toy placement tool while taking a course on the subject.<p>Slide 5 of this deck shows some of the problems in chip-design, most of which have been heavily optimized by simulated annealing. <a href="http://www.ispd.cc/slides/ISPD12Slides/ISPD12_3_2.pdf" rel="nofollow">http:&#x2F;&#x2F;www.ispd.cc&#x2F;slides&#x2F;ISPD12Slides&#x2F;ISPD12_3_2.pdf</a><p>I love the beauty of the analogy to annealing a metal in metallurgy, and how surprisingly well it translates into software. The fact that the result is non-deterministic, but always useful, makes me smile.
评论 #8332608 未加载
makosdv超过 10 年前
It&#x27;s cool to see this kind of stuff. I used simulated annealing for my thesis on cellular network optimization back in college. Haven&#x27;t used any algorithms like this since then, but they have their uses.
评论 #8332856 未加载
joshvm超过 10 年前
Presumably this could be extended to include, say, average flight costs and other modes of transport so you could work out the an optimally fast and cheap way to travel around the world?
评论 #8332609 未加载
pyk超过 10 年前
Wow, the article didn&#x27;t even mention the &quot;original&quot; solve of the 48 US city problem (one in each state) in 1954 (they included Washington D.C., so 49 to be precise)! For those interested, Dantzig (creator of the simplex method), Fulkerson and Johnson made quite the stir when they tried out the TSP at Rand in California more than half a century ago in their paper, &quot;Solution of a large scale traveling salesman problem&quot; [1].<p>The paper contains a historical context of the problem and their methods towards finding and proving (important!) that their solution was in fact optimal.<p>For those interested in Dantzig, he was the famed PhD student who came late to class one day and wrote down two open problems mistakenly thinking it was homework. He ended up using those solutions as a portion of his PhD thesis [2].<p>Here&#x27;s an excerpt from Dantzig himself:<p><i>It happened because during my first year at Berkeley I arrived late one day at one of [Jerzy] Neyman&#x27;s classes. On the blackboard there were two problems that I assumed had been assigned for homework. I copied them down. A few days later I apologized to Neyman for taking so long to do the homework — the problems seemed to be a little harder than usual. I asked him if he still wanted it. He told me to throw it on his desk. I did so reluctantly because his desk was covered with such a heap of papers that I feared my homework would be lost there forever. About six weeks later, one Sunday morning about eight o&#x27;clock, [my wife] Anne and I were awakened by someone banging on our front door. It was Neyman. He rushed in with papers in hand, all excited: &quot;I&#x27;ve just written an introduction to one of your papers. Read it so I can send it out right away for publication.&quot; For a minute I had no idea what he was talking about. To make a long story short, the problems on the blackboard that I had solved thinking they were homework were in fact two famous unsolved problems in statistics. That was the first inkling I had that there was anything special about them.<p>A year later, when I began to worry about a thesis topic, Neyman just shrugged and told me to wrap the two problems in a binder and he would accept them as my thesis.<p>The second of the two problems, however, was not published until after World War II. It happened this way. Around 1950 I received a letter from Abraham Wald enclosing the final galley proofs of a paper of his about to go to press in the Annals of Mathematical Statistics. Someone had just pointed out to him that the main result in his paper was the same as the second &quot;homework&quot; problem solved in my thesis. I wrote back suggesting we publish jointly. He simply inserted my name as coauthor into the galley proof.</i><p>[1] <a href="http://www.iro.umontreal.ca/~gendron/IFT6551/LECTURES/TSP.pdf" rel="nofollow">http:&#x2F;&#x2F;www.iro.umontreal.ca&#x2F;~gendron&#x2F;IFT6551&#x2F;LECTURES&#x2F;TSP.pd...</a><p>[2] <a href="http://www.snopes.com/college/homework/unsolvable.asp" rel="nofollow">http:&#x2F;&#x2F;www.snopes.com&#x2F;college&#x2F;homework&#x2F;unsolvable.asp</a>
pradn超过 10 年前
Lovely site design and clear explanation of simulated annealing. I&#x27;ve always more or less equated hill climbing and simulated annealing. Your article makes the difference easy to understand. Thanks!
chromaton超过 10 年前
I believe the effectiveness of search algorithms goes something like this:<p>Monte Carlo &lt; Hill climbing &lt; Simulated annealing &lt; Genetic algorithm &lt; Differential evolution
评论 #8331798 未加载
评论 #8332878 未加载