Employee scheduling with CP-SAT, sharing a real-world implementation

21 views
Skip to first unread message

Victor

unread,
Mar 10, 2026, 5:05:40 PM (2 days ago) Mar 10
to or-tools-discuss

Hi everyone,

I built a CP-SAT-based employee scheduling system for my own needs, monthly rostering for regulated industries with cross-qualified staff, variable daily needs, legal rest constraints and fairness objectives.

The model uses boolean variables assign[e, d, s] and is_off[e, d], with hard constraints covering one shift per day, 11-hour rest between shifts (toxic pairs), qualification enforcement and fixed absences. Soft objectives use weighted penalties: coverage gaps (10k), missing days off (1.5k), weekend guarantees (5k), intra-group equity on worked days and per-qualification shifts, consecutive work day limits and isolated day-off penalties.

For around 150 employees, 30 days and 50 shift types, it solves in 2 to 5 minutes. Larger instances with 300+ employees take 10 to 30 minutes with the time limit set accordingly. CP-SAT returns the best solution found within that window.

I put together a landing page that explains the approach in more detail: Planopti

The tool runs fully on-premise with SQLite and no cloud dependency. I originally built it for one company but the model is general enough for any shift-based industry: healthcare, security, logistics, transport.

Happy to discuss the modelling choices or share insights on tuning CP-SAT for this type of problem.

blind.lin...@gmail.com

unread,
Mar 10, 2026, 11:28:49 PM (2 days ago) Mar 10
to or-tools...@googlegroups.com

Hi Victor,

That looks pretty great. Good job.

I have developed and am supporting a scheduling tool for a medical practice, but I'm not well suited to commercializing the scheduler itself as you have. Selling subscriptions etc is not a skill that I have.

The problem itself is in a similar domain area, but they have very specific constraints and fairness rules, so I don't think it would fit in your program.

I'd love to talk directly to compare notes about how to approach these problems, especially as I have just finished another round of work on this project and the code is all "in my head" as it were.

My biggest pain point has not been the solver, but rather debugging issues when the presolver discovers an infeasibility. Usually this is just due to bad coverage somewhere, but the infeasible messages are so cryptic it was impossible for the users to decipher what might be needed. I've developed a "translator" to convert those failing constraint messages into meaningful advice. We shall see this coming month whether my efforts have hit the mark or not.

Feel free to email me directly if you want to chat.

Regards,

James

On Tue, Mar 10, 2026 at 01:18:16PM -0700, Victor wrote:

Hi everyone,

I built a CP-SAT-based employee scheduling system for my own needs, monthly rostering for regulated industries with cross-qualified staff, variable daily needs, legal rest constraints and fairness objectives.

The model uses boolean variables assign[e, d, s] and is_off[e, d], with hard constraints covering one shift per day, 11-hour rest between shifts (toxic pairs), qualification enforcement and fixed absences. Soft objectives use weighted penalties: coverage gaps (10k), missing days off (1.5k), weekend guarantees (5k), intra-group equity on worked days and per-qualification shifts, consecutive work day limits and isolated day-off penalties.

For around 150 employees, 30 days and 50 shift types, it solves in 2 to 5 minutes. Larger instances with 300+ employees take 10 to 30 minutes with the time limit set accordingly. CP-SAT returns the best solution found within that window.

I put together a landing page that explains the approach in more detail: Planopti https://planopti.io/en/

The tool runs fully on-premise with SQLite and no cloud dependency. I originally built it for one company but the model is general enough for any shift-based industry: healthcare, security, logistics, transport.

Happy to discuss the modelling choices or share insights on tuning CP-SAT for this type of problem.

-- You received this message because you are subscribed to the Google Groups "or-tools-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to or-tools-discu...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/or-tools-discuss/7a8908cf-eae6-4495-bdf4-cb44341b594cn%40googlegroups.com.

--
James E. Marca  
Activimetrics LLC  

Victor

unread,
Mar 11, 2026, 9:29:06 AM (19 hours ago) Mar 11
to or-tools...@googlegroups.com
Hi James,

Thanks for sharing all of this, really interesting to hear about your work on the medical scheduling side!

It sounds like you've done some solid technical work, especially the "translator" for infeasibility messages, that's a smart solution.

I think the best way to compare notes and dig into all of this properly would be a quick call - Google Meet would work great on my end. We could go through the technical side together, which I think I can help you see more clearly.

Feel free to suggest a time that works for you and we'll get something set up.

Looking forward to it!

Victor

You received this message because you are subscribed to a topic in the Google Groups "or-tools-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/or-tools-discuss/u2pm4Io4R-w/unsubscribe.
To unsubscribe from this group and all its topics, send an email to or-tools-discu...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/or-tools-discuss/abDhZkkVFA_abeUo%4021740287de31.
Reply all
Reply to author
Forward
0 new messages