简体   繁体   中英

Constrain logic in Linear programming

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?

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 (ie 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. Ie this method is correct (if not, a lot of my models would fail).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM