OR-Tools: Adding mandatory 1-hour driver break causes solver to fail

48 views
Skip to first unread message

Simone Mazzieri

unread,
Mar 11, 2026, 6:30:39 AMMar 11
to or-tools...@googlegroups.com
Hello everyone,

I’m trying to model the mandatory 1-hour driver break between 11:30 and 13:30 in OR-Tools, but after adding this constraint the solver fails to produce a plan.

My goal is to ensure that each driver takes a continuous 1-hour break within that time window, while still allowing the solver to schedule all required services (some of which are connected or interdependent).

However, once I introduce the break constraint, the solver often fails to find a feasible solution.

Has anyone faced a similar issue?
Do you have any suggestions or a robust way to model this type of mandatory break window in OR-Tools, especially when there are linked services that must still be scheduled?

Any advice or best practices would be greatly appreciated.

Thanks in advance!

Victor

unread,
Mar 11, 2026, 9:37:07 AMMar 11
to or-tools-discuss
Hi,

This is a classic infeasibility issue. The problem is that you are modeling the break as a rigid hard constraint, which leaves the solver almost no room to work with.

The 2-hour window (11:30 to 13:30) only offers a handful of valid positions for a 1-hour break, and as soon as any service overlaps that window, there are no slots left. On top of that, if you have linked or sequential services, forcing a 1-hour cut in the middle makes the whole sequence impossible when travel times don't allow it.

The robust fix is to discretize the break start time into 15-minute slots and let the solver choose where to place the break within the window, rather than fixing it. You then add a NoOverlap constraint between the break interval and the driver's service intervals.

This gives the solver the flexibility it needs. If it still comes back infeasible, consider relaxing the break to a soft constraint with a penalty rather than a hard one.

Hope that helps!
Victor

Reply all
Reply to author
Forward
0 new messages