The Traveling Salesman with Simulated Annealing, R, and Shiny
toddwschneider.com
toddwschneider.com
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?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.
Which are you referring to here as the "seemingly so simple function"?
It's really hard to find something around this.
On the open-source front, OpenCPU (https://www.opencpu.org/), Jug (http://bart6114.github.io/jug/) or plumber (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/
(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.