In 1
In 1
Midterm Examination
Date: 04/04/2022; Duration: 120 minutes
Open book/ Offline/ Laptops are NOT allowed
Full name:
Full name:
Proctor 1 Proctor 2
Signature Signature
STUDENT INFO
Student name:
Student ID:
INSTRUCTIONS: the total of point is 100 (equivalent to 25% of the
course)
1. Purpose:
● Test your knowledge in1,2 (CLOi)
Find the earliest starting time, latest starting time, earliest completion time, latest completion time, and
critical path of the following given network
Node 1 2 3 4 5 6 7 8 9 10
P 2 3 4 4 5 4 5 5 3 5
Answer
Node 1 2 3 4 5 6 7 8 9 10
P 2 3 4 4 5 4 5 5 3 5
ES 0 2 2 6 6 10 10 14 15 19
EC 2 5 6 10 11 14 15 19 18 24
LS 0 6 2 6 9 10 11 14 16 19
LC 2 9 6 10 14 14 16 19 19 24
Slack 0 4 0 0 3 0 1 0 1 0
The critical path is : 1-3-4-6-8-10
Q2. (30pts)
Write down the 1st and 2nd iterations of the following Time/Cost Trade-Off Problem
The parameters of each job are given as follows. It is known that c 0=5 .
Node 1 2 3 4 5 6 7 8 9 10
Pmax 3 4 4 4 5 4 5 5 5 5
Pmin 2 2 2 2 2 2 4 4 3 2
αj 4 3 4 5 4 2 4 3 2 3
Answer
The 1st iteration
Node 1 2 3 4 5 6 7 8 9 10
Pmax 3 4 4 4 5 4 5 5 5 5
ES 0 3 3 7 7 7 11 12 16 21
EC 3 7 7 11 12 11 16 17 21 26
LS 0 3 3 7 11 7 11 16 16 21
LC 3 7 7 11 16 11 16 21 21 26
Slack 0 0 0 0 4 0 0 4 0 0
2/6
HCMC National University St udent Na me :………...……………………….
International University Student ID:…………………………….
------------
● If they decide to manufacture type B, they have to buy at least n2 type 2 production lines
● If they decide to manufacture both A and B, then they also have to open the distribution center D
● If either A or B is manufactured, then they have to hire a 3rd party G for the logistic service
Parameters
c 1: cost for buy one type 1 production line
c 2: cost for buy one type 2 production line
n1: minimum number of type 1 production line for manufacturing type A
n2: minimum number of type 2 production line for manufacturing type B
c D: cost for open and operation of distribution center D during the planning horizon
c G : cost for hire the logistic service G during the planning horizon
b A: benefit if item A is produced during the planning horizon
b B: benefit if item B is produced during the planning horizon
Decision variables
X A : binary variable, X A =1 if type A is manufactured; otherwise X A =0
X B: binary variable, X B=1 if type B is manufactured; otherwise X B=0
X D: binary variable, X D =1 if distribution center D is open; otherwise X D =0
X G : binary variable, X G =1 if the logistic service G is hired; otherwise X G =0
Y 1: number of production line type 1
Y 2: number of production line type 2
3/6
HCMC National University St udent Na me :………...……………………….
International University Student ID:…………………………….
------------
Answer
Objective function :
b A X A +b B X B−c D X D−cG X G−c 1 Y 1−c 2 Y 2
Subject to
BigM ( 1−X A ) +Y 1 ≥ n1 OR Y 1 ≥n 1 X A
BigM ( 1−X B ) +Y 2 ≥n 2 OR Y 2 ≥n 2 X B
−BigM × X A + Y 1 ≤ 0
−BigM × X B+ Y 2 ≤ 0
XD≤ XA
X D ≤ XB
X D ≥ X A + X B −1
XG ≥ X A
XG ≥ X B
XG ≤ X A+ XB
Q4. (25pts): Write down the CPLEX code for the following problem
The following problem is tried to describe the Production Planning Model for the assignment of
Fermentation Tanks at Wineries The problem faced by the winemaker before and during the harvest
season, is the assignment problem of the harvesting lots to the fermentation vats, to keep the iniquity of the
lots and at the same time have an efficient usage of the tanks.
At the time of planning, the winemaker has a limited number of fermentation tanks, which do not
necessarily have the same capacity, but they can be used more than once during the harvest. Depending on
the grape lot’s volume, it may be necessary to divide this lot and assign it to more than one fermentation
tank. In addition, different types of grapes (varietal) cannot be processed in the same fermentation tank,
and have different characteristics such as fermentation time or tank’s filling space.
Index
t=1. .T : index of tanks
l=1. . L: index of lots of harvested grapes
Parameters
C t Capacity(tons) of tank t
Pt =1if tank t is proscribed from use in certain fermentations, 0 otherwise;
St : Setup cost incurred each time tank t is used;
Al : expected amount(tons) of lot l;
H l :expected harvest date, measured in days from the start of the season of lot l;
F l: expected fermentation length (days) of lot l;
Rl =1 if lot l is intended to become a red wine, 0 otherwise;
W : user-specified objective weight, where 0 ≤ W ≤1.
M l ,l : conflict matrix M l ,l =1 if ( H l + Fl ≥ H l ∨H l ≤ H l and l ! ≠l 2 , 0 otherwise. In short, it is given and is
1 2 1 2 1 1 2 1 2
4/6
HCMC National University St udent Na me :………...……………………….
International University Student ID:…………………………….
------------
Variables
v l. t : Volume of lot l assigned to tank t;
w l .t : Wasted space in tank t leftover from being used for lot l;
ml ,t =1 if Lot l is matched to tank t, 0 otherwise;
Answer
int numT = ...;
int numL = ...;
// Parameters
float C[rangeT] = ...; // Công suất của thiết bị T
int P[rangeT] = ...; // Kiểm tra điều kiện loại thiết bị
float S[rangeT] = ...; // Hệ số chi phí đầu tiên
float A[rangeT] = ...; // Yêu cầu công suất cần thiết
float H[rangeL] = ...; // Trọng số ưu tiên 1 (nếu có)
float F[rangeL] = ...; // Trọng số ưu tiên 2 (nếu có)
float R[rangeL] = ...; // Hệ số hạn chế (cho điều kiện đặc biệt)
float W = ...; // Trọng số mục tiêu hài hòa
float M[rangeL][rangeL] = ...; // Ma trận xung đột (1 nếu không thể cùng
lúc)
// Decision variables
dvar float+ v[rangeL][rangeT]; // Giá trị công suất chính
dvar float+ w[rangeL][rangeT]; // Giá trị công suất phụ
dvar boolean m[rangeL][rangeT]; // Biến nhị phân xác định chọn thiết bị
// Objective function
5/6
HCMC National University St udent Na me :………...……………………….
International University Student ID:…………………………….
------------
minimize
W * sum(t in rangeT, l in rangeL) S[t] * m[l][t]
+ (1 - W) * sum(t in rangeT, l in rangeL) w[l][t];
// Constraints
subject to {
// Đảm bảo tổng công suất chọn đủ yêu cầu
forall(l in rangeL) {
sum(t in rangeT) C[t] * m[l][t] >= A[l];
sum(t in rangeT) v[l][t] == A[l];
}
// Nếu P[t] == 1 thì không được chọn các thiết bị có R[l] > 0
forall(t in rangeT : P[t] == 1) {
sum(l in rangeL) R[l] * m[l][t] == 0;
}
}
- END –
6/6