Professional Documents
Culture Documents
April 1, 2020
Contents
2 Max Constraint 2
3 Min Constraint 3
4 And Condition 4
5 Or Condition 4
6 Z=X × Y Constraint 5
7 Conflicted Condition 5
1
Ho Chi Minh City International University Deterministic Models in Operation Research
Industrial Systems Engineering Department Lecturer: Phan Nguyen Ky Phuc
Let:
Cj : be the capacity regarding to facility j
BigM : be the very large number
Oj : be the binary decision variable, Oj = 1 if the facility j is opened; otherwise Oj = 0
It is often that, there are at least one of 2 following constraints
X
() ≤ Cj × Oj
i
X
() ≤ BigM × Oj
i
2 Max Constraint
X = max(A, 0)
X = max(A, B)
where X, A, B are variables. This constraint can be transformed to linear form as follow:
Let Y be the index variable:
1 , if (A − B) ≥ 0
Y =
0 , if (A − B) ≤ 0
Given a threshold R for a resource , if the usage of this resource is higher than R it will incur an extra cost
for each extra usage resource.
In short the following constraints need to be transform into linear constraint:
!
X
X = max Ci Yi − R, 0
i
P
Now the constraints X = max ( i Ci Yi − R, 0) can be transformed to linear form as :
0 ≤ X ≤ 0 + BigM × Z
(P C Y − R) ≤ X ≤ (P C Y − R) + BigM × (1 − Z)
i i i i i i
3 Min Constraint
X = min(A, 0)
X = min(A, B)
where X, A, B are variables. This constraint can be transformed to linear form as follow:
Let Y be the binary variable:
1 , if A − B ≥ 0
Y =
0 , if A − B ≤ 0
4 And Condition
Y = X1 ∩ X2 ∩ X3 ... ∩ Xn
5 Or Condition
Y = X1 ∪ X2 ∪ X3 ... ∪ Xn
6 Z=X × Y Constraint
7 Conflicted Condition
Example
Assume that there are 2 jobs i and j. These jobs must be finished in their time window [si ; ei ] and [sj ; ej ].
If their time windows are overlapped, so these jobs cannot be assigned to the same worker. These jobs are
called conflicted jobs. If [si ; ei ] and [sj ; ej ] are not decision variables so their conflict due to overlap can be
express through a parameters Cij .
Parameters
Eim be the enable matrix Eim = 1 if job i is possible to be assigned to worker m; otherwise Eim = 0
Cij be the conflict matrix Cij = 1 if job i and job j cannot be assigned to the same worker m due to overlap
constraint; otherwise Cij = 0
Decision variables
Xim be the binary variable; Xim = 1 if job i is assigned to worker m; otherwise Xim = 0
Basic constraints
Index
i: index of job
j: index of job
w: index of worker
Parameters
BigM : Very large number
Sijm :setup time for job j on machine mif job i is immediate precedence job of job j on machine m Eniw : be
the enable matrix Eniw = 1 if job i is able to be assigned to worker w;otherwise Enij = 0
Bw and Fw are two values identify the time window of worker w
Decision Variables
Xiw be the binary variable, Xiw = 1 if job i is assigned to worker w; otherwise Xiw = 0
si starting time of job i
ei finishing time of job i
Basically there are two cases when 2 jobs are overlapped:
• The first is the starting time of job i, si in the range of job j, [sj , ej ]
• The second is the ending time of job i, ei in the range of job j, [sj , ej ]
ei ≤ sj , ∀P reij = 1
For each uij , vij , pij , qij pair of constrains are used
Elimination condition
1 1
If uij = 1 and vij = 1, then rij = 1 otherwise rij =0
1
rij ≤ uij , ∀i, j
1
rij ≤ vij , ∀i, j
1
rij ≥ uij + vij − 1, ∀i, j
2 2
If pij = 1 and qij = 1, then rij = 1 otherwise rij =0
2
rij ≤ pij , ∀i, j
2
rij ≤ qij , ∀i, j
2
rij ≥ pij + qij − 1, ∀i, j
1 2
The values of rij and rij will create following constraints
Furthermore if Xiw = 1 then si and ei must be in the range [Bw ; Fw ], this will create the following constraints
s1 e1
s2 e2
s1 e1
s2 e2
Index
i: index of job
j: index of job
m: index of machine
Parameters
BigM : Very large number
P roim : be the processing time if job i on machine m
Setijm : be the setup time of job j on on machine m if job i is an immediate precedence job of job j on
machine m
Enim : be the enable matrix Enim = 1 if job i is able to be assigned to worker w;otherwise Enij = 0
Bm and Fm are two values identify the time window of machine m
Decision Variables
Xim be the binary variable, Xim = 1 if job i is assigned to machine m; otherwise Xim = 0
Yij be the binary variable, Yij = 1 if job j is the immediate successor job of job i on the same machine,
otherwise Yij = 0
si starting time of job i
ei finishing time of job i
X ≥A−B
X ≥B−A
X ≤A+B
X ≤2−A−B
Given several ranges [ai ; bi ] , i = 1...n and decision variable X, Y . If ai ≤ X ≤ bi then Y = fi (X)
Let ri be the index variable if X ∈ [ai ; bi ] then ri = 1 otherwise ri = 0.
ai ≤ Xi + BigM × (1 − ri )
Xi ≤ bi + BigM × (1 − ri ) ∀i = 1...I
Xi ≤ BigM × ri ∀i = 1...I
I
X
ri = 1, ∀i = 1...I
i=1
X
Y = ri × fi (Xi ) ∀i = 1...I
i
Zi ≤ BigM × ri ∀i = 1...I
Zi ≤ F (Xi ) + BigM × (1 − ri ) ∀i = 1...I
Zi ≥ F (Xi ) − BigM × (1 − ri ) ∀i = 1...I
ai ≤ Xi + BigM × (1 − ri )
Xi ≤ bi + BigM × (1 − ri )
Xi ≤ BigM × ri
Job 1 2 3 4 5
wi 1 1 2 3 3
si 0 4 3 7 6
ei 5 6 8 12 10
Resources {1,3} {2,3} {2,3} {1} {3}
Parameters
• wi weight of job i
• Oijt matrix, if job i and job j are overlap at time t then Oijt = 1 otherwise Oijt = 0
• Rjs resource matrix, if job j requires resource s then Rjs = 1 otherwise Rjs = 0
Decision variable
• Xj if job j is selected
Mathematical model
J
X
max wj Xj
j=1
Constraints:
J
X
Ris Xi + Oijt Rjs Xj ≤ Ns , ∀i, t, s
j=1,j6=I
Problem description
• Decision variable includes the purchase quantity, number of production lines and savage actions. They
are divided into 2 stages:
– In the first stage, decision variables are made without information about the demands, i.e, only
their distributions are known.
– In the second stage decision variables are made when the demands are known, i.e. , the correct
activities are made.
• Total cost includes cost of 1st stage and expected cost of 2nd stage.
Annotations
m: index of materials m = 1...M
p: index of products p = 1...P
s: index of suppliers s = 1...S
r: index of price ranges r = 1...R
l: index of production lines l = 1...L
e: index of scenarios e = 1...E
Parameters
Dpe : demand of product p under scenario e
BigM : very large number
αmp : number of material m for one product p
M
βm : savage price of one unit of material m
βpP : savage price of one unit of product p
γp : selling price of one unit of product p
1
θmsr : the offer price of material m from supplier s at price ranger at stage 1
2
θmsr : the offer price of material m from supplier s at price ranger at stage 2
1
LBmsr : the lower bound for purchasing the material m from supplier s at price range r in stage 1
2
LBmsr : the lower bound for purchasing the material m from supplier s at price range r in stage 2
1
U Bmsr : the upper bound for purchasing the material m from supplier s at price range r in stage 1
2
U Bmsr : the upper bound for purchasing the material m from supplier s at price range r in stage 2
πe : the probability associating to scenario e
Φ1s : fixed cost for ordering from supplier s at stage 1
Φ2s : fixed cost for ordering from supplier s at stage 2
ωl1 fixed cost for using line l at stage 1
ωl2 fixed cost for using line l at stage 2
Decision Variables
1
Xmsr :number of material m purchased from supplier s at price range r in stage 1
2
Xmsre :number of material m purchased from supplier s at price range r under scenario e in stage 2
Ypl1 :number of product p manufactured in line l in stage 1
2
Yple :number of product p manufactured in line l under scenario e in stage 2
Zl1 : binary , Zl1 = 1 if line l is used in stage 1, otherwise Zl1 = 0
2 2 2
Zle : binary, Zle = 1 if line l is used in stage 2 under scenario e, otherwise Zle =0
Auxiliary Variables
1 1
Vmsr :binary, Vmsp = 1 if material m is purchased from supplier s at price range r in stage 1, otherwise
1
Vmsr = 0;
2 2
Vmsre :binary, Vmspe = 1 if material m is purchased from supplier s at price range r under scenario e in stage
2
2, otherwise Vmsre = 0;
Fpe : binary Fpe = 1 if at the end of stage 2 under scenario e there is no redundant product p, otherwise
Fpe = 0
Gme : binary Gme = 1 if at the end of stage 2 under scenario e there is no redundant material m, otherwise
Gme = 0
Ipe : be the income we obtain the from selling product p under scenario e when the demand smaller than the
total manufacturing quantities
Ope : be the money we obtain from selling the unsold products p at savage price under scenario e
Nme : be the money we obtain from selling the unsold materials m at savage price under scenario e
Mathematical Model
The objective function
The objective function is to maximize the expected profit, includes:
At stage 1
• Purchasing cost
• Manufacturing cost
At stage 2
• Purchasing cost
• Manufacturing cost
M X R
S X S R
M X
! L
X X X X
1 1
θmsr Xmsr + Φ1s 1
Vmsr + ωl1 Zl1
m=1 s=1 r=1 s=1 m=1 r=1 l=1
Constraints The materials purchased from each supplier is either zero or belong to only one price range
R
X
1
Vmsr ≤ 1, ∀m = 1...m, s = 1...S
r=1
R
X
2
Vmsre ≤ 1, ∀m = 1...m, s = 1...S, e = 1...E
r=1
1 1
If Vmsr = 1 then the purchasing quantity from supplier s, Xmsr must belong to the the range of price r at
1 1 1 1
stage 1, i.e., [LBmsr ≤ Xmsr ≤ U Bmsr ], otherwise; Xmsr =0
2 2
If Vmsre = 1 then the purchasing quantity from supplier s, Xmsre must belong to the the range of price r at
2 2 2 2
stage 2, i.e., [LBmsr ≤ Xmsre ≤ U Bmsr ], otherwise; Xmsre =0
1 1 1
LBmsr ≤ Xmsr + BigM (1 − Vmsr ), ∀m = 1..M, s = 1...S, r = 1...R
1 1 1
Xmsr ≤ U Bmsr + BigM (1 − Vmsr ), ∀m = 1..M, s = 1...S, r = 1...R
1 1 1
Xmsr ≤ U Bmsr Vmsr , ∀m = 1..M, s = 1...S, r = 1...R
2 2 2
LBmsr ≤ Xmsre + BigM (1 − Vmsre ), ∀m = 1..M, s = 1...S, r = 1...R, e = 1...E
2 2 2
Xmsre ≤ U Bmsr + BigM (1 − Vmsre ), ∀m = 1..M, s = 1...S, r = 1...R, e = 1...E
2 2 2
Xmsre ≤ U Bmsr Vmsr , ∀m = 1..M, s = 1...S, r = 1...R, e = 1...E
The total purchasing materials in both 2 stages must be smaller than the maximize usage of them in all
scenarios
S X
X R S X
X R P
X
1 2
Xmsr + Xmsre ≤ Dpmax αmp , ∀m = 1...M, e = 1...E
s=1 r=1 s=1 r=1 p=1
The quantity of purchasing material m from the supplier s must be smaller than the supplier capacity in
each stage
R
X
1 1
Xmsr ≤ Cms , ∀m = 1...M, s = 1...S
r=1
R
X
2 2
Xmsre ≤ Cms , ∀m = 1...M, s = 1...S
r=1
The number of product p produce on each stage must be smaller than the total available of material m on
this stage
X L
P X S X
X R
αmp Ypl1 ≤ 1
Xmsr , ∀m = 1...M
p=1 l=1 s=1 r=1
P X
X L P X
X L X R
S X
αmp Ypl1 + 2 1 2
αmp Yple ≤ Xmsr + Xmsre , ∀m = 1...M, e = 1...E
p=1 l=1 p=1 l=1 s=1 r=1
The total quantities of all products p manufacturing on each line l in each stage must be smaller than the
number of available hours on this line
P
X
tpl Ypl1 ≤ Hl1 Zl1 , ∀l = 1...L;
p=1
P
X
2
tpl Yple ≤ Hl2 Zle
2
, ∀l = 1...L, e = 1...E;
p=1
If we manufacture or purchase more than demand in each scenario, it will incur a savage benefit
L L
!
X X
Ope = βpP max Ypl1 + 2
Yple − Dpe , 0 ∀p = 1...P ; e = 1...E
l=1 l=1
S S L X
P L X
P
!
X X X X
M 1 2
Nme = βm max Xms + Xmse − αmp Ypl1 − 2
αmp Yple ,0
s=1 s=1 l=1 p=1 l=1 p=1
∀m = 1...M ; e = 1...E
P
S PR 1
PS PR 2
PP PL 1
PP PL 2
Gme = 1 if s=1 r=1 Xmsr + s=1 r=1 Xmsre − p=1 l=1 αmp Ypl − p=1 l=1 α mp Yple , 0 ≥ 0;
otherwise, Gme = 0
P
L PL
The constraints between l=1 Ypl1 + l=1
2
Yple − Dpe and Fpe can be expressed as:
P
L 1
PL 2
l=1 Ypl + l=1 Yple − Dpe ≥ BigM × (Fpe − 1)
PL Y 1 + PL Y 2 − D ≤ BigM × Fpe
l=1 pl l=1 ple pe
L L
!
X X
Ope = βpP × max Ypl1 + 2
Yple − Dpe , 0 ∀p = 1...P ; e = 1...E
l=1 l=1
P
L 1
PL 2
Y
l=1 pl + Y
l=1 ple − D pe ≥ BigM (Fpe − 1)
P
L 1
P L 2
l=1 Ypl + l=1 Yple − Dpe ≤ BigM × Fpe
P
M S 1
PS 2
PP PL 1
PP PL 2
s=1 Xmse − l=1 αmp Ypl − ≥ BigM (Gme − 1)
βm
s=1 Xms + p=1 p=1 l=1 αmp Yple
P
β M S 1
P S 2
PP PL 1
P P PL 2
m s=1 Xms + s=1 Xmse − p=1 l=1 αmp Ypl − p=1 l=1 αmp Yple ≤ BigM × Gme
0 ≤ Nme ≤ 0 + BigM × Gme
P
M S 1
PS 2
PP PL 1
PP PL 2
βm s=1 Xms + s=1 Xmse − p=1 l=1 αmp Ypl − p=1 l=1 αmp Yple ≤ Nme
N ≤ β M PS X 1 + PS X 2 − PP PL α Y 1 − PP PL α Y 2 + BigM (1 − G )
me m s=1 ms s=1 mse p=1 l=1 mp pl p=1 l=1 mp ple me
If we manufacture or purchase less than demand in each scenario, we can sold all the product with the price
γp
L L
!
X X
Ipe = γp min Ypl1 + 2
Yple , Dpe ∀p = 1...P ; e = 1...E
l=1 l=1
γp Dpe ≥ Ipe ≥ γp Dpe − BigM (1 − Fpe )
γp PL Y 1 + PL Y 2 ≥ Ipe ≥ γp PL Y 1 + PL Y 2 − BigM × Fpe
l=1 pl l=1 ple l=1 pl l=1 ple