Hey,

I am a new GAMS user. I am trying to build a partial equilibirum model. Ideally, in the results profit function should be equal to zero. However, the results give positive profit.

Could you please advise what I might done wrong?

Thanks,

Aziz

$offlisting

Option solprint = on;

Option limrow = 0;

Option limcol = 0;

SETS

ITER Negishi Iterations /IT1*IT6/

J Farmers that produce commodity G (A=Cotton and B=Wheat and C=Vegetables) /A,B,C/

;

PARAMETERS

scale only relative prices matter so scale all prices

RESULT(*,*,*) parameter for storing results

KS capital supply

LS labour supply

AS land supply

p(J) price of goods

R price of capital

w price of labour

i price of land

Y Total income

alpha(J) Expenditure shares of capital for production function

gamma(J) Expenditure shares of land for production function

beta(J) Technology level parameter for production function

Kappa Share of cotton in utility function (elasticity of cotton with respect to utility)

lambda Share of wheat in utility function (elasticity of wheat with respect to utility)

;

KS = 100

;

LS = 100

;

AS = 100

;

*the land supply (AS) is given as 100% and then the benchmark scenario is calibrated as distrubution of this 100% for different crops

alpha(“A”) = 0.951375516;

alpha(“B”) = 0.731496622;

alpha(“C”) = 0.707058144;

gamma(“A”) = 0;

gamma(“B”) = 0.239240717;

gamma(“C”) = 0.220353187;

beta(“A”) = 0.470455045

;

beta(“B”) = 0.69868095

;

beta(“C”) = 0.848599911

;

kappa = 0.3576

;

lambda = 0.0220

;

*initialization of prices

p(J) = 0.1;

R = 0.1;

w = 0.1;

i = 0.1;

POSITIVE VARIABLES

Q(J) crop G produced

C(J) consumption of crop G

K(J) capital demand for producing G

L(J) labor demand for producing G

A(J) land demand for producing G

;

VARIABLES

U utility from consumption

PRF(J) profits

;

*initialization and bounds for variables*

*K.L(J) = 0.1*KS;

K.LO(J) = 0.01; K.UP(J) = KS;

*L.L(J) = 0.5*LS;

L.LO(J) = 0.01; L.UP(J) = LS;

A.LO(J) = 0.01; A.UP(J) = AS;

Y = rKS + w*LS+i*AS;

C.LO(J) = 0.01;

EQUATIONS

EqU Utility function

EqQ(J) Production function of all three producers

EqO(J) Balance of consumption and production

EqKS Capital maximum is equal to capital stock

EqLS Labour maximum is equal to labour stock

EqAS Land maximum is equal to land stock

EqY Budget constraint

EqPRF(J) Profit function to ensure zero profit condition

;

EqU… U =E= (C(“A”)**kappa)***(C(“B”)**lambda)*(C(“C”)(1-kappa-lambda));

EqQ(J)… Q(J) =E= beta(J)*(K(J)**alpha(J))*(A(J)**gamma(J))*(L(J)**(1-alpha(J)-gamma(J)));

EqO(J)… C(J) =L= Q(J);

EqKS… KS =G= sum(J, K(J));

EqLS… LS =G= sum(J, L(J));

EqAS… AS =G= sum (J, A(J));

EqY… Y =G= sum(J, p(J)*C(J));*

EqPRF(J)… PRF(J) =E= p(J)*Q(J)-r*K(J)-wL(J)-i*A(J);

MODEL APEM /ALL/;

LOOP (ITER,

SOLVE APEM MAXIMIZING U USING DNLP;

p(J) = ABS(EqO.m(J));

R = ABS(EqKS.m);

w = ABS(EqLS.m);

i = ABS(EqAS.m);

Y = r*KS + w*LS+i*AS;

);

*The wage rate might be zero, therefore we may normalise on the price of capital*

IF(w LE 1E-05, scale = r; ELSE scale = w);

DISPLAY w, r, i, scale;

Y = Y/scale;

p(J) = p(J)/scale;

R = R/scale;

w = w/scale;

i= i/scale;

PRF.l(J) = P(J)*Q.l(J)-r*K.l(J)-wL.l(J)-i*A.l(J);

RESULT(“0. base”, “commodity price”,J) = p(J);

RESULT(“0. base”, “Capital price”,“total”) = R;

RESULT(“0. base”, “Wage”,“total”) = w;

