Sunteți pe pagina 1din 18

Floudas: Nonlinear and Mixed-Integer Optimization

Chapter 5
Mixed-Integer Linear Programming
Cheng-Liang Chen
PSE
LABORATORY
Department of Chemical Engineering
National TAIWAN University
Chen CL 1
Modeling with 0 1 Variables
Application: select among process units i PU
Let y
i
=

1 if unit i is selected
0 if unit i is NOT selected
i PU
Select one & only one unit

iPU
y
i
= 1
Select at most one unit

iPU
y
i
1
Select at least one unit

iPU
y
i
1
Chen CL 2
Modeling with 0 1 Variables
Application: select unit i if unit j is selected
y
i
= 1 if unit i PU is selected, 0 otherwise
If unit j is selected (y
j
= 1)
then unit i should be selected too (y
i
= 1)
Others: not dened
y
j
y
i
0 (check it)
Derivation: y
i
= 1 P
i
is true; y
j
= 1 P
j
is true
P
j
P
i
P
j
P
i
(?)
(1 y
j
) +y
i
1 (?)
y
j
y
i
0
Chen CL 3
Propositional Logic Expressions
NEGATION denoted as
AND denoted as
OR denoted as
EXCLUSIVE OR denoted as
Modeling with 0 1 Variables:
y
i
=

1 if clause P
i
is true
0 if clause P
i
is false
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
Modeling with 0 1 Variables
Proposition Mathematical Representation
1. P
1
P
2
P
3
y
1
+y
2
+y
3
1
2. P
1
P
2
P
3
y
1
1
y
2
1
y
3
1
3. P
1
P
2
(P
1
P
2
) 1 y
1
+y
2
1 (y
1
y
2
0)
4.
(P
1
P
2
)
(P
1
P
2
) (P
2
P
1
)
(P
1
P
2
) (P
2
P
1
)
y
1
y
2
0
y
2
y
1
0
or y
1
= y
2
5.
(P
1
P
2
P
3
)
(P
1
P
3
) (P
2
P
3
)
y
1
y
3
0
y
2
y
3
0
6. P
1
P
2
P
3
(exactly one) y
1
+y
2
+y
3
= 1
Chen CL 5
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 ?
Chen CL 6
Blending Products Including Discrete Batch Sizes
MILP Formulation
x
1
, x
2
thousands of pounds per day
for products 1 and 2
max f = 160x
1
+ 200x
2
s.t. 0.6x
1
+ 0.3x
2
6
x
i
= 2y
i
0 2000y
1
8000
0 2000y
2
10000
y
i
: integers (0, 1, 2, . . .)
Chen CL 7
Blending Products Including Discrete Batch Sizes
Solution
(y
1
, y
2
) = (2, 5) f

= 2.8 10
3
Chen CL 8
Design of A Chemical Complex
Proposed Chemical complex
Objective: to maximize prot
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 9
Design of A Chemical Complex
Data
Cost xed ($) Variable ($/ton raw material)
Process I 1000 250
Process II 1500 400
Process III 2000 550
Price A 500/ton
B 950/ton
C 1800/ton
Conversions Process I 90% of A to B
Process II 82% of B to C
Process III 95% of B to C
Constraints Maximum supply of A: 16 tons/hr
Maximum demand of C: 10 tons/hr
Chen CL 10
Design of A Chemical Complex
Notation
YI = 1 if process I is selected and 0 if not
YII = 1 if process II is selected and 0 if not
YIII = 1 if process III is selected and 0 if not
PA purchases of A (tons/hr)
PB purchases of B (tons/hr)
SC sales of C (tons/hr)
BI production rate of B in process I (tons/hr)
BII consumption rate of B in process II (tons/hr)
BIII consumption rate of B in process III (tons/hr)
CII production rate of C in process II (tons/hr)
CIII production rate of C in process III (tons/hr)
Chen CL 11
Design of A Chemical Complex
Formulation
MB for B, C: BI +PB = BII +BIII
CII +CIII = SC
Balance around I,II,III: BI = 0.9PA
CII = 0.82BII
CIII = 0.95BIII
Process can operate if built PA 16Y I
BII (10/0.82)Y II
BIII (10/0.95)Y III
Demand limitation: SC 10
II and III are exclusive: Y II +Y III 1
Prot to be maximized: J =
investment and operating costs

