gams modeling - sharifie.sharif.ir/~ali.ekhlasi/gams_ekhlassi.pdf · j = {dubai, tehran} k =...

38
Sharif University of Technology Industrial Engineering GAMS Modeling Operation Research 2 Ali Ekhlassi Spring 2020 Prof. Mohammad Modarres

Upload: others

Post on 05-Aug-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: GAMS Modeling - Sharifie.sharif.ir/~ali.ekhlasi/GAMS_Ekhlassi.pdf · j = {Dubai, Tehran} k = {Tabriz, Esfahan, Shiraz} Supply = 100 50 40 Demand = 60 40 70 Table F2W(i,j) Shipping

Sharif University of TechnologyIndustrial Engineering

GAMS Modeling

Operation Research 2

Ali EkhlassiSpring 2020

Prof. Mohammad Modarres

Page 2: GAMS Modeling - Sharifie.sharif.ir/~ali.ekhlasi/GAMS_Ekhlassi.pdf · j = {Dubai, Tehran} k = {Tabriz, Esfahan, Shiraz} Supply = 100 50 40 Demand = 60 40 70 Table F2W(i,j) Shipping

Factories RetailersDistributor

Three-layer Supply Chain

2

Page 3: GAMS Modeling - Sharifie.sharif.ir/~ali.ekhlasi/GAMS_Ekhlassi.pdf · j = {Dubai, Tehran} k = {Tabriz, Esfahan, Shiraz} Supply = 100 50 40 Demand = 60 40 70 Table F2W(i,j) Shipping

Factories DistributorWarehouse

Three-layer Supply Chain

LG

Samsung

Apple

Tabriz

Esfahan

ShirazTehran

Dubai

Supply: 100

50

40

Demand: 60

40

70

3

Page 4: GAMS Modeling - Sharifie.sharif.ir/~ali.ekhlasi/GAMS_Ekhlassi.pdf · j = {Dubai, Tehran} k = {Tabriz, Esfahan, Shiraz} Supply = 100 50 40 Demand = 60 40 70 Table F2W(i,j) Shipping

Factories RetailersDistributor

Three-layer Supply Chain

LG

Samsung

Apple

Tabriz

Esfahan

ShirazTehran

Dubai

X Yمتغیرهای تصمیم

4

Page 5: GAMS Modeling - Sharifie.sharif.ir/~ali.ekhlasi/GAMS_Ekhlassi.pdf · j = {Dubai, Tehran} k = {Tabriz, Esfahan, Shiraz} Supply = 100 50 40 Demand = 60 40 70 Table F2W(i,j) Shipping

Factories RetailersDistributor

Three-layer Supply Chain

LG

Samsung

Apple

Tabriz

Esfahan

ShirazTehran

Dubai

𝑋𝑖𝑗 Yi j

i = {Samsung, LG, Apple}

j = {Dubai, Tehran}

5

Page 6: GAMS Modeling - Sharifie.sharif.ir/~ali.ekhlasi/GAMS_Ekhlassi.pdf · j = {Dubai, Tehran} k = {Tabriz, Esfahan, Shiraz} Supply = 100 50 40 Demand = 60 40 70 Table F2W(i,j) Shipping

Factories RetailersDistributor

Three-layer Supply Chain

LG

Samsung

Apple

Tabriz

Esfahan

ShirazTehran

Dubai

𝑋𝑖𝑗 Yi j

i = {Samsung, LG, Apple}

j = {Dubai, Tehran}

6

Page 7: GAMS Modeling - Sharifie.sharif.ir/~ali.ekhlasi/GAMS_Ekhlassi.pdf · j = {Dubai, Tehran} k = {Tabriz, Esfahan, Shiraz} Supply = 100 50 40 Demand = 60 40 70 Table F2W(i,j) Shipping

Factories RetailersDistributor

Three-layer Supply Chain

LG

Samsung

Apple

Tabriz

Esfahan

ShirazTehran

Dubai

𝑋𝑖𝑗 𝑌𝑗𝑘

i ji = {Samsung, LG, Apple}

j = {Dubai, Tehran}

k

k = {Tabriz, Esfahan, Shiraz}7

Page 8: GAMS Modeling - Sharifie.sharif.ir/~ali.ekhlasi/GAMS_Ekhlassi.pdf · j = {Dubai, Tehran} k = {Tabriz, Esfahan, Shiraz} Supply = 100 50 40 Demand = 60 40 70 Table F2W(i,j) Shipping

Three-layer Supply Chaini = {Samsung, LG, Apple}

j = {Dubai, Tehran}

k = {Tabriz, Esfahan, Shiraz}

Factories DistributorWarehouse

LG

Samsung

Apple

Tabriz

Esfahan

ShirazTehran

Dubai

50

40

Demand: 60

40

70

Supply: 100

8

Page 9: GAMS Modeling - Sharifie.sharif.ir/~ali.ekhlasi/GAMS_Ekhlassi.pdf · j = {Dubai, Tehran} k = {Tabriz, Esfahan, Shiraz} Supply = 100 50 40 Demand = 60 40 70 Table F2W(i,j) Shipping

Three-layer Supply Chaini = {Samsung, LG, Apple}

j = {Dubai, Tehran}

k = {Tabriz, Esfahan, Shiraz}

Factories DistributorWarehouse

LG

Samsung

Apple

Tabriz

Esfahan

ShirazTehran

Dubai

50

40

Demand: 60

40

70

Supply: 100

9

تابع هدف Min z

Page 10: GAMS Modeling - Sharifie.sharif.ir/~ali.ekhlasi/GAMS_Ekhlassi.pdf · j = {Dubai, Tehran} k = {Tabriz, Esfahan, Shiraz} Supply = 100 50 40 Demand = 60 40 70 Table F2W(i,j) Shipping

Three-layer Supply Chaini = {Samsung, LG, Apple}

j = {Dubai, Tehran}

k = {Tabriz, Esfahan, Shiraz}

Factories DistributorWarehouse

LG

Samsung

Apple

Tabriz

Esfahan

ShirazTehran

Dubai

50

40

Demand: 60

40

70

Supply: 100

تابع هدف Min z = 5 × 𝑋𝑠𝑎𝑚,𝑑𝑢𝑏𝑎𝑖 + 9 × 𝑋𝑠𝑎𝑚,𝑡𝑒ℎ𝑟𝑎𝑛 + 4 × 𝑋𝐿𝐺,𝑑𝑢𝑏𝑎𝑖 + …+ 10 × 𝑋𝑎𝑝𝑝𝑙𝑒,𝑡𝑒ℎ𝑟𝑎𝑛+ 3 × 𝑌𝑑𝑢𝑏𝑎𝑖,𝑡𝑎𝑏𝑟𝑖𝑧 + 3 × 𝑌𝑑𝑢𝑏𝑎𝑖,𝑒𝑠𝑓𝑎ℎ𝑎𝑛 + …+ 3 × 𝑌𝑡𝑒ℎ𝑟𝑎𝑛,𝑠ℎ𝑖𝑟𝑎𝑧

𝑋𝑖𝑗 𝑌𝑗𝑘

10

Page 11: GAMS Modeling - Sharifie.sharif.ir/~ali.ekhlasi/GAMS_Ekhlassi.pdf · j = {Dubai, Tehran} k = {Tabriz, Esfahan, Shiraz} Supply = 100 50 40 Demand = 60 40 70 Table F2W(i,j) Shipping

Three-layer Supply Chaini = {Samsung, LG, Apple}

j = {Dubai, Tehran}

k = {Tabriz, Esfahan, Shiraz}

Factories DistributorWarehouse

LG

Samsung

Apple

Tabriz

Esfahan

ShirazTehran

Dubai

50

40

Demand: 60

40

70

Supply: 100

تابع هدف Min z = 5 × 𝑋𝑠𝑎𝑚,𝑑𝑢𝑏𝑎𝑖 + 9 × 𝑋𝑠𝑎𝑚,𝑡𝑒ℎ𝑟𝑎𝑛 + 4 × 𝑋𝐿𝐺,𝑑𝑢𝑏𝑎𝑖 + …+ 10 × 𝑋𝑎𝑝𝑝𝑙𝑒,𝑡𝑒ℎ𝑟𝑎𝑛+ 3 × 𝑌𝑑𝑢𝑏𝑎𝑖,𝑡𝑎𝑏𝑟𝑖𝑧 + 3 × 𝑌𝑑𝑢𝑏𝑎𝑖,𝑒𝑠𝑓𝑎ℎ𝑎𝑛 + …+ 3 × 𝑌𝑡𝑒ℎ𝑟𝑎𝑛,𝑠ℎ𝑖𝑟𝑎𝑧

𝑋𝑖𝑗 𝑌𝑗𝑘

Factory2warehouse = 5 94 76 10 11

Page 12: GAMS Modeling - Sharifie.sharif.ir/~ali.ekhlasi/GAMS_Ekhlassi.pdf · j = {Dubai, Tehran} k = {Tabriz, Esfahan, Shiraz} Supply = 100 50 40 Demand = 60 40 70 Table F2W(i,j) Shipping

Three-layer Supply Chaini = {Samsung, LG, Apple}

j = {Dubai, Tehran}

k = {Tabriz, Esfahan, Shiraz}

Factories DistributorWarehouse

LG

Samsung

Apple

Tabriz

Esfahan

ShirazTehran

Dubai

50

40

Demand: 60

40

70

Supply: 100

تابع هدف Min z = 5 × 𝑋𝑠𝑎𝑚,𝑑𝑢𝑏𝑎𝑖 + 9 × 𝑋𝑠𝑎𝑚,𝑡𝑒ℎ𝑟𝑎𝑛 + 4 × 𝑋𝐿𝐺,𝑑𝑢𝑏𝑎𝑖 + …+ 10 × 𝑋𝑎𝑝𝑝𝑙𝑒,𝑡𝑒ℎ𝑟𝑎𝑛+ 3 × 𝑌𝑑𝑢𝑏𝑎𝑖,𝑡𝑎𝑏𝑟𝑖𝑧 + 3 × 𝑌𝑑𝑢𝑏𝑎𝑖,𝑒𝑠𝑓𝑎ℎ𝑎𝑛 + …+ 3 × 𝑌𝑡𝑒ℎ𝑟𝑎𝑛,𝑠ℎ𝑖𝑟𝑎𝑧

𝑋𝑖𝑗 𝑌𝑗𝑘

i

j

12

Factory2warehouse = 5 94 76 10

Page 13: GAMS Modeling - Sharifie.sharif.ir/~ali.ekhlasi/GAMS_Ekhlassi.pdf · j = {Dubai, Tehran} k = {Tabriz, Esfahan, Shiraz} Supply = 100 50 40 Demand = 60 40 70 Table F2W(i,j) Shipping

Three-layer Supply Chaini = {Samsung, LG, Apple}

j = {Dubai, Tehran}

k = {Tabriz, Esfahan, Shiraz}

Factories DistributorWarehouse

LG

Samsung

Apple

Tabriz

Esfahan

ShirazTehran

Dubai

50

40

Demand: 60

40

70

Supply: 100

تابع هدف Min z = 5 × 𝑋𝑠𝑎𝑚,𝑑𝑢𝑏𝑎𝑖 + 9 × 𝑋𝑠𝑎𝑚,𝑡𝑒ℎ𝑟𝑎𝑛 + 4 × 𝑋𝐿𝐺,𝑑𝑢𝑏𝑎𝑖 + …+ 10 × 𝑋𝑎𝑝𝑝𝑙𝑒,𝑡𝑒ℎ𝑟𝑎𝑛+ 3 × 𝑌𝑑𝑢𝑏𝑎𝑖,𝑡𝑎𝑏𝑟𝑖𝑧 + 3 × 𝑌𝑑𝑢𝑏𝑎𝑖,𝑒𝑠𝑓𝑎ℎ𝑎𝑛 + …+ 3 × 𝑌𝑡𝑒ℎ𝑟𝑎𝑛,𝑠ℎ𝑖𝑟𝑎𝑧

𝑋𝑖𝑗 𝑌𝑗𝑘

F2W = 5 94 76 10

i

j

W2D = 3 4 72 5 3

j

k

13

Page 14: GAMS Modeling - Sharifie.sharif.ir/~ali.ekhlasi/GAMS_Ekhlassi.pdf · j = {Dubai, Tehran} k = {Tabriz, Esfahan, Shiraz} Supply = 100 50 40 Demand = 60 40 70 Table F2W(i,j) Shipping

Three-layer Supply Chaini = {Samsung, LG, Apple}

j = {Dubai, Tehran}

k = {Tabriz, Esfahan, Shiraz}

Factories DistributorWarehouse

LG

Samsung

Apple

Tabriz

Esfahan

ShirazTehran

Dubai

50

40

Demand: 60

40

70

Supply: 100

تابع هدف Min z = σ𝑖σ𝑗 𝐹2𝑊𝑖𝑗 × 𝑋𝑖𝑗 +

𝑋𝑖𝑗 𝑌𝑗𝑘

F2W = 5 94 76 10

i W2D = 3 4 72 5 3

j

k

14

Page 15: GAMS Modeling - Sharifie.sharif.ir/~ali.ekhlasi/GAMS_Ekhlassi.pdf · j = {Dubai, Tehran} k = {Tabriz, Esfahan, Shiraz} Supply = 100 50 40 Demand = 60 40 70 Table F2W(i,j) Shipping

Three-layer Supply Chaini = {Samsung, LG, Apple}

j = {Dubai, Tehran}

k = {Tabriz, Esfahan, Shiraz}

Factories DistributorWarehouse

LG

Samsung

Apple

Tabriz

Esfahan

ShirazTehran

Dubai

50

40

Demand: 60

40

70

Supply: 100

تابع هدف Min z = σ𝑖σ𝑗 𝐹2𝑊𝑖𝑗 × 𝑋𝑖𝑗 + σ𝑗σ𝑘𝑊2𝐷𝑗𝑘 × 𝑌𝑗𝑘

𝑋𝑖𝑗 𝑌𝑗𝑘

F2W = 5 94 76 10

i W2D = 3 4 72 5 3

j

k

15

Page 16: GAMS Modeling - Sharifie.sharif.ir/~ali.ekhlasi/GAMS_Ekhlassi.pdf · j = {Dubai, Tehran} k = {Tabriz, Esfahan, Shiraz} Supply = 100 50 40 Demand = 60 40 70 Table F2W(i,j) Shipping

Three-layer Supply Chaini = {Samsung, LG, Apple}

j = {Dubai, Tehran}

k = {Tabriz, Esfahan, Shiraz}

Factories DistributorWarehouse

LG

Samsung

Apple

Tabriz

Esfahan

ShirazTehran

Dubai

50

40

Demand: 60

40

70

Supply: 100

𝑋𝑖𝑗 𝑌𝑗𝑘

F2W = 5 94 76 10

W2D = 3 4 72 5 3

محدودیت ها

16

Page 17: GAMS Modeling - Sharifie.sharif.ir/~ali.ekhlasi/GAMS_Ekhlassi.pdf · j = {Dubai, Tehran} k = {Tabriz, Esfahan, Shiraz} Supply = 100 50 40 Demand = 60 40 70 Table F2W(i,j) Shipping

Three-layer Supply Chaini = {Samsung, LG, Apple}

j = {Dubai, Tehran}

k = {Tabriz, Esfahan, Shiraz}

Factories DistributorsWarehouses

LG

Samsung

Apple

Tabriz

Esfahan

ShirazTehran

Dubai

50

40

Demand: 60

40

70

Supply: 100

𝑋𝑖𝑗 𝑌𝑗𝑘

Factories

Warehouses

Distributors

F2W = 5 94 76 10

W2D = 3 4 72 5 3

محدودیت ها

17

Page 18: GAMS Modeling - Sharifie.sharif.ir/~ali.ekhlasi/GAMS_Ekhlassi.pdf · j = {Dubai, Tehran} k = {Tabriz, Esfahan, Shiraz} Supply = 100 50 40 Demand = 60 40 70 Table F2W(i,j) Shipping

Three-layer Supply Chaini = {Samsung, LG, Apple}

j = {Dubai, Tehran}

k = {Tabriz, Esfahan, Shiraz}

Factories DistributorsWarehouses

LG

Samsung

Apple

Tabriz

Esfahan

ShirazTehran

Dubai

50

40

Demand: 60

40

70

Supply: 100

𝑋𝑖𝑗 𝑌𝑗𝑘

Factories

Warehouses

Distributors

𝑋𝑠𝑎𝑚,𝑑𝑢𝑏𝑎𝑖 + 𝑋𝑠𝑎𝑚,𝑡𝑒ℎ𝑟𝑎𝑛 ≤ 100

𝑋𝐿𝐺,𝑑𝑢𝑏𝑎𝑖 + 𝑋𝐿𝐺,𝑡𝑒ℎ𝑟𝑎𝑛 ≤ 50

