When I am not programming, playing music or studying I like to spend my summers working at Tivoli Friheden in Aarhus. There I get to enjoy the weather, the weekly concerts and lots of good colleagues! It is a nice break from the 0's and 1's of programming. When I worked as a rollercoaster operator, I saw how my manager would spend each morning before opening, by filling out a schedule of which rollercoasters should be operated by who that day. I quickly realized that it not that simple. There are certain requirements and rules they must abide by. And then there is the important aspect of employee satisfaction. A 10-hour-shift is just a bit more fun if you haven't spent the last 3 shifts in the same rollercoaster as well, but with 130 total operators, that is quite difficult to manage in your head.
SAT-solving to the rescue!
Luckily, it was around this time that I was introduced to SAT solving in one of my courses at university. The idea of solving a mathematical satisfiability problem sounded like it could be used in Tivoli's case! I started investigating and found that Google has built a set of tools called "OR-Tools", which allows you to define and solve SAT problems in Python. This led me to build a tool for my manager called: "Bytte Bent". It was built in Python with Tkinter for the UI-part, SQLLite for the database and OR-Tools for SAT solving. It basically allowed to manager to input which employees are working today, what certifications do they have, any manual overrides and with the click of a button, a schedule was built! All 30 employees evenly distributed among the rollercoasters, minimizing the total time they have spent in that rollercoaster the last few shifts and also abiding by various rules, such as cyclic rotations throughout the day, when the employees had a break.
This was a really fun project to make and it benefitted both my manager, but also me and my colleagues that spent each day out in the park at a rollercoaster.