TAMUhack 2023🔗︎
My First Hackathon🔗︎
I spend a lot of time programming. The goal for most of my projects is to expand my skills by doing something I had never done before. I don't set deadlines and I don't even commit to spending a certain amount of time working on it. Once I have a viable product, I move on. This process can take weeks or even months sometimes. Hackathons are the complete opposite. In a hackathon, you have to take a problem, design a solution, and implement the solution, all in 24 hours. 24 hours seems like a lot of time, especially with a team, but debugging can take a lot of time.
I was unprepared for this hackathon. I didn't find a team beforehand and I didn't have a project in mind. I thought that the format would be more like a game jam, where everyone is given a theme to get them started. I was surprised that the challenges were not released until the hacking began. I was also surprised that we had the option to create whatever we wanted, without adhering to a theme or solving a specific challenge. I found a team at the beginning of the event and we settled on tackling the CBRE Challenge.
CBRE Challenge🔗︎
CBRE is the largest Commercial Real Estate Services company by revenue. One common challenge we help our clients overcome is to help fill an office space, given a team structure and preferences. And at the same time, maximize the amount of space available. Create an app to visualize the most optimal way of allotting the teams to the space across the floors, so that none of the floors remain empty and at least 25% of each floor remains occupied.
This challenge has two main components: the optimization algorithm and the visualization. I decided to focus on the
algorithm while my teammate worked on the visualization. I researched many candidate algorithms to solve this problem.
This challenge is a combinatorial optimization problem that
contains elements of the stable marriage problem and the
knapsack problem. I tried several algorithms, but each one only
satisfied one of the optimization conditions at a time. The sample data that we were given to test our algorithm
contains 11 teams and 5 floors, so it was reasonable to test all the combinations to find the best one. So that is
exactly what I did. I wrote the algorithm in C++ for maximum efficiency. Heap allocations are also avoided entirely.
This algorithm has a complexity of O(n2)
space and time. In practice, the space used by the
algorithm is negligible even if there are hundreds of teams, but time is a real problem. When my program is run on the
sample data, it takes 15-20 seconds to process. This is reasonable, but there is a possibility that the time could grow
to minutes or even hours if there are enough teams. Despite these shortcomings, I was satisfied that my program would
always find the most optimal solution.
Creating the API Server🔗︎
My teammate was creating the frontend in React, so we needed to make sure that the React application could interact with my C++ program. To do this, I created a Python API server with FastAPI to manage the algorithm program. I implemented a basic account system to store team and floor data with each building manager's account. Several API routes were necessary to achieve this functionality.
Our Final Product🔗︎
The frontend was a bit rough around the edges. We didn't have time to create the account creation flow, so there is a
single hardcoded account. Once you log in with that account, you are able to upload teams.csv
and floors.csv
, then
there is a button to submit. After the optimal floor arrangement is returned to the client, a summary report is
generated in the form of a bar graph. Despite the algorithm functioning properly, our visualization was basic in
comparison.
Lessons Learned🔗︎
We didn't win any awards, but we learned a lot about how to problem-solve quickly and pivot when something isn't working. We received some interesting feedback from the judges. One judge mentioned that it might be beneficial to offer multiple options for team arrangements to add an element of choice to the application. It was then that I realized that the whole time I was coming up with the solution, I was thinking of it like a math problem. Sometimes we forget that the solutions that we're creating are going to be used by real people with interests beyond the problem domain. It can also be motivating and give you a sense of purpose to think this way.
I believe I was disadvantaged by not finding a team before the event. If I had worked with these people before or had discussed ideas beforehand, we might have been able to be more efficient. Although, I did get some practice working with people that I hadn't met before. We quickly identified each of our strengths and used that information to assign tasks. Looking back, we could have assisted each other more with our tasks when issues came up.
Overall, I had a lot of fun. This definitely won't be my last hackathon.
The Algorithm🔗︎
algorithm.cpp | |
---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 |
|
Results🔗︎
Links🔗︎
View Code On GitHub View Entry On Devpost View Competition Website