I recall the first time I experienced the black box magic of AI outside of LLMs.
I was given a task to prototype an employee shift scheduling webapp for a big hotel chain in Southeast Asia. My boss had already warned us that we could not use the usual for loops and if else logic. Come to think of it, this is something that requires a sophisticated solution. You need to automate a monthly schedule for 50+ employees. There are full timers who can work 40 hours and part timers at 20 hours, and these employees all have personal preferences. Some employees cannot work on Fridays, some have every Friday off, some are unavailable on Mondays every two weeks. These employees also need to be allocated shifts where each department has different shift lengths. housekeeping is only 4 hours, while front office needs to do 8 hours.
I tried to research the problem and found out it is actually an NP-hard problem called the Nurse Scheduling Problem. I came across Google OR-Tools, which is where I learned about the existence of SAT solvers. I then found OptaPlanner, a solution more suited to our needs since we had to integrate it with an existing Java webapp we had already built for those hotels. In there I learned about constraints and how to translate real world constraints into parts of the algorithm. It is a different way of thinking about code, you do not write a solution, but you write the shape of the problem, then you choose a search strategy to solve it. You can use brute force, or level up to more advanced solutions like genetic algorithms or simulated annealing.
After I developed the backend and plugged it into a frontend calendar, I was amazed by the magic of experiencing it as an end user who does not know what is happening in the backend. As an end user, you just input the constraints, hit generate, the backend works for one to three minutes, and then boom, the calendar is full of shifts. Magically all the constraints are fulfilled and you do not need to spend a full day juggling all the employee availability yourself. Like Clarke's Third Law: any sufficiently advanced technology is indistinguishable from magic.
On a side note, OptaPlanner has since spun off into an independent startup called Timefold, founded around 2023, with a focus on scaling optimization solvers for enterprise use. I think they will succeed because these problems exist across many industries in the real world, and the solutions are genuinely useful.