
Ask HN: Algorithm for Scheduling appointments by location - tmaly
Is there a good general purpose algorithm that can be used to schedule appointments given time and location constraints.  Say someone wants me to come to their house to fix a computer at a certain time on a particular day and their neighbor also needs a computer fixed and is flexible with time.  The algorithm would work it out to show the neighbor that I am near by and available on a certain time slot.  Another potential client that is 50 miles away wants to schedule something close to the same time slots, but the algorithm considers they are much farther away and offers them a time slot much later in the day.
======
heynickc
It's been a while since I looked into this myself, but I used to do a lot of
GIS work and have a lot of experience with the tools for doing this kind of
analysis. Doing a quick search around for a general purpose algorithm for the
"traveling salesman problem" \- I came across this: [http://www-sre.wu-
wien.ac.at/ersa/ersaconfs/ersa03/cdrom/pap...](http://www-sre.wu-
wien.ac.at/ersa/ersaconfs/ersa03/cdrom/papers/433.pdf)

In my experience, the most important part of doing network analysis is to have
a "topology model" for your road network data. It contains the information
necessary to model turns, drive-time, traffic signals, etc.

Anyway, I used to know the 1000 ft view of the math behind this stuff but not
anymore. If, however, you're trying to build it into an application - there
are solutions like pgRouting
[https://github.com/pgRouting/pgrouting](https://github.com/pgRouting/pgrouting)
which utilizes PostGIS (PostgreSQL), ESRI's Network Analyst ($$), and Google
Maps Directions API. These all leverage some underlying topology data like
Open Street Map to do routing and figure out the subsequent times/schedule to
get from point to point to point...

Hope this helps!

~~~
tmaly
Thanks, I have no real experience in this. I was hoping there was some general
purpose library available to do this. I would even be ok to just consider
straight line distances without regard to traffic etc.

~~~
heynickc
Gotcha. You might also be able to search around Mapbox's Github repos
[https://github.com/mapbox](https://github.com/mapbox) for a good library, or
at least some good examples.

