My team “Quantum Guys” finished 5th in Code Samurai 2024. Today I will write about our journey and experience of different rounds of this competition.
Code Samurai is one of the biggest coding competitions in Bangladesh. The competition was held in collaboration with various Japanese companies and the Department of Computer Science and Engineering of Dhaka University, Bangladesh. The word samurai means warrior. As such, “Code Samurai” means one who fights by coding. A funny memory came to mind while saying this. I saluted my teammate Junior Asfi by calling him “Samurai Man” or code warrior in the Eid salami message caption. It is basically an inter-university hackathon competition. Where each team is given to solve one or more problems according to the problem set. This year there were a total of 3 rounds in this competition. 1200+ students from around 400+ teams participated in the preliminary selection. After the preliminary selection, 90 teams are selected for the 2nd round. Out of 90 teams, 45 teams got the opportunity to participate in the main competition held in the Computer Science and Engineering Department of Dhaka University.
1st round:
The 1st round was to create a backend application for a railway ticketing system. Designing the API system according to that problem was quite easy for us. In that 4 hour contest, there was a problem at 7 problems. From there I coded to connect to an online call. Except for the last optimization problem, we solved almost all of them very well. But little by little we have submitted the wrong file. Where docker containers do not run properly. But we were lucky the submission time was extended by 5 minutes. Finally, I fix it in 5 minutes and submit it. But still information went over our heads. In other words, none of us really noticed. That is the requirement we were told that every time we run our application, the database starts from a fresh condition. As the judging process is fully automated, they will simply check the output from our submitted code by running it as a Docker container. If it matches the test output, I will get a score and if it doesn’t match, I won’t get a score. So after the submission we gave up a lot of hope that we could go to the next round Because our application was not restarting the database every time. Moreover, our Postgres database was hosted on aws rds which was giving data very late when the network was low. We thought of using locally but for better collaboration we used a hosted database. And the rest of our tools for creating Api systems are: Express JS, Prisma ORM. However in that round we scored like 14500 out of 15000. Which was the 3rd highest score. We were really happy to finish 3rd out of so many teams. I think it gave us confidence in the other rounds as well. At the end of the 1st round, the number of teams was reduced from 400 to 90.
2nd round:
The 2nd round starts towards the middle of the fast. Here each team was asked to create a web based application for waste management of Dhaka North City Corporation. Where basically there were 3 types of users.
1. System Admin. That can manage, control and monitor everything. Like adding users, doing various access controls. Any data update, delete and assignment to relational properties.
2. STS Manager, who will basically perform various actions from secondary waste storage stations located at different points of the city. For example, how much waste a truck will take, how much waste is currently in the Sub Station or STS.
3. Landfall Manager refers to a landfill where waste is ultimately disposed of. For example Aminbazar Landfill for North City Corporation and Matuail for South City. So what the landfill manager will do is he will manage the various information of his landfill. If a truck dumps garbage, it will enter. And will generate the bill and provide the truck.
So we put a front end of Next js on our previous backend and develop the whole system within 1 week as per the given time. Apart from coding, this round involved submission of our entire system design, database relationship diagram, figma layout design, use-case diagram and activity diagram.
Moreover, in round 2 we had an interesting/challenging part of making a dashboard. Where we show a real time overview of the entire system on decision maps without using traditional various charts, graphs. That is, by looking at a map of Dhaka city, you can get an idea of how much waste is there at this moment, showing its size and color according to the capacity, where is the truck at this moment, how much waste is it carrying. And the landfill can be seen how much waste has been dumped in that landfill. And here is a date based controller to display this data for any particular time.
To solve this we had a plan. First we just need to highlight North City Corporation on the map divided by ward. I found online that this work can be easily integrated into Google Maps using geojson. For this I talked to my friend Rafid who studies geography. He suggested installing ArcGis to work with this.. But I had not found any specific map, shape-file of Dhaka North on the internet. Later, I got a shape-file of the whole Bangladesh, from that I deleted all the rest by keeping the ward of Dhaka North City. As a result, we got the North City shape-file. After making some additional changes, I converted it to geojson with geopandas. In this map, we have shown data of all STS or stations, trucks, landfills in an interactive way.
The submission was at 12 o’clock at night. But later it was extended to 12 am the next day. I had an interview that day at 10 am but I missed it to make a video demo. The demo video wasn’t very good because I was up all night trying a lot. It was very painful because there was no time. But that demo did not go well even with many retakes. Later, as I don’t have time, I submit it that way.
It took a long time to give the results of the 2nd round. We scored 88.5 out of 100 in this round Which was the 3rd highest score. After this round my confidence remained intact. In this round 90 to 45 are selected for the final round.
Final Round:
There was a gap of 1 week from the result of the 2nd round before the final. We were told that in the final round we have to build a mobile app by extending the 2nd round application. I used to work with an Actively mobile app about 2 years back. Also received prizes at several hackathons and project showcasing. I had many advanced skills then, but now I have forgotten many things. At that time I was so serious about making mobile apps that many people know that an app I made in my second year got one million bdt of funding from the ICT division. This however did not see the light of day due to many other external factors. Someday I will write about this in detail.
Anyway back to our 2nd round North City Corporation waste management system. Since the finals are still a few days away, we sit down and make some predictions that will be fun to listen to. If you have carefully read what we did in the 2nd round and what were their requirements, then you must have understood. Only one user type was missing in that round who needed to use the app. Because their position was continuously moving. Can you guess what the app might be for? Yes of course for drivers. Drivers take trucks to various sub-stations for garbage, then carry it to the landfill. By tracking the location of all their trucks, the trucks can be dynamically routed on optimized routes based on the real-time waste capacity of different stations. It sounds simple but there were many complexities for us to solve.
Our Prediction for the Final:
According to the 2nd round requirement, a truck visits the substations statically connected to it in only one route. But it costs a lot. It is neither optimized nor efficient. So how can the matter be optimized? We thought that a truck would not be connected to only one station, but a truck would go to any station and collect waste. And instead of thinking about one landfill, we thought about multiple landfills. In a word, a truck can collect waste from any waste station and dump waste at any landfill. Now we start working on designing the algorithm to derive the optimized trip plan according to the location, capacity, type of trucks. By trip plan, I mean making a future plan of exactly which sub station a track will visit, how much waste it collects, which route it follows, which landfill it will go to. Now the question is, Why are we talking about future plans? Because at the end of the day, the trucks take the waste to the landfill only at night. So we have information about what kind of waste is there in all the stations. Now we have to make an algorithm for a perfect plan. We consider a fully connected graph with each station for trip plan optimization, with the shortest distance of two points as edges. And think of many trucks as visitors in that graph. Much like the ‘traveling salesman’ algorithm.
Our main aim here was to minimize the number of trucks and maximize collection according to their capacity. So our algorithm was run once around 10pm to generate an automated optimized trippan for each truck. To increase the efficiency of the algorithm, we approached a teacher of our department, Honorable Aminul Islam Sir. Sir suggested us to use Reinforcements Learning Queue. While we can’t implement this at the moment, we feel we can more efficiently create trip plans for our trucks using reinforcement. Needless to say, even after creating the trip plan, the system admin can create, edit or update the trip plan using the application UI. The truck driver will get a notification on his phone before the start of work, which station to use today, which route to use. He will start his trip according to that plan. If we start waste collection according to this plan, the cost will be less.
Final round problem:
Unfortunately our prediction doesn’t match the final problem set. Nothing came of the driver or optimization in the final. A citizen app has arrived where citizens can post various articles, pictures, videos on waste management. Post topics can be waste management guidelines, awareness raising, disposal etc. Also they can create various issues which can be viewed by the system admin. In this case, it has been asked to keep the feature of issuing anonymous reports. And there was to show on the map whether there is any substation around me. We develop all these features in an Android app. We have created different access levels there so that only the admin can moderate the content shared by the citizens, delete the useless posts. Here I directly use many components of another app developed by me 2-3 years ago, that app was also uploaded to Play Store. Let those experiences come in handy in the finals.
New Problem Set also added some simple CRUD processing to the web application part. That is, there will be many workers under different contactors, the workers will connect the sub stations by taking waste houses or waste from different places in vans. These were not very interesting, what I liked here is that they want to track the workers but no mobile or camera can be given to the workers. It was very difficult for everyone to figure out this part cost effectively. We proposed a QR Code based solution. Which they didn’t dislike much. It is really difficult to do all these things in one day. We didn’t sleep at all. After passing the primary selection of judges in the morning, we were ranked in the top 10. Being in the top 10, we get a chance to give a presentation. We very confidently present demos of both our projects to everyone. We shared our optimization mechanism with judges. After the presentation we were very happy. Everything was going according to our expectations. After the presentation, we moved from CSEDU to DU’s Senate building.
Prize Giving:
Never been to the Senate building before. The place is very beautiful. In the beginning, a Japanese magician performs his amazing magic tricks in the Senate building. We enjoyed his magic tricks sleeplessly for almost 40 hours. After some boring speeches the prize giving announcement started. Counting starts from 10. A team from BUET won 10th place. Then our name was announced at the 5th position. Honestly I expected a little higher rank.
A little bit of disappointment at that moment was very tainted by the privilege of receiving the award on such a big stage. Everyone was appreciating us because our success rate in such competitions was not that great. We received the award from the eminent billionaire Salman F Rahman. Honorable Vice-Chancellor of Dhaka University Mr. Maqsud Kamal was also present there. Those few seconds on stage are some of the best moments of my life. There were 3 other Dhaka University teams in front of our ranks and an amazing team from SUST was the champion in Code Samurai 2024.
Not to mention an interesting fact, last year this team of SUST was the second runner-up in the Leading University of Sylhet, The team from DU who became the first runner-up here this time, they also became the first runner-up in the Leading University, where We were 4th position. However, a grand dinner was organized after the prize distribution.. Moreover, there was no registration fee.
Since the entire event was directly operated by the Japanese, the welfare of the final event allowed many Japanese people to observe up close. They are so polite, speak very nicely. I just thought they were all anime characters. The conversation, the head tilting all resembled the anime. But I had to get a little faster to understand many of them in English. A big thank you to the Japanese people for hosting such a great event.
Everything about this competition was top notch but one thing is not to say, we fared pretty well with WiFi connectivity during the contest time. The internet was going out again and again which was dropping our focus. Hopefully there will be no such problems in the future. In conclusion, this is the best hackathon I have seen so far. It still feels like a dream that it’s all over. I will definitely participate again if I get a chance. Many thanks to everyone involved in this whole event.
All our code are here: https://github.com/JHM69/CS24-p2-quantum_guys