0

I'm new to linear programming and trying to develop an ILP model around a problem I'm trying to solve.

My problem is analogous to a machine resource scheduling problem. I have a set of binary variables to represent paired-combinations of machines with a discrete-time grid. Job A takes 1 hour, Job B takes 1 hr and 15 minutes, so the time grid should be in 15 minute intervals. Therefore Job A would use 4 time units, and Job B would use 5 time units.

I'm having difficulty figuring out how to express a constraint such that when a job is assigned to a machine, the units it occupies are sequential in the time variable. Is there an example of how to model this constraint? I'm using PuLP if it helps.

Thanks!

Rodrigo de Azevedo
  • 1,097
  • 9
  • 17
MichaelC
  • 15
  • 1
  • 8

1 Answers1

0

You want to implement the constraint:

x(t-1) = 0 and x(t) = 1 ==> x(t)+...+x(t+n-1) = n

One way is:

x(t)+...+x(t+n-1) >= n*(x(t)-x(t-1))

Notes:

  1. you need to repeat this constraint for each t.

  2. A slightly better version is:

    x(t+1)+...+x(t+n-1) >= (n-1)*(x(t)-x(t-1))
    
  3. There is also a disaggregated version of this constraint that may help performance (depending on the solver: some solvers can do this disaggregation automatically).

  4. Things can become interesting near the beginning and end of the planning period. E.g. machine started at t=-1.

Update:

A different approach is just to limit the "start" of a job to 1. I.e. allow only the combination

 x(j,t-1) = 0 and x(j,t) = 1

for a given job j. This can be handled in a similar way:

 start(j,t) >= x(j,t)-x(j,t-1)
 sum(t, start(j,t)) <= 1
 0 <= start(j,t) <= 1
Erwin Kalvelagen
  • 15,677
  • 2
  • 14
  • 39