Lecture MILP
Lecture MILP
Lecture
Process Optimization: MILP
1. Fundamentals of MILP.
2. Branch and bound method.
3. Tearing using MILP.
Learning outcomes
• Develop understanding of the fundamentals of MILP.
• Model simple logic statements using algebraic equations containing binary variables
• Develop understanding of the fundamentals of the branch and bound method.
DPPI | 31.11.2024 | 2
Mixed-integer linear programming
min 𝑓 𝑥, 𝑦 = 0
s. t. ℎ 𝑥, 𝑦 = 0 • Only difference compared to LP: existence of binary
variables
𝑔 𝑥, 𝑦 ≤ 0 • Any integer variable can be replaced by binary
𝑥 ∈ ℝ𝑛 variables
𝑦 ∈ 0,1 𝑛 binary
variable
Algorithms:
Major software codes
• Branch and bound
(they are usually used to solve both LPs and
• NO
Cutting planes (convexification, convert the MILP MILPs):
into an LP)
CPLEX, XPRESS, OSL, GUROBI
•
N
Much more complex to solve compared to LPs! (complexity grows with the number of binaries)
DPPI | 31.11.2024 | 3
3
Mixed-integer linear programming
• Is the feasible region of an MILP convex?
not convex
you
!!
cannot draw
𝑥1 , 𝑥2 ∈ 0,1,2 three possible
discrite values
it's be
of an especific problem
line between
−𝑥1 + 𝑥2 = 1
a
it
2 point be
doesn't belong
to the feasable
all of then
I not
region
e of
.
b are feasible
This canno
w restriction
Me
Maximized f-value
𝑓=5
O Maximum
doesn't lie on
any Vertex
O O O
Only the 5
point
𝑓 =0
are
DPPI | 31.11.2024 | 4
Integer and binary variables
Any integer variable N can be expressed as a summation of binary variables y, e.g., N from 0 to 9:
𝑁 = 1𝑦1 + 2𝑦2 + 3𝑦3 + 4𝑦4 + 5𝑦5 + 6𝑦6 + 7𝑦7 + 8𝑦8 + 9𝑦9 + 10𝑦10 − 1
𝑦1 + 𝑦2 + 𝑦3 + 𝑦4 + 𝑦5 + 𝑦6 + 𝑦7 + 𝑦8 + 𝑦9 + 𝑦10 = 1
N =
20 ,
1 ,
2 ,
]
...,
𝑁+1 𝑁+1
NE (0
to
,
can
1
,
2
,
be
...
)
converted
1)
y ( (0 .
0 Vi + 3
𝑁 = 𝑖𝑦𝑖 − 1, 𝑦𝑖 = 1 , 𝑦𝑖 ∈ 0,1
DPPI N= 2 (z = 1 =
y
=
| 31.11.2024 | 5
𝑖=1 𝑖=1
Modelling with 0-1 variables
𝑦𝑗 = 1 Binary variable is one if j is true (select item j)
Binary variable is zero if j is false (do not select item j)
𝑦𝑗 = 0
At most one is true (both cannot be true simultaneously)
non lineat
J
iecome a
we
AB2 X
X
y ,
+
y23d a
y X X
𝑦𝑗 ≤ 1
𝑗∈𝐽
y ,
+
yz[1B
DPPI | 31.11.2024 | 6
Modelling with 0-1 variables
AND operator
↓
𝑦1 + 𝑦2 ≥ 1 ⋀ 𝑦3 + 𝑦4 ≥ 1
𝑦1 + 𝑦2 ≥ 1
(select 1 or 2 or both) AND (select 3 or 4 or both)
𝑦3 + 𝑦4 ≥ 1 E F
- ~
,
C'e X
X
3 , 4 O
~
~
X
A 31 y210
-
DPPI | 31.11.2024 | 7
Modelling with 0-1 variables + P-550
f, (x)20
OR
fr(x)20
10 P5
- only I are
selected
- Y1 + ye = 1 M=
parameter
106
t I
bigm
X
f, (x) = M(1 -
y) ,
Fi
OR (disjunctions, can be inclusive or exclusive) Six = m (1
-
Y2)
04210- Pos
OR
v 52M(1
y1)(y, 1
-
P + =
yz
𝑓1 (𝑥) ≤ 0 𝑓2 𝑥 ≤ 0
-
*
P -
10 = M(1 -
yz)
0
more restricted
1 the
byz
=
= =
y -
is
thisa
PIS
P-10 [
M PE1O + OX
𝑓2 𝑥 ≤ 𝑀(1 − 𝑦2 )
𝑦1 + 𝑦2 = 1 Exclusive disjunction (inclusive OR would imply 𝑦1 + 𝑦2 ≥ 1)
If something is true, then an equation is satisfied
u(x) = M(1 y)
𝑖𝑓 𝑦 = 1 → ℎ 𝑥 = 0 E hi
-
h(x)Y M(1 y)
-
-
𝑦ℎ 𝑥 = 0 Leads to:
−𝑀(1 − 𝑦) ≤ ℎ 𝑥 ≤ 𝑀(1 − 𝑦)
DPPI | 31.11.2024 | 8
Modelling with 0-1 variables
Modelling disjunctions (exclusive disjunction, i.e., only one term is true)
𝑥 − O
𝑣𝑖 = 0 𝑥, 𝑣𝑖 ∈ 𝕽𝑛
replace
𝑖∈𝐷 It
praction-
𝑣
reformatte 𝑖
𝑦𝑖 ℎ𝑖 ≤ 0 ∀𝑖 ∈ 𝐷
𝑦𝑖 Trade-off: Big-M involves fewer variables but the M parameter can
𝑦𝑖 = 1 cause numerical difficulties, while convex hull tends to be
numerically more stable but requires auxiliary variables.
𝑖∈𝐷
𝑦𝑖 ∈ 0,1 ∀𝑖 ∈ 𝐷
0 ≤ 𝑣𝑖 ≤ 𝑣𝑖𝑈 𝑦𝑖 ∀𝑖 ∈ 𝐷
DPPI | 31.11.2024 | 9
Modelling with 0-1 variables
Example: reformulate the following linear disjunction
or Disjuntation
𝑥1 − 𝑥2 ≤ 1 ˅ 2𝑥1 − 𝑥2 ≤ 4
˅ 𝑥1 − 2𝑥2 ≤ 5
0 ≤ 𝑥1 , 𝑥2 ≤ 5
Big-M relaxation (where M is a
𝑥1 − 𝑥2 − 1 ≤ 𝑀 1 − 𝑦1
sufficiently large parameter)
2𝑥1 − 𝑥2 − 4 ≤ 𝑀 1 − 𝑦2
𝑥1 − 2𝑥2 − 5 ≤ 𝑀 1 − 𝑦3
𝑦1 + 𝑦2 + 𝑦3 = 1
0 ≤ 𝑥1 , 𝑥2 ≤ 5, 𝑦1 , 𝑦2 , 𝑦3 ∈ 0,1
𝑦1 + 𝑦2 + 𝑦3 = 1
xz = 1) v [2x ,
-
x2[Y]v[x ,
-
2xz = 5)
0 =X /
X 25
M
reformulation
M
big positive 103
Big
=
number - M=
x, -
xz
-
1 = M(1 -
y)
nicx) = M(1 -
yi)
& 2x
X1
,
-
-
xc
2x
-
-
4 - M(1
5 = M(1
-
-
yz]
y3)
1
Zyi 7
y1 yz
>
+ + =
yz
= -
02XI
x(15 ; y: (0 1]
,
Convex buil
reformulation
Drivi Yi
/- y x*?
= X ,;
=5
0 0
= 82 = 0 x
x2-02
0x y1
>
Vi
need
-
0
3.
-
=
X
- -
-
I
= 0 0 = 0,
[5y /
0 = 021 = 5y /
35[-2 50 -
Jy 2523 5yzzo
se[
- -
.
0
32 = 1 =
Dy
=
y =
+ 1
yz
+
y
=
yz
it zweg 3e
=1 + V z + Dis
Xy ,
x2 =
02 + 022 + 523
Mixed-integer linear programming
min 𝑓 𝑥, 𝑦 = 0
s. t. ℎ 𝑥, 𝑦 = 0 • Only difference compared to LP: existence of binary variables
• Any integer variable can be replaced by binary variables
𝑔 𝑥, 𝑦 ≤ 0
𝑥 ∈ ℝ𝑛
𝑦 ∈ 0,1 𝑛
MILP example: technologies selection
DPPI | 31.11.2024 | 11
11
process yield
↓
YI
XI 1 (0 .
6) fixed cost
-
(80 ; 54 ; 27$/hr)
variable cost - (35 ; 30
; 25 $/ga)
B
A XL
667)
YII
B produce 10V9/n of Creative
11 (0 .
variables : X ,, Xc , Xz =
Vy/nog A
max
15kg/h of A
available
X3 Y111 35
0
min 2 x, 30 23 + 54 + 27
111(0 555) yz
+
+
xz +
-91 y
- -
x3
- -
=
.
-
Variable cost Fixed cost
3
Y1 Ya Y3 8 Xz] 15
2 X1 +
Availability
=
=
Xz +
& PP the
O & too
many if n
* 0 .
8 +
Xz
:
0 667
.
+
Xz
.
2 . 555 = 10 <
production of B
from yield of each process
O O 1
↓ relaxation X1 15 y 20
ria&
-
,
-
Ex =0 don't and
P 1 & o Y: 11 Y ;R Xy
-
15yz = 0 :
y ,
=o -X ,
=D
pay produce
1 O O
x can take Practional values
15 yz = 0
Xy
-
13 10
fix and solve the LP
1 O 1
↓ X Y Sit 20 ,
used - > pay penalty
suboptimal optinaetio
Y
O 11 infectible you can
produce
relaxed
↑
1 ↓
1 * don't happen
1 rMLPEMILP
Yoptimal
𝑐𝑜𝑠𝑡 = 𝑎 · 𝑦 + 𝑏 · 𝑥
I (0.8)
A 𝑎
II (0.667) B
𝑥
III (0.555)
𝑘𝑔
𝐸. 𝑔. , 𝑖𝑓 𝐼 𝑖𝑠 𝑠𝑒𝑙𝑒𝑐𝑡𝑒𝑑, 𝑖𝑡 𝑐𝑎𝑛 𝑐𝑜𝑛𝑠𝑢𝑚𝑒 𝑢𝑝 𝑡𝑜 15 𝑜𝑓 𝐴:
ℎ𝑟
𝑥1 ≤ 15
80y1+35x1+54y2+30x2+27y3+25x3 𝑎𝑛𝑑 𝑖𝑡𝑠 𝑐𝑜𝑠𝑡 𝑤𝑖𝑙𝑙 𝑏𝑒 𝑐ℎ𝑎𝑟𝑔𝑒𝑑 𝑖𝑛 𝑡ℎ𝑒 𝑂𝐹;
𝑜𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒, 𝑖𝑡𝑠 𝑖𝑛𝑝𝑢𝑡 𝑖𝑠 𝑓𝑖𝑥𝑒𝑑 𝑡𝑜 𝑧𝑒𝑟𝑜:
𝑥1 ≤ 0
𝑎𝑛𝑑 𝑛𝑜 𝑐𝑜𝑠𝑡 𝑤𝑖𝑙𝑙 𝑛𝑜𝑤 𝑏𝑒 𝑐ℎ𝑎𝑟𝑔𝑒𝑑 𝑖𝑛 𝑡ℎ𝑒 𝑂𝐹
DPPI | 31.11.2024 | 12
Solving MILPs: Exhaustive enumeration
DPPI | 31.11.2024 | 13
Solving MILPs: Rounding off to nearest integer
RMILP* ≤ MILP*
DPPI | 31.11.2024 | 14
Branch and bound: divide and conquer
Select one binary variable at a time, and
create two child ones, in each of
which some binary variables are
fixed to either zero or one, while the
pick up just
- -
1 variable and
others are simply relaxed (i.e., they
optimized can take any fractional value
- -
DPPI | 31.11.2024 | 15
Branch and bound
DPPI | 31.11.2024 | 16
Branch and bound
DPPI | 31.11.2024 | 17
Branch and bound
Lower and upper bounds are updated at
each iteration. The upper bound
corresponds to the best feasible
solution found so far. The lower
bound corresponds to the best
relaxation among the active nodes.
An active node is discarded when its
T
relaxed value is worse than the
current best feasible solution (upper
bound).
o o
DPPI | 31.11.2024 | 18
Branch and bound
The algorithm stops when the lower and
upper bounds are sufficiently close
to each other. The optimal solution
is then the best feasible point found
so far (current upper bound).
DPPI | 31.11.2024 | 19
Branch and bound
DPPI | 31.11.2024 | 20
Branch and bound
• Avoids exhaustive enumeration of all 0-1 combinations and still finds the global optimum
• Partitions the original MILP into a sequence of LP sub-problems
• Generates bounds using relaxations to eliminate combinations
• Updates bounds until the optimality gap is closed within a tolerance
DPPI | 31.11.2024 | 21
Recap
• Fundamentals of MILP.
• Modelling with binary variables.
• Relaxations and branch and bound method.
DPPI | 31.11.2024 | 22
Lecture
Process Optimization: MILP
Xz =
?
X3 X5
B
D Process 11
X7
Purchasea P
Demand
of < is 10
tos/h
selling price :
18004/ton
Xi
C Price : A :
500$/tor
9505/to
-48 xy
Process B :
*
B
D
Process(II
Profit =
Selling) -
Cost (Fixed +
variable)
proces
X6 Xg
the
process
of
costofa
cost material
a
rou
↓ consume
↓ ↓
B
P 1300 2000 1230 500 x 950x3
1800-1900y 400x5
+
y, Ye
-
- + -
= ,
-
-
selling C
penaltys -
BdM
variable cost
Convertions
constriction on the
production
Xi 30
I not have a reverse
flow