
The Traveling Salesman with Simulated Annealing, R, and Shiny - sebg
http://toddwschneider.com/posts/traveling-salesman-with-simulated-annealing-r-and-shiny/
======
teps
I don't understand how the simulated annealing is helping.

I quote the explanation of step 4:

    
    
      If the candidate tour is worse than the existing tour, still maybe accept it, according to some probability. 
      The probability of accepting an inferior tour is a function of how much longer the candidate is compared to the current tour, and the temperature of the annealing process. 
      A higher temperature makes you more likely to accept an inferior tour
    

Why would you need a simulated annealing for a seemingly so simple function?

~~~
spooningtamarin
Simulated annealing is simple. It's just the acceptance criterion of simulated
annealing that you are using.

You take the previous solution, and the current one, the difference of the
cost (up or down) and plug it into the formula.

Simulated annealing allows some jumps up and jumps down, hill climbing goes
only up.

~~~
baldeagle
And the purpose of the down jumps is to move you away from a local maxima. For
example, if you were wanting to climb [any large mountain] and could only gain
elevation, then you would fairly easily get stuck in the stairwell of the
hotel in the valley.

------
sandGorgon
A little bit off topic, but has anyone run a r based api in production? What
do you guys use - something like renjin...or do you put up reserve behind a
connection pool ?

It's really hard to find something around this.

~~~
trestletech
YHat and Domino Data Labs both have commercial solutions for exactly this.

On the open-source front, OpenCPU
([https://www.opencpu.org/](https://www.opencpu.org/)), Jug
([http://bart6114.github.io/jug/](http://bart6114.github.io/jug/)) or plumber
([http://plumber.trestletech.com/](http://plumber.trestletech.com/)) are all
built for this. Plumber has a page to guide you through setting it up on a
server using PM2 here:
[http://plumber.trestletech.com/docs/hosting/](http://plumber.trestletech.com/docs/hosting/)

(Conflict of interest warning: I wrote plumber.)

I've been running an API on plumber (with admittedly low volumes of traffic)
for months now unattended using a strategy similar to the guide mentioned
above. Haven't had any issues yet.

~~~
sandGorgon
Very cool! How do you manage this in production? We use supervisors for other
services. Is plumber aware of USR1, SIGHUP,etc signals to trigger restarts,etc

