$Title Chapter 1 (Fig. 1.5)
$Title An example of importing data from Excel to GAMS
$Title Data for supply (Si), demand (Dj), and unit transportation cost (ci,j)
$Title You need to save the dataset "Chapter1_data.xls" in the same folder of this file.
$onText
If using this code, please cite:
---------------------------------------------------------------------------------
Emrouznejad, A., P. Petridis, and V. Charles (2023). Data Envelopment Analysis
with GAMS: A Handbook on Productivity Analysis, and Performance Measurement,
Springer, ISBN: 978-3-031-30700-3.
---------------------------------------------------------------------------------
Website: https://dataenvelopment.com/GAMS/
$offText
Sets i Plants /Plant1*Plant3/
j Markets /Market1*Market4/;
$CALL GDXXRW.EXE Chapter1_data.xls par=S rng=Sheet1!B3:C5 Rdim=1
Parameter S(i);
$GDXIN Chapter1_data.gdx
$LOAD S
$GDXIN
$CALL GDXXRW.EXE Chapter1_data.xls par=D rng=Sheet1!E3:F6 Rdim=1
Parameter D(j);
$GDXIN Chapter1_data.gdx
$LOAD D
$GDXIN
$CALL GDXXRW.EXE Chapter1_data.xls par=c rng=Sheet1!H3:L6 Cdim=1 Rdim=1
Parameter c(i,j);
$GDXIN Chapter1_data.gdx
$LOAD c
$GDXIN
Variables
TC Total cost
Nonnegative variables
x(i,j) quantity transported from plant i to market j
Equations
TotalCost objective function
Supply(i) supply constraint
Demand(j) demand constraint;
TotalCost.. TC=E=SUM(i,SUM(j,c(i,j)*x(i,j)));
Supply(i).. SUM(j,x(i,j))=L=S(i);
Demand(j).. SUM(i,x(i,j))=G=D(j);
Model Transportation_example /All/
Solve Transportation_example min TC using LP
Display TC.l, x.l, x.m;