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:

how_it_works_1.png

how_it_works_2.gif

Use CloudDeploy to publicly deploy the FormPage to the Wolfram Cloud:

how_it_works_3.png

how_it_works_4.png

how_it_works_5.gif


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:

how_it_works_6.png

how_it_works_7.png

how_it_works_8.png

how_it_works_9.png

how_it_works_10.png

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:

how_it_works_11.png

Graphics:None


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:

how_it_works_13.png

how_it_works_14.gif

how_it_works_15.png

how_it_works_16.gif

If flying is required, then TravelDirections will fail to compute the path with the travel method “Driving”:

how_it_works_17.png

how_it_works_18.png

how_it_works_19.png


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:

how_it_works_20.gif

how_it_works_21.png

how_it_works_22.png

how_it_works_23.png

how_it_works_24.gif

Find the shortest tour to visit your friends and relatives!