Floudas: Floudas: Nonlinea Nonlinearr and Mixed-Integ Mixed-Integer er Optimizati Optimization on Chapter 5
Mixed-Integer Linear Programming
Cheng-Liang Chen
PSE
LABORATORY
Department of Chemical Engineering National TAIWAN University
Chen CL
1
Propositional Logic Expressions NEGA NEGATI TION ON deno denote ted d as ¬
Modeling with 0 − 1 Variables:
AND deno denote ted d as ∧
1 if clause P is true 0 if clause P is false i
yi =
OR denoted as ∨
i
EXCL EXCLUS USIV IVE E OR OR deno denote ted d as ⊕
P 1 P 2 P 1 ∧ P 2 P 1 ∨ P 2 P 1 ⇒ P 2 ¬P 1 ¬P 1 ∨ P 2 P 1 ⊕ P 2 1
1
1
1
1
0
1
0
1
0
0
1
0
0
0
1
0
1
0
1
1
1
1
1
0
0
0
0
1
1
1
0
Note:
P 1 ⇒ P 2 is equivalent to ¬P 1 ∨ P 2
Chen CL
1
Propositional Logic Expressions NEGA NEGATI TION ON deno denote ted d as ¬
Modeling with 0 − 1 Variables:
AND deno denote ted d as ∧
1 if clause P is true 0 if clause P is false i
yi =
OR denoted as ∨
i
EXCL EXCLUS USIV IVE E OR OR deno denote ted d as ⊕
P 1 P 2 P 1 ∧ P 2 P 1 ∨ P 2 P 1 ⇒ P 2 ¬P 1 ¬P 1 ∨ P 2 P 1 ⊕ P 2 1
1
1
1
1
0
1
0
1
0
0
1
0
0
0
1
0
1
0
1
1
1
1
1
0
0
0
0
1
1
1
0
Note:
P 1 ⇒ P 2 is equivalent to ¬P 1 ∨ P 2
Chen CL
2
Modeling with 0 − 1 Variables Prop osition
1. P 1 ∨ P 2 ∨ P 3
Mathematical Representation
y1 + y2 + y3 ≥ 1 y1 ≥ 1
2. P 1 ∧ P 2 ∧ P 3
y2 ≥ 1 y3 ≥ 1
3. P 1 ⇒ P 2
(¬P 1 ∨ P 2)
(P 1 ⇔ P 2) 4.
(P 1 ⇒ P 2) ∧ (P 2 ⇒ P 1) (¬P 1 ∨ P 2) ∧ (¬P 2 ∨ P 1)
5.
1 − y1 + y2 ≥ 1 (y1 − y2 ≤ 0) y1 − y2 ≤ 0 y2 − y1 ≤ 0
or y1 = y2
(P 1 ∨ P 2 ⇒ P 3)
y1 − y3 ≤ 0
(¬P 1 ∨ P 3) ∧ (¬P 2 ∨ P 3)
y2 − y3 ≤ 0
6. P 1 ⊕ P 2 ⊕ P 3 (exactly one)
y1 + y2 + y3 = 1
Chen CL
3
Application: select among process units i ∈ P U
y y y
i
= 1
select only one unit
i
≤ 1
select at most one unit
i
≥ 1
select at least one unit
i∈P U i∈P U i∈P U
Application: select unit i if unit j is selected If unit j is selected (P j is true or yj = 1) then unit i should be selected too (P i is true or yi = 1) Others: not defined
P j ⇒ P i ⇒ ¬P j ∨ P i ⇒ (1 − yj ) + yi ≥ 1 ⇒ yj − yi ≤ 0
Chen CL
Blending Products Including Discrete Batch Sizes The Batch Plant
Unit 1 has a max capacity of 8, 000 lb/day, and unit 2 of 10, 000 lb/day
To make 1.0 lb of product 1 requires 0.4 lb of A and 0.6 lb of B To make 1.0 lb of product 2 requires 0.3 lb of B and 0.7 lb of C
A maximum of 6, 000 lb/day of B is available (no limit on A and C )
Net revenue of product 1 is $0.16/lb, and of product 2 is $0.20/lb
Each product must be made in batches of 2, 000 lb Q: How much of products 1 and 2 should be produced per day ?
4
Chen CL
5
Blending Products Including Discrete Batch Sizes MILP Formulation
x1, x2 thousands of pounds per day for products 1 and 2 max f = 160x1 + 200x2 s.t. 0.6x1 + 0.3x2 ≤ 6 xi = 2yi 0 ≤ 2000y1 ≤ 8000 0 ≤ 2000y2 ≤ 10000 yi : integers (0, 1, 2, . . .)
Chen CL
6
Blending Products Including Discrete Batch Sizes Solution
(y1, y2) = (2, 5)
f ∗ = 2.8 × 103
Chen CL
7
Design of A Chemical Complex Proposed Chemical complex
Objective: to maximize profit
Should chemical C be produced, and if so how much ?
Which process to build (II and III are exclusive) ?
How to obtain chemical B ?
Chen CL
8
Design of A Chemical Complex Data
Process III
fixed ($) 1000 1500 2000
A B C
500/ton 950/ton 1800/ton
Cost
Process I Process II Price
Conversions
Process I Process II Process III
Constraints
Maximum supply of A: Maximum demand of C:
Variable ($/ton raw material) 250 400 550
90% of A to B 82% of B to C 95% of B to C 16 tons/hr 10 tons/hr
Chen CL
9
Design of A Chemical Complex Notation YI
= 1 if process I is selected and 0 if not
YII YIII PA PB SC BI BII
= 1 if process II is selected and 0 if not = 1 if process III is selected and 0 if not purchases of A (tons/hr) purchases of B (tons/hr) sales of C (tons/hr) production rate of B in process I (tons/hr) consumption rate of B in process II (tons/hr)
BIII CII CIII
consumption rate of B in process III (tons/hr) production rate of C in process II (tons/hr) production rate of C in process III (tons/hr)
Chen CL
10
Design of A Chemical Complex Formulation MB for B, C: Balance around I,II,III:
Process can operate if built
Demand limitation: II and III are exclusive: Profit to be maximized:
BI + P B
= BII + BIII
CII + CIII = SC BI = 0.9P A CII CIII PA BI I BIII
= = ≤ ≤ ≤ SC ≤ Y II + Y I I I ≤ J =
0.82BII 0.95BIII 16Y I (10/0.82)Y II (10/0.95)Y I I I 10 1
−
investment and operating costs
(1000Y I + 250P A + 1500Y II + 400BI I + 2000Y I I I + 550BIII )
− (500P A + 950P B ) +1800SC Model Size :
9 constraints;
raw materials
8 continuous variables,
sales
3 binary variables
Chen CL
11
Design of A Chemical Complex GAMS Code $TITLE Design of a Chemical Complex $offsymxref offsymlist *filename: COMPLEX.gms option optcr=0, limrow=0, limcol=0; BINARY VARIABLES YI denotes selection of process I when equal to one YII denotes selection of process II when equal to one YIII denotes selection of process III when equal to one
;
POSITIVE VARIABLES PA purchases of A (tons per hr) PB purchases of B (tons per hr) SC sales of C (tons per hr) BI production rate of B in process I (tons per hr) BII consumption rate of B in process II (tons per hr) BIII consumption rate of B in process III (tons per hr) CII production rate of C in process II (tons per hr) CIII production rate of C in process II (tons per hr) VARIABLE PROFIT objective function
; ;
EQUATIONS E1 E2
select at most one of process II and III mass balance for B
Chen CL
12 E3 E4 E5 E6 E7 E8 E9 OBJ
E1 E2 E3 E4 E5 E6 E7 E8 E9
.. .. .. .. .. .. .. .. ..
mass balance for C mass balance around process I mass balance around process II mass balance around process III no purchases of A unless process I is selected no production of BII unless process II is selected no production of BIII unless process III is selected objective function definition ;
YII + YIII =L= 1 BI + PB =E= BII + BIII CII + CIII =E= SC BI =E= 0.9 * PA CII =E= 0.82 * BII CIII =E= 0.95 * BIII PA =L= 16 * YI BII =L= (10/0.82) * YII BIII =L= (10/0.95) * YIII
; ; ; ; ; ; ; ; ;
* constraint (10) for max demand of C is declared as an upper bound here SC.UP = 10 ; OBJ .. PROFIT =E= - ( 1000 * YI + 250 * PA + 1500 * YII + 400 * BII + 2000 * YIII + 550 * BIII 500 * PA - 950 * PB + 1800 * SC MODEL COMPLEX /ALL/ SOLVE COMPLEX USING MIP MAXIMIZING PROFIT
) ; ; ;
Chen CL
13
Design of A Chemical Complex Results
J = 459.3 $/hr P A = 13.55 tons/hr select process I and II
Chen CL
14
Planning of A Chemical Complex Problem Description
Chen CL
15
Decide:
Which process to build (2 and 3 are not excluded) ? How to obtain chemical 2 ? How much should be produced of product 3 ?
Objective: to maximize net present value over a long range horizon consisting
of 3 time periods of 2, 3 and 5 years length
Assume:
Prices, demands, and cost coefficients remain constant during each time period Capacity expansions of the processes are allowed at the beginning of each time period No limit of expansion frequencies, a limit on amount of money that can be invested at each time period for expansions (20, 30, and 40 m$ for periods 1, 2, 3) The size of expansion may not exceed 100 kton/yr
Chen CL
16
Planning of A Chemical Complex Data
Fixed investment coefficients (105 $/ton) Period 1 Period 2
Period 3
Process 1
85
95
112
Process 2
73
82
102
Process 3
110
125
148
Variable investment coefficients (102$/ton) Period 1 Period 2
Period 3
Process 1
1.38
1.56
1.78
Process 2
2.72
3.22
4.60
Process 3
1.76
2.34
2.84
Operating Expenses coefficients (102 $/ton of main product) Period 1 Period 2
Period 3
Process 1
0 .4
0 .5
0 .6
Process 2
0 .6
0 .7
0 .8
Process 3
0 .5
0 .6
0 .7
Chen CL
17
Prices (102 $/ton) Period 1
Period 2
Period 3
Chemical 1
4.0
5.24
7.32
Chemical 2
9.6
11.52
13.52
Chemical 3
26.2
29.2
35.2
Upper bounds for Purchase/Sales (kton/yr) Period 1
Period 2
Period 3
Chemical 1
6
7.5
8 .6
Chemical 2
20
25.5
30
Chemical 3
65
75
90
Mass balance coefficients (to main product) Chemical 1 Process 1
Chemical 2
1.11
Chemical 3
1
Process 2
1.22
1
Process 3
1.05
1
Existing capacity
Salvage value
Working capital
kton/yr
factor
factor
0.1
0.15
0.1
0.15
0.1
0.15
Miscellaneous data
Process 1 Process 2
50
Process 3 Interest rate = 10%,
Tax rate rate = 45%,
Depreci Depreciati ation on method method:: straig straight ht line line
Chen CL
18
Planning of A Chemical Complex Formulation
Index notation
i process
i = 1, N P
j chemical
j = 1, N C
market
= 1, N M
t time period t = 1, N T
Chen CL
19
Plant capacities
Qit: total available capacity of process i in period t, t = 1, N T Qi0: existing capacity at time t = 0 QE it it : capacity expansion of process i installed in period t L U QE it , QE it : lower/upper bounds for capacity expansions yit = {0, 1}: occurrence of expansions L U ≤ QE it yitQE it it ≤ QE it yit
yit = 0, 1
i = 1, N P t = 1, N T
Qit = Q i,t−1 + QE it it
i = 1, N P t = 1, N T
Chen CL
20
Amount of chemicals being consumed and produced
Amounts of chemicals being consumed and produced Li: index set of streams corresponding to inputs/outputs of process i W ijt ≥ 0
i = 1, NP,
j ∈ Li
t = 1, NT
Stream mi ∈ Li: main product produced by process i, capacity limitation W imit ≤ Qit
i = 1, N P
t = 1, N T
Note: W imit = 0 if shut-down Material balances in each plant (use constant characteristics of process i and chemical j)
W ijt = µij W imit
i = 1, NP,
j ∈ Li
t = 1, NT
Chen CL
21
Purchases and sales of N C nodes of chemicals
L,U (aL,U , d jt jt : loewr/upper bounds for availabilities and demands)
U ≤ ≤ aL P a j t jt jt
dL jt
≤ S jt ≤
j = 1, N C, = 1, N M, t = 1, N T
dU jt
Mass balances on chemicals’ node
I ( j): index set of plants which consume chemical j O( j): index set of plants which produce chemical j N M
P
j t +
=1
k∈O (j )
N M
W kt
= S
j t +
=1
W
kt
k∈I (j )
j = 1, N C , t = 1, N T
Chen CL
22
Net present value of the project
αit, β it variable and fixed terms for the investment costs δ it unit operating cost γ jt , Γjt prices of sales and purchases of chemical j in market N T N P
NP V =
N T N P
− (α QE + β y ) − δ W + (γ S − Γ P ) it
it
it it
t=1 i=1 N T N C N M
t=1 i=1
j t jt
t=1 j =1 =1
it
jt
jt
imit
Chen CL
23
Additional constraints
Limit on number of expansions N T
y
it
≤ NEXP (i)
i ∈ Γ ⊂ {1, · · · , N P }
t=1
Limit on capital available for investment (with overline denoting non-discounted cost coefficients) N P
α QE + β y ≤ CI (t) it
i=1
it
it it
t ∈ T ⊂ {1, · · · , N T }
Chen CL
24
Planning of A Chemical Complex GAMS Code $OFFSYMLIST OFFSYMXREF * Filename: MULPLAN.gms * Multiperiod MILP Model for Selection of Processes, Capacity Expansion, * Purchases and Sales Policies, and Operating Profiles. * Reference: Sahinidis, N.V., I.E. Grossmann, R.E. Fornari and M. * Chatrathi, "Optimization Model for Long Range Planning in the Chemical * Industry", Computers and Chemical Engineering, 13, 1049 (1989). * Authors: N.V. Sahinidis and I.E. Grossmann OPTIONS LIMROW=0, LIMCOL=0, SOLPRINT=OFF, OPTCR=0; SCALARS
SETS
T I J K
NPRO NPER NCHE NMAR INTR TAX
number of processes number of periods / number of chemicals number of markets / interest rate / 0.10 tax rate / 0.45 /
time periods / 1*3 / processes / 1*3 / chemicals / 1*3 / markets / 1*1 /
SET TT project lifetime
/ 3 / 1 /
3 / / 3 / /
Chen CL
25
* define this set with length (at least) equal to the life time of the project / 1*100 / SET TE time periods plus one / 1*4 /; PARAMETERS LENP(T)
*
*
length of time periods (years) / 1 2 2 3 3 5 / LINVEST(T) limit on investment / (1e5 $/yr) 1 200 2 300 3 400 / JMM(I) main product for each process / 1 2 2 3 3 3 / LNEXP(I) limit on the number of expansions / 1 3 2 3 3 3 / WCAPF(I) working capital factor / 1 0.15 2 0.15 3 0.15 / EXCAP(I) existing capacities / (kton/yr) 1 0
Chen CL
26
SVALF(I)
TABLE *
TABLE *
QELB(I,T)
QEUB(I,T)
2 50 3 0 / salvage value factor / 1 0.10 2 0.10 3 0.10 / ; lower bounds on expansion (kton/yr) 1 2 3 1 2 3 ; upper bounds on (kton/yr) 1 2 1 100 100 2 100 100 3 100 100
expansion 3 100 100 100
TABLE MI(I,J) mass balance coefficients * positive for inputs and negative for outputs. * value should be left to zero if product J is neither * an input to nor an output from process I 1 2 3 1 1.11 -1 2 1.22 -1 3 1.05 -1
Chen CL TABLE *
27 ALPHA(I,T)
1 2 3 TABLE *
TABLE *
BETA(I,T)
variable investement coefficient (1e2 $/ton) 1 2 3 1.38 1.56 1.78 2.72 3.22 4.6 1.76 2.34 2.84
1 2 3
fixed investement coefficient (1e5 $) 1 2 3 85 95 112 73 82 102 110 125 148
1 2 3
operating expenses per unit of main product (1e2 $ /ton) 1 2 3 0.4 0.5 0.6 0.6 0.7 0.8 0.5 0.6 0.7
DELTA(I,T)
TABLE LAM(J,K,T) cost for purchase of one unit of chemical * (1e2 $/ton) * values should be left to zero if chemical J is not available * from market K during period T 1 2 3 1.1 4. 5.24 7.32 2.1 9.6 11.52 13.52 3.1
Chen CL TABLE PLB(J,K,T) purchase lower bounds * (kton/yr) * both lower and upper bounds should be left to zero * if chemical J is unavailable from market K during period T 1 2 3 1.1 2.1 3.1 TABLE PUB(J,K,T) purcase upper bounds * (kton/yr) * both upper and lower bound should be left to zero * if chemical J is unavailable from market K during period T 1 2 3 1.1 6. 7.5 8.6 2.1 20 25.5 30. 3.1 TABLE GAMMA(J,K,T) sale prices * (1e2 $/ton) * values should be left to zero if chemical J is not * desired by market K during period T 1 2 3 1.1 2.1 3.1 26.20 29.20 35.20 TABLE SLB(J,K,T) sales lower bounds * (kton/yr) * both lower and upper bounds should be left to zero
28
Chen CL *
29
if chemical J is not desired by market K during period T 1 2 3 1.1 2.1 3.1
TABLE SUB(J,K,T) sales upper bounds * (kton/yr) * both upper and lower bounds should be left to zero * if chemical J is not desired by market K during period T 1 2 3 1.1 2.1 3.1 65 75 90 * * parameter evaluations * PARAMETERS EP epsilon ALPHAR(I,T) fixed investement coefficient depreciated etc BETAR(I,T) variable investement coefficient depreciated etc ; EP = 0.0001; SCALAR FX project lifetime; SCALARS Z1,Z2,INTER1; PARAMETERS X(T),C1(I,T),C2(T),T1(T),T2(I,T),T3(I,T),T4(I),SCOEFF(T); X(’1’)=0 ; LOOP (T $ (ORD(T) NE CARD(T)) , X(T+1) = FX=SUM(T,LENP(T));
X(T)+LENP(T) ) ;
Chen CL
30
INTER1=1/(1+INTR); LOOP(T, Z1=X(T)+1 ; C2(T)=SUM (TT $((ORD(TT) GE Z1) AND (ORD(TT) LE FX)),INTER1**ORD(TT)) ); T1(T)=-INTER1**X(T); T2(I,T)=WCAPF(I)*(T1(T)+INTER1**FX); T3(I,T)=(1-SVALF(I))*TAX*C2(T)/(FX-X(T)); T4(I)=SVALF(I)*INTER1**FX; C1(I,T)=T1(T)+T2(I,T)+T3(I,T)+T4(I); ALPHAR(I,T)=-ALPHA(I,T)*C1(I,T); BETAR(I,T)=-BETA(I,T)*C1(I,T); LOOP(T $ (ORD(T) NE CARD(T)) , Z1=X(T)+1 ; Z2=X(T+1) ; SCOEFF(T)=SUM(TT $ ((ORD(TT) GE Z1) AND (ORD(TT) LE Z2)) , INTER1**ORD(TT))*(1-TAX) ); LOOP(T $ (ORD(T) EQ CARD(T)), Z1=X(T)+1 ; Z2=FX ; SCOEFF(T)=SUM(TT $ ((ORD(TT) GE Z1) AND (ORD(TT) LE Z2)), INTER1**ORD(TT) )*(1-TAX) ) ; LAM(J,K,T)=SCOEFF(T)*LAM(J,K,T); GAMMA(J,K,T)=SCOEFF(T)*GAMMA(J,K,T); DELTA(I,T)=SCOEFF(T)*DELTA(I,T); * * model definition VARIABLES
Q(I,T) QE(I,T) Y(I,T)
capacities capacity expansions integer decision variables
Chen CL
31 W(I,*,T) S(J,K,T) P(J,K,T) NPV
flow rates sales purchases net present value;
POSITIVE VARIABLES Q,QE,W,S,P; BINARY VARIABLES Y; EQUATIONS
*
CELBD(I,T) capacity expansion lower bounds CEUBD(I,T) capacity expansion upper bounds CAPBL(I,T) capacity balances PRCP(I,T) production cannot exceed capacity PBAL(I,J,T) balances around processes constraints <6> will be given as lower and upper bounds BAL(J,T) balances for chemicals OBJ net present value definition NEXP(I) limitation of number of expansions INVBD(T) bound on investment at each time period
SET JM(I,*) ;
ALIAS (J,JP) ;
1> 2> 3> 4> 5>
7> 8> 9> 10> ;
JM(I,J) = YES $ (ORD(J) EQ JMM(I)) ;
CELBD(I,T) $ QELB(I,T) .. Y(I,T)*QELB(I,T) =L= QE(I,T); CEUBD(I,T) $ (QEUB(I,T) NE INF) .. QE(I,T) =L= QEUB(I,T)*Y(I,T); CAPBL(I,T) .. Q(I,T) =E= EXCAP(I) $ (ORD(T) EQ 1) + Q(I,T-1) + QE(I,T); PRCP(I,T) .. SUM(J
$ JM(I,J), W(I,J,T)) =L= Q(I,T);
* equations <6> are given as lower and upper bounds on the variables
Chen CL P.LO(J,K,T) P.UP(J,K,T) S.LO(J,K,T) S.UP(J,K,T)
32 $ $ $ $
PLB(J,K,T) = PLB(J,K,T); (PUB(J,K,T) AND (PUB(J,K,T) NE INF)) = PUB(J,K,T); SLB(J,K,T) = SLB(J,K,T); (SUB(J,K,T) AND (SUB(J,K,T) NE INF)) = SUB(J,K,T);
PBAL(I,J,T) $ MI(I,J) .. W(I,J,T) =E= ABS(MI(I,J))*SUM(JP $ JM(I,JP), W(I,JP,T)); BAL(J,T) .. SUM( K, P(J,K,T) $ LAM(J,K,T) - S(J,K,T) $ GAMMA(J,K,T) ) =E= SUM ( I, SIGN(MI(I,J)) * W(I,J,T) ); OBJ .. NPV =E= - SUM ( (I,T), ALPHAR(I,T)*QE(I,T) + BETAR(I,T)*Y(I,T) + DELTA(I,T)*SUM(J $ JM(I,J), W(I,J,T) ) ) + SUM ( (J,K,T), GAMMA(J,K,T)*S(J,K,T) - LAM(J,K,T)*P(J,K,T) ); NEXP(I) $ (LNEXP(I) LT NPER) .. SUM(T, Y(I,T)) =L= LNEXP(I); INVBD(T) $(LINVEST(T) NE INF) .. SUM ( I, ALPHA(I,T)*QE(I,T) + BETA(I,T)*Y(I,T) ) =L= LINVEST(T); * obtain solution using branch and bound * MODEL MULT/ALL/; SOLVE MULT MAXIMIZING NPV USING MIP; DISPLAY NPV.L, Y.L, QE.L, Q.L, W.L, S.L, P.L ;
Chen CL
33
Planning of A Chemical Complex Result
Period 1 Period 2 Period 3 Process 1 Capacity
7.75
7.75
7.75
Production
5.41
6.76
7.75
Process 2 Capacity Production
50.0 20.82
50.0 0
50.0 0
Process 3 Capacity Production
0 0
35.95 30.72
35.95 35.95
Chen CL
34
Multi-product Batch Plant Scheduling Batch Scheduling and Planning Problems
A principal feature of batch plants is the production of multiple products using the same set of equipment
The total time required to produce a set of batches (makespan or cycle time) depends on the sequence of production ⇒ to minimize the makespan
Chen CL
35
Multi-product Batch Plant Scheduling A 4-products 3-units Plant
Products
Units u1 u2 u3
p1 (i=1) p2 (i=2) p3 (i=3)
3.5 4.0 3.5
4.3 5.5 7.5
8.7 3.5 6.0
p4 (i=4)
12.
3.5
8.0
Chen CL
36
Multi-product Batch Plant Scheduling MILP Formulation N, M numbers of products and units C j,k the time for jth slot of product leaving k unit ti,k processing time for ith product (pi) in kth unit (t3,2 = 7.5 h) τ j,k
processing time for jth slot of product in kth unit
jth slot of product cannot leave unit uk until it is processed, and it must have left unit u(k-1) C j,k ≥ C j,k−1 + τ j,k
j = 1, N , k = 2, M
(1)
jth slot of product cannot leave unit uk, until ( j − 1)th slot of product has left and the former has been processed (C 0,k = 0) C j,k ≥ C j −1,k + τ j,k
j = 1, N , k = 1, M
(2)
Chen CL
37
jth slot of product cannot leave unit uk, until the downstream unit u(k+1) is free (( j − 1)th slot of product has left) C j,k ≥ C j −1,k+1
j = 1, N , k = 1, M − 1
Note: Eq.s (3), C j,k−1 ≥ C j −1,k ⇒ Eq.s (1) and (3) imply Eq.s (2) for k = 2, M
Only one product in every slot j of the sequence X i,j = 1 if ith product (product pi) is in slot j of the sequence
(3)
(If product pi is in slot j , then Xi,j = 1 and Xi,1 = . . . = X i,j −1 = Xi,j +1 = . . . = Xi,N = 0)
X 1,j + X 2,j + . . . + X N,j = 1
Every product should occupy only one slot in the sequence X i,1 + X i,2 + . . . + X i,N = 1
j = 1, N (4)
i = 1, N (5)
For any given set of X i,j (production sequence) if ith product is in slot j (X i,j = 1), then the processing time of j th-slot product
Chen CL
38
in unit k is ti,k
⇒ τ j,k = X 1,j t1,k + X 2,j t2,k + . . . + X N,j tN,k
j = 1, N , k = 1, M
MILP formulation:
min C N,M s.t. Eq.s 3,4,5 N
+ X + X
C j,k ≥ C j,k−1
i,j ti,k
j = 1, N k = 2, M
i,j ti,k
j = 1, N
i=1 N
C j,k ≥ C i−1,k
i=1
C j,k ≥ 0 and X i,j binary
Chen CL
39
Multi-product Batch Plant Scheduling GAMS Code $TITLE Multiproduct Batch Plant Scheduling $OFFUPPER $OFFSYMXREF OFFSYMLIST OPTION SOLPRINT = OFF; * Define product and unit index sets SETS PI Product batches to be produced /p1*p4/ UK Four batch processing units in the plant /u1*u3/ J Slots for products in the sequence /1*4/; ALIAS (I, J); * Define and initialize problem data TABLE T(PI,UK) Processing times of products on unit UK in h u1 u2 u3 p1 3.5 4.3 8.7 p2 4.0 5.5 3.5 p3 3.5 7.5 6.0 p4 12.0 3.5 8.0 PARAMETER TMIN(UK) Minimum of the processing times of products on UK; TMIN(UK) = SMIN(PI, T(PI,UK)); PARAMETER TP(PI,UK) Processing times of products above TMIN on UK; TP(PI,UK) = T(PI,UK) - TMIN(UK); SCALAR N Number of products to be produced M Number of units in the plant;
Chen CL N = CARD(PI); M = CARD(UK); * Define optimization variables VARIABLES X(PI,J) Product PI is in sequence slot J C(I,UK) Completion time of the product in sequence slot I on unit UK MSPAN Makespan or total time to produce all products; POSITIVE VARIABLES C; BINARY VARIABLES X; * Define constraints and objective function EQUATIONS OBJFUN Minimize makespan ONEPRODUCT(J) Only one product should be in each slot ONESLOT(PI) Only one slot should be assigned to each product CEQ1(I,UK) Completion time recurrence Eqs. 8 CEQ2(I,UK) Completion time recurrence Eqs. 7 CEQ3(I,UK) Completion Time recurrence Eqs. 3; OBJFUN.. MSPAN =E= SUM((I,UK) $(ORD(I) EQ N AND ORD(UK) EQ M), C(I,UK)); ONEPRODUCT(J).. SUM(PI, X(PI,J)) =E= 1; ONESLOT(PI).. SUM(J, X(PI,J)) =E= 1; CEQ1(I,"u1").. C(I,"u1") =G= C(I-1,"u1") $(ORD(I) GT 1) + TMIN("u1") + SUM(PI, TP(PI,"u1")*X(PI,I)); CEQ2(I,UK) $(ORD(UK) GT 1).. C(I,UK) =G= C(I,UK-1) + TMIN(UK) + SUM(PI, TP(PI,UK)*X(PI,I)); CEQ3(I,UK) $(ORD(I) GT 1 AND ORD(UK) LT M).. C(I,UK) =G= C(I-1,UK+1); * Define model and solve MODEL SCHEDULE /ALL/; SOLVE SCHEDULE USING MIP MINIMIZING MSPAN; DISPLAY X.L, C.L, MSPAN.L;
40
Chen CL
41
Multi-product Batch Plant Scheduling The Optimal Schedule
X 1,1 = X 2,4 = X 3,2 = X 4,3 = 1, others = 0 ⇒ product p1 is in slot j = 1, product p2 is in slot j = 4, · · · ⇒ to produce products in sequence: p1 - p3 - p4 - p2 Unit 1 is processing during [0, 3.5] h. When p1 leaving u1 at t = 3.5 h, u1 starts processing p3 ([3.5, 7]) U1 holds p3 during [7, 7.8] because u2 is still processing p1
The finished batches of p1, p3, p2, and p4 are completed at times 16.5 h, 23.3 h, 31.3 h, and 34.8 h (minimum makespan is 34.8 h)
Chen CL
42
Mathematical Description for MILP min cT x + dT y s.t. Ax + By ≤ b x ≥ 0, x ∈ X ⊆ Rn y ∈ {0, 1}q x a vector of n continuous variables y a vector of q 0 − 1 variables c, d (n × 1), (q × 1) vectors of parameters A, B matrices of appropriate dimensions b a vector of p inequalities
Chen CL
43
Mathematical Description: Remark 1
A linear objective function and linear constraints in x and y
A mixed set of variables (continuous x and 0 − 1 y )
d = 0, B = 0 ⇒ linear programming LP problem
c = 0, A = 0 ⇒ integer linear programming ILP problem
Major difficulty: combinatorial nature of domain of y variables Any choice of 0 or 1 for elements of y results in a LP problem on x variables Enumerating fully all possible combinations of 0 − 1 variables for elements of
y
⇒ 2q possible combinations !
Chen CL
44
Outline of MILP Algorithms
Branch and Bound Methods
A binary tree to represent 0 − 1 combinations ⇒ to partition feasible region into sub-domains systematically Valid upper and lower bounds are generated at different levels of the binary tree
Chen CL
Cutting Plane Methods
New constraints (cuts) are generated and added which reduce the feasible region until a 0 − 1 optimal solution is obtained
Decomposition Methods
45
Mathematical structure of the models is exploited via variable partitioning, duality, and relaxation methods
Logic-Based Methods
Disjunctive constraints or symbolic inference techniques are utilized which can be expressed in terms of binary variables
Chen CL
46
Branch and Bound Methods Basic Notion 1: Separation
Separation: Let an MILP model be denoted as (P ) and let its
set of feasible solutions be denoted as F S (P ). A set of subproblems (P 1), . . . , (P n) of (P ) is defined as a separation of (P ) if the following conditions hold: A feasible solution of any of the subproblems (P 1), . . . , (P n) is a feasible solution of (P ); and Every feasible solution of (P ) is a feasible solution of exactly one of the subproblems
Chen CL
47
Remark 1: The above conditions imply that the FSs of the subproblems F S (P 1), . . . , F S (P n) are a partition of the FSs of (P ), that is F S (P )
⇒ original problem (P ) is called a parent node problem the subproblems are called the children node problems
Chen CL
48
Remark 2: how to separate (P ) into (P 1), . . . , (P n) ? Most frequently used way: considering contradictory constraints on a single binary variable
min −3y1 − 2y2 − 3y3 + 2x1 s.t. y1 + y2 + y3 + x1 ≥ 2 =⇒ 5y1 + 3y2 + 4y3 + 10x1 ≤ 10 x1 ≥ 0 y1, y2, y3 = 0, 1
min −3y1 − 2y2 − 3y3 + 2x1 s.t. y1 + y2 + y3 + x1 ≥ 2 5y1 + 3y2 + 4y3 + 10x1 ≤ 10 y1 = 0 x1 ≥ 0 0 ≤ y2, y3 ≤ 1 min −3y1 − 2y2 − 3y3 + 2x1 s.t. y1 + y2 + y3 + x1 ≥ 2 5y1 + 3y2 + 4y3 + 10x1 ≤ 10 y1 = 1 x1 ≥ 0 0 ≤ y2, y3 ≤ 1
Chen CL
49
Branch and Bound Methods Basic Notion 2: Relaxation
Relaxation:
An optimization problem, denoted as (RP ), is defined as a relaxation of problem (P ) if the set of feasible solutions of (P ) is a subset of the set of feasible solutions of (RP ) F S (P ) ⊆ F S (RP )
Chen CL
50
Remark 1: The above definition implies the following relationships between problem (P ) and the relaxed problem (RP )
If (RP ) has no feasible solution, then (P ) has no feasible solution; Let the optimal solution of (P ) be zP and the optimal solution of (RP ) be zRP . Then
zRP ≤ zP That is, the solution of relaxed problem (RP ) provides a lower bound on the solution of problem (P ) If an optimal solution of (RP ) is feasible for problem (P ), then it is an optimal solution of (P )
Chen CL
51
Remark 2: how to relax problem (P ) ?
Omitting one or several constraints of problem (P ) Setting one or more positive coefficients of binary variables of the objective function equal to zero Replacing integrality conditions on y variables by 0 ≤ y ≤ 1 (⇒ LP )
Remark 3: selection of relaxation methods A trade-off between two competing criteria:
The capability of solving the relaxed problem The type and quality of produced lower bound
Chen CL
52
Branch and Bound Methods Basic Notion 3: Fathoming
Fathoming:
Let (CS ) be a candidate subproblem in solving (P ). A candidate subproblem (CS ) will be considered that has been fathomed if one of the following two conditions take place: It can be ascertained that the feasible solution F S (CS ) cannot contain a better solution than the best solution found so far (i.e., incumbent, z ∗); or An optimal solution of (CS ) is found
Chen CL
53
Fathoming Criteria:
Criterion 1: FC1 If a relaxation of a candidate subproblem, (RCS ), has no feasible solution, then (CS ) has no feasible solution and hence can be fathomed
Criterion 2: FC2 If the optimal solution of (RCS ), zRCS , is greater or equal to the incumbent (z ∗), i.e., zRCS ≥ z ∗, then (CS ) can be fathomed Note: if zCS ≥ z ∗ ≥ zRCS ⇒ (CS ) is not fathomed
Criterion 3: FC3 If an optimal solution of (RCS ) is found to be feasible in (CS ), then it must be an optimal solution of (CS ), hence (CS ) is fathomed (note: update incumbent if its value is less than z ∗)
Chen CL
54
General Branch and Bound Framework
Step 1: Initialization
Initialize the list of candidate subproblems to consist of the MILP alone, and Set z ∗ = +∞ (or any known upper bound)
Step 2: Termination
If list of candidate subproblems is empty , then terminate with optimal solution the current incumbent If an incumbent does not exist, then the MILP problem is infeasible
Chen CL
Step 3: Selection of Candidate Subproblem
55
Select one of the subproblems in the candidate list to become the current candidate subproblem (CS )
Step 4: Relaxation
Select a relaxation (RCS ) of the current candidate subproblem (CS ), solve it and denote its solution by zRCS
Chen CL
56
Step 5: Fathoming apply the three fathoming criteria
FC1: If (RCS ) is infeasible, then the current (CS ) has no feasible solution. Go to step 2 ∗ FC2: If zRCS ≥ z , then current (CS ) has no feasible solution better than the incumbent. Go to step 2 FC3: If optimal solution of (RCS ) is feasible for (CS ) (eg, integral), then it is an optimal solution of (CS ). If zRCS ≤ z ∗, then record this solution as the new incumbent (z ∗ = zRCS ). Go to step 2
Step 6: Separation
Separate the current candidate subproblem (CS ) and add its children nodes to the list of candidate subproblems. Go to step 2
Chen CL
57
Remark 1: In step 1, one can use prior knowledge on an upper
bound and initialize the incumbent to such an upper bound
Remark 2: Node Selection
Depth-first search (Last-In-First-Out) Breadth-first search
Chen CL
58
Branch and Bound Based on Linear Programming Relaxation
Chen CL
MILP
59
min
cT x + dT y
s.t.
Ax + By ≤ b x ≥ 0, x ∈ X ⊆ Rn y ∈ {0, 1}
(RCS )11 =⇒ z(RCS )1 1
3
min cT x + dT y s.t. Ax + By ≤ b x ≥ 0, x ∈ X ⊆ Rn y1 = 0; 0 ≤ y2, y3 ≤ 1
(RCS )01 =⇒ z(RCS )0
min cT x + dT y s.t. Ax + By ≤ b x ≥ 0, x ∈ X ⊆ Rn 0 ≤ y1, y2, y3 ≤ 1
(RCS )12 =⇒ z(RCS )1
min cT x + dT y s.t. Ax + By ≤ b x ≥ 0, x ∈ X ⊆ Rn y1 = 1; 0 ≤ y2, y3 ≤ 1
1
2
(RCS )01 ⇒ z(RCS )0 : (LP relaxation of the MILP ) 1 a lower bound on optimal solution of the MILP (optimal and terminate if all y s are 0 − 1) (RCS )11 ⇒ z(RCS )1 : (LP relaxation of the (CS )) 1 an upper bound on the solution of (RCS )11
Chen CL
60
Branch and Bound Based on Linear Programming Relaxation: Illustration
min 2x1 − 3y1 − 2y2 − 3y3 s.t. x1 + y1 + y2 + y3 ≥ 2 10x1 + 5y1 + 3y2 + 4y3 ≤ 10 x1 ≥ 0 y1, y2, y3 = 0, 1
relax of =⇒ root node
min 2x1 − 3y1 − 2y2 − 3y3 s.t. x1 + y1 + y2 + y3 ≥ 2 10x1 + 5y1 + 3y2 + 4y3 ≤ 10 x1 ≥ 0 0 ≤ y1, y2, y3 ≤ 1 ⇓ x1 = 0 (y1, y2, y3) = (0.6, 1, 1) z = −6.8
Chen CL
61
BB Method Based on LP Relaxation: Illustration
The MILP problem: min 2x1 − 3y1 − 2y2 − 3y3 x,y
s.t. x1 + y1 + y2 + y3 ≥ 2 10x1 + 5y1 + 3y2 + 4y3 ≤ 10 x1 ≥ 0 y1, y2, y3 ∈ {0, 1}
Relaxed problem: min 2x1 − 3y1 − 2y2 − 3y3 x,y
s.t. x1 + y1 + y2 + y3 ≥ 10x1 + 5y1 + 3y2 + 4y3 ≤ x1 ≥ y1, y2, y3 ∈
2 10 0 [0, 1]
⇒ z = −6.8, x1 = 0, y = [0.6, 1, 1] −6.8 < z ∗ = +∞ =⇒ separate problem into subproblems 1,2
Chen CL
62
Consider breadth first search, at level 1:
Relaxed problem of subproblem 1: min 2x1 − 3y1 − 2y2 − 3y3 x,y
s.t. x1 + y1 + y2 + y3 10x1 + 5y1 + 3y2 + 4y3 x1 y1 y2 , y 3
≥ ≤ ≥ = ∈
2 10 0 0 [0, 1]
⇒ z = −5, x1 = 0, y = [0, 1, 1] optimal solution of (RP ) is feasible for problem (P ), and −5 < z ∗ = +∞ ⇒ z ∗ = −5
Chen CL
63
Relaxed problem of subproblem 2: min 2x1 − 3y1 − 2y2 − 3y3 x,y
s.t. x1 + y1 + y2 + y3 ≥ 2 10x1 + 5y1 + 3y2 + 4y3 ≤ 10 x1 ≥ 0 y1 = 1 y2, y3 ∈ [0, 1]
⇒ z = −6.667, x1 = 0, y = [1, 0.333, 1] −6.667 < z ∗ = −5 =⇒ separate subproblem 2 into subproblems 3,4
Chen CL
64
At level 2:
Relaxed problem of subproblem 3: min 2x1 − 3y1 − 2y2 − 3y3 x,y
s.t. x1 + y1 + y2 + y3 10x1 + 5y1 + 3y2 + 4y3 x1 y1 y2 y3
≥ ≤ ≥ = = ∈
2 10 0 1 0 [0, 1]
⇒ z = −6, x1 = 0, y = [1, 0, 1] optimal solution of (RP ) is feasible for problem (P ), and −6 < z ∗ = −5 ⇒ z ∗ = −6
Chen CL
65
Relaxed problem of subproblem 4: min 2x1 − 3y1 − 2y2 − 3y3 x,y
s.t. x1 + y1 + y2 + y3 ≥ 2 10x1 + 5y1 + 3y2 + 4y3 ≤ 10 x1 ≥ 0 y1 = 1 y2 = 1 y3 ∈ [0, 1]
⇒ z = −6.5, x1 = 0, y = [1, 1, 0.5] −6.5 < z ∗ = −6 =⇒ separate subproblem 4 into subproblems 5,6
Chen CL
66
At level 3:
Subproblem 5 min 2x1 − 3y1 − 2y2 − 3y3 x,y
s.t. x1 + y1 + y2 + y3 ≥ 2 10x1 + 5y1 + 3y2 + 4y3 ≤ 10 x1 ≥ 0 y1 = 1 y2 = 1 y3 = 0
⇒ z = −5, x1 = 0, y = [1, 1, 0] optimal solution of (RP ) is feasible for problem (P ), and −5 > z ∗ = −6 ⇒ Stop
Chen CL
67
Subproblem 6: min 2x1 − 3y1 − 2y2 − 3y3 x,y
s.t. x1 + y1 + y2 + y3 ≥ 2 10x1 + 5y1 + 3y2 + 4y3 ≤ 10 x1 ≥ 0 y1 = 1 y2 = 1 y3 = 1 Infeasible =⇒ Stop
Chen CL
68
Branch and Bound Based on Linear Programming Relaxation: Illustration Binary Tree for Breadth First Search