A traveling salesman tour of Africa
Suppose you'd like to tour Africa, visiting each country once, then returning to your starting point, minimizing the distance traveled.
Here's my first attempt at a solution using Mathematica, based on an example in the documentation for FindShortestTour.
africa = CountryData["Africa"] FindShortestTour[africa] GeoGraphics[{Thick, Red, GeoPath[africa[[%[[2]]]]]}]
This produced the following map:
Hmm. Maybe I should have been more specific about what I mean by Africa." My intention was to find a tour of continental Africa, i.e. not including islands. This means I needed to remove several items from Mathematica's list of African countries. Also, I had in mind sovereign states, not territories of overseas states and not disputed territories.
After doing this, the map is more like what I'd expect.
The tour is then
- Algeria
- Tunisia
- Libya
- Egypt
- Chad
- Central African Republic
- Democratic Republic of the Congo
- Burundi
- Rwanda
- Uganda
- South Sudan
- Sudan
- Eritrea
- Djibouti
- Somalia
- Ethiopia
- Kenya
- Tanzania
- Malawi
- Zambia
- Mozambique
- Zimbabwe
- Eswatini
- Lesotho
- South Africa
- Botswana
- Namibia
- Angola
- Republic of the Congo
- Gabon
- Equatorial Guinea
- Cameroon
- Nigeria
- Niger
- Mali
- Burkina Faso
- Benin
- Togo
- Ghana
- Ivory Coast
- Liberia
- Sierra Leone
- Guinea
- Guinea-Bissau
- Gambia
- Senegal
- Mauritania
- Morocco
The initial tour, including islands, foreign territories, and Western Sahara, was 23,744 miles or 38,213 kilometers. The second tour was 21,074 miles or 33915 kilometers.
Here's a tour of just the islands, excluding foreign territories.
The order of the tour is
- Cape Verde
- Seychelles
- Mauritius
- Madagascar
- Comoros
- Sao Tome and Principe
This tour is 13,034 miles or 20,976 kilometers.
Update: See the next two posts for tours of the Americas and Eurasia and Oceania.
Related postsThe post A traveling salesman tour of Africa first appeared on John D. Cook.