Find the shortest tour to visit your friends and relatives!
How It Works - Family Tour
Powered by the Wolfram Language and the Wolfram Cloud
Family Tour is a showcase of three functions—FormPage, TravelDirections, and FindShortestTour—from the 5,000+ that are built into the Wolfram Language.
Based on more than 25 years of development, the Wolfram Language is a unique new high-level computer language that builds in as much computational knowledge about algorithms and the world as possible.
FormPage in the Wolfram Language
The Wolfram Language has built-in capabilities for creating and deploying forms on the web and elsewhere. Use FormPage to deploy dynamic forms that generate results on the same page on the web.
Here is a FormPage with a RepeatingElement named cities that can appear between 1 and 10 times. Initially, the element appears three times, and it comes with the “City” Interpreter type. When four cities or more are submitted, the FormPage returns a joined GeoListPlot of their GeoPosition:
Use CloudDeploy to publicly deploy the FormPage to the Wolfram Cloud:
Find the Shortest Tour
To find the shortest tour to visit, let’s say all of the large cities of Canada, you will need to compute their GeoPosition first and then apply the built-in function FindShortestTour:
FindShortestTour provides an ordering of the GeoPositions that minimizes the total distance on a path from Toronto to Montreal. To show that tour on a map, you can use a GeoListPlot of the cities preserving the ordering of FindShortestTour:
Travel Directions
Since Version 10.3, the Wolfram Language has built-in TravelDirections for three different travel methods: “Driving”, “Biking”, and “Walking”. If flying isn’t required, TravelDirections will return a GeoPath that can be visualized with GeoGraphics:
If flying is required, then TravelDirections will fail to compute the path with the travel method “Driving”:
Deploying to the Web
The Wolfram Language supports highly automated web deployment based on the Wolfram Cloud and Wolfram Private Clouds. The following is all it takes to deploy a polished FormPage to the Wolfram Cloud. The result format is set to be a “PNG” using ExportForm, and a title and a description have been added using AppearanceRules: