TSP (Traveling Salesman Problem) solver Using Goog

2020-06-17 14:40发布

We are developing an application, in which we will show some available houses for sale in google map. User can select any houses from the map and can find the shortest driving route between all the houses he/she selected.

Can any one please tell me how we can find the shortest route and can show that on the map? Is there any PHP based TSP library, that can help us to achieve what we are trying?

3条回答
戒情不戒烟
2楼-- · 2020-06-17 14:53

If the problem satisfy the triangle inequality you can try the Christofides algorithm.

查看更多
一纸荒年 Trace。
3楼-- · 2020-06-17 15:09

A Google search shows many results.

You could probably combine the two, choosing which to run based on the size of the graph.

As @Barbar points out in the comments, there is an existing app that does what you're attempting. There is a blog post explaining how it works.

查看更多
再贱就再见
4楼-- · 2020-06-17 15:12

Its old but it may be useful to people: https://developers.google.com/maps/documentation/javascript/v2/services#RoutesAndSteps

just create waypoints for each house and let google do the math for you...

查看更多
登录 后发表回答