*==>scarfbnum.gms $offsymxref offsymlist offuellist offuelxref $title: Scarf's activity analysis example $inlinecom /* */ /* --------------------------------------------------------------- Reference: H. Scarf, The Computation of Economic Equilibria", (Yale University Press, New Haven, Connecticut, 1973). This is a Walrasian model, with 14 commodities, 4 consumers, and 26 sectors of production (activities). It is the second and larger of the two described by Scarf in Chapter 5.3 of the above reference. The optimal commidity prices p(COM) in this model are determined only up to a positive factor. The price system can be normalized by fixing a numeraire or by fixing the sum of the prices. In this model, we take the former approach of fixing a numeraire. If no normalization of the price system is desired, comment out the line fx-ing the numeraire price. --------------------------------------------------------------- */ sets run / run1 * run3 /, COM /* commodities */ / agri, food, textile, hserv, /* housing services and heating */ fun, /* entertainment */ houseop, /* housing, end of period */ capeop, /* other capital, eop */ steel, coal, wood, housbop, /* housing, beginning of period */ capbop, /* other capital, bop */ labor, forex /, /* foreign exchange */ CNR / 1 * 4 /, /* consumers */ S / 1 * 26 /; /* production sectors or activities */ alias (COM,CCOM); parameters esub (CNR), /* Elasticities of substitution in demand */ alpha(COM,CNR), /* demand function share parameters */ act(COM,S), /* Activity analysis (input/output) matrix */ e(COM,CNR), /* Consumer's initial commodity endowments */ includerun (run) / run1 01 run2 01 run3 01 /; /* first two init pts are from Harker & Xiao's paper */ $include 'scarfb.dat' /* ensure each consumer's demand share parameters sum to 1 */ loop (CNR, abort $ (abs (sum (COM, alpha(COM,CNR)) - 1) gt 1e-5) "Error in demand share parameters for consumer ", CNR; ); parameter iprice(COM,run), iprod(S, run); iprice(COM,"run1") = 1 / card(COM); iprod(S,"run1") = 1; iprice(COM,"run2") = 1 / card(COM); iprod(S,"run2") = 0; scalars eps1 / 1.0e-5 /; positive variables p(COM), /* commodity prices */ y(S); /* levels of production */ equations supply(COM), /* excess supply of commodities */ profit(S); /* (opposite of) profit for activity */ supply(COM) .. sum(S, act(COM,S)*y(S)) /* production */ + sum(CNR, e(COM,CNR)) /* initial endowment */ =g= sum (cnr$(esub(cnr) ne 1), /* consumer demand (Cobb-Douglas func) */ alpha(com,cnr) * p(com)**(-esub(cnr)) * sum (ccom, p(ccom)*e(ccom,cnr)) / sum (ccom, p(ccom)**(1-esub(cnr)) * alpha(ccom,cnr)) ) + sum (cnr$(esub(cnr) eq 1), /* consumer demand (CES func) */ ( alpha(com,cnr) * sum (ccom, p(ccom)*e(ccom,cnr)) ) / p(com) ); profit(S) .. 0 =g= sum(COM, P(COM) * act(COM,S)); model scarf / supply.p, profit.y /; option real1 = 1; option limrow = 0; option limcol = 0; option iterlim = 1000; option reslim = 120; option domlim = 30; *p.lo(com) = 0.0001$(smax(cnr, alpha(com,cnr)) gt eps1); loop (run, if (includerun (run), p.l(COM) = iprice(COM,run); y.l(S) = iprod(S,run); /* fix the price of numeraire commodity */ p.fx("capbop") = max (1e-1, p.l("capeop")); solve scarf using mcp; ));