I am writing to seek assistance with several issues and errors I am encountering in my GAMS code. I am currently working on a model that involves importing data from a TXT file. My GAMS code:
* Define sets and parameters based on bank data
Set
i /1*3/ ! Input categories: labor, physical capital, equity capital
r /1*2/ ! Output categories: net operating income, non-performing loans
j /1*2/ ! Banks (DMUs)
t /2018*2021/ ! Time period
kh /1*2/; ! Links between stages: Deposits, Loans, Securities
Alias(j,k);
* Parameters: input and output data for banks
Parameter
xt(i,j,k,t) "Inputs for bank j in stage k at time t"
yt(r,j,k,t) "Outputs for bank j in stage k at time t"
Zfree(kh,t) "Linking intermediate products"
Zbadcarry(k,t) "Undesirable carry-over activities";
* Including data from external source txt formatted for GAMS
INCLUDE C:\Users\S M T\Desktop\chapter1\Book1.TXT; ! Bank data inputs in txt format
* Variables for model
Variable lambda(j,k,t), smin(i,k,t), splus(r,k,t);
Variable zfree(j,kh,t), slack(kh,t), zbadcarry(j,k,t), sbadcarry(j,k,t);
Variable theta, Wt(t), wk(k);
* Equation 1: Summation constraint for intensities
Equation eq1;
eq1(j,k,t).. sum(j, lambda(j,k,t)) =e= 1;
* Equation 2: Input-output matrices and slacks
Equation eq2x, eq2y;
eq2x(i,k,t).. xt(i,j,k,t) =g= sum(j, lambda(j,k,t)) + smin(i,k,t);
eq2y(r,k,t).. yt(r,j,k,t) =l= sum(j, lambda(j,k,t)) - splus(r,k,t);
* Equation 3: Free linking of activities between stages
Equation eq3;
eq3(kh,t).. Zfree(kh,t) =e= sum(j, lambda(j,kh,t)) + slack(kh,t);
* Equation 4: Free link slack between stages
Equation eq4;
eq4(kh,t).. zfree(j,kh,t) =e= Zfree(kh,t)*lambda(j,k,t) + slack(kh,t);
* Equation 5: Undesirable carry-over activities
Equation eq5;
eq5(k,t).. zbadcarry(j,k,t) =g= Zbadcarry(k,t)*lambda(j,k,t) + sbadcarry(j,k,t);
* Equation 6: Efficiency objective function
Equation objective;
objective.. theta =e= min(sum(t, Wt(t) * sum(k, wk(k) * (1 - (1/(3+2)) * sum(i, smin(i,k,t)/xt(i,k,t)
+ sbadcarry(k,t)/Zbadcarry(k,t))))
+ sum(k, wk(k) * (1 + (1/(2+2)) * sum(r, splus(r,k,t)/yt(r,k,t)))))));
* Model definition and solving
Model efficiencyModel /all/;
Solve efficiencyModel using lp minimizing theta;
* Use 'put' to output the results
File output /'results.txt'/;
put output;
put "Objective Function Value: ", theta.l /;
loop((j,k,t),
put "Lambda(", j, ",", k, ",", t, "): ", lambda.l(j,k,t) /;
);