Skip to content(if available)orjump to list(if available)

Rotating Workforce Scheduling in MiniZinc

darksaints

I absolutely love minizinc and constraint programming in general, but I have to say that the whole concept of a specialized language for constraint programming really breaks down once you get past the toy problem stage. For example, there isn't really IO...the closest you can get is a specialized file format to input data into your model, and printing output to stderr. If you want specialized constraints, you're gonna need to implement them yourself at the language level. There aren't really libraries. It's really fun to play with, but not for serious problems that would underpin a production system.

Although it sometimes feels like it was created by an unholy union of mathematicians and 1990's C++ dweebs that never learned a new thing since Y2K, I'd really recommend Google's or-tools for something similar that requires a better solver and a language with actual capabilities outside of solving toy problems.

And although it's not a traditional constraint solver, I would also recommend Timefold. It's incredibly good for the types of problems that have elements of linear programming, quadratic programming, constraint programming, but also with odd domains that are hard to express as models using typical constraint programming idioms. I actually have had a bunch of incredibly valuable wins with this (and its predecessor Optiplanner)...for example, I've used it to optimize operations planning with $10+B budgets that could save 10+% over previous methodologies. And I've used it to dynamically reoptimized auction bidding strategies for FCC spectrum auctions, which saved us from overbidding on hot bid licenses by adjusting our bidding targets for subsequent rounds to capture better value for our auction money compared to what we could get in the secondary market.

irq-1

> For example, there isn't really IO...

Check out Picat. It has IO and you can use it for scripting.

https://picat-lang.org/

mzl

My process is generally that I want to prototype the model in MiniZinc and use that to run benchmarks. If the problem to solve is large or batch-oriented, I might also use MiniZinc in production (probably via the python wrapper for the toolchain).

If on the other hand the problem is smaller, is more meant as an interactive system, or there is a need for deep integration, then I would re-implement the model in the API for a solver, or I might even write a dedicated solver. As a Gecode developer, I naturally think that Gecode is very useful for the cases where the problem is not a traditional model / instance / solve / done process, but I've used many other solvers as well depending on circumstances and need.

I've never really felt that Optaplanner / Timefold has been that useful of effective. In the cases I might have used it, I've instead written a custom local search system or constraint programming like system, and I think that has been a more effective approach. Do you have an example of what kind of problem you used it for?

clickety_clack

I know a couple of people who work these kinds of shifts, and a major headache is trading shifts so that people can attend life events. If you could program that into this you could have a pretty interesting product.

whatever1

Scheduling optimization is everywhere. From project management and shift scheduling to even NFL game programming.

There are a ton of players in the market that they cater to specific use case.

The issue is that there are always domain-specific nuances that a generic solver does not capture. Someone needs to encode them.

mzl

That is more the area of workforce management systems, and they are really big business.

I’ve previously tried starting a scheduling company, and even when one has a product that in testing shows that it would save the potential customers lots of money, it is really hard to gain traction.

qsort

Younger me would jump on that problem. The issue, of course, is that by the time you're making allowances for life events, trading favors, etc. the problem isn't technical anymore.