How gotFlowers? Built A Delivery Management System with the HERE platform
#BuiltWithHERE is a series that showcases how developers are using the HERE platform to solve location-related business problems using location data. Each post highlights developer solutions and apps that are timely, innovative, and transformative.
In this blog post, we showcase the work of a Silicon Valley based company, gotFlowers?, that created a cloud service for retail florists. They offer a full suite of tools to help their clients manage every aspect of their business. From product management, marketing, workflows, inventory control, point-of-sale systems, credit card processing and of course, delivery management!
We interviewed Sheldon Allen, Senior Software Engineer at gotFlowers?, on how they use the HERE platform to build their service using location data.
Location-related business problems
The biggest challenge with any delivery management system is solving “The Traveling Salesman Problem” or more specifically, the Vehicle Routing Problem (VRP). The question it poses is, given a set of stops, what is the most optimal route for a vehicle to take? Depending on the business, optimal can mean different things, in the case of flower shops, “optimal” is the least amount of travel time because flowers are perishable items.
Depending on the size of the flower shop, they might average anywhere between 10 to 50 deliveries a day. Around Valentine’s Day and Mother’s Day, shops are handling hundreds of deliveries. Imagine managing 450+ deliveries on Valentine’s Day, the busiest day of the year! It’s a lot to optimize. On top of that, deliveries might have specific time requirements such as delivery windows. As an example, flowers for funerals must be delivered before a specific time, with no exceptions. Some customers might request early AM deliveries or “deliver after 2pm”. Another curveball is same-day orders. Most shops allow orders to be placed for same-day delivery before a certain cutoff time. All of these variables must be considered for the optimization algorithm.
Solution using HERE Technologies
The first thing gotFlowers? does is separate orders into "zones", which are user-defined polygonal areas. Usually, this is based on zip code boundaries. The flower shop types in a zip code and they pull the polygon of coordinates from the dataset. GotFlowers? then use the HERE Maps API for Javascript to display the zone and all the points. The flower shop can redefine zones as needed by adding new points or moving existing points around on the map. Some shops create zones based on areas such as "Downtown", "West City", "Upper City", etc.
Once all the zones are created, deliveries are automatically sorted into these zones, using HERE Geocoding & Search API to convert delivery addresses into geographical coordinates. Then it calculates which of the zones the delivery address falls into, using a ray tracing algorithm; it draws a ray from outside of a polygon to the starting point (delivery address). If the ray intersects with the edges of the polygon an odd number of times, it's inside of the zone. Otherwise, it's outside of the zone.
Any zones that have deliveries form the basis of the routes. Finally, the biggest step is using the HERE Routing API, specifically, the Calculate Matrix call. Calculate Matrix lets you send a set of destinations, and it will return a matrix between all points with the travel distances and travel times. They feed this data to the call, using the deliveries that have been split by zone. They take the information that they get back and combine it with the order-specific factors to determine a final, optimized route for the driver to take. Primarily, they use a simple nearest neighbor implementation, which works for their customers’ purposes. Once the routes are optimized, they're assigned to a driver who can see all the details for each delivery on their Trega App, which is powered by the HERE SDK (Navigate Edition).
What’s next?
In the future, gotFlowers? is planning on looking into the HERE Waypoints Sequence API to see if it might be more efficient than using the Calculate Matrix. They are also implementing a real-time map overview of all drivers for a given shop and "destination arrival" estimations.
Have your say
Sign up for our newsletter
Why sign up:
- Latest offers and discounts
- Tailored content delivered weekly
- Exclusive events
- One click to unsubscribe