*---------------------------------------------------------------- * Rio Grande Basin Drought Study * Ag Water Values Analysis * * Elephant Butte Irrigation District, New Mexico * Data based on 1999 NMSU Farm Cost and Return Budgets * Dona Ana and Sierra Counties * ----------------------------------------------------------- file summary / ebidacrsum.txt/; summary.pw=250; * names output file * acreage by crop * by surface and groundwater supply * assigns pw = 250 cols file summary2 / ebidshsum.txt/; summary2.pw=250; * names output file * Shadow prices by water and land categories * assigns pw = 250 cols ************************************************************************ * GAMS code begins ************************************************************************ Scalars sw surface water in acre-inches, gw groundwater in acre-inches, psw dollar price per ac-in surf water irrig dist charge, pgw dollar price per ac-in grnd wat pumping--capit + fuel, watcost dollar fixed cost pr ac for irrig dist membership /11.00/ * EBID water cost is $45 per acre yearly for rights * to 2 acre feet per acre plus $17 per acre foot * for water beyond 2 a-f per acre. We use $17 * per acre foot (1.42 / a-inch) for all water, with a residual fixed * cost of 11, where 11 = 45 - (17 * 2) neg large neg alters net ret for some conditions /-20000./ alfestperc percent alfalfa estab /.25/ pestperc percent pasture establishment /.04/ baseacre acres in district for gw and sw avail calc /90640./ scalefact multiplier for percent change in acreage restrictions /1.0/ * defines scalars, without assigning total values to * total surface and groundwater till solve inside loop at end *********************************************************************** * SETS AND SUBSETS *********************************************************************** tveg threshhold totwater value for scaling of veg /0.01/ * totwater value below this threshhold lets upper and lower bounds on * vegetable acreage proportions to widen trow threshhold totwater value for scaling of rowcrops /0.01/ * totwater value below this threshhold lets upper and lower bounds on * row crop acreage proportions to widen tallgw threshhold totwater value for allowing allgw tchnolgy in /8.01/ * totwater values below this threshhold lets the allgw tchn into soln * totwater above preclude allgw and enforces negative net return for the crop tdeep threshold totwater value for allowing deep aquifer in /8.01/ * totwater values below threshhold lets dry pecan production in soln * So only the zero gw, zero sw case allows dry pecan prodn. ; set iter /it1*it49/ * sets water supply drought scenario number, 7 x 7 levels of sw and gw b1 /sw, gw, psw, pgw, hay, cotton, lettuce, wheat, onions, chile, pecans, corntot, irrpast, tot_income, tot__acres, inc_p_acre, vegc_acres, rowc_acres/ * b1: column headings for acreage output display b2 /sw, gw, psw, pgw, sw_shprice, gw_shprice, dw_shprice, lnd_veg_sp, lnd_row_sp, lnd_pec_sp/ * b2: column headings for shadow price output display item /sw, gw, gwdeep, base, mix, allgw, dry, vscale, rscale, totwat, psw, pgw, pdw/ * 4 production tchnolgys: surface water (sw), groundwater (gw), * base (historical cropping based on NMSU farm enterprise budgets), * mix (half sw half gw), * allgw (all gw), * dry (expensive deep aquifer pumping when sw and gw are gone). * (vscale, rscale) used to vary the net returns options and/or widening * acreage proportions. * totwat is sum of the sw and gw by drought iteration. tech(item) /base, mix, allgw, dry/; * defines water application technologies for irrigated crop production table code(iter,item) sw gw base mix psw pgw it1 36.0 36.0 1.0 1.0 1.42 5.08 it2 30.0 36.0 1.0 1.0 1.42 5.08 it3 24.0 36.0 1.0 1.0 1.42 5.08 it4 18.0 36.0 1.0 1.0 1.42 5.08 it5 12.0 36.0 1.0 1.0 1.42 5.08 it6 6.0 36.0 1.0 1.0 1.42 5.08 it7 0.0 36.0 1.0 1.0 1.42 5.08 it8 36.0 30.0 1.0 1.0 1.42 5.08 it9 30.0 30.0 1.0 1.0 1.42 5.08 it10 24.0 30.0 1.0 1.0 1.42 5.08 it11 18.0 30.0 1.0 1.0 1.42 5.08 it12 12.0 30.0 1.0 1.0 1.42 5.08 it13 6.0 30.0 1.0 1.0 1.42 5.08 it14 0.0 30.0 1.0 1.0 1.42 5.08 it15 36.0 24.0 1.0 1.0 1.42 5.08 it16 30.0 24.0 1.0 1.0 1.42 5.08 it17 24.0 24.0 1.0 1.0 1.42 5.08 it18 18.0 24.0 1.0 1.0 1.42 5.08 it19 12.0 24.0 1.0 1.0 1.42 5.08 it20 6.0 24.0 1.0 1.0 1.42 5.08 it21 0.0 24.0 1.0 1.0 1.42 5.08 it22 36.0 18.0 1.0 1.0 1.42 5.08 it23 30.0 18.0 1.0 1.0 1.42 5.08 it24 24.0 18.0 1.0 1.0 1.42 5.08 it25 18.0 18.0 1.0 1.0 1.42 5.08 it26 12.0 18.0 1.0 1.0 1.42 5.08 it27 6.0 18.0 1.0 1.0 1.42 5.08 it28 0.0 18.0 1.0 1.0 1.42 5.08 it29 36.0 12.0 1.0 1.0 1.42 5.08 it30 30.0 12.0 1.0 1.0 1.42 5.08 it31 24.0 12.0 1.0 1.0 1.42 5.08 it32 18.0 12.0 1.0 1.0 1.42 5.08 it33 12.0 12.0 1.0 1.0 1.42 5.08 it34 6.0 12.0 1.0 1.0 1.42 5.08 it35 0.0 12.0 1.0 1.0 1.42 5.08 it36 36.0 6.0 1.0 1.0 1.42 5.08 it37 30.0 6.0 1.0 1.0 1.42 5.08 it38 24.0 6.0 1.0 1.0 1.42 5.08 it39 18.0 6.0 1.0 1.0 1.42 5.08 it40 12.0 6.0 1.0 1.0 1.42 5.08 it41 6.0 6.0 1.0 1.0 1.42 5.08 it42 0.0 6.0 1.0 1.0 1.42 5.08 it43 36.0 0.0 1.0 1.0 1.42 5.08 it44 30.0 0.0 1.0 1.0 1.42 5.08 it45 24.0 0.0 1.0 1.0 1.42 5.08 it46 18.0 0.0 1.0 1.0 1.42 5.08 it47 12.0 0.0 1.0 1.0 1.42 5.08 it48 6.0 0.0 1.0 1.0 1.42 5.08 it49 0.0 0.0 1.0 1.0 1.42 5.08 ; code(iter,'totwat')=code(iter,'sw') + code(iter,'gw'); * Vscale is a calculated change applied to upper and lower bound * of acreage proportions. This change is only active if totwater * IS BELOW threshold value defined by user above. * For example, suppose sw = 1.0 af and gw = 0.5 af and tveg = 2.0 * Then totwat = 1.5, and calc sets vscale to the * max(0, 1*(1-1.5/2)) = max (0, 1 - .75) = .25. * So if drought scenario value of totwat is 25 pct below threshold and * proportions on the vegetable crops can widen, more profitable vege crops * are allowed to enter at a larger proportion than normal, and lets * less profitable veges have a smaller proportion or even be dropped * from final solution if potential lower bound proportion = zero. * Rscale Calcations is same thing for row crops. * Scalefact (usually set to 1) allows user to speed or slow * how fast widening of the bounds occurs as drought intensifies code(iter,'vscale')=max(0, scalefact*(1. - ((code(iter,'totwat'))/tveg))); code(iter,'rscale')=max(0, scalefact*(1. - ((code(iter,'totwat'))/trow))); * Similar threshholds specified for allgw and dry production activities. * For full water allocations these options are unlikely to be included * in set of production activities. But as drought intensifies, * 'totwat' declines below threshhold values tallgw and tdeep. * When totwat falls below threshhold levels, net returns matrix no longer * altered to have large negative net returns for allgw and dry activities. * Those production options then can compete with base and mix activities. code(iter,'allgw') = (1.-((code(iter,'totwat')) / tallgw)); code(iter,'dry') = (1.-((code(iter,'totwat')) / tdeep)); option code:4:1:1; display code ; *************************************************************** set resource lists all water and land resources--land divided into 3 kinds /sw, gw, gwdeep, landveg, landrow, landpec/ watlevel water application--high is high application with high yield /high, medium, low/ * not used for now, but it would be nice to add an index * for water intensity. Can't figure out how to pull it off * without messing up the rest of the program res2 traps errors in equal spacing of water input to crop wat prodn fn /swfix, swvar, gw/ crop lists all crops in the available suite /alfest, alf, alfshort, sudan, silage, pima, pimashort, pimaxshort, upland, upshort, flettuce, slettuce, wht, fallonion, midonion, swsponion, greenchile, redchile, pecan, pasture, pastest, corn / vegcrop(crop) lists vegetable crop subset /flettuce, slettuce, fallonion, midonion, swsponion, greenchile, redchile/ rowcrop(crop) lists row crop subset /alfest, alf, alfshort, sudan, silage, wht, pima, pimashort, pimaxshort, upland, upshort, pasture, pastest, corn / g1(b1) group 1 subset for total crop production sums /hay, cotton, lettuce, wheat, onions, chile, pecans, corntot, irrpast/ pyvar price-yield-income-cost crop data from NMSU farm budgets /p1, y1, p2, y2, othinc, tvc/ corr1(g1,crop) set elements within group g1 for crop prod sums /hay. (alfest, alf, alfshort, sudan, silage) cotton. (pima, pimashort, pimaxshort, upland, upshort) lettuce. (flettuce, slettuce) wheat. (wht) onions. (fallonion, midonion, swsponion) chile. (greenchile, redchile) pecans. (pecan) corntot. (corn) irrpast. (pastest,pasture) / g2 set for acreage limits /totfonion, totmonion, totssonion, totgrch, totrch, totslet, totflet, totalf, totpima, totup, totwht, totsudan, totsilage, totpast, totcorn / g3 indices for all water application technologies /sw, gw, gwdeep/ veg(g2) group for vegetable acreage limits /totfonion, totmonion, totssonion, totgrch, totrch, totslet, totflet / row(g2) group for rowcrop acreage limits -- note no pecans here /totalf, totpima, totup, totwht, totsudan, totsilage, totpast, totcorn / corr2(veg,crop) set elements for vegetable acre limits /totfonion.fallonion totmonion.midonion totssonion.swsponion totgrch.greenchile totrch.redchile totslet.slettuce totflet.flettuce / corr3(row,crop) set elements for row crop acre limits /totalf. (alf, alfest, alfshort) totpima. (pima, pimashort, pimaxshort) totup. (upland, upshort) totsudan. (sudan) totsilage. (silage) totpast. (pasture, pastest) totwht. (wht) totcorn. (corn) / ; set bnd /lprop, uprop, mid, ubmax, ubacre, alprop, auprop/ ; * set elements used to define upper and lower bounds on * acreage proportions for selected crop classes ************************************************************** * DATA ************************************************************** table prop(g2, bnd) lprop uprop ubmax totalf 0.2957 0.4647 1.1 totcorn 0.0676 0.1521 1.1 totpast 0.0176 0.0351 1.1 totpima 0.1859 0.5069 1.1 totsilage 0.0169 0.1690 1.1 totsudan 0.0000 0.0000 0.0 totup 0.0845 0.1859 1.1 totwht 0.0338 0.0845 1.1 totflet 0.0499 0.1995 1.1 totfonion 0.0797 0.1396 1.1 totgrch 0.2397 0.4194 1.1 totmonion 0.0797 0.1396 1.1 totrch 0.2397 0.4194 1.1 totslet 0.0100 0.0401 1.1 totssonion 0.0797 0.1396 1.1 ; ***************************************************************** * lprop = lower bound proportion * uprop = upper bound proportion * mid = midpoint of lprop and uprop * ubmax = percent increase above normal uprop (1.1 = 10% increase) * This option lets total absolute acreage of a crop be slightly * higher than historical upper proportion. In severe drought, absolute * acres of a profitable crop can exceed historical highs due to > profit * ubacre = absolute acre upper bound for crop (not proportion) * alprop = adjusted lower proportion * auprop = adjusted upper proportion * These last two values allowed to change if total water * falls below thresholds tveg and/or trow. ***************************************************************** table bwatuse(crop,tech,g3) water use in ac-in pr acre by crop-tech-source sw gw gwdeep alfest.base 12.0 0.0 0.0 alfest.mix 6.0 6.0 0.0 alfest.allgw 0.0 12.0 0.0 alfest.dry 0.0 0.0 12.0 alf.base 60.0 0.0 0.0 alf.mix 30.0 30.0 0.0 alf.allgw 0.0 60.0 0.0 alf.dry 0.0 0.0 60.0 alfshort.base 42.0 0.0 0.0 alfshort.mix 21.0 21.0 0.0 alfshort.allgw 0.0 42.0 0.0 alfshort.dry 0.0 0.0 42.0 pima.base 33.0 0.0 0.0 pima.mix 16.5 16.5 0.0 pima.allgw 0.0 33.0 0.0 pima.dry 0.0 0.0 33.0 pimashort.base 27.0 0.0 0.0 pimashort.mix 13.5 13.5 0.0 pimashort.allgw 0.0 27.0 0.0 pimashort.dry 0.0 0.0 27.0 upland.base 33.0 0.0 0.0 upland.mix 16.5 16.5 0.0 upland.allgw 0.0 33.0 0.0 upland.dry 0.0 0.0 33.0 upshort.base 27.0 0.0 0.0 upshort.mix 13.5 13.5 0.0 upshort.allgw 0.0 27.0 0.0 upshort.dry 0.0 0.0 27.0 slettuce.base 30.0 0.0 0.0 slettuce.mix 15.0 15.0 0.0 slettuce.allgw 0.0 30.0 0.0 slettuce.dry 0.0 0.0 30.0 flettuce.base 40.0 0.0 0.0 flettuce.mix 20.0 20.0 0.0 flettuce.allgw 0.0 40.0 0.0 flettuce.dry 0.0 0.0 40.0 wht.base 30.0 0.0 0.0 wht.mix 15.0 15.0 0.0 wht.allgw 0.0 30.0 0.0 wht.dry 0.0 0.0 30.0 fallonion.base 56.0 0.0 0.0 fallonion.mix 28.0 28.0 0.0 fallonion.allgw 0.0 56.0 0.0 fallonion.dry 0.0 0.0 56.0 midonion.base 48.0 0.0 0.0 midonion.mix 24.4 24.0 0.0 midonion.allgw 0.0 48.0 0.0 midonion.dry 0.0 0.0 48.0 swsponion.base 56.0 0.0 0.0 swsponion.mix 28.0 28.0 0.0 swsponion.allgw 0.0 56.0 0.0 swsponion.dry 0.0 0.0 56.0 greenchile.base 55.0 0.0 0.0 greenchile.mix 27.5 27.5 0.0 greenchile.allgw 0.0 55.0 0.0 greenchile.dry 0.0 0.0 55.0 redchile.base 60.0 0.0 0.0 redchile.mix 30.0 30.0 0.0 redchile.allgw 0.0 60.0 0.0 redchile.dry 0.0 0.0 60.0 pastest.base 12.0 0.0 0.0 pastest.mix 6.0 6.0 0.0 pastest.allgw 0.0 12.0 0.0 pastest.dry 0.0 0.0 12.0 pasture.base 60.0 0.0 0.0 pasture.mix 30.0 30.0 0.0 pasture.allgw 0.0 60.0 0.0 pasture.dry 0.0 0.0 60.0 corn.base 48.0 0.0 0.0 corn.mix 24.0 24.0 0.0 corn.allgw 0.0 48.0 0.0 corn.dry 0.0 0.0 48.0 silage.base 36.0 0.0 0.0 silage.mix 18.0 18.0 0.0 silage.allgw 0.0 36.0 0.0 silage.dry 0.0 0.0 36.0 pecan.base 72.0 0.0 0.0 pecan.mix 36.0 36.0 0.0 pecan.allgw 0.0 72.0 0.0 pecan.dry 0.0 0.0 72.0 ; parameter watuse(crop,tech,g3) water use if crop efficiency improves ; watuse(crop,tech,g3) = 1.00 * bwatuse(crop,tech,g3); * allows for water use greater or less than base historical water use * states economic impacts of developing drought resistent crops * unity coefficient could vary by crop or technology if necessary ****************************************************************** * Fixed versus variable surface water sums to total surface water. * Mix of groundwater and total surface water * is symmetric, which permits equal spacing in crop production fn * Result is 4 possible crop-water technologies: * (1) all surface water, * (2) 50% surface 50% groundwater * (3) all groundwater. * (4) deep aquifer pumping * * First 3 are equally spaced in input space. This sets up * for future work to allow smaller substitution increments, * for example 10% jumps instead of 50%. * The symmetry / equal spacing permits error trapping for * impacts of substituting groundwater for surface water on * reducing crop yields and/or increasing variable pumping costs. * The symmetry guarantees falling net returns at a constant * or increased rate with higher percentages of groundwater * in production mix. * Mathematically this increasing marginal loss assures convex * sets with well-behaved, consistent, and monotonic changes in crop * mix in the face of increased drought severity. ******************************************************************* parameter resuse(crop, resource, tech) land + water resource use swcost(crop, tech) surface water cost pr ac --price pr a-in * a-in pr ac gwcost(crop, tech) groundwater cost pr ac --price pr a-in * a-in pr ac dwcost(crop, tech) deep aq gw cost pr ac --price pr a-in * a-in pr ac twatcost(crop, tech) total water cost pr ac --sum of prices * quantities nrbase(crop, tech) base net returns--total rev minus all nonwater costs nr(iter, crop, tech) base net returns--set up for iterating in solve loop netret(crop, tech) final net returns--subtracts water costs in solv loop * next are several post-optimality parameters--values known only after solve * used for displays nrac net returns per acre --post optimality calculation sw_use total surface water use in acre inches--le supply gw_use total ground water use in acre inches--le supply sw_use_afa surface water used-- acre feet per acre optimally farmed gw_use_afa ground water used -- acre feet per acre optimally farmed inc_swat total net income w surface water minus net inc w groundwater only swat_bill total money charges for all surface water used gwat_bill total money charges for all ground water used tv_sw tot value sw = tot net income + total surf water charges tv_gw tot value gw = tot net income + total grnd water charges a_inc_sw average tot net income per acre inch surf water used a_inc_gw average tot net income per acre inch grnd water used a_bill_sw average price per a-in surf water used (water price) a_bill_gw average price per a-in grnd water used (water price) a_tval_sw average total value per a-in surface water (income + water price) a_tval_gw average total value per a-in groundwater (income + water price) m_inc_sw marginal net income per acre inch surf water used m_inc_gw marginal net income per acre inch grnd water used m_bill_sw marginal price per acre inch surf water used (water price) m_bill_gw marginal price per acre inch grnd water used (water price) m_tval_sw marginal tot value per a-in surf water (income + water price) m_tval_gw marginal tot value per a-in grnd water (income + water price) ; parameter resavail(resource) total land + water supplies / gwdeep 100000000., landveg 13800., landrow 48930., landpec 19950. / * surf and ground w supplies defined later in solve loop wrprice(resource) price per acre inch by water source + land prices / gwdeep 5.08 landveg 0.0 landrow 0.0 landpec 0.0 / * varying surface and groundwater price defined later inside solve loop ; resuse(vegcrop,"landveg",tech) = 1.0; resuse(rowcrop,"landrow",tech) = 1.0; resuse('pecan',"landpec",tech) = 1.0; * Land in vegetables, row crops, and pecans per unit of land use = 1 resuse(crop,'sw',tech) = watuse(crop,tech,'sw'); resuse(crop,'gw',tech) = watuse(crop,tech,'gw'); resuse(crop,'gwdeep',tech) = watuse(crop,tech,'gwdeep'); * resource use includes water use by relevent indices * ----------------------------------------------------------------* * resuse(crop, 'sw', 'base') = 1.0 * resuse(crop, 'gw', 'allgw'); * resuse(crop, 'sw', 'mix') = 0.5 * resuse(crop, 'sw', 'base'); * resuse(crop, 'gw', 'mix') = 0.5 * resuse(crop, 'gw', 'allgw'); * ----------------------------------------------------------------* * Test code to see if equal marginal water values for sw, gw, gwdeep * when all 4 crop water prodn technologies have * (1) equal net returns and * (2) equal total water use * A water use tech with higher net returns has higher marg value of water * A water use tech using more of a given water source has lower marg value twatcost(crop, tech) = sum(resource, resuse(crop, resource, tech) * wrprice(resource)); * Per acre total water cost = water uses times prices summed over wat sources display resuse; display resavail; display twatcost; prop(g2,'mid') = (prop(g2,'lprop') + prop(g2,'uprop'))/2 ; prop(veg,'ubacre') = prop(veg,'uprop') * prop(veg,'ubmax')*resavail('landveg'); prop(row,'ubacre') = prop(row,'uprop') * prop(row,'ubmax')*resavail('landrow'); * Calculates midpoint of upper and lower proportions * Midpnt calculates absolute change altered from init lower bound * lets acreage proportions widen as drought intensifies. ************************************************************************** Table nrinfo(crop,tech,pyvar) price-cost-yield factors affect net ret pr ac p1 y1 p2 y2 othinc tvc alfest.base 0.00 0.00 0.00 0.00 0.00 274.80 alfest.mix 0.00 0.00 0.00 0.00 0.00 283.10 alfest.allgw 0.00 0.00 0.00 0.00 0.00 291.48 alf.base 95.00 8.00 0.00 0.00 0.00 418.98 alf.mix 95.00 7.60 0.00 0.00 0.00 403.44 alf.allgw 95.00 7.20 0.00 0.00 0.00 474.06 pima.base 1.08 741.00 0.05 1185.60 0.00 459.16 pima.mix 1.08 738.00 0.05 1180.80 0.00 474.14 pima.allgw 1.08 734.00 0.05 1174.40 0.00 534.88 upland.base 0.72 943.00 0.05 1508.80 61.48 534.62 upland.mix 0.72 939.00 0.05 1502.40 61.22 547.70 upland.allgw 0.72 934.00 0.05 1494.40 60.90 604.54 slettuce.base 6.05 464.00 0.00 0.00 0.00 2765.15 slettuce.mix 6.05 449.00 0.00 0.00 0.00 2721.87 slettuce.allgw 6.05 434.00 0.00 0.00 0.00 2695.11 flettuce.base 7.42 488.00 0.00 0.00 0.00 3007.03 flettuce.mix 7.42 473.00 0.00 0.00 0.00 2974.26 flettuce.allgw 7.42 457.00 0.00 0.00 0.00 2957.43 wht.base 3.60 81.00 0.00 0.00 51.03 292.85 wht.mix 3.60 80.00 0.00 0.00 50.40 321.39 wht.allgw 3.60 79.00 0.00 0.00 49.77 357.38 fallonion.base 5.61 825.00 0.00 0.00 0.00 4292.24 fallonion.mix 5.61 791.00 0.00 0.00 0.00 4171.51 fallonion.allgw 5.61 756.00 0.00 0.00 0.00 4113.62 midonion.base 6.08 675.00 0.00 0.00 0.00 3722.58 midonion.mix 6.08 647.00 0.00 0.00 0.00 3630.05 midonion.allgw 6.08 618.00 0.00 0.00 0.00 3580.06 swsponion.base 6.42 825.00 0.00 0.00 0.00 4648.14 swsponion.mix 6.42 790.00 0.00 0.00 0.00 4524.84 swsponion.allgw 6.42 756.00 0.00 0.00 0.00 4464.44 greenchile.base 285.00 9.90 0.00 0.00 0.00 2047.75 greenchile.mix 285.00 9.60 0.00 0.00 0.00 2039.79 greenchile.allgw 285.00 9.30 0.00 0.00 0.00 2095.54 redchile.base 0.68 3150.00 0.00 0.00 0.00 1787.40 redchile.mix 0.68 3057.00 0.00 0.00 0.00 1789.57 redchile.allgw 0.68 2963.00 0.00 0.00 0.00 1857.13 alfshort.base 95.00 5.60 0.00 0.00 0.00 385.27 alfshort.mix 95.00 5.32 0.00 0.00 0.00 428.10 alfshort.allgw 95.00 5.04 0.00 0.00 0.00 474.63 upshort.base 0.72 773.26 0.05 1237.22 50.42 501.74 upshort.mix 0.72 769.98 0.05 1231.97 50.20 531.34 upshort.allgw 0.72 765.88 0.05 1225.41 49.94 555.32 pimashort.base 1.08 607.62 0.05 972.19 0.00 430.25 pimashort.mix 1.08 605.16 0.05 968.26 0.00 459.69 pimashort.allgw 1.08 601.88 0.05 963.01 0.00 489.52 pecan.base 1.13 1912.00 0.00 0.00 0.00 1289.19 pecan.mix 1.13 1858.00 0.00 0.00 0.00 1314.46 pecan.allgw 1.13 1803.00 0.00 0.00 0.00 1386.49 pastest.base 0.00 0.00 0.00 0.00 0.00 123.22 pastest.mix 0.00 0.00 0.00 0.00 0.00 128.32 pastest.allgw 0.00 0.00 0.00 0.00 0.00 148.25 pasture.base 36.36 8.30 0.00 0.00 0.00 236.08 pasture.mix 36.36 8.30 0.00 0.00 0.00 267.15 pasture.allgw 36.36 8.20 0.00 0.00 0.00 396.90 corn.base 4.55 85.00 0.63 85.00 10.00 208.05 corn.mix 4.55 82.50 0.63 82.50 10.00 364.80 corn.allgw 4.55 80.00 0.63 80.00 10.00 521.69 silage.base 28.00 19.40 0.00 0.00 0.00 502.83 silage.mix 28.00 18.40 0.00 0.00 0.00 521.32 silage.allgw 28.00 17.50 0.00 0.00 0.00 569.21 pecan.dry 1.13 1803.00 0.00 0.00 0.00 1449.23 ; ************************************************************************* * price defined as (p1, p2), * yield defined as (y1,y2) * otherincome is other income from activity * tvc is total variable cost excluding all water costs * water costs are computed separately above * These data let us simulate different combinations * of crop price crop yield, and total variable nonwater cost * These data are taken from NMSU farm budgets for Dona Ana County, 1998. ************************************************************************** nrinfo(crop,'dry','othinc')$(nrinfo(crop,'dry','p1') eq 0.0) = neg; nrbase(crop,tech) = nrinfo(crop,tech,'p1') * nrinfo(crop,tech,'y1') + nrinfo(crop,tech,'p2') * nrinfo(crop,tech,'y2') + nrinfo(crop,tech,'othinc') - nrinfo(crop,tech,'tvc') ; display nrbase; * NET RETURNS EXCLUDES ALL WATER COSTS. WATER COSTS FOUND INSIDE SOLVE LOOP nr(iter,crop,tech) = nrbase(crop,tech); * SETS NET RETURNS DEFAULT FOR EACH ITERATION * (nr(iter,crop,tech)$(code(iter,tech) LE 0.)=nr(iter,crop,tech) + neg; * SETS NET RETURNS DEFAULT TO NEG NUMBER IF CODE FOR SCENARIO < 0 * BASED ON THRESHOLD ADJUSTMENTS BY MODEL USER nr(iter,crop,'mix') = nr(iter,crop,'base'); nr(iter,crop,'allgw')= nr(iter,crop,'base'); * TEST CODE * ASSURES = SHADOW PRICES OF SW AND GW * IF NET RETURNS ARE INDEPENDENT OF WATER TECHNOLOGY USED. * I.E. WATER IS WATER IF WATER COSTS AND YIELDS ARE = ACROSS TECHS display nr, resavail; ********************************************************* * VARIABLES FOLLOW ********************************************************* positive variables acre(crop,tech) ACRES BY CROP slack(resource) UNUSED RESOURCES (SW GW LAND ETC) totacr TOTAL INCOME MAXIMIZING ACRES PLANTED BY CROP finacre(g1) TOTALS FOR VARIOUS CROP SUMMARY CLASSES basecost FIXED WATER COST FOR ENTIRE DISTRICT INDEPENDENT OF SUPPLY totpec TOTAL PECAN ACRES totveg TOTAL VEGE ACRES totrow TOTAL ROW CROP ACRES ; variables profit GROSS PROFIT EXCLUDING EBID MEMBERSHIP CHARGE PER ACRE netprofit PROFIT NET OF EBID MEMBERSHIP CHARGE PER ACRE ; *********************************************************** * EQUATIONS FOLLOW *********************************************************** equations acmin1(veg) LOWER BOUNDS ON VEGETABLES (PROPORTION OF TOTAL VEGETABLES) acmin2(row) LOWER BOUNDS ON ROWCROPS (PROPORTION OF TOTAL ROW CROPS) rowmax1(row) UPPER BOUND ROWCROPS (PROPORTION OF TOTAL ROW CROPS) rowmax2(row) UPPER BOUND ROWCROPS (LIMIT ON TOTAL ABSOLUTE ACRES) vegmax1(veg) UPPER BOUND VEG CROPS (PROPORTION OF TOTAL VEG CROPS) vegmax2(veg) UPPER BOUND VEG CROPS (LIMIT ON TOTAL ABSOLUTE ACRES) pecbal COUNTS TOTAL PECAN CROP ACRES vegbal COUNTS TOTAL VEGE CROP ACRES rowbal COUNTS TOTAL ROW CROP ACRES bal COUNTS TOTAL CROP ACRES balpast PASTURE ESTABLISHMENT ACRES = FIXED PCT OF ALL PASTURE balalfestb ALFALFA ESTABLISHMENT ACRES = FIXED PCT OF ALL AFLALFA available(resource) CONSTRAINTS ON RESOURCES (LAND + WATER) totprod(g1) SUM ACRES FOR CROP AGGREGATE CATEGORIES fixwatc FIXED SURF WATER PRICE PR ACRE--NOT PR AC-FT--CONSTANT IN DRGHT grossprof GROSS PROFIT netprof NET PROFIT ; *** SETS ESTABLISHMENT ACRES AS A PCNT OF PASTURE AND ALFALFA balpast.. sum(tech,acre("pastest",tech)) =e= pestperc * sum(tech, acre("pasture",tech)); balalfestb.. sum(tech,acre("alfest",tech)) =e= alfestperc * sum(tech, (acre("alf",tech)+acre("alfshort",tech))); *** COUNTS ACRES OF VEGES, ROW CROPS, AND PECANS vegbal.. totveg =e= sum((veg,crop,tech)$corr2(veg,crop),acre(crop,tech)); rowbal.. totrow =e= sum((row,crop,tech)$corr3(row,crop),acre(crop,tech)); pecbal.. totpec =e= finacre('pecans'); *** COUNTS ACRES OF ALL CROPS bal.. totacr =e= sum((crop,tech),acre(crop,tech)); *** MINIMUMS ON VEGETABLES AND ROWCROPS acmin1(veg).. sum((crop,tech)$corr2(veg,crop),acre(crop,tech)) =g= prop(veg,'alprop') * totveg; acmin2(row).. sum((crop,tech)$corr3(row,crop),acre(crop,tech)) =g= prop(row,'alprop') * totrow; **** MAXIMUMS ON ROW AND VEGETABLE CROPS (ENFORCES SMALLER OF TWO BOUNDS) rowmax1(row).. sum((crop,tech)$corr3(row,crop),acre(crop,tech))=l= prop(row,'auprop')*totrow; rowmax2(row).. sum((crop,tech)$corr3(row,crop),acre(crop,tech))=l= prop(row,'ubacre'); vegmax1(veg).. sum((crop,tech)$corr2(veg,crop),acre(crop,tech))=l= prop(veg,'auprop')*totveg; vegmax2(veg).. sum((crop,tech)$corr2(veg,crop),acre(crop,tech))=l= prop(veg,'ubacre'); *** TOTAL RESOURCE USE FROM ALL CROPS + SLACK = TOTAL RESOURCE SUPPLIES available(resource).. sum((crop,tech),resuse(crop,resource,tech) * acre(crop,tech)) + slack(resource) =e= resavail(resource); *** COUNTS TOTAL ACRES OF LAND FARMED FOR CROP AGGREGATE CATEGORIES totprod(g1).. finacre(g1)=e=sum((crop,tech) $corr1(g1,crop), acre(crop,tech)); *** DEFINES FIXED WATER CHARGE, GROSS PROFITS, AND NET PROFITS fixwatc.. basecost =e= baseacre * watcost; grossprof.. profit =e= sum((crop,tech), netret(crop,tech)*acre(crop,tech)); netprof.. netprofit =e= profit - basecost; ************************************************************************** * END OF EQUATIONS ************************************************************************** model test /all/; file out /ebidout.txt/; *out.pc = 0; put out; ********************************************************************** * States which equations are used for a particular model. Don't * need to use all of them. ********************************************************************** parameter report1(iter,b1) report2(iter,b2) bounds(iter,g2,*); * report1 is acreage display * report2 is shadow price display * NEXT SETS UP TO DO MULTI SOLVES INSIDE A LOOP. * SOLVES FOR SEVERAL WATER PRICE AND SUPPLY LEVELS loop (iter, *first we vary water prices and their impacts on net returns psw = code(iter,'psw'); pgw = code(iter,'pgw'); swcost(crop, tech) = psw * resuse(crop, 'sw', tech); gwcost(crop, tech) = pgw * resuse(crop, 'gw', tech); twatcost(crop, tech) = swcost(crop, tech) + gwcost(crop, tech); netret(crop,tech) = nr(iter,crop,tech) - twatcost(crop,tech); *next we vary water allocations and their impacts on available resources sw = code(iter,'sw'); gw = code(iter,'gw'); resavail('sw') = sw * baseacre; resavail('gw') = gw * baseacre; *next we deal with impacts of wat prices and quantities on acreage proportions prop(veg,'alprop')=max(0,prop(veg,'lprop')-code(iter,'vscale') *prop(veg,'mid')); prop(veg,'auprop')=(prop(veg,'uprop') + code(iter,'vscale') *prop(veg,'mid')); prop(row,'alprop')=max(0,prop(row,'lprop')-code(iter,'rscale') *prop(row,'mid')); prop(row,'auprop')=(prop(row,'uprop') + code(iter,'rscale') *prop(row,'mid')); ************************************************************************* * LOOPS OVER ALL DROUGHT SCENARIOS. * UPDATE SURFACE WATER SUPPLY AND GROUNDWATER SUPPLY BY ITERATION * AND SETS UP RIGHT HAND SIDE RESOURCE CONSTRAINTS. * FINDS PERCENT CHANGE IN WATER USE PROPORTIONS BASED UPON * THE SIZE OF CURRENT TOTAL WATER SUPPLY IN BOTH SURF AND GROUNDWATER ************************************************************************ solve test using lp maximizing netprofit; *** SOLVES MODEL USING LINEAR PROGRAMMING ************************************************************************* * MAIN GAMS PROGRAM FINISHED. * NEXT ARE SEVERAL POST OPTIMALITY CALCULATIONS USED FOR DISPLAYS * NOTE: WE'RE STILL INSIDE SOLVE-DISPLAY LOOP ************************************************************************* nrac = netprofit.l / (totacr.l + .0001); sw_use = resavail('sw') - slack.l('sw'); gw_use = resavail('gw') - slack.l('gw'); sw_use_afa = sw_use / ((totacr.l * 12 )+ .0001); gw_use_afa = gw_use / ((totacr.l * 12 )+ .0001); inc_swat = netprofit.l - 0 ; * net total income w surf + gwater minus rhs number net income with gw only swat_bill = psw * sw_use; gwat_bill = pgw * gw_use; tv_sw = inc_swat + swat_bill; a_inc_sw = inc_swat / (sw_use + 0.0001); a_bill_sw = psw; a_bill_gw = pgw; a_tval_sw = (inc_swat + swat_bill) / (sw_use + 0.0001); m_inc_sw = -slack.m('sw'); m_inc_gw = -slack.m('gw'); m_bill_sw = psw; m_bill_gw = pgw; m_tval_sw = m_inc_sw + m_bill_sw; m_tval_gw = m_inc_gw + m_bill_gw; * POST OPTIMALITY CALCULATIONS, LAND, WATER USE AND WATER BILLS; ************************************************************************* report1(iter,'sw') = sw; report1(iter,'gw') = gw; report1(iter,'psw') = psw; report1(iter,'pgw') = pgw; report1(iter,g1) = finacre.l(g1); report1(iter, 'tot_income') = netprofit.l; report1(iter, 'inc_p_acre') = nrac; report1(iter, 'tot__acres') = totacr.l; report1(iter, 'vegc_acres') = totveg.l; report1(iter, 'rowc_acres') = totrow.l; report2(iter,'sw') = sw; report2(iter,'gw') = gw; report2(iter,'psw') = psw; report2(iter,'pgw') = pgw; report2(iter, 'sw_shprice') = -slack.m('sw'); report2(iter, 'gw_shprice') = -slack.m('gw'); report2(iter, 'dw_shprice') = -slack.m('gwdeep'); report2(iter, 'lnd_veg_sp') = -slack.m('landveg'); report2(iter, 'lnd_row_sp') = -slack.m('landrow'); report2(iter, 'lnd_pec_sp') = -slack.m('landpec'); bounds(iter,g2,'lbnd') = prop(g2,'alprop'); bounds(iter,g2,'ubnd') = prop(g2,'auprop'); display bounds; * Displays upper and lower bounds for vege and row crop acres in LISTING. * write each iteration output to file, not part of GAMS model LISTING. * Next is detailed output of each water supply + price iteration put 'water supply limits' / @3'surface water a-in/acre ',sw / @3'groundwater a-in/acre ',gw // put 'water prices' / @3'surface water price/a-in', psw / @3'groundwater price/a-in', pgw // put 'resource',@19,'rhs',@34,'slack',@49,'shadprice' /; loop (resource, put @3, resource.tl, @15, resavail(resource), @30,slack.l(resource),@45,(-slack.m(resource))/); put / 'tot gros inc =',@15,profit.l / / 'tot net income =',@15,netprofit.l / 'tot net sw inc =',@15,inc_swat / 'wat bill_sw =',@15,swat_bill / 'wat bill_gw =',@15,gwat_bill / 'tot_value_sw =',@15,tv_sw / / 'av tinc/ai_sw =',@15,a_inc_sw / 'av bill/ai_sw =',@15,a_bill_sw / 'av bill/ai_gw =',@15,a_bill_gw / 'av tval/ai_sw =',@15,a_tval_sw / / 'mrg inc/ai_sw =',@15,m_inc_sw / 'mrg inc/ai_gw =',@15,m_inc_gw / 'mrg bil/ai_sw =',@15,m_bill_sw / 'mrg bil/ai_gw =',@15,m_bill_gw / 'mrg tval/ai_sw =',@15,m_tval_sw / 'mrg tval/ai_gw =',@15,m_tval_gw / / 'ac-in swat use =',@15,sw_use / 'ac-in gwat use =',@15,gw_use / 'a-f/ac sw use =',@15,sw_use_afa / 'a-f/ac gw use =',@15,gw_use_afa / 'totacre =',@15,totacr.l / 'net_inc/ac =',@15,nrac / ; put //'veg acr props widen when totwat < this threshold ',tveg; put / 'row acr props widen when totwat < this threshold ',trow; put / 'neg rets for all gw enforced when totwat > threshold',tallgw; put / 'neg rets for deep aq enforced when totwat > threshold',tdeep; put //'acreage summary'/ ; loop (g1, put @3,g1.tl,@15, finacre.l(g1)/) ; put /'Individual cropped acreages'/; put @3,'crop',@15,' base mix allgw dry'/ ; loop (crop, put @3, crop.tl,@15,acre.l(crop,"base"), @30, acre.l(crop, "mix"), @45, acre.l(crop,"allgw"),@58,acre.l(crop,"dry")/); *putpage "solve number",(ord(iter))/; put "END OF RUN. SOLVE NUMBER",(ord(iter)) / '--------------------------------------------------------' / /; ); ********* write summary report to output file********************* put summary; summary.nj=2; loop (b1, put @(ord(b1)*12-10), b1.tl); put /; loop ( iter, loop (b1, put @(ord(b1)*12-10), report1(iter,b1)); put /); put summary2; summary2.nj=2; loop (b2, put @(ord(b2)*12-10), b2.tl); put /; loop ( iter, loop (b2, put @(ord(b2)*12-10), report2(iter,b2)); put /); display bounds; ******************************************************************* * THE END *******************************************************************