DEV Community

Cover image for Twitch Recap: Building a Small-Service Delivery App!
Olivia Vahsen 🥑 🦄 for TomTom Devs

Posted on

Twitch Recap: Building a Small-Service Delivery App!

Last week on Twitch, we did something a little different! As we've grown our channel, we wanted to experiment with doing two shorter streams instead of our regular long session. You can find the links to part 1 and part 2 here!

Originally, Jose and I presented a demo of this sample project at the recent virtual WeAreDevelopers conference in Vienna. We had a great time and wanted to break down these components for our Twitch audience.

In general, this project focused on the differences between creating multi-stop routing based on optimal speed vs. based on optimal distance, taking real-time traffic into consideration.

Alt Text

In part one, we focused specifically on the principles behind optimal "shortest path" finding, and explained the TSP (Traveling Salesman Problem).

TSP is familiar to many engineers for its lack of a universal solution - its one mathematical concept which can only be solved by a high-speed check of all possible path options.

When "paths" need to be mapped onto real-life roads, it introduces a whole new set of factors that TSP isn't responsible for - road closures, accidents, winding turns, and daily congestion.

Alt Text

In this project specifically, we used the nearest neighbor algorithm to help us marry a need for optimal delivery stops along our route, along with our optimal route calculations. Each route could be calculated with a priority of either the shortest speed or the shortest total distance. These are often not the same!

Alt Text

In part two, we used topics from one of our last devisodes to create radial geofences around each delivery waypoint on our route. This would allow us to later use the Notifications API to alert our recipient when their delivery is close to arriving.

Alt Text

By using a webhook connecting to MS Teams, we were able to view notifications of when our delivery car arrived in and out of the geofence, or dwelled there for a certain number of seconds.

Alt Text

Be sure to catch our Q&A on Traffic next week, Dec 15th at 12pm PST!

Top comments (0)