RESULT(“0. base”, “income”,“total”) = Y;

RESULT(“0. base”, “production”,J) =Q.L(J);

RESULT(“0. base”, “consumption”,J)=C.L(J);

RESULT(“0. base”, “Utility”,“total”)=U.L;

RESULT(“0. base”, “A”,J)=A.L(J);

RESULT(“0. base”, “K”,J)=K.L(J);

RESULT(“0. base”, “L”,J)=L.L(J);

RESULT(“0. base”, “AT”,“total”)=A.L(“A”)+A.L(“B”)+A.L(“C”);

RESULT(“0. base”, “LT”,“total”)=L.L(“A”)+L.L(“B”)+L.L(“C”);

RESULT(“0. base”, “KT”,“total”)=K.L(“A”)+K.L(“B”)+K.L(“C”);

RESULT(“0. base”, “PRF”,J)=PRF.l(J);

DISPLAY RESULT;

AS = 950

MODEL APEM_LD /ALL/;

LOOP (ITER,

SOLVE APEM_LD MAXIMIZING U USING DNLP;

p(J) = ABS(EqO.m(J));

R = ABS(EqKS.m);

w = ABS(EqLS.m);

i = ABS(EqAS.m);

Y = r*KS + w*LS+i*AS;

);

*The wage rate might be zero, therefore we may normalise on the price of capital*

IF(w LE 1E-05, scale = r; ELSE scale = w);

DISPLAY w, r, i, scale;

Y = Y/scale;

p(J) = p(J)/scale;

R = R/scale;

w = w/scale;

i= i/scale;

PRF.l(J) = P(J)*Q.l(J)-r*K.l(J)-wL.l(J)-i*A.l(J);

RESULT(“1. base”, “commodity price”,J) = p(J);

RESULT(“1. base”, “Capital price”,“total”) = R;

RESULT(“1. base”, “Wage”,“total”) = w;

RESULT(“1. base”, “income”,“total”) = Y;

RESULT(“1. base”, “production”,J) =Q.L(J);

RESULT(“1. base”, “consumption”,J)=C.L(J);

RESULT(“1. base”, “Utility”,“total”)=U.L;

RESULT(“1. base”, “A”,J)=A.L(J);

RESULT(“1. base”, “K”,J)=K.L(J);

RESULT(“1. base”, “L”,J)=L.L(J);

RESULT(“1. base”, “AT”,“total”)=A.L(“A”)+A.L(“B”)+A.L(“C”);

RESULT(“1. base”, “LT”,“total”)=L.L(“A”)+L.L(“B”)+L.L(“C”);

RESULT(“1. base”, “KT”,“total”)=K.L(“A”)+K.L(“B”)+K.L(“C”);

RESULT(“1. base”, “PRF”,J)=PRF.l(J);

DISPLAY RESULT;

189 PARAMETER RESULT parameter for storing results

A B C total

- base.A 0.010 3.707 96.283
- base.commodity price 28.772 21.772 18.239
- base.Capital price 12.605
- base.Wage 1.000
- base.income 1585.665
- base.production 19.708 1.602 53.937
- base.consumption 19.708 1.602 53.937
- base.Utility 34.828
- base.K 42.796 2.024 55.180
- base.L 27.571 1.021 71.408
- base.AT 100.000
- base.LT 100.000
- base.KT 100.000
- base.PRF -0.023 4.179262E-6 -6.21145E-9
- base.A 0.010 100.000 100.000
- base.commodity price 28.772 9.898 18.087
- base.Capital price 12.605
- base.Wage 1.000
- base.income 1360.528
- base.production 19.708 3.524 54.389
- base.consumption 19.708 3.524 54.389
- base.Utility 35.621
- base.K 42.796 2.024 55.180
- base.L 27.571 1.021 71.408
- base.AT 200.010
- base.LT 100.000
- base.KT 100.000
- base.PRF 4.60894E-11 8.346 216.769

EXECUTION TIME = 0.000 SECONDS 3 MB 24.2.2 r44857 WIN-VS8

USER: GAMS Development Corporation, Washington, DC G871201/0000CA-ANY

Free Demo, 202-342-0180, sales@gams.com, www.gams.com DC0000

–

To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.

To post to this group, send email to gamsworld@googlegroups.com.

Visit this group at http://groups.google.com/group/gamsworld.

For more options, visit https://groups.google.com/d/optout.