Siamak Naderi
Optimisation Models
Concrete vs Abstract model
Concrete model
Objective function:
minimize z = TLAX + 5*TLAY+ TLAZ + 2*TLBX +
7*TLBY + TLBZ + 5*TLCX + 8*TLCY + 2*TLCZ
Subject to :
TLAX + TLAY+ TLAZ <= 2 Supply
TLBX + TLBY+ TLBZ <= 4 constraints
TLCX + TLCY+ TLCZ <= 4
TLAX + TLBX+ TLCX >= 3
Demand
TLAY + TLBY+ TLCY >= 4
constraints
TLAZ + TLBZ+ TLCZ >= 3
TLAX, TLAY, TLAZ, TLBX, TLBY, Non-negativity
TLBZ, TLCX, TLCY, TLCZ>= 0 constraints
2
Concrete vs Abstract model
Concrete model
Objective function: Objective function:
3
Concrete vs Abstract model
Concrete model
Objective function: Objective function:
minimize z = TLAX + 5*TLAY+ TLAZ + 2*TLBX +
7*TLBY + TLBZ + 5*TLCX + 8*TLCY + 2*TLCZ
4
Concrete vs Abstract model
Concrete model
Objective function: Objective function:
minimize z = TLAX + 5*TLAY+ TLAZ + 2*TLBX + minimize z = σ𝑛𝑖=1 σ𝑚
𝑗=1 𝑐𝑖𝑗 𝑇𝐿𝑖𝑗
7*TLBY + TLBZ + 5*TLCX + 8*TLCY + 2*TLCZ
5
Concrete vs Abstract model
Concrete model
Objective function: Objective function:
minimize z = TLAX + 5*TLAY+ TLAZ + 2*TLBX + minimize z = σ𝑛𝑖=1 σ𝑚
𝑗=1 𝑐𝑖𝑗 𝑇𝐿𝑖𝑗
7*TLBY + TLBZ + 5*TLCX + 8*TLCY + 2*TLCZ
Subject to : Subject to :
6
Concrete vs Abstract model
Concrete model
Objective function: Objective function:
minimize z = TLAX + 5*TLAY+ TLAZ + 2*TLBX + minimize z = σ𝑛𝑖=1 σ𝑚
𝑗=1 𝑐𝑖𝑗 𝑇𝐿𝑖𝑗
7*TLBY + TLBZ + 5*TLCX + 8*TLCY + 2*TLCZ
Subject to : Subject to :
TLAX + TLAY+ TLAZ <= 2 Supply
TLBX + TLBY+ TLBZ <= 4 constraints
TLCX + TLCY+ TLCZ <= 4
7
Concrete vs Abstract model
Concrete model
Objective function: Objective function:
minimize z = TLAX + 5*TLAY+ TLAZ + 2*TLBX + minimize z = σ𝑛𝑖=1 σ𝑚
𝑗=1 𝑐𝑖𝑗 𝑇𝐿𝑖𝑗
7*TLBY + TLBZ + 5*TLCX + 8*TLCY + 2*TLCZ
Subject to : Subject to :
TLAX + TLAY+ TLAZ <= 2
TLBX + TLBY+ TLBZ <= 4
Supply σ𝑚
𝑗=1 𝑇𝐿𝑖𝑗 <=𝑠𝑖
constraints
TLCX + TLCY+ TLCZ <= 4
8
Concrete vs Abstract model
Concrete model
Objective function: Objective function:
minimize z = TLAX + 5*TLAY+ TLAZ + 2*TLBX + minimize z = σ𝑛𝑖=1 σ𝑚
𝑗=1 𝑐𝑖𝑗 𝑇𝐿𝑖𝑗
7*TLBY + TLBZ + 5*TLCX + 8*TLCY + 2*TLCZ
Subject to : Subject to :
TLAX + TLAY+ TLAZ <= 2
TLBX + TLBY+ TLBZ <= 4
Supply σ𝑚
𝑗=1 𝑇𝐿𝑖𝑗 <=𝑠𝑖 i=1,…,n
constraints
TLCX + TLCY+ TLCZ <= 4
9
Concrete vs Abstract model
Concrete model
Objective function: Objective function:
minimize z = TLAX + 5*TLAY+ TLAZ + 2*TLBX + minimize z = σ𝑛𝑖=1 σ𝑚
𝑗=1 𝑐𝑖𝑗 𝑇𝐿𝑖𝑗
7*TLBY + TLBZ + 5*TLCX + 8*TLCY + 2*TLCZ
Subject to : Subject to :
TLAX + TLAY+ TLAZ <= 2
TLBX + TLBY+ TLBZ <= 4
Supply σ𝑚
𝑗=1 𝑇𝐿𝑖𝑗 <=𝑠𝑖 i=1,…,n
constraints
TLCX + TLCY+ TLCZ <= 4
TLAX + TLBX+ TLCX >= 3
Demand
TLAY + TLBY+ TLCY >= 4
constraints
TLAZ + TLBZ+ TLCZ >= 3
10
Concrete vs Abstract model
Concrete model
Objective function: Objective function:
minimize z = TLAX + 5*TLAY+ TLAZ + 2*TLBX + minimize z = σ𝑛𝑖=1 σ𝑚
𝑗=1 𝑐𝑖𝑗 𝑇𝐿𝑖𝑗
7*TLBY + TLBZ + 5*TLCX + 8*TLCY + 2*TLCZ
Subject to : Subject to :
TLAX + TLAY+ TLAZ <= 2
TLBX + TLBY+ TLBZ <= 4
Supply σ𝑚
𝑗=1 𝑇𝐿𝑖𝑗 <=𝑠𝑖 i=1,…,n
constraints
TLCX + TLCY+ TLCZ <= 4
TLAX + TLBX+ TLCX >= 3
TLAY + TLBY+ TLCY >= 4
Demand σ𝑛𝑖=1 𝑇𝐿𝑖𝑗 ≥ 𝑑𝑗
constraints
TLAZ + TLBZ+ TLCZ >= 3
11
Concrete vs Abstract model
Concrete model
Objective function: Objective function:
minimize z = TLAX + 5*TLAY+ TLAZ + 2*TLBX + minimize z = σ𝑛𝑖=1 σ𝑚
𝑗=1 𝑐𝑖𝑗 𝑇𝐿𝑖𝑗
7*TLBY + TLBZ + 5*TLCX + 8*TLCY + 2*TLCZ
Subject to : Subject to :
TLAX + TLAY+ TLAZ <= 2
TLBX + TLBY+ TLBZ <= 4
Supply σ𝑚
𝑗=1 𝑇𝐿𝑖𝑗 <=𝑠𝑖 i=1,…,n
constraints
TLCX + TLCY+ TLCZ <= 4
TLAX + TLBX+ TLCX >= 3
TLAY + TLBY+ TLCY >= 4
Demand σ𝑛𝑖=1 𝑇𝐿𝑖𝑗 ≥ 𝑑𝑗 j=1,…,m
constraints
TLAZ + TLBZ+ TLCZ >= 3
12
Concrete vs Abstract model
Concrete model
Objective function: Objective function:
minimize z = TLAX + 5*TLAY+ TLAZ + 2*TLBX + minimize z = σ𝑛𝑖=1 σ𝑚
𝑗=1 𝑐𝑖𝑗 𝑇𝐿𝑖𝑗
7*TLBY + TLBZ + 5*TLCX + 8*TLCY + 2*TLCZ
Subject to : Subject to :
TLAX + TLAY+ TLAZ <= 2
TLBX + TLBY+ TLBZ <= 4
Supply σ𝑚
𝑗=1 𝑇𝐿𝑖𝑗 <=𝑠𝑖 i=1,…,n
constraints
TLCX + TLCY+ TLCZ <= 4
TLAX + TLBX+ TLCX >= 3
TLAY + TLBY+ TLCY >= 4
Demand σ𝑛𝑖=1 𝑇𝐿𝑖𝑗 ≥ 𝑑𝑗 j=1,…,m
constraints
TLAZ + TLBZ+ TLCZ >= 3
TLAX, TLAY, TLAZ, TLBX, TLBY, Non-negativity
TLBZ, TLCX, TLCY, TLCZ>= 0 constraints
13
Concrete vs Abstract model
Concrete model
Objective function: Objective function:
minimize z = TLAX + 5*TLAY+ TLAZ + 2*TLBX + minimize z = σ𝑛𝑖=1 σ𝑚
𝑗=1 𝑐𝑖𝑗 𝑇𝐿𝑖𝑗
7*TLBY + TLBZ + 5*TLCX + 8*TLCY + 2*TLCZ
Subject to : Subject to :
TLAX + TLAY+ TLAZ <= 2
TLBX + TLBY+ TLBZ <= 4
Supply σ𝑚
𝑗=1 𝑇𝐿𝑖𝑗 <=𝑠𝑖 i=1,…,n
constraints
TLCX + TLCY+ TLCZ <= 4
TLAX + TLBX+ TLCX >= 3
TLAY + TLBY+ TLCY >= 4
Demand σ𝑛𝑖=1 𝑇𝐿𝑖𝑗 ≥ 𝑑𝑗 j=1,…,m
constraints
TLAZ + TLBZ+ TLCZ >= 3
TLAX, TLAY, TLAZ, TLBX, TLBY, Non-negativity
TLBZ, TLCX, TLCY, TLCZ>= 0 constraints
𝑇𝐿𝑖𝑗 ≥ 0 i=1,…,n, j=1,…,m
14
Model
Objective function:
Sets:
Suppliers: Set of supplier points minimize z = σ𝑛𝑖=1 σ𝑚
𝑗=1 𝑐𝑖𝑗 𝑇𝐿𝑖𝑗
Demands : Set of demand points
Subject to :
σ𝑚
𝑗=1 𝑇𝐿𝑖𝑗 <=𝑠𝑖 i=1,…,n
σ𝑛𝑖=1 𝑇𝐿𝑖𝑗 ≥ 𝑑𝑗 j=1,…,m
𝑇𝐿𝑖𝑗 ≥ 0 i=1,…,n, j=1,…,m
15
Model Set of
suppliers
Sets:
Suppliers: Set of supplier points Objective function:
minimize z = σ𝑛𝑖=1 σ𝑚
𝑗=1 𝑐𝑖𝑗 𝑇𝐿𝑖𝑗
Demands : Set of demand points
Subject to :
σ𝑚
𝑗=1 𝑇𝐿𝑖𝑗 <=𝑠𝑖 i=1,…,n
σ𝑛𝑖=1 𝑇𝐿𝑖𝑗 ≥ 𝑑𝑗 j=1,…,m
𝑇𝐿𝑖𝑗 ≥ 0 i=1,…,n, j=1,…,m
16
Set of
Model Set of
demand
points
suppliers
Sets:
Suppliers: Set of supplier points Objective function:
minimize z = σ𝑛𝑖=1 σ𝑚
𝑗=1 𝑐𝑖𝑗 𝑇𝐿𝑖𝑗
Demands : Set of demand points
Subject to :
σ𝑚
𝑗=1 𝑇𝐿𝑖𝑗 <=𝑠𝑖 i=1,…,n
σ𝑛𝑖=1 𝑇𝐿𝑖𝑗 ≥ 𝑑𝑗 j=1,…,m
𝑇𝐿𝑖𝑗 ≥ 0 i=1,…,n, j=1,…,m
17
Set of
Model Set of
demand
points
suppliers
Sets:
Suppliers: Set of supplier points Objective function:
Demands : Set of demand points minimize z = σ𝑛𝑖=1 σ𝑚
𝑗=1 𝑐𝑖𝑗 𝑇𝐿𝑖𝑗
Parameters: Subject to :
cij: Unit cost of delivery from supply point I to demand
point j, 𝑖 ∈ 𝑆𝑢𝑝𝑝𝑙𝑖𝑒𝑟𝑠, 𝑗 ∈ 𝐷𝑒𝑚𝑎𝑛𝑑𝑠 σ𝑚
𝑗=1 𝑇𝐿𝑖𝑗 <=𝑠𝑖 i=1,…,n
σ𝑛𝑖=1 𝑇𝐿𝑖𝑗 ≥ 𝑑𝑗 j=1,…,m
𝑇𝐿𝑖𝑗 ≥ 0 i=1,…,n, j=1,…,m
18
Set of
Model Set of
demand
points
suppliers
Sets:
Suppliers: Set of supplier points Objective function:
Demands : Set of demand points minimize z = σ𝑛𝑖=1 σ𝑚
𝑗=1 𝑐𝑖𝑗 𝑇𝐿𝑖𝑗
Parameters: Subject to :
cij: Unit cost of delivery from supply point I to demand
point j, 𝑖 ∈ 𝑆𝑢𝑝𝑝𝑙𝑖𝑒𝑟𝑠, 𝑗 ∈ 𝐷𝑒𝑚𝑎𝑛𝑑𝑠 σ𝑚
𝑗=1 𝑇𝐿𝑖𝑗 <=𝑠𝑖 i=1,…,n
si: Supply of supplier I, 𝑖 ∈ 𝑆𝑢𝑝𝑝𝑙𝑖𝑒𝑟𝑠
σ𝑛𝑖=1 𝑇𝐿𝑖𝑗 ≥ 𝑑𝑗 j=1,…,m
𝑇𝐿𝑖𝑗 ≥ 0 i=1,…,n, j=1,…,m
19
Set of
Model Set of
demand
points
suppliers
Sets:
Suppliers: Set of supplier points Objective function:
Demands : Set of demand points minimize z = σ𝑛𝑖=1 σ𝑚
𝑗=1 𝑐𝑖𝑗 𝑇𝐿𝑖𝑗
Parameters: Subject to :
cij: Unit cost of delivery from supply point I to demand
point j, 𝑖 ∈ 𝑆𝑢𝑝𝑝𝑙𝑖𝑒𝑟𝑠, 𝑗 ∈ 𝐷𝑒𝑚𝑎𝑛𝑑𝑠 σ𝑚
𝑗=1 𝑇𝐿𝑖𝑗 <=𝑠𝑖 i=1,…,n
si: Supply of supplier I, 𝑖 ∈ 𝑆𝑢𝑝𝑝𝑙𝑖𝑒𝑟𝑠
dj: Demand of demand point j, 𝑗 ∈ 𝐷𝑒𝑚𝑎𝑛𝑑𝑠 σ𝑛𝑖=1 𝑇𝐿𝑖𝑗 ≥ 𝑑𝑗 j=1,…,m
𝑇𝐿𝑖𝑗 ≥ 0 i=1,…,n, j=1,…,m
20
Impot data from excel file
21
Impot data from excel file
• If you get error that xlrd does not exist, try:
22
Impot data from excel file
• If you get error that xlrd does not exist, try:
23
Pyomo: import data and solve the problem
24
Pyomo: import data and solve the problem
25
Pyomo: import data and solve the problem
26
Pyomo: import data and solve the problem
27
Model
Sets:
Suppliers: Set of supplier points Objective function:
Demands : Set of demand points minimize z = σ𝑛𝑖=1 σ𝑚
𝑗=1 𝑐𝑖𝑗 𝑇𝐿𝑖𝑗
Parameters: Subject to :
cij: Unit cost of delivery from supply point I to demand
point j, 𝑖 ∈ 𝑆𝑢𝑝𝑝𝑙𝑖𝑒𝑟𝑠, 𝑗 ∈ 𝐷𝑒𝑚𝑎𝑛𝑑𝑠 σ𝑚
𝑗=1 𝑇𝐿𝑖𝑗 <=𝑠𝑖 i=1,…,n
si: Supply of supplier I, 𝑖 ∈ 𝑆𝑢𝑝𝑝𝑙𝑖𝑒𝑟𝑠
dj: Demand of demand point j, 𝑗 ∈ 𝐷𝑒𝑚𝑎𝑛𝑑𝑠
σ𝑛𝑖=1 𝑇𝐿𝑖𝑗 ≥ 𝑑𝑗 j=1,…,m
𝑇𝐿𝑖𝑗 ≥ 0 i=1,…,n, j=1,…,m
28