3

I am trying to schedule a certain number of events in the week according to certain constraints, and would like to spread out these events as evenly as possible throughout the week.

If I add the standard deviation of the intervals between events to the objective function, then CPLEX can minimise it.

I am struggling to define the standard deviation of the intervals in terms of CPLEX expressions, mainly because the events don't have to be in any particular sequence, and I don't know which event is prior to any other one.

I feel sure this must be a solved problem, but I have not been able to find help in IBM's cplex documentation or on the internet.

Michael Sandler
  • 1,290
  • 3
  • 17
  • 30

1 Answers1

2

Scheduling Uniformly Spaced Events

Here a few possible ideas for you to try:

Let t0, t1, t2, t3 ... tn be the event times. (These are variables chosen by the model.)

Let d1 = t1-t0, d2=t2-t1 etc... dn.

Goal: We want all these d's to be roughly equal, which would have the effect of roughly evenly spacing out the t's.

Options

Option 1: Put a cost on the deviation from ideal

Let us take one example. Let's say that you want to schedule 10 events in a week (168 hours.) With no other constraint except equal spacing, we could have the first event start at time=0, and the last one end at time t=168. The others would be 168/(10-9) =~ 18.6 hours apart. Let's call this d_ideal.

We don't want d's to be much less than d_ideal (18.6) or much greater than d_ideal.

That is, in the objective, add Cost_dev * (abs(d_ideal - dj)) (You have to create two variable for each d (d+ and d-to handle the absolute values in the objective function.)

Option 1a

In the method above, all deviations are priced the same. So the model doesn't care if it deviates by 3 hours, or two deviations of 1.5 hours each. The way to handle that is to add step-wise costs. Small cost for small deviations, with very high cost for high deviations. (You make them step-wise linear so that the formulation stays an LP/IP)

Option 2: Max-min

This is around your minimize the std. deviation of d's idea. We want to maximize each d (increase the inter-event separation.) But we would also hugely punish (big cost) that particular d value that is the greatest. (In English, we don't want to let any single d to get too large)

This is the MinMax idea. (Minimize the maximum d value, but also maximize individual d's)

Option 3: Two LPs: Solve first, then move the events around in a second LP

One drawback of layering on more and more of these side constraints is that the formulation becomes complicated. To address this, I have seen two (or more) passes used. You solve the base LP first, assign events and then in another LP, you address the issue of uniformly distributing times.

The goal of the second LP is to move the events around, without breaking any hard constraints.

Option 3a: Choose one of many "copies"

To achieve this, we use the following idea:

We allow multiple possible time slots for an event, and make the model select one. The Event e1 (currently assigned to time t1) is copied into (say) 3 other possible slots.

 e11 + e12 + e13 + e14 = 1 

The second model can choose to move the event to a "better" time slot, or leave it be. (The old solution is always feasible.)

The reason you are not seeing much in CPLEX manuals is that these are all formulation ideas. If you search for job- or event-scheduling using LP's, you will come across a few pdf's that mighe be helpful.

Community
  • 1
  • 1
Ram Narasimhan
  • 22,341
  • 5
  • 49
  • 55
  • how would I be able get the correct `d`s if the `t` variables are not ordered in time (due to other constraints/cost) – N4ppeL May 13 '20 at 16:21