0

I'm trying to build a linear optimization model for a production unit. I have Decision variable (binary variable) X(i)(j) where I is hour of J day. The constrain I need to introduce is a limitation on downtime (minimum time period the production unit needs to be turned off between two starts).

For example:

Hours:  1 2 3 4 5 6 7 8 9 10 11 12
On/off: 0 1 0 1 1 0 1 1 1  0  0  1

I cannot run the hour 4 or 7 because time period between 2 and 4 / 5 and 7 is one. I can run hour 12 since I have two hour gap after hour 9. How do I enforce this constrain in Linear programming/ optimization?

Prune
  • 76,765
  • 14
  • 60
  • 81

1 Answers1

1

I think you are asking for a way to model: "at least two consecutive periods of down time". A simple formulation is to forbid the pattern:

t  t+1 t+2
1   0   1 

This can be written as a linear inequality:

x(t) - x(t+1) + x(t+2) <= 1

One way to convince yourself this is correct is to just enumerate the patterns:

x(t)  x(t+1) x(t+2)  LHS
 0      0      0      0 
 0      0      1      1
 0      1      0     -1
 0      1      1      0
 1      0      0      1
 1      0      1      2  <--- to be excluded 
 1      1      0      0 
 1      1      1      1 

With x(t) - x(t+1) + x(t+2) <= 1 we exactly exclude the pattern 101 but allow all others.


Similarly, "at least two consecutive periods of up time" can be handled by excluding the pattern

t  t+1 t+2
0   1   0 

or

-x(t) + x(t+1) - x(t+2) <= 0

Note: one way to derive the second from the first constraint is to observe that forbidding the pattern 010 is the same as saying y(t)=1-x(t) and excluding 101 in terms of y(t). In other words:

(1-x(t)) - (1-x(t+1)) + (1-x(t+2)) <= 1

This is identical to

-x(t) + x(t+1) - x(t+2) <= 0

In the comments it is argued this method does not work. That is based on a substantial misunderstanding of this method. The pattern 100 (i.e. x(1)=1,x(2)=0,x(3)=0) is not allowed because

 -x(0)+x(1)-x(2) <= 0

Where x(0) is the status before we start our planning period. This is historic data. If x(0)=0 we have x(1)-x(2)<=0, disallowing 10. I.e. this method is correct (if not, a lot of my models would fail).

Erwin Kalvelagen
  • 15,677
  • 2
  • 14
  • 39
  • Thank you. That helped. Just an extension of the query and curious to know how do you model "at least two consecutive periods of running"? – Karthik K S Mar 12 '19 at 20:24
  • That can be modeled in a very similar way. – Erwin Kalvelagen Mar 13 '19 at 02:18
  • 1
    Good explanation. I think this answer should be accepted. Maybe the intuition behind the first inequality is clearer starting with `x(t) + (1 - x(t+1)) + x(t+2) <= 2` (_not all three_), which is then simplified to `x(t) - x(t+1) + x(t+2) <= 1`? – Magnus Åhlander Mar 13 '19 at 11:58
  • @ErwinKalvelagen, the given logic for **up time** fails in 3 states. `1 0 0, 0 0 1 and 1 0 1` in all these cases **LHS** is `<=0`, but they don't have **two consecutive up time**. – Karthik K S Apr 23 '19 at 15:11
  • Border thing. This depends on the state at x(0) and x(T+1). These cases need to be handled accordingly. – Erwin Kalvelagen Apr 23 '19 at 15:39