|
Manual approach |
Top Previous Next |
|
Suppose we have an existing model and we wish to do a comparative analysis altering commodity prices. In this case we will use as a base a farm profit-maximizing model that is called farmcomp.gms. Within that model we have a vector of commodity prices
PARAMETER price(primary) prices for products /corn 2.20 soybeans 5.00 beef 0.50/
and we wish to run a base case and two cases with alternative prices – a case with the beef price at $0.70 and one with the corn price at $2.70. Suppose we also have programmed a report writer using the techniques discussed in the Improving Output via Report Writing chapter and placed the calculations for it in the file farmrep.gms. When that file is included using the $Include syntax as discussed in Including External Files chapter we get a report on whatever solution was generated by the last solve executed in the GAMS program. This report consists of a number of tables. We will only focus on the one below
Set alli allitems /Corn,Soybeans,Beef ,cattle Water,Cropland,Pastureland Fertilizer,Seed,Othercost, Veternary, Supplement "April Labor","May Labor" "Summer Labor","Sept Labor","Oct Labor", Cattlefeed Total/ Set measures output measures / "Net Income", "Land use", "Dry Cropping", "Irr Cropping", "Livestock", "Resource Value","Product Value"/ Parameter summary(alli,measures) Farm Summary;
which computes the report summary which contains rows for the major commodities as named in the alli set and the columns identified in the measures set. Now given this code we can accomplish a comparative analysis in the file mancomp.gms as follows
$include Farmcomp.gms display price; $include Farmrep.gms price("beef")=0.70; SOLVE Firm USING LP MAXIMIZING NETINCOME; display price; $include Farmrep.gms price("corn")=2.70; SOLVE Firm USING LP MAXIMIZING NETINCOME; display price; $include Farmrep.gms
This code
This yields in the LST file a display arising from line 287 which is associated with the Base model gives
---- 266 PARAMETER SUMMARY Farm Summary Net Income Land use Dry Cropp~ Irr Cropp~ Livestock Resource ~ Product V~ Corn 20.00 200.00 2.20 Soybeans 480.00 5.00 Beef 0.50 cattle 615.79 Water 16.83 Cropland 700.00 128.49 Pastureland 130.00 84.26 Cattlefeed 4.71 Total 162685.05 500.00 200.00
while a display arising from line 359 which is associated with the $0.70 beef price gives
---- 359 PARAMETER SUMMARY Farm Summary Net Income Land use Dry Cropp~ Irr Cropp~ Livestock Resource ~ Product V~ Corn 22.84 160.85 2.34 Soybeans 489.86 5.00 Beef 0.70 cattle 866.67 Cropland 673.55 Pastureland 130.00 1456.90 Cattlefeed 4.89 Total 373686.10 512.70 160.85
and the display arising from line 431 which is associated with the $2.70 corn price gives
---- 431 PARAMETER SUMMARY Farm Summary Net Income Land use Dry Cropp~ Irr Cropp~ Livestock Resource ~ Product V~ Corn 31.98 200.00 2.70 Soybeans 410.24 5.00 Beef 0.70 cattle 866.67 Water 15.99 Cropland 642.22 Pastureland 130.00 1316.09 Cattlefeed 5.36 Total 375839.30 442.22 200.00
Now let's appraise how good this is. In my judgment it is not so good for four reasons
Lets fix these up. |