(1000Y I + 250PA + 1500Y II+
400BII + 2000Y III + 550BIII)
(500PA + 950PB)

raw materials
+1800SC

sales
Model Size : 9 constraints; 8 continuous variables, 3 binary variables
Chen CL 12
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 select at most one of process II and III
E2 mass balance for B
Chen CL 13
E3 mass balance for C
E4 mass balance around process I
E5 mass balance around process II
E6 mass balance around process III
E7 no purchases of A unless process I is selected
E8 no production of BII unless process II is selected
E9 no production of BIII unless process III is selected
OBJ objective function definition ;
E1 .. YII + YIII =L= 1 ;
E2 .. BI + PB =E= BII + BIII ;
E3 .. CII + CIII =E= SC ;
E4 .. BI =E= 0.9 * PA ;
E5 .. CII =E= 0.82 * BII ;
E6 .. CIII =E= 0.95 * BIII ;
E7 .. PA =L= 16 * YI ;
E8 .. BII =L= (10/0.82) * YII ;
E9 .. 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 14
Design of A Chemical Complex
Results
J = 459.3 $/hr
PA = 13.55 tons/hr
select process I and II
Chen CL 15
Planning of A Chemical Complex
Problem Description
Chen CL 16
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 coecients 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 17
Planning of A Chemical Complex
Data
Fixed investment coecients (10
5
$/ton)
Period 1 Period 2 Period 3
Process 1 85 95 112
Process 2 73 82 102
Process 3 110 125 148
Variable investment coecients (10
2
$/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 coecients (10
2
$/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 18
Prices (10
2
$/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 coecients (to main product)
Chemical 1 Chemical 2 Chemical 3
Process 1 1.11 1
Process 2 1.22 1
Process 3 1.05 1
Miscellaneous data
Existing capacity
kton/yr
Salvage value
factor
Working capital
factor
Process 1 0.1 0.15
Process 2 50 0.1 0.15
Process 3 0.1 0.15
Interest rate = 10%, Tax rate = 45%, Depreciation method: straight line
Chen CL 19
Planning of A Chemical Complex
Formulation
Index notation
i process i = 1, NP
j chemical j = 1, NC
market = 1, NM
t time period t = 1, NT
Chen CL 20
Plant capacities
Q
it
: total available capacity of process i in period t, t = 1, NT
Q
i0
: existing capacity at time t = 0
QE
it
: capacity expansion of process i installed in period t
QE
L
it
, QE
U
it
: lower/upper bounds for capacity expansions
y
it
= {0, 1}: occurrence of expansions
y
it
QE
L
it
QE
it
QE
U
it
y
it
y
it
= 0, 1 i = 1, NP t = 1, NT
Q
it
= Q
i,t1
+QE
it
i = 1, NP t = 1, NT
Chen CL 21
Amount of chemicals being consumed and produced
Amounts of chemicals being consumed and produced
L
i
: index set of streams corresponding to inputs/outputs of process i
W
ijt
0 i = 1, NP, j L
i
t = 1, NT
Stream m
i
L
i
: main product produced by process i, capacity
limitation
W
im
i
t
Q
it
i = 1, NP t = 1, NT
Note: W
im
i
t
= 0 if shut-down
Material balances in each plant (use constant characteristics of process
i and chemical j)
W
ijt
=
ij
W
im
i
t
i = 1, NP, j L
i
t = 1, NT
Chen CL 22
Purchases and sales of NC nodes of chemicals
(a
L,U
jt
, d
L,U
jt
: loewr/upper bounds for availabilities and demands)
a
L
jt
P
jt
a
U
jt
d
L
jt
S
jt
d
U
jt
j = 1, NC, = 1, NM, t = 1, NT
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
NM

=1
P
jt
+

kO(j)
W
kt
=
NM

=1
S
jt
+

kI(j)
W
kt
j = 1, NC, t = 1, NT
Chen CL 23
Net present value of the project

it
,
it
variable and xed terms for the investment costs

it
unit operating cost

jt
,
jt
prices of sales and purchases of chemical j in market
NPV =
NT

t=1
NP

i=1
(
it
QE
it
+
it
y
it
)
NT

t=1
NP

i=1

it
W
im
i
t
+
NT

t=1
NC

j=1
NM

=1
(
jt
S
jt

jt
P
jt
)
Chen CL 24
Additional constraints
Limit on number of expansions
NT

t=1
y
it
NEXP(i) i {1, , NP}
Limit on capital available for investment
(with overline denoting non-discounted cost coecients)
NP

i=1

it
QE
it
+
it
y
it

CI(t) t T {1, , NT}


Chen CL 25
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 NPRO number of processes / 3 /
NPER number of periods / 3 /
NCHE number of chemicals / 3 /
NMAR number of markets / 1 /
INTR interest rate / 0.10 /
TAX tax rate / 0.45 /
SETS T time periods / 1*3 /
I processes / 1*3 /
J chemicals / 1*3 /
K markets / 1*1 /
SET TT project lifetime
Chen CL 26
* 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 27
2 50
3 0 /
SVALF(I) salvage value factor /
1 0.10
2 0.10
3 0.10 / ;
TABLE QELB(I,T) lower bounds on expansion
* (kton/yr)
1 2 3
1
2
3 ;
TABLE QEUB(I,T) upper bounds on expansion
* (kton/yr)
1 2 3
1 100 100 100
2 100 100 100
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 28
TABLE ALPHA(I,T) variable investement coefficient
* (1e2 $/ton)
1 2 3
1 1.38 1.56 1.78
2 2.72 3.22 4.6
3 1.76 2.34 2.84
TABLE BETA(I,T) fixed investement coefficient
* (1e5 $)
1 2 3
1 85 95 112
2 73 82 102
3 110 125 148
TABLE DELTA(I,T) operating expenses per unit of main product
* (1e2 $ /ton)
1 2 3
1 0.4 0.5 0.6
2 0.6 0.7 0.8
3 0.5 0.6 0.7
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 29
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
Chen CL 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);
X(1)=0 ; LOOP (T $ (ORD(T) NE CARD(T)) , X(T+1) = X(T)+LENP(T) ) ;
FX=SUM(T,LENP(T));
Chen CL 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 Q(I,T) capacities
QE(I,T) capacity expansions
Y(I,T) integer decision variables
Chen CL 32
W(I,*,T) flow rates
S(J,K,T) sales
P(J,K,T) purchases
NPV net present value;
POSITIVE VARIABLES Q,QE,W,S,P;
BINARY VARIABLES Y;
EQUATIONS CELBD(I,T) capacity expansion lower bounds <EQ. 1>
CEUBD(I,T) capacity expansion upper bounds <EQ. 2>
CAPBL(I,T) capacity balances <EQ. 3>
PRCP(I,T) production cannot exceed capacity <EQ. 4>
PBAL(I,J,T) balances around processes <EQ. 5>
* constraints <6> will be given as lower and upper bounds
BAL(J,T) balances for chemicals <EQ. 7>
OBJ net present value definition <EQ. 8>
NEXP(I) limitation of number of expansions <EQ. 9>
INVBD(T) bound on investment at each time period <EQ. 10> ;
SET JM(I,*) ; ALIAS (J,JP) ; 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 33
P.LO(J,K,T) $ PLB(J,K,T) = PLB(J,K,T);
P.UP(J,K,T) $ (PUB(J,K,T) AND (PUB(J,K,T) NE INF)) = PUB(J,K,T);
S.LO(J,K,T) $ SLB(J,K,T) = SLB(J,K,T);
S.UP(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 34
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 50.0 50.0 50.0
Production 20.82 0 0
Process 3 Capacity 0 35.95 35.95
Production 0 30.72 35.95
Chen CL 35
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 36
Multi-product Batch Plant Scheduling
A 4-products 3-units Plant
Units
Products u1 u2 u3
p1 (i=1) 3.5 4.3 8.7
p2 (i=2) 4.0 5.5 3.5
p3 (i=3) 3.5 7.5 6.0
p4 (i=4) 12. 3.5 8.0
Chen CL 37
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
t
i,k
processing time for ith product (pi) in kth unit (t
3,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,k1
+
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
j1,k
+
j,k
j = 1, N, k = 1, M (2)
Chen CL 38
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
j1,k+1
j = 1, N, k = 1, M 1 (3)
Note: Eq.s (3), C
j,k1
C
j1,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
(If product pi is in slot j, then X
i,j
= 1 and X
i,1
= . . . = X
i,j1
= X
i,j+1
= . . . = X
i,N
= 0)
X
1,j
+X
2,j
+. . . +X
N,j
= 1 j = 1, N (4)
Every product should occupy only one slot in the sequence
X
i,1
+X
i,2
+. . . +X
i,N
= 1 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 jth-slot product
Chen CL 39
in unit k is t
i,k

j,k
= X
1,j
t
1,k
+X
2,j
t
2,k
+. . . +X
N,j
t
N,k
j = 1, N, k = 1, M
MILP formulation:
min C
N,M
s.t. Eq.s 3,4,5
C
j,k
C
j,k1
+
N

i=1
X
i,j
t
i,k
j = 1, N k = 2, M
C
j,k
C
i1,k
+
N

i=1
X
i,j
t
i,k
j = 1, N
C
j,k
0 and X
i,j
binary
Chen CL 40
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 41
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;
Chen CL 42
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 nished 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 43
Mathematical Description for MILP
min c
T
x +d
T
y
s.t. Ax +By b
x 0, x X R
n
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 44
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 diculty: 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
2
q
possible combinations !
Chen CL 45
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 dierent levels of
the binary tree
Chen CL 46
Outline of MILP Algorithms
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
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 47
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 FS(P). A set
of subproblems (P
1
), . . . , (P
n
) of (P) is dened 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
Branch and Bound Methods
Basic Notion 1: Separation
Remark 1:
The above conditions imply that the FSs of the
subproblems FS(P
1
), . . . , FS(P
n
) are a partition of the
FSs of (P), that is FS(P)
original problem (P) is called a parent node problem
subproblems are called children node problems
Chen CL 49
Branch and Bound Methods
Basic Notion 1: Separation
Remark 2: how to separate (P) into (P
1
), . . . , (P
n
) ?
Most frequently used way:
Considering contradictory constraints on a single binary variable
min 3y
1
2y
2
3y
3
+ 2x
1
s.t. y
1
+y
2
+y
3
+x
1
2
5y
1
+ 3y
2
+ 4y
3
+ 10x
1
10
x
1
0 y
1
, y
2
, y
3
= 0, 1
=
min 3y
1
2y
2
3y
3
+ 2x
1
s.t. y
1
+y
2
+y
3
+x
1
2
5y
1
+ 3y
2
+ 4y
3
+ 10x
1
10
y
1
= 0
x
1
0 0 y
2
, y
3
1
min 3y
1
2y
2
3y
3
+ 2x
1
s.t. y
1
+y
2
+y
3
+x
1
2
5y
1
+ 3y
2
+ 4y
3
+ 10x
1
10
y
1
= 1
x
1
0 0 y
2
, y
3
1
Chen CL 50
Branch and Bound Methods
Basic Notion 2: Relaxation
Relaxation:
An optimization problem, denoted as (RP), is dened
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)
FS(P) FS(RP)
Chen CL 51
Branch and Bound Methods
Basic Notion 2: Relaxation
Remark 1:
The above denition 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 z
P
and the optimal solution
of (RP) be z
RP
. Then (for minimization problem)
z
RP
z
P
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
Branch and Bound Methods
Basic Notion 2: Relaxation
Remark 2: how to relax problem (P) ?
Omitting one or several constraints of problem (P)
Setting one or more positive coecients 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-o between two competing criteria:
The capability of solving the relaxed problem
The type and quality of produced lower bound
Chen CL 53
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 FS(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 54
Branch and Bound Methods
Basic Notion 3: Fathoming
Fathoming Criteria 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
Fathoming Criteria 2: FC2
If the optimal solution of (RCS), z
RCS
, is greater or equal to the
incumbent (z

), i.e., z
RCS
z

, then (CS) can be fathomed


Note: if z
CS
z

z
RCS
(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
fathomed (Note: update incumbent if its value is less than z

)
Chen CL 55
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
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
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 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 z
RCS
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 z
RCS
z

, then record this solution as the new incumbent


(z

= z
RCS
). Go to step 2
Chen CL 57
General Branch and Bound Framework
Step 6: Separation
Separate the current candidate subproblem (CS) and add its
children nodes to the list of candidate subproblems. Go to step
2
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-rst search (Last-In-First-Out)
Breadth-rst search
Chen CL 58
Branch and Bound Based on Linear
Programming Relaxation
Chen CL 59
MILP
min c
T
x +d
T
y
s.t. Ax +By b
x 0, x X R
n
y {0, 1}
3
(RCS)
0
1
=
z
(RCS)
0
1
min c
T
x +d
T
y
s.t. Ax +By b
x 0, x X R
n
0 y
1
, y
2
, y
3
1
(RCS)
1
1
=
z
(RCS)
1
1
min c
T
x +d
T
y
s.t. Ax +By b
x 0, x X R
n
y
1
= 0; 0 y
2
, y
3
1
(RCS)
1
2
=
z
(RCS)
1
2
min c
T
x +d
T
y
s.t. Ax +By b
x 0, x X R
n
y
1
= 1; 0 y
2
, y
3
1
(RCS)
0
1
z
(RCS)
0
1
: (LP relaxation of the MILP )
a lower bound on optimal solution of the MILP
(optimal and terminate if all y

s are 0 1)
(RCS)
1
1
z
(RCS)
1
1
: (LP relaxation of the (CS))
an upper bound on the solution of (RCS)
1
1
Chen CL 60
Branch and Bound Based on Linear
Programming Relaxation: Illustration
min 2x
1
3y
1
2y
2
3y
3
s.t. x
1
+y
1
+y
2
+y
3
2
10x
1
+ 5y
1
+ 3y
2
+ 4y
3
10
x
1
0
y
1
, y
2
, y
3
= 0, 1
relax of
=
root node
min 2x
1
3y
1
2y
2
3y
3
s.t. x
1
+y
1
+y
2
+y
3
2
10x
1
+ 5y
1
+ 3y
2
+ 4y
3
10
x
1
0
0 y
1
, y
2
, y
3
1

x
1
= 0
(y
1
, y
2
, y
3
) = (0.6, 1, 1)
z = 6.8
Chen CL 61
BB Method Based on LP Relaxation:
Illustration
The MILP problem:
min
x,y
2x
1
3y
1
2y
2
3y
3
s.t. x
1
+y
1
+y
2
+y
3
2
10x
1
+ 5y
1
+ 3y
2
+ 4y
3
10
x
1
0
y
1
, y
2
, y
3
{0, 1}
Relaxed problem:
min
x,y
2x
1
3y
1
2y
2
3y
3
s.t. x
1
+y
1
+y
2
+y
3
2
10x
1
+ 5y
1
+ 3y
2
+ 4y
3
10
x
1
0
y
1
, y
2
, y
3
[0, 1]
z = 6.8, x
1
= 0, y = [0.6, 1, 1]
6.8 < z

= + = separate problem into subproblems 1,2


Chen CL 62
BB Method Based on LP Relaxation:
Illustration
Consider breadth rst search, at level 1:
Relaxed problem of subproblem 1:
min
x,y
2x
1
3y
1
2y
2
3y
3
s.t. x
1
+y
1
+y
2
+y
3
2
10x
1
+ 5y
1
+ 3y
2
+ 4y
3
10
x
1
0
y
1
= 0
y
2
, y
3
[0, 1]
z = 5, x
1
= 0, y = [0, 1, 1]
optimal solution of (RP) is feasible for problem (P), and
5 < z

= + z

= 5
Chen CL 63
BB Method Based on LP Relaxation:
Illustration
Consider breadth rst search, at level 1:
Relaxed problem of subproblem 2:
min
x,y
2x
1
3y
1
2y
2
3y
3
s.t. x
1
+y
1
+y
2
+y
3
2
10x
1
+ 5y
1
+ 3y
2
+ 4y
3
10
x
1
0
y
1
= 1
y
2
, y
3
[0, 1]
z = 6.667, x
1
= 0, y = [1, 0.333, 1]
6.667 < z

= 5 = separate subproblem 2 into subproblems 3,4


Chen CL 64
BB Method Based on LP Relaxation:
Illustration
At level 2:
Relaxed problem of subproblem 3:
min
x,y
2x
1
3y
1
2y
2
3y
3
s.t. x
1
+y
1
+y
2
+y
3
2
10x
1
+ 5y
1
+ 3y
2
+ 4y
3
10
x
1
0
y
1
= 1
y
2
= 0
y
3
[0, 1]
z = 6, x
1
= 0, y = [1, 0, 1]
optimal solution of (RP) is feasible for problem (P), and
6 < z

= 5 z

= 6
Chen CL 65
BB Method Based on LP Relaxation:
Illustration
At level 2:
Relaxed problem of subproblem 4:
min
x,y
2x
1
3y
1
2y
2
3y
3
s.t. x
1
+y
1
+y
2
+y
3
2
10x
1
+ 5y
1
+ 3y
2
+ 4y
3
10
x
1
0
y
1
= 1
y
2
= 1
y
3
[0, 1]
z = 6.5, x
1
= 0, y = [1, 1, 0.5]
6.5 < z

= 6 = separate subproblem 4 into subproblems 5,6


Chen CL 66
BB Method Based on LP Relaxation:
Illustration
At level 3:
Subproblem 5
min
x,y
2x
1
3y
1
2y
2
3y
3
s.t. x
1
+y
1
+y
2
+y
3
2
10x
1
+ 5y
1
+ 3y
2
+ 4y
3
10
x
1
0
y
1
= 1
y
2
= 1
y
3
= 0
z = 5, x
1
= 0, y = [1, 1, 0]
optimal solution of (RP) is feasible for problem (P), and
5 > z

= 6 Stop
Chen CL 67
BB Method Based on LP Relaxation:
Illustration
At level 3:
Subproblem 6:
min
x,y
2x
1
3y
1
2y
2
3y
3
s.t. x
1
+y
1
+y
2
+y
3
2
10x
1
+ 5y
1
+ 3y
2
+ 4y
3
10
x
1
0
y
1
= 1
y
2
= 1
y
3
= 1
Infeasible = Stop
Chen CL 68
Branch and Bound Based on Linear
Programming Relaxation: Illustration
Binary Tree for Breadth First Search
Chen CL 69
Branch and Bound Based on Linear
Programming Relaxation: Illustration
Binary Tree for Depth First Search with Backtracking
Chen CL 70
Thank You for Your Attention
Questions Are Welcome

S-ar putea să vă placă și