Professional Documents
Culture Documents
-----🙞🙜🕮🙞🙜-----
HOMEWORK 3
SUBJECT
NAME MSSV
Phùng Gia Bảo 2153213
SOLUTION
Solution:
a) Decision Variables:
Objective Function:
Maximize Z = 8 x 1+ 5 x 2 +7 x 3+ 6 y 1+ 4 y 2 +5 y 3
Constraints:
6 x 1+ 3 x 2 + 4 x 3+5 y 1 +2 y 2+ 3 y 3 ≤ 10
y1 + y2 + y3 ≤ 1
y 1−x 1 ≤ 0
y 2−x 2 ≤0
y 3−x 3 ≤ 0
PROBLEM 12.1-2
SOLUTION
a) Mj = 1 if j does marketing,
0 if j does not do marketing
Cj = 1 if j does cooking,
Dj = 1 if j does dishwashing,
Lj = 1 if j does laundry,
ME + CE + DE + LE = 2
MS + CS + DS + LS = 2
ME + MS = 1; CE + CS = 1
DE + DS = 1; LE + LS = 1
b - c)
Result:
Therefore, the optimal solution is:
SOLUTION
Subject to
b & c)
Call “solver” to solve the problem:
Result:
PROBLEM 12.1-4.
SOLUTION
S.t:
b) Solution by POM-QM
SOLUTION
a) Formulate an IP model
SOLUTION
b) Solution by Lingo
The Maximun Profit will be 80000 with the 2000 Product 2 are produced.
PROBLEM 12.3-2.
SOLUTION
|x 1−x 2|=0 → x 1−x 2=0 ;
PROBLEM 12.3-3.
SOLUTION
1) 3 x 1−x 2−x 3+ x 4 ≤ 12+ y 1 M
x 1+ x 2+ x 3+ x 4 ≤ 15+ M ( y 1−1)
Y1 is a binary number
2) 2 x 1+5 x 2−x 3+ x 4 ≤ 30+ My 2
−x 1+3 x 2+5 x 3+ x 4 ≤ 40+ My 3
3 x 1−x 2+3 x 3−x 4 ≤ 60+ My 4
2 ≤ y 2+ y 3+ y 4
Y1,y2,y3,y4 is binary
PROBLEM 12.3-4.
a) Let and be binary variables that y1 & y2 indicate whether or not toys 1 and 2 are
produced. Let and be the number of toys x1 and x2 that are produced. Also, let be z
0 if factory 1 is used and 1 if factory 2 is used.
Maximize: 10x1 + 15x2 – 50000y1 – 80000y2
Subject to:
X1 ≤ My1
X2 ≤ My2
1 1
x 1+ x 2 ≤ 500+ Mz
50 40
1 1
x 1+ x 2 ≤ 700+ M (z−1)
40 25
X1, x2 ≥ 0
Y1, y2, z is binary
c) Coding and result:
MAX = 10*X1 + 15*X2 - 50000*Y1 - 80000*Y2 ;
X1 <= 100000*Y1;
X2 <= 100000*Y2;
1/50 * X1 + 1/40* X2 <= 500 + 100000*Z;
1/40*X1 + 1/25*X2 <= 700 + 100000*(1-Z);
@GIN(X1);
@GIN(X2);
@BIN(Y1);
@BIN(Y2);
@BIN(Z);
Objective value: 230000.0
Variable Value
X1 28000.00
X2 0.000000
Y1 1.000000
Y2 0.000000
Z = 1.000000
PROBLEM 12.3-6.
SOLUTION
a) Let: X1 = Y11 + 2Y12
X2 = Y21 + 2Y22
Max: Z = X1 + 5X2 = Y11 + 2Y12 + 5Y21 + 10Y22
Subject to Y11 + 2Y12 + 10Y21 + 20Y22 <= 20
Y11 + 2Y12 <= 2
Yij binary, for I, I = 1, 2
b)
When input to POM, symbolize X1=Y11, X2=Y12, X3=Y21, X4=Y22, X5=X1,
X6=X2
Max: X1 + 2X2 + 5X3 + 10X4
X1 + 2X2 + 10X3 + 20X4 <= 20
X1 + 2X2 <= 2
- X1 - 2X2 + X5 = 0
- X3 - 2X4 + X6 = 0
Solution:
PROBLEM 12.4-1.
For i = 1, 2, 3 and j = 1, 2, 3, 4, 5.
Max: Z = –Y11 + 3Y12 + 2Y13 + Y21 + 4Y22 + Y31 + 2Y32 + 2Y33 + Y34
+ Y35
Subject to:
Y13 <= Y12 <= Y11
Y22 <= Y21
Y35 <= Y34 <= Y33 <= Y32 <= Y31
Y11 + Y12 + Y13 + 2Y21 + 2Y22 + Y31 + Y32 + Y33 + Y34 + Y35 <= 5
With Yij binary
d) When input data to POM, symbolize X1 = Y11, X2 = Y12, X3 = Y13, X4 =
Y21, X5 = Y22, X6 = Y31, X7 = Y32, X8 = Y33, X9 = Y34, X10 = Y35.
Max: - X1 + 3X2 + 2X3 + X4 + 4X5 + X6 + 2X7 + 2X8 + X9 + X10
- X1 + X2 <= 0
- X2 + X3 <= 0
- X4 + X5 <= 0
- X6 + X7 <= 0
- X7 + X8 <= 0
- X8 + X9 <= 0
- X9 + X10 <= 0
X1 + X2 + X3 + 2X4 + 2X5 + X6 + X7 + X8 + X9 + X10 <= 5
Solution:
PROBLEM 12.4-3.
SOLUTION
a) Introduce the auxiliary binary variables Y1, Y2 and Y3 to represent positive
production levels
Max Z = 50X1 + 20X2 + 25X3
Subject to:
9X1 + 3X2 + 5X3 <= 500
5X1 + 4X2 <= 350
3X1 + 2X3 <= 150
X3 <= 20
X1 <= MY1, X2 <= MY2, X3 <= MY3
Y1 + Y2 + Y3 <= 2
X1, X2, X3 >= 0
Y1, Y2, Y3 binary
b) When input data in POM, symbolize X1 = X1, X2 = X2, X3 = X3, X4 = Y1, X5 =
Y2, X6 = Y3, M = 999
Max 50X1 + 20X2 + 25X3
9X1 + 3X2 + 5X3 <= 500
5X1 + 4X2 <= 350
3X1 + 2X3 <= 150
X3 <= 20
X4 + X5 + X6 <= 2
X1 - 999X4 <= 0
X2 - 999X5 <= 0
X3 - 999X6 <= 0
Solution:
PROBLEM 12.4-4.
SOLUTION
a) When x1 + x2 <= 3 => x1, x2 = 0;1;2;3.
b) The solution:
y 23 ≤ y 22 ≤ y 21
y 11 + y 23 ≤1
y 12+ y 22 ≤ 1
y 13 + y 21 ≤ 1
d)
SOLUTION
a)
Min = 3 x 12+6 x 13+ 6 x 24+5 x 25 +4 x 34 +3 x 35+3 x 46 +2 x56
x 12+ x 13=1
x 25+ x 24 + x 35 + x34 =1
x 46 + x 56=1
x 24 + x 25−x12=0
x 34 + x 35− x13=0
−x 24−x 34 + x 46=0
x IJ is binary
b) Coding:
RESULT
x 12=x 25=x56=1 => Z = 10.
Path: 1 -> 2 -> 5 -> 6.
PROBLEM 12.4-6.
SOLUTION
+ Cost: cj = [6 4 7 5 4 6 5 3 7 6];
[ ]
1 0 0 0 1 0 0 0 1 0
0 2 0 1 0 2 0 0 2 2
0 0 3 3 0 0 3 0 3 0
2 0 0 0 0 1 0 1 0 0
+ xij = 0 0 2 2 0 3 0 0 0 0 ; yj = 0 or 1.
0 1 0 0 2 0 0 0 0 0
3 0 0 0 0 0 1 2 0 3
0 0 1 0 3 0 0 0 0 1
0 3 0 4 0 0 2 0 0 0
10
Minimize: Z = ∑ c J y J ;
J =1
10
10
∑ y J =3.
5=1
Yij = 0 or 1.
b)Coding:
Solution:
Y4 = Y5 = Y8 = 1 -> Assign sequence 4, 5, 8 to a crew.