Chen CL
1
Modeling with 0 − 1 Variables Applicati Appl ication: on: select among process units i ∈ P U
Floudas: Nonlinear and Mixed-Integer Optimization Optimization Chapter 5
Let
Mixed-Integer Linear Programming
1 if unit i unit i is selected y = 0 if unit i unit i is NOT selected
i ∈ P U
i
Select one Select one & only one unit one unit ⇒
y
= 1
y
≤ 1
y
≥ 1
i
i∈P U
⇒
Select at Select at most one unit one unit
Cheng-Liang Chen
i∈P U
PSE
⇒
Select at Select at least one unit one unit
LABORATORY
Department of Chemical Engineering National TAIWAN University
Chen CL
Chen CL
3
Modeling with 0 − 1 Variables
Propositional Logic Expressions
Applicat Appl ication: ion: selec selectt unit i if unit j is selected
¬ NEGATION NEGA TION deno denoted ted as as ¬
yi = 1 if unit i unit i ∈ P U U is is selected, 0 otherwise
∧ AND AN D de deno note ted d as as ∧
If unit j unit j is selected (y (yj = 1) Others: not defined
⇒ yj − yi ≤ 0
(checkk it) (chec
Derivation: yi = 1 ≡ P i is true;
yj = 1 ≡ P j is true
P j ⇒ P i ⇒ ¬P j ∨ P i (?) ⇒ (1 − yj ) + yi ≥ 1 (?) ⇒ yj − yi ≤ 0
i
i∈P U
2
then unit i unit i should be selected too (y (yi = 1)
i
Modeling with 0 − 1 Variables:
yi =
∨ OR de deno note ted d as as ∨
1 if clause P is true 0 if clause P is false i i
EXCLU EX CLUSIV SIVE E OR den denote oted 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
4
Chen CL
Modeling with 0 − 1 Variables Proposition
5
Blending Products Including Discrete Batch Sizes The Batch Plant
Mathematical Representation
1. P 1 ∨ P 2 ∨ P 3
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.
➢
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
1 − y1 + y2 ≥ 1 (y1 − y2 ≤ 0) y1 − y2 ≤ 0 y2 − y1 ≤ 0
or y1 = y 2
(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
Q: How much of products 1 and 2 should be produced per day ?
6
Blending Products Including Discrete Batch Sizes MILP Formulation
Chen CL
7
Blending Products Including Discrete Batch Sizes Solution
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, . . .)
(y1, y2) = (2, 5)
f ∗ = 2.8 × 103
Chen CL
8
Chen CL
9
Design of A Chemical Complex
Design of A Chemical Complex
Proposed Chemical complex
Data Process I Process II Process III
fixed ($) 1000 1500 2000
A B C
500/ton 950/ton 1800/ton
Cost
Price
➢
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
10
Variable ($/ton raw material) 250 400 550
Conversions
Process I Process II Process III
90% of A to B 82% of B to C 95% of B to C
Constraints
Maximum supply of A: Maximum demand of C:
16 tons/hr 10 tons/hr
Chen CL
11
Design of A Chemical Complex
Design of A Chemical Complex
Notation
Formulation MB for B, C:
YI YII YIII PA PB SC BI BII BIII CII CIII
= 1 if process I is selected and 0 if not = 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) 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)
Balance around I,II,III:
Process can operate if built
Demand limitation: II and III are exclusive: Profit to be maximized:
BI + P B CI I + CIII BI CI I CIII PA BI I BIII SC Y II + Y I I I
= = = = = ≤ ≤ ≤ ≤ ≤
BI I + BIII SC 0.9P A 0.82BI I 0.95BIII 16Y I (10/0.82)Y II (10/0.95)Y I I I 10 1
investment and operating costs
J = − (1000Y I + 250P A + 1500Y II +
400BI I + 2000Y I I I + 550BIII )
− (500P A + 950P B) +1800SC
raw materials
sales
Chen CL
12
Chen CL
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
13 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 ; O BJ .. PR OF IT =E = - ( ; ;
+
MODEL COMPLEX /ALL/ SOLVE COMPLEX USING MIP MAXIMIZING PROFIT
select at most one of process II and III mass balance for B
Chen CL
1 000 * YI + 2 50 * PA + 15 00 * YI I + 4 00 * BII + 2 000 * Y II I + 5 50 * B II I ) 500 * PA - 950 * PB 1800 * SC
14
; ; ;
Chen CL
15
Design of A Chemical Complex
Planning of A Chemical Complex
Results
Problem Description
J = 459.3 $/hr P A = 13.55 tons/hr select process I and II
Chen CL ➢
16
Chen CL
17
Planning of A Chemical Complex
Decide:
Which process to build (2 and 3 are not excluded) ? ☞ How to obtain chemical 2 ? ☞ How much should be produced of product 3 ? ☞
➢
Data
Objective: to maximize net present value over a long range horizon consisting
of 3 time periods of 2, 3 and 5 years length ➢
Fixed investment coefficients ( 105$/ton)
Assume:
Period 1 Period 2
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 ☞
18
Period 3
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
Chen CL
Process 1
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
19
Planning of A Chemical Complex
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
Formulation
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
➢
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 Interest rate = 10%
Tax rate = 45%
Depreciation method: straight line
Chen CL ➢
20
Plant capacities
☞ ☞ ☞ ☞ ☞
Chen CL ➢
Qit: total available capacity of process i in period t, t = 1, N T Qi0: existing capacity at time t = 0 QE 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
☞
yit = 0, 1
i = 1, NP t = 1, N T
Qit = Q i,t−1 + QE it
i = 1, NP t = 1, N T
Amounts of chemicals being consumed and produced Li: index set of streams corresponding to inputs/outputs of process i W ijt ≥ 0
☞
L U ≤ QE it ≤ QE it yitQE it yit
21
Amount of chemicals being consumed and produced
i = 1, NP,
j ∈ Li t = 1, N T
Stream mi ∈ L i: 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
Chen CL ➢
22
Purchases and sales of N C nodes of chemicals
i = 1, NP,
j ∈ Li
t = 1, N T
Chen CL ➢
23
Net present value of the project
L,U (aL,U jt , djt : loewr/upper bounds for availabilities and demands)
αit, β it variable and fixed terms for the investment costs aL jt dL jt ➢
≤ P jt ≤ ≤ S jt ≤
aU jt U djt
j = 1, N C, = 1, N M, t = 1, N T
δ it unit operating cost γ jt , Γjt prices of sales and purchases of chemical j in market N T N P
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 T N P
(α QE + β y ) − δ W (γ S − Γ P ) +
N P V = −
it
it
P
jt +
=1
k∈ O (j )
N M
S W =
jt +
kt
=1
W
kt
k∈I (j )
j = 1, N C , t = 1, N T
t=1 j =1 =1
it
t=1 i=1
jt
N M
it it
t=1 i=1 N T N C N M
jt
jt
jt
imi t
Chen CL ➢
24
Chen CL
☞
25
Planning of A Chemical Complex
Additional constraints
Limit on number of expansions
GAMS Code
N T
y
it
≤ NEXP (i)
$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
i ∈ Γ ⊂ {1, · · · , N P }
t=1
☞
Limit on capital available for investment (with overline denoting non-discounted cost coefficients)
OPTIONS LIMROW=0, LIMCOL=0, SOLPRINT=OFF, OPTCR=0;
N P
α QE + β y ≤ CI (t) it
it
it it
SCALARS
t ∈ T ⊂ {1, · · · , N T }
i=1
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 /
/ 3 / 1 /
3 / / 3 / /
time periods / 1*3 / processes / 1*3 / chemicals / 1*3 / markets / 1*1 /
SET TT project lifetime
Chen CL
26
Chen CL
27
* define this set with length (at least) equal to the life time of the project / 1*100 / SVALF(I) SET TE time periods plus one / 1*4 /; PARAMETERS LE NP (T )
*
*
l eng th o f ti me p er io ds ( ye ar s) / 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 / LN EX P( I) l imi t on t he n um be r o f e xp an si on s / 1 3 2 3 3 3 / WC AP F( I) w ork in g c api ta l f act or / 1 0 .15 2 0 .15 3 0.15 / EX CA P( I) e xis ti ng c ap ac it ie s / (kton/yr) 1 0
2 50 3 0 / salvage value factor / 1 0 .10 2 0 .10 3 0.10 / ;
TABLE *
TABLE *
QELB(I,T)
QEUB(I,T)
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 * a n i npu t to nor an ou tp ut fr om pr oc es s I 1 2 3 1 1.11 -1 2 1.22 -1 3 1.05 -1
Chen CL TABLE *
28 ALPHA(I,T)
1 2 3 TABLE *
BETA(I,T)
TABLE *
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 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 T AB LE GA MM A( J, K, T) sa le p ri ce s * (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
30
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);
Chen CL
X(T)+LENP(T) ) ;
31
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
X(’1’)=0 ; LOOP (T $ (ORD(T) NE CARD(T)) , X(T+1) = FX=SUM(T,LENP(T));
29
T AB LE PL B( J, K, T) pu rc ha se l ow er b ou nd s * (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 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 * f ro m ma rk et K d ur in g pe ri od T 1 2 3 1.1 4. 5.24 7.32 2.1 9.6 11.52 13.52 3.1
Chen CL
Chen CL
Q(I,T) QE(I,T) Y(I T)
capacities capacity expansions i d i i i bl
Chen CL
32 W(I,*,T) S(J,K,T) P(J,K,T) NPV
flow rates sales purchases net present value;
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 ALIAS (J,JP) ;
1> 2> 3> 4> 5>
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);
7> 8> 9> 10> ;
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);
JM(I,J) = YES $ (ORD(J) EQ JMM(I)) ; * obtain solution using branch and bound * MODEL MULT/ALL/; SOLVE MULT MAXIMIZING NPV USING MIP;
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
$ $ $ $
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));
EQUATIONS
SET JM(I,*) ;
33
P.LO(J,K,T) P.UP(J,K,T) S.LO(J,K,T) S.UP(J,K,T)
POSITIVE VARIABLES Q,QE,W,S,P; BINARY VARIABLES Y;
*
Chen CL
DISPLAY NPV.L, Y.L, QE.L, Q.L, W.L, S.L, P.L ;
$ 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
34
Chen CL
35
Planning of A Chemical Complex
Multi-product Batch Plant Scheduling
Result
Batch Scheduling and Planning Problems
Period 1 Period 2 Period 3 Process 1 Capacity Production Process 2 Capacity Production
7.75 5.41 50.0 20.82
7.75 6.76 50.0 0
7.75 7.75 50.0 0
Process 3 Capacity Production
0 0
35.95 30 72
35.95 35 95
➢
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
Chen CL
36
Chen CL
37
Multi-product Batch Plant Scheduling
Multi-product Batch Plant Scheduling
A 4-products 3-units Plant
MILP Formulation N, M numbers of products and units C j,k the time for j th 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 j th slot of product in kth unit
Products
u1
p1 (i=1) p2 (i=2) p3 (i=3) p4 (i=4)
3.5 4.0 3.5 12.
Units u2 u3 4.3 5.5 7.5 3.5
➢
8.7 3.5 6.0 8.0
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
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
Chen CL ➢
38
j = 1, N , k = 1, M
39
in unit k is t i,k
⇒ τ j,k = X 1,j t1,k + X 2,j t2,k + . . . + X N,j tN,k
➢
➢
j = 1, N , k = 1, M − 1
➢
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 (If product pi is in slot j , then X i,j = 1 and X i,1 = . . . = X i,j −1= X i,j+1 = . . . = X i,N = 0)
j = 1, N (4)
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
➢
Every product should occupy only one slot in the sequence X i,1 + X i,2 + . . . + X i,N = 1
➢
For any given set of X i,j (production sequence)
j = 1, N , k = 1, M
(3)
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
X 1,j + X 2,j + . . . + X N,j = 1
(2)
Chen CL
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
(1)
i = 1, N (5)
C j,k ≥ 0 and X i,j binary
Chen CL
40
Multi-product Batch Plant Scheduling
* 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;
$TITLE Multiproduct Batch Plant Scheduling $OFFUPPER $OFFSYMXREF OFFSYMLIST OPTION SOLPRINT = OFF;
* 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 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;
* Define model and solve MODEL SCHEDULE /ALL/; SOLVE SCHEDULE USING MIP MINIMIZING MSPAN; DISPLAY X.L, C.L, MSPAN.L;
42
Multi-product Batch Plant Scheduling
41
N = CARD(PI); M = CARD(UK);
GAMS Code
Chen CL
Chen CL
Chen CL
43
Mathematical Description for MILP
The Optimal Schedule 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 ➢
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
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
44
Chen CL
Mathematical Description: Remark 1
Outline of MILP Algorithms ➢
➢
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
➢
45
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 ☞
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
46
Chen CL
Outline of MILP Algorithms ➢
➢
New constraints (cuts) are generated and added which reduce the feasible region until a 0 − 1 optimal solution is obtained
Decomposition Methods
☞
➢
Branch and Bound Methods Basic Notion 1: Separation
Cutting Plane Methods
☞
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
47
➢
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
➢
48
Chen CL
49
Branch and Bound Methods
Branch and Bound Methods
Basic Notion 1: Separation
Basic Notion 1: Separation
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 subproblems are called children node problems
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
Chen CL
➢
50
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
51
Branch and Bound Methods
Branch and Bound Methods
Basic Notion 2: Relaxation
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 )
➢
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 z RP . Then ( for minimization problem ) 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
➢
52
Chen CL
Branch and Bound Methods
Branch and Bound Methods
Basic Notion 2: Relaxation
Basic Notion 3: Fathoming
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:
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:
☞
➢
53
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 ☞
The capability of solving the relaxed problem ☞ The type and quality of produced lower bound ☞
Chen CL
54
Chen CL
Branch and Bound Methods Basic Notion 3: Fathoming ➢
Fathoming Criteria 1: FC1
General Branch and Bound Framework ➢
Step 1: Initialization
☞
If a relaxation of a candidate subproblem, (RCS ), has no feasible solution, then (CS ) has no feasible solution and hence can be fathomed ➢
Fathoming Criteria 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
➢
Fathoming Criteria 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
55
☞
➢
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 ☞
➢
Step 3: Selection of Candidate Subproblem
☞
Select one of the subproblems in the candidate list to become the current candidate subproblem (CS )
Chen CL
56
Chen CL
General Branch and Bound Framework ➢
➢
General Branch and Bound Framework
Step 4: Relaxation
☞
➢
Select a relaxation (RCS ) of the current candidate subproblem (CS ), solve it and denote its solution by z RCS
Step 6: Separation
☞
☞
☞
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 ∗ = z RCS ). Go to step 2
Chen CL
58
Branch and Bound Based on Linear Programming Relaxation
Separate the current candidate subproblem (CS ) and add its children nodes to the list of candidate subproblems. Go to step 2
Step 5: Fathoming apply the three fathoming criteria
☞
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
MILP
59
min s.t.
T
T
c x+d y Ax + By ≤ b x ≥ 0, x ∈ X ⊆ Rn y ∈ {0, 1}3
(RCS )11 =⇒ z(RCS )1 1
➢
➢
T
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 1
(RCS )12 =⇒ z(RCS )1 2
T
min c x + d y s.t. Ax + By ≤ b x ≥ 0, x ∈ X ⊆ Rn 0 ≤ y1, y2, y3 ≤ 1 min cT x + dT y s.t. Ax + By ≤ b x ≥ 0, x ∈ X ⊆ Rn y1 = 1; 0 ≤ y2, y3 ≤ 1
(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
Chen CL
Branch and Bound Based on Linear Programming Relaxation: Illustration
BB Method Based on LP 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
61
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
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 ≥ 2 10x1 + 5y1 + 3y2 + 4y3 ≤ 10 x1 ≥ 0 y1, y2, y3 ∈ [0, 1]
⇒ z = −6.8, x1 = 0, y = [0.6, 1, 1] −6.8 < z ∗ = + ∞ =⇒ separate problem into subproblems 1,2
Chen CL
62
Chen CL
BB Method Based on LP Relaxation: Illustration ➢
Consider breadth first search, at level 1 : ☞
Consider breadth first search, at level 1: ☞
min 2x1 − 3y1 − 2y2 − 3y3 x,y
s.t. x1 + y1 + y2 + y3 10x1 + 5y1 + 3y2 + 4y3 x1 y1 y2, y3
BB Method Based on LP Relaxation: Illustration ➢
Relaxed problem of subproblem 1:
≥ ≤ ≥ = ∈
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
63
Relaxed problem of subproblem 2: 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, 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
Chen CL
BB Method Based on LP Relaxation: Illustration ➢
BB Method Based on LP Relaxation: Illustration
At level 2 : ☞
➢
Relaxed problem of subproblem 3:
At level 2 : ☞
Relaxed problem of subproblem 4:
min 2x1 − 3y1 − 2y2 − 3y3
min 2x1 − 3y1 − 2y2 − 3y3
x,y
s.t. x1 + y1 + y2 + y3 10x1 + 5y1 + 3y2 + 4y3 x1 y1 y2 y3
≥ ≤ ≥ = = ∈
x,y
2 10 0 1 0 [0, 1]
s.t. x1 + y1 + y2 + y3 10x1 + 5y1 + 3y2 + 4y3 x1 y1 y2 y3
⇒ 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
66
At level 3 : ☞
At level 3 : ☞
Subproblem 6: min 2x1 − 3y1 − 2y2 − 3y3
x,y
≥ ≤ ≥ = = =
x,y
2 10 0 1 1 0
⇒ z = −5, x1 = 0, y = [1, 1, 0] optimal solution of (RP ) is feasible for problem (P ), and −5 > z ∗ = −6 ⇒ Stop
67
BB Method Based on LP Relaxation: Illustration
min 2x1 − 3y1 − 2y2 − 3y3 s.t. x1 + y1 + y2 + y3 10x1 + 5y1 + 3y2 + 4y3 x1 y1 y2 y3
2 10 0 1 1 [0, 1]
Chen CL
➢
Subproblem 5
≥ ≤ ≥ = = ∈
⇒ z = −6.5, x1 = 0, y = [1, 1, 0.5] −6.5 < z ∗ = −6 =⇒ separate subproblem 4 into subproblems 5,6
BB Method Based on LP Relaxation: Illustration ➢
65
s.t. x1 + y1 + y2 + y3 10x1 + 5y1 + 3y2 + 4y3 x1 y1 y2 y3 Infeasible =⇒ Stop
≥ ≤ ≥ = = =
2 10 0 1 1 1
Chen CL
68
Chen CL
Branch and Bound Based on Linear Programming Relaxation: Illustration
Branch and Bound Based on Linear Programming Relaxation: Illustration
Binary Tree for Breadth First Search
Binary Tree for Depth First Search with Backtracking
Chen CL
70
Thank You for Your Attention Questions Are Welcome
69