2

We're struggling with some aspects of the following problem:

  • a public transportation bus timetable consists of shifts (~ track sections) each with fixed start and end times

  • bus drivers need to be assigned to each of those shifts

  • [constraint in question] legal regulations demand that each bus driver has a 30 min break after 4 hours of driving (i.e. after driving shifts)

  • put differently, a driver accrues driving time when driving shifts that must not exceed 4h unless the driver takes a 30 min break in which case the accrued time is "reset to zero"

In summary, we need to track the accrued driving time of each driver in order to suppress shift assignments to enforce the 30 min break.

The underlying problem seems to sit halfway between a job shop and an assignment problem:

  • Like job shop problems, it has shifts (or tasks, jobs) with many no-overlap and precedence constraints between them...

  • ...BUT our shifts (~tasks/jobs) are not pre-assigned to drivers; in contrast with job shop problems, the tasks (~shifts) need to be executed on specific machines (~drivers) and are therefore pre-assigned, so assigning them is not part of the problem

  • Like assignment tasks, we need to assign shifts to as few as possible drivers...

  • ...BUT we also need to handle the aforementioned no-overlap and precedence constraints, that are not taken into account in assignment problems

So my question is, how to best model the above constraint in a constraint problem with the or-tools?

Thanks in advance!

movingabout
  • 343
  • 3
  • 10
  • What is the underlying optimization problem? A routing problem? Does the model already have decision variables to keep track of timing, like arrival times at a node or something like that? – LarrySnyder610 May 18 '19 at 12:37
  • Hi Larry, classifying the underlying problem is actually our challenge. I edited the question above to make it more clear. We are currently modelling it as an assignment problem (only conceptually as pseudocode). – movingabout May 19 '19 at 12:24
  • Post at https://or.stackexchange.com instead. – Rodrigo de Azevedo Jun 01 '19 at 18:10

1 Answers1

1

One general technique for specifying patterns in constraint programming is the regular constraint (in Gecode, Choco, MiniZinc, among others, unsure of the status for or-tools), where patterns of variables are specified using finite automata (DFAs and NFAs) or regular expressions.

In your case, assuming that you have a sequence of variables representing what a certain driver does at each time-point, it is fairly straight-forward to specify an automaton that accepts any sequence of values that does not contain mora than four consecutive hours of driving. A sketch of such an automaton:

States:

  • Driving states Dn representing n time units driving (for some resolution of time units), up to n=4 hours.
  • Break states DnBm for a break of length m after n time units of driving, up to m=30 minutes.
  • Start state is D0.

Transitions:

  • Driving: When driving 1 unit of time, move from state Dn to D(n+1), and from a break shorter than 30 minutes from DnBm to D(n+1).
  • Break of 1 unit of time, move from DnBm to DnB(m+1), unless the 30 minutes break time has been reached, for which the transition goes back to D0.
  • Other actions handled mostly as self-loops, depending on desired semantics.

Of course, details will vary for your specific use-case.

Zayenz
  • 1,914
  • 12
  • 11