Inspiration
WakeFern provided us with challenges, and one of the challenges was optimizing shopping to make it fast, easy and efficient. We recalled how one of the biggest problems in grocery shopping is navigating the maze of aisles to find the items we need which can turn a 15 minute grocery trip to a two hour one. Not to mention, all that wandering can cause someone to forget things on their list and get distracted by an unnecessary item. This causes you to waste both time and money.
What it does
Shoprite Shuffle makes shopping fast and efficient by providing the user with the route that would get to your items and to the checkout the fastest. Simply put in which items you want to purchase from their departments, and the algorithm will create a route which will minimize the distance traveled so you can spend less time searching and more time doing.
How we built it
We split the project into 3 main parts and coded in Java and Java Swing: the algorithm, the GUI, and the API.
The algorithm was creating the route with the shortest distance and was actually loosely based off of Dijkstra’s algorithm, but modified to path-find for multiple target nodes. It required some heavy modifications, and in the end it works just as we wanted it to.
The GUI was created using Java Swing and allowed the user to select which items they wanted. After selecting the items they wanted to purchase, they could finalize their list and the map of where to go first would display.
We retrieved the item data from the API. Using the API, we got the Departments and the types of food and applied that into our algorithm and GUI.
Challenges we ran into
The most difficult part of this project was creating the algorithm. Although we were familiar with similar path-finding algorithms (such as Dijsktra’s algorithm), this was more intense because there were multiple locations and we had to optimize the distance between all of those. Since there were multiple target nodes, a typical Dijkstra’s algorithm would not suffice, as it is intended to be used to find the shortest path from a single node to an individual target node. Initially, we had to find a better algorithm to use, which led to us using an algorithm we found in a published scientific article, but even that came with its own problems: issues arose with fixing both the start and end of the path that threw us for a loop.
Additionally, a major challenge was using the API. We were able to pull the data from the get request, and our hope was to parse through the JSON array of objects that would return. Unfortunately, the JSON file itself had formatting issues, specifically a misplaced comma at line 370 which caused an “Unexpected Token” error, so we were unable to parse through the file to get the individual elements. We were able to fix it on our own workspace, but since the code directly references the original JSON API file, we could not resolve the issue. As a result, we had to hardcode the data values.
Accomplishments that we're proud of
The algorithm was the most challenging aspect of this project. Since it had so many complicated elements, it felt incredible seeing it properly function and work as intended, with fairly few errors in the code itself.
What we learned
We learned a lot from the algorithm part of this project; it made us think and utilize our brains in a really interesting way, taking an existing algorithm, having to understand a re-adaptation of it, and then modifying that even more for our own uses.
We also learned a lot more about how to work with APIs, get requests, and how to parse through a JSON file. Though JSON can be a bit challenging to work with at times, we learned a lot more about how to do it. We can definitely apply more APIs into our future projects since this gave us a solid foundation.
What's next for Shoprite Shuffle–Get your items with no struggle!
Assuming the JSON formatting issue is resolved and we can successfully use it, we would apply that into our code. We could also use the price information from the API and include a final price so customers can see their budget and save both time and money.
Although certain aspects of Shoprite Shuffle are hardcoded (for example, the coordinate system would have to differ per shoprite location), the general algorithm can be applied to other stores. This could be incredibly useful and help save time and money for millions of customers.


Log in or sign up for Devpost to join the conversation.