𝑋𝑎𝑝𝑝𝑙𝑒,𝑑𝑢𝑏𝑎𝑖 + 𝑋𝑎𝑝𝑝𝑙𝑒,𝑡𝑒ℎ𝑟𝑎𝑛 ≤ 40

F2W = 5 94 76 10

W2D = 3 4 72 5 3

محدودیت ها

18

Page 19: GAMS Modeling - Sharifie.sharif.ir/~ali.ekhlasi/GAMS_Ekhlassi.pdf · j = {Dubai, Tehran} k = {Tabriz, Esfahan, Shiraz} Supply = 100 50 40 Demand = 60 40 70 Table F2W(i,j) Shipping

Three-layer Supply Chaini = {Samsung, LG, Apple}

j = {Dubai, Tehran}

k = {Tabriz, Esfahan, Shiraz}

Factories DistributorsWarehouses

LG

Samsung

Apple

Tabriz

Esfahan

ShirazTehran

Dubai

50

40

Demand: 60

40

70

Supply: 100

𝑋𝑖𝑗 𝑌𝑗𝑘

Factories

Warehouses

Distributors

𝑋𝑠𝑎𝑚,𝑑𝑢𝑏𝑎𝑖 + 𝑋𝑠𝑎𝑚,𝑡𝑒ℎ𝑟𝑎𝑛 ≤ 100

𝑋𝐿𝐺,𝑑𝑢𝑏𝑎𝑖 + 𝑋𝐿𝐺,𝑡𝑒ℎ𝑟𝑎𝑛 ≤ 50

𝑋𝑎𝑝𝑝𝑙𝑒,𝑑𝑢𝑏𝑎𝑖 + 𝑋𝑎𝑝𝑝𝑙𝑒,𝑡𝑒ℎ𝑟𝑎𝑛 ≤ 40

i ij j

F2W = 5 94 76 10

W2D = 3 4 72 5 3

محدودیت ها

𝑗

𝑋𝑖𝑗 ≤ 100

19

Page 20: GAMS Modeling - Sharifie.sharif.ir/~ali.ekhlasi/GAMS_Ekhlassi.pdf · j = {Dubai, Tehran} k = {Tabriz, Esfahan, Shiraz} Supply = 100 50 40 Demand = 60 40 70 Table F2W(i,j) Shipping

Three-layer Supply Chaini = {Samsung, LG, Apple}

j = {Dubai, Tehran}

k = {Tabriz, Esfahan, Shiraz}

Factories DistributorsWarehouses

LG

Samsung

Apple

Tabriz

Esfahan

ShirazTehran

Dubai

50

40

Demand: 60

40

70

Supply: 100

𝑋𝑖𝑗 𝑌𝑗𝑘

Factories

Warehouses

Distributors

𝑋𝑠𝑎𝑚,𝑑𝑢𝑏𝑎𝑖 + 𝑋𝑠𝑎𝑚,𝑡𝑒ℎ𝑟𝑎𝑛 ≤ 100

𝑋𝐿𝐺,𝑑𝑢𝑏𝑎𝑖 + 𝑋𝐿𝐺,𝑡𝑒ℎ𝑟𝑎𝑛 ≤ 50

𝑋𝑎𝑝𝑝𝑙𝑒,𝑑𝑢𝑏𝑎𝑖 + 𝑋𝑎𝑝𝑝𝑙𝑒,𝑡𝑒ℎ𝑟𝑎𝑛 ≤ 40

𝑗

𝑋𝑖𝑗 ≤ 100 i = Samsung

F2W = 5 94 76 10

W2D = 3 4 72 5 3

محدودیت ها

20

i ij j

Page 21: GAMS Modeling - Sharifie.sharif.ir/~ali.ekhlasi/GAMS_Ekhlassi.pdf · j = {Dubai, Tehran} k = {Tabriz, Esfahan, Shiraz} Supply = 100 50 40 Demand = 60 40 70 Table F2W(i,j) Shipping

Three-layer Supply Chaini = {Samsung, LG, Apple}

j = {Dubai, Tehran}

k = {Tabriz, Esfahan, Shiraz}

Factories DistributorsWarehouses

LG

Samsung

Apple

Tabriz

Esfahan

ShirazTehran

Dubai

50

40

Demand: 60

40

70

Supply: 100

𝑋𝑖𝑗 𝑌𝑗𝑘

Factories

Warehouses

Distributors

𝑋𝑠𝑎𝑚,𝑑𝑢𝑏𝑎𝑖 + 𝑋𝑠𝑎𝑚,𝑡𝑒ℎ𝑟𝑎𝑛 ≤ 100

𝑋𝐿𝐺,𝑑𝑢𝑏𝑎𝑖 + 𝑋𝐿𝐺,𝑡𝑒ℎ𝑟𝑎𝑛 ≤ 50

𝑋𝑎𝑝𝑝𝑙𝑒,𝑑𝑢𝑏𝑎𝑖 + 𝑋𝑎𝑝𝑝𝑙𝑒,𝑡𝑒ℎ𝑟𝑎𝑛 ≤ 40

𝑗

𝑋𝑖𝑗 ≤ 100 i = Samsung

𝑗

𝑋𝑖𝑗 ≤ 50 i = LG

𝑗

𝑋𝑖𝑗 ≤ 40 i = Apple

F2W = 5 94 76 10

W2D = 3 4 72 5 3

محدودیت ها

21

i ij j

Page 22: GAMS Modeling - Sharifie.sharif.ir/~ali.ekhlasi/GAMS_Ekhlassi.pdf · j = {Dubai, Tehran} k = {Tabriz, Esfahan, Shiraz} Supply = 100 50 40 Demand = 60 40 70 Table F2W(i,j) Shipping

Three-layer Supply Chaini = {Samsung, LG, Apple}

j = {Dubai, Tehran}

k = {Tabriz, Esfahan, Shiraz}

Factories DistributorsWarehouses

LG

Samsung

Apple

Tabriz

Esfahan

ShirazTehran

Dubai

50

40

Demand: 60

40

70

Supply: 100

𝑋𝑖𝑗 𝑌𝑗𝑘

Factories

Warehouses

Distributors

𝑋𝑠𝑎𝑚,𝑑𝑢𝑏𝑎𝑖 + 𝑋𝑠𝑎𝑚,𝑡𝑒ℎ𝑟𝑎𝑛 ≤ 100

𝑋𝐿𝐺,𝑑𝑢𝑏𝑎𝑖 + 𝑋𝐿𝐺,𝑡𝑒ℎ𝑟𝑎𝑛 ≤ 50

𝑋𝑎𝑝𝑝𝑙𝑒,𝑑𝑢𝑏𝑎𝑖 + 𝑋𝑎𝑝𝑝𝑙𝑒,𝑡𝑒ℎ𝑟𝑎𝑛 ≤ 40

𝑗

𝑋𝑖𝑗 ≤ 100 i = Samsung

𝑗

𝑋𝑖𝑗 ≤ 50 i = LG

𝑗

𝑋𝑖𝑗 ≤ 40 i = Apple

Supply = 1005040

F2W = 5 94 76 10

W2D = 3 4 72 5 3

محدودیت ها

22

i ij j

Page 23: GAMS Modeling - Sharifie.sharif.ir/~ali.ekhlasi/GAMS_Ekhlassi.pdf · j = {Dubai, Tehran} k = {Tabriz, Esfahan, Shiraz} Supply = 100 50 40 Demand = 60 40 70 Table F2W(i,j) Shipping

Three-layer Supply Chaini = {Samsung, LG, Apple}

j = {Dubai, Tehran}

k = {Tabriz, Esfahan, Shiraz}

Factories DistributorsWarehouses

LG

Samsung

Apple

Tabriz

Esfahan

ShirazTehran

Dubai

50

40

Demand: 60

40

70

Supply: 100

𝑋𝑖𝑗 𝑌𝑗𝑘

Factories

Warehouses

Distributors

𝑗

𝑋𝑖𝑗 ≤ 100 i = Samsung

𝑗

𝑋𝑖𝑗 ≤ 50 i = LG

𝑗

𝑋𝑖𝑗 ≤ 40 i = Apple

𝑗

𝑋𝑖𝑗 ≤ 𝑆𝑢𝑝𝑝𝑙𝑦𝑖

A

i

Supply = 1005040

F2W = 5 94 76 10

W2D = 3 4 72 5 3

محدودیت ها

23

Page 24: GAMS Modeling - Sharifie.sharif.ir/~ali.ekhlasi/GAMS_Ekhlassi.pdf · j = {Dubai, Tehran} k = {Tabriz, Esfahan, Shiraz} Supply = 100 50 40 Demand = 60 40 70 Table F2W(i,j) Shipping

Three-layer Supply Chaini = {Samsung, LG, Apple}

j = {Dubai, Tehran}

k = {Tabriz, Esfahan, Shiraz}

Factories DistributorsWarehouses

LG

Samsung

Apple

Tabriz

Esfahan

ShirazTehran

Dubai

50

40

Demand: 60

40

70

Supply: 100

𝑋𝑖𝑗 𝑌𝑗𝑘

Factories

Warehouses

Distributors

Supply = 1005040

F2W = 5 94 76 10

W2D = 3 4 72 5 3

محدودیت ها

24

Page 25: GAMS Modeling - Sharifie.sharif.ir/~ali.ekhlasi/GAMS_Ekhlassi.pdf · j = {Dubai, Tehran} k = {Tabriz, Esfahan, Shiraz} Supply = 100 50 40 Demand = 60 40 70 Table F2W(i,j) Shipping

Three-layer Supply Chaini = {Samsung, LG, Apple}

j = {Dubai, Tehran}

k = {Tabriz, Esfahan, Shiraz}

Factories DistributorsWarehouses

LG

Samsung

Apple

Tabriz

Esfahan

ShirazTehran

Dubai

50

40

Demand: 60

40

70

Supply: 100

𝑋𝑖𝑗 𝑌𝑗𝑘

Factories

Warehouses

Distributors

𝑋𝑠𝑎𝑚,𝑑𝑢𝑏𝑎𝑖 + 𝑋𝐿𝐺,𝑑𝑢𝑏𝑎𝑖 + 𝑋𝑎𝑝𝑝𝑙𝑒,𝑑𝑢𝑏𝑎𝑖 ≥ 𝑌𝑑𝑢𝑏𝑎𝑖,𝑡𝑎𝑏𝑟𝑖𝑧 + 𝑌𝑑𝑢𝑏𝑎𝑖,𝑒𝑠𝑓𝑎ℎ𝑎𝑛 + 𝑌𝑑𝑢𝑏𝑎𝑖,𝑠ℎ𝑖𝑟𝑎𝑧

𝑋𝑠𝑎𝑚,𝑡𝑒ℎ + 𝑋𝐿𝐺,𝑡𝑒ℎ + 𝑋𝑎𝑝𝑝𝑙𝑒,𝑡𝑒ℎ ≥ 𝑌𝑡𝑒ℎ,𝑡𝑎𝑏𝑟𝑖𝑧 + 𝑌𝑡𝑒ℎ,𝑒𝑠𝑓𝑎ℎ𝑎𝑛 + 𝑌𝑡𝑒ℎ,𝑠ℎ𝑖𝑟𝑎𝑧

Supply = 1005040

F2W = 5 94 76 10

W2D = 3 4 72 5 3

محدودیت ها

25

Page 26: GAMS Modeling - Sharifie.sharif.ir/~ali.ekhlasi/GAMS_Ekhlassi.pdf · j = {Dubai, Tehran} k = {Tabriz, Esfahan, Shiraz} Supply = 100 50 40 Demand = 60 40 70 Table F2W(i,j) Shipping

Three-layer Supply Chaini = {Samsung, LG, Apple}

j = {Dubai, Tehran}

k = {Tabriz, Esfahan, Shiraz}

Factories DistributorsWarehouses

LG

Samsung

Apple

Tabriz

Esfahan

ShirazTehran

Dubai

50

40

Demand: 60

40

70

Supply: 100

𝑋𝑖𝑗 𝑌𝑗𝑘

Factories

Warehouses

Distributors

𝑖

𝑋𝑖𝑗 ≥

𝑘

𝑌𝑗𝑘 j = Dubai

j = Tehran

𝑖

𝑋𝑖𝑗 ≥

𝑘

𝑌𝑗𝑘

A

j

𝑖

𝑋𝑖𝑗 ≥

𝑘

𝑌𝑗𝑘

Supply = 1005040

F2W = 5 94 76 10

W2D = 3 4 72 5 3

محدودیت ها

26

Page 27: GAMS Modeling - Sharifie.sharif.ir/~ali.ekhlasi/GAMS_Ekhlassi.pdf · j = {Dubai, Tehran} k = {Tabriz, Esfahan, Shiraz} Supply = 100 50 40 Demand = 60 40 70 Table F2W(i,j) Shipping

Three-layer Supply Chaini = {Samsung, LG, Apple}

j = {Dubai, Tehran}

k = {Tabriz, Esfahan, Shiraz}

Factories DistributorsWarehouses

LG

Samsung

Apple

Tabriz

Esfahan

ShirazTehran

Dubai

50

40

Demand: 60

40

70

Supply: 100

𝑋𝑖𝑗 𝑌𝑗𝑘

Factories

Warehouses

Distributors

Supply = 1005040

F2W = 5 94 76 10

W2D = 3 4 72 5 3

محدودیت ها

27

Page 28: GAMS Modeling - Sharifie.sharif.ir/~ali.ekhlasi/GAMS_Ekhlassi.pdf · j = {Dubai, Tehran} k = {Tabriz, Esfahan, Shiraz} Supply = 100 50 40 Demand = 60 40 70 Table F2W(i,j) Shipping

Three-layer Supply Chaini = {Samsung, LG, Apple}

j = {Dubai, Tehran}

k = {Tabriz, Esfahan, Shiraz}

Factories DistributorsWarehouses

LG

Samsung

Apple

Tabriz

Esfahan

ShirazTehran

Dubai

50

40

Demand: 60

40

70

Supply: 100

𝑋𝑖𝑗 𝑌𝑗𝑘

Factories

Warehouses

Distributors

Supply = 1005040

F2W = 5 94 76 10

W2D = 3 4 72 5 3

𝑌𝑑𝑢𝑏𝑎𝑖,𝑡𝑎𝑏𝑟𝑖𝑧 + 𝑌𝑡𝑒ℎ𝑟𝑎𝑛,𝑡𝑎𝑏𝑟𝑖𝑧 ≥ 60

𝑌𝑑𝑢𝑏𝑎𝑖,𝑒𝑠𝑓𝑎ℎ𝑎𝑛 + 𝑌𝑡𝑒ℎ𝑟𝑎𝑛,𝑒𝑠𝑓𝑎ℎ𝑎𝑛 ≥ 40

𝑌𝑑𝑢𝑏𝑎𝑖,𝑠ℎ𝑖𝑟𝑎𝑧 + 𝑌𝑡𝑒ℎ𝑟𝑎𝑛,𝑠ℎ𝑖𝑟𝑎𝑧 ≥ 70

محدودیت ها

28

Page 29: GAMS Modeling - Sharifie.sharif.ir/~ali.ekhlasi/GAMS_Ekhlassi.pdf · j = {Dubai, Tehran} k = {Tabriz, Esfahan, Shiraz} Supply = 100 50 40 Demand = 60 40 70 Table F2W(i,j) Shipping

Three-layer Supply Chaini = {Samsung, LG, Apple}

j = {Dubai, Tehran}

k = {Tabriz, Esfahan, Shiraz}

Factories DistributorsWarehouses

LG

Samsung

Apple

Tabriz

Esfahan

ShirazTehran

Dubai

50

40

Demand: 60

40

70

Supply: 100

𝑋𝑖𝑗 𝑌𝑗𝑘

Factories

Warehouses

Distributors

F2W = 5 94 76 10

W2D = 3 4 72 5 3

𝑗

𝑌𝑗𝑘 ≥ 60 k = Tabriz

𝑗

𝑌𝑗𝑘 ≥ 40 k = Esfahan

𝑗

𝑌𝑗𝑘 ≥ 70 k = Shiraz

𝑌𝑑𝑢𝑏𝑎𝑖,𝑡𝑎𝑏𝑟𝑖𝑧 + 𝑌𝑡𝑒ℎ𝑟𝑎𝑛,𝑡𝑎𝑏𝑟𝑖𝑧 ≥ 60

𝑌𝑑𝑢𝑏𝑎𝑖,𝑒𝑠𝑓𝑎ℎ𝑎𝑛 + 𝑌𝑡𝑒ℎ𝑟𝑎𝑛,𝑒𝑠𝑓𝑎ℎ𝑎𝑛 ≥ 40

𝑌𝑑𝑢𝑏𝑎𝑖,𝑠ℎ𝑖𝑟𝑎𝑧 + 𝑌𝑡𝑒ℎ𝑟𝑎𝑛,𝑠ℎ𝑖𝑟𝑎𝑧 ≥ 70

Supply = 1005040

محدودیت ها

29

Page 30: GAMS Modeling - Sharifie.sharif.ir/~ali.ekhlasi/GAMS_Ekhlassi.pdf · j = {Dubai, Tehran} k = {Tabriz, Esfahan, Shiraz} Supply = 100 50 40 Demand = 60 40 70 Table F2W(i,j) Shipping

Three-layer Supply Chaini = {Samsung, LG, Apple}

j = {Dubai, Tehran}

k = {Tabriz, Esfahan, Shiraz}

Factories DistributorsWarehouses

LG

Samsung

Apple

Tabriz

Esfahan

ShirazTehran

Dubai

50

40

Demand: 60

40

70

Supply: 100

𝑋𝑖𝑗 𝑌𝑗𝑘

محدودیت ها

Factories

Warehouses

Distributors

Supply = 1005040

F2W = 5 94 76 10

W2D = 3 4 72 5 3

𝑗

𝑌𝑗𝑘 ≥ 𝐷𝑒𝑚𝑎𝑛𝑑𝑘

A

k𝑌𝑑𝑢𝑏𝑎𝑖,𝑡𝑎𝑏𝑟𝑖𝑧 + 𝑌𝑡𝑒ℎ𝑟𝑎𝑛,𝑡𝑎𝑏𝑟𝑖𝑧 ≥ 60

𝑌𝑑𝑢𝑏𝑎𝑖,𝑒𝑠𝑓𝑎ℎ𝑎𝑛 + 𝑌𝑡𝑒ℎ𝑟𝑎𝑛,𝑒𝑠𝑓𝑎ℎ𝑎𝑛 ≥ 40

𝑌𝑑𝑢𝑏𝑎𝑖,𝑠ℎ𝑖𝑟𝑎𝑧 + 𝑌𝑡𝑒ℎ𝑟𝑎𝑛,𝑠ℎ𝑖𝑟𝑎𝑧 ≥ 70

Demand = 604070

𝑗

𝑌𝑗𝑘 ≥ 60 k = Tabriz

𝑗

𝑌𝑗𝑘 ≥ 40 k = Esfahan

𝑗

𝑌𝑗𝑘 ≥ 70 k = Shiraz30

Page 31: GAMS Modeling - Sharifie.sharif.ir/~ali.ekhlasi/GAMS_Ekhlassi.pdf · j = {Dubai, Tehran} k = {Tabriz, Esfahan, Shiraz} Supply = 100 50 40 Demand = 60 40 70 Table F2W(i,j) Shipping

Three-layer Supply Chaini = {Samsung, LG, Apple}

j = {Dubai, Tehran}

k = {Tabriz, Esfahan, Shiraz}

Factories DistributorsWarehouses

LG

Samsung

Apple

Tabriz

Esfahan

ShirazTehran

Dubai

50

40

Demand: 60

40

70

Supply: 100

𝑋𝑖𝑗 𝑌𝑗𝑘Supply =

1005040

F2W = 5 94 76 10

W2D = 3 4 72 5 3

𝑗

𝑌𝑗𝑘 ≥ 𝐷𝑒𝑚𝑎𝑛𝑑𝑘

A

k

Demand = 604070

تابع هدف Min Z = σ𝑖σ𝑗 𝐹2𝑊𝑖𝑗 × 𝑋𝑖𝑗 + σ𝑗σ𝑘𝑊2𝐷𝑗𝑘 × 𝑌𝑗𝑘

Factories

Warehouses

Distributors

محدودیت ها

𝑖

𝑋𝑖𝑗 ≥

𝑘

𝑌𝑗𝑘

A

j

𝑗

𝑋𝑖𝑗 ≤ 𝑆𝑢𝑝𝑝𝑙𝑦𝑖

A

i

31

Page 32: GAMS Modeling - Sharifie.sharif.ir/~ali.ekhlasi/GAMS_Ekhlassi.pdf · j = {Dubai, Tehran} k = {Tabriz, Esfahan, Shiraz} Supply = 100 50 40 Demand = 60 40 70 Table F2W(i,j) Shipping

Modeli = {Samsung, LG, Apple}

j = {Dubai, Tehran}

k = {Tabriz, Esfahan, Shiraz}

Supply = 1005040

F2W = 5 94 76 10

W2D = 3 4 72 5 3

𝑗

𝑌𝑗𝑘 ≥ 𝐷𝑒𝑚𝑎𝑛𝑑𝑘

A

k

Demand = 604070

تابع هدف Min Z = σ𝑖σ𝑗 𝐹2𝑊𝑖𝑗 × 𝑋𝑖𝑗 + σ𝑗σ𝑘𝑊2𝐷𝑗𝑘 × 𝑌𝑗𝑘

Factories

Warehouses

Distributors

محدودیت ها

𝑖

𝑋𝑖𝑗 ≥

𝑘

𝑌𝑗𝑘

A

j

𝑗

𝑋𝑖𝑗 ≤ 𝑆𝑢𝑝𝑝𝑙𝑦𝑖

A

i

𝑋𝑖𝑗≥ 0 𝑋𝑖𝑗∈ int

𝑌𝑗𝑘≥ 0 𝑌𝑗𝑘∈ int

A

i,j

A

j,k

محدودیت عالمت

32

Page 33: GAMS Modeling - Sharifie.sharif.ir/~ali.ekhlasi/GAMS_Ekhlassi.pdf · j = {Dubai, Tehran} k = {Tabriz, Esfahan, Shiraz} Supply = 100 50 40 Demand = 60 40 70 Table F2W(i,j) Shipping

GAMS

i = {Samsung, LG, Apple}

j = {Dubai, Tehran}

k = {Tabriz, Esfahan, Shiraz}

Setsi index of factories /Samsung, LG, Apple/j index of warehouses /Dubai, Tehran/k index of distributors /Tabriz, Shiraz, Esfahan/

33

Page 34: GAMS Modeling - Sharifie.sharif.ir/~ali.ekhlasi/GAMS_Ekhlassi.pdf · j = {Dubai, Tehran} k = {Tabriz, Esfahan, Shiraz} Supply = 100 50 40 Demand = 60 40 70 Table F2W(i,j) Shipping

GAMS

i = {Samsung, LG, Apple}

j = {Dubai, Tehran}

k = {Tabriz, Esfahan, Shiraz}

ParametersSupply(i) amount of factory supply /Samsung 100, LG 50, Apple 40/Demand(k) amount of distributor demand /Tabriz 60, Esfahan 40, Shiraz 70/;

Supply = 1005040

Demand = 604070

Setsi index of factories /Samsung, LG, Apple/j index of warehouses /Dubai, Tehran/k index of distributors /Tabriz, Shiraz, Esfahan/

34

Page 35: GAMS Modeling - Sharifie.sharif.ir/~ali.ekhlasi/GAMS_Ekhlassi.pdf · j = {Dubai, Tehran} k = {Tabriz, Esfahan, Shiraz} Supply = 100 50 40 Demand = 60 40 70 Table F2W(i,j) Shipping

GAMS

i = {Samsung, LG, Apple}

j = {Dubai, Tehran}

k = {Tabriz, Esfahan, Shiraz}

Supply = 1005040

Demand = 604070

Table F2W(i,j) Shipping cost between factory and warehouseDubai Tehran

Samsung 5 9LG 4 7Apple 6 10;

Table W2D(j,k) Shipping cost between warehouse and distributorTabriz Esfahan Shiraz

Dubai 3 4 7Tehran 2 5 3;

F2W = 5 94 76 10

W2D = 3 4 72 5 3

ParametersSupply(i) amount of factory supply /Samsung 100, LG 50, Apple 40/Demand(k) amount of distributor demand /Tabriz 60, Esfahan 40, Shiraz 70/;

Setsi index of factories /Samsung, LG, Apple/j index of warehouses /Dubai, Tehran/k index of distributors /Tabriz, Shiraz, Esfahan/

35

Page 36: GAMS Modeling - Sharifie.sharif.ir/~ali.ekhlasi/GAMS_Ekhlassi.pdf · j = {Dubai, Tehran} k = {Tabriz, Esfahan, Shiraz} Supply = 100 50 40 Demand = 60 40 70 Table F2W(i,j) Shipping

GAMS

𝑋𝑖𝑗≥ 0 𝑋𝑖𝑗∈ int

𝑌𝑗𝑘≥ 0 𝑌𝑗𝑘∈ int

A

i,j

A

j,k

Variables z objective function;

Integer VariablesX(i,j) quantity of goods moved between factory and warehouseY(j,k) quantity of goods moved between warehouse and distributor;

X.up(i,j) = 1000;Y.up(j,k) = 1000;

36

Page 37: GAMS Modeling - Sharifie.sharif.ir/~ali.ekhlasi/GAMS_Ekhlassi.pdf · j = {Dubai, Tehran} k = {Tabriz, Esfahan, Shiraz} Supply = 100 50 40 Demand = 60 40 70 Table F2W(i,j) Shipping

GAMS

𝑋𝑖𝑗≥ 0 𝑋𝑖𝑗∈ int

𝑌𝑗𝑘≥ 0 𝑌𝑗𝑘∈ int

A

i,j

A

j,k

EquationsObj objective function

Factories(i) Factories production constraintWarehouses(j) warehouses constraintDistributors(k) Distributors demand constraint;

Obj .. z =e= sum( (i,j) , F2W(i,j) * X(i,j) ) + sum( (j,k) , W2D(j,k) * Y(j,k) );Factories(i) .. sum( j , X(i,j) ) =l= Supply(i); Warehouses(j) .. sum( i , X(i,j) ) =g= sum( k , Y(j,k) );Distributors(k) .. sum( j , Y(j,k) ) =g= Demand(k);

Z = σ𝑖σ𝑗 𝐹2𝑊𝑖𝑗 × 𝑋𝑖𝑗 + σ𝑗σ𝑘𝑊2𝐷𝑗𝑘 × 𝑌𝑗𝑘

𝑗

𝑌𝑗𝑘 ≥ 𝐷𝑒𝑚𝑎𝑛𝑑𝑘

A

k

𝑖

𝑋𝑖𝑗 ≥

𝑘

𝑌𝑗𝑘

A

j

𝑗

𝑋𝑖𝑗 ≤ 𝑆𝑢𝑝𝑝𝑙𝑦𝑖

A

i

Variables z objective function;

Integer VariablesX(i,j) quantity of goods moved between factory and warehouseY(j,k) quantity of goods moved between warehouse and distributor;

X.up(i,j) = 1000;Y.up(j,k) = 1000;

37

Page 38: GAMS Modeling - Sharifie.sharif.ir/~ali.ekhlasi/GAMS_Ekhlassi.pdf · j = {Dubai, Tehran} k = {Tabriz, Esfahan, Shiraz} Supply = 100 50 40 Demand = 60 40 70 Table F2W(i,j) Shipping

GAMS

Model Spring2020 /all/;Solve Spring2020 using MIP minimizing Z;

Display X.l, Y.l, Z.l;

38