1 # Model I Forest Estate Modelling using GLPK/MathProg
2 # Reading and writing dbf files
4 # by Noli Sicad --- nsicad@gmail.com
7 # Forest Management 4th Edition
8 # by Lawrence Davis, K. Norman Johnson, Pete Bettinger, Theodore Howard
9 # Chapter 11 - Daniel Pickett
10 # http://warnell.forestry.uga.edu/Warnell/Bettinger/mgtbook/index.htm
14 /* Note: This is not the full LP model mentioned in the book.
15 Some of the constraints are deliberately omitted in this model for the purpose of clarity.
17 The features of MathProg in this example are:
18 * reading and writing dbf from regular dbf files,
19 * reading dbf file (database of shapefile (stands.shp)) (e.g. area parameter),
20 * using the area data in the constraints and
21 * writing dbf file from result of LP model.
23 Model I - Harvest Scheduling formulation for Sustainable Forest Management (SFM)
26 * Net Present Value for the objective function (Revenue - Cost)
27 * Harvest Constraints by period - Sustainable Yield per Period
28 * Even-Flow Constraint / Volume - Harvest Flow Constraint - Alpha (1-Apha)
29 * Even-Flow Constraint / Volume - Harvest Flow Constraint - Beta (1 +Beta)
30 * Forest / Land Constraint -- Total Area of the forest
31 * Forest Stand Constraint -- Individual stands
33 What is next? -- Forest Mgt Carbon Accounting for Climate Change
35 Note: The model file that the data containing in
36 the dbf files is public domain material (so it is compatible with the
37 GNU GPL) and data can be found in
38 http://warnell.forestry.uga.edu/Warnell/Bettinger/mgtbook/index.htm
40 # Noli Sicad --- nsicad@gmail.com
44 set G_STAND_TYPE; # A, B, C
50 param Forest_Cost{G_STAND_TYPE,I_CULTURAL_PRES, J_MGT_YEAR}; # cost
52 param Yield_Table_Vol{G_STAND_TYPE, I_CULTURAL_PRES, J_MGT_YEAR, 1..K_PERIOD} >= 0;
58 param TCost_Table{G_STAND_TYPE, I_CULTURAL_PRES, J_MGT_YEAR, 1..K_PERIOD} >= 0;
60 param NetRev_Table{G_STAND_TYPE, I_CULTURAL_PRES, J_MGT_YEAR, 1..K_PERIOD};
63 var XForestLand{g in G_STAND_TYPE, i in I_CULTURAL_PRES, j in J_MGT_YEAR} >= 0;
67 table tab IN "xBASE" "standtype.dbf": G_STAND_TYPE <- [STAND];
71 table tab2 IN "xBASE" "cultural_pres.dbf": I_CULTURAL_PRES <- [CUL_PRES];
72 display I_CULTURAL_PRES;
74 table tab3 IN "xBASE" "mgt_year.dbf": J_MGT_YEAR <- [MGT_YEAR];
78 param Forest_Cost{G_STAND_TYPE,I_CULTURAL_PRES, J_MGT_YEAR} default 0; # cost
82 table tab4 IN "xBASE" "Forest_Cost.dbf": S1 <- [STAND, CUL_PRES, MGT_YEAR],Forest_Cost ~FCOST;
86 table tab5 IN "xBASE" "Yield_Table_Vol.dbf": S2 <- [STAND, CUL_PRES, MGT_YEAR, PERIOD],Yield_Table_Vol ~YIELD;
87 display Yield_Table_Vol;
90 table tab5 IN "xBASE" "TCost_Table.dbf": S3 <- [STAND, CUL_PRES, MGT_YEAR, PERIOD],TCost_Table ~TCOST;
95 table tab5 IN "xBASE" "NetRev_Table.dbf": S4 <- [STAND, CUL_PRES, MGT_YEAR, PERIOD],NetRev_Table ~NETREV;
101 param Area_Stand_Indi{g in G_STAND_TYPE, m in 1..MGT} default 0;
104 table tab5 IN "xBASE" "stands.dbf": ST <- [VEG_TYPE, MGT], Area_Stand_Indi ~ACRES;
105 display Area_Stand_Indi;
107 param Area_Stand_Type{g in G_STAND_TYPE}:= sum {m in 1..MGT } Area_Stand_Indi[g,m];
108 display Area_Stand_Type;
111 param Total_Area := sum {g in G_STAND_TYPE, m in 1..MGT } Area_Stand_Indi[g,m];
114 param Harvest_Min_Vol_Period;
120 maximize Net_Present_Value: NetPresentValue;
123 NetPresentValue = sum {g in G_STAND_TYPE, i in I_CULTURAL_PRES, j in J_MGT_YEAR} Forest_Cost[g,i,j] * XForestLand[g,i,j];
125 # Harvest Constraint by Period
126 subject to Harvest_Period_H {k in 1..K_PERIOD}:
127 sum {g in G_STAND_TYPE, i in I_CULTURAL_PRES, j in J_MGT_YEAR} Yield_Table_Vol[g,i,j,k] * XForestLand[g,i,j] >= Harvest_Min_Vol_Period;
130 #Even-Flow Constraint / Volume - Harvest Flow Constraint - Alpha
131 subject to Even_Flow_Constaints_Alpha {k in 6..K_PERIOD-1}:
132 (1 - Alpha) * sum {g in G_STAND_TYPE, i in I_CULTURAL_PRES, j in J_MGT_YEAR} Yield_Table_Vol[g,i,j,k] * XForestLand[g,i,j] -
133 sum {g in G_STAND_TYPE,i in I_CULTURAL_PRES, j in J_MGT_YEAR} Yield_Table_Vol[g,i,j,k+1] * XForestLand[g,i,j] <= 0;
135 # Even-Flow Constraint / Volume - Harvest Flow Constraint - Beta
136 subject to Even_Flow_Constaints_Beta {k in 6..K_PERIOD-1}:
137 (1 + Beta) * sum {g in G_STAND_TYPE, i in I_CULTURAL_PRES, j in J_MGT_YEAR} Yield_Table_Vol[g,i,j,k] * XForestLand[g,i,j] -
138 sum {g in G_STAND_TYPE,i in I_CULTURAL_PRES, j in J_MGT_YEAR} Yield_Table_Vol[g,i,j,k+1] * XForestLand[g,i,j] >= 0;
140 # Forest / Land Constraints
141 subject to Total_Area_Constraint:
142 sum {g in G_STAND_TYPE, i in I_CULTURAL_PRES, j in J_MGT_YEAR} XForestLand[g,i,j] <= Total_Area;
145 # Forest / Land Constraints for A B C
146 subject to Area {g in G_STAND_TYPE}:
147 sum {i in I_CULTURAL_PRES,j in J_MGT_YEAR} XForestLand[g,i,j] = Area_Stand_Type[g];
153 printf '#################################\n';
154 printf 'Forest Management Model I - Noli Sicad\n';
156 printf 'Net Present Value = %.2f\n', NetPresentValue;
160 printf 'Variables\n';
161 printf 'Stand_Type Age_Class Mgt_Presc Sign Value \n';
162 printf{g in G_STAND_TYPE, i in I_CULTURAL_PRES, j in J_MGT_YEAR}:'%5s %10s %11s = %10.2f\n', g,i,j, XForestLand[g,i,j];
165 printf 'Constraints\n';
166 printf 'Period Harvest Sign \n';
167 for {k in 1..K_PERIOD} {
168 printf '%5s %10.2f >= %.3f\n', k, sum {g in G_STAND_TYPE, i in I_CULTURAL_PRES, j in J_MGT_YEAR} Yield_Table_Vol[g,i,j,k] * XForestLand[g,i,j], Harvest_Min_Vol_Period;
172 table Harvest{k in 1..K_PERIOD} OUT "xBASE" "HarvestArea1.dbf" "N(5)N(15,2)" : k ~ Period, (sum {g in G_STAND_TYPE, i in I_CULTURAL_PRES, j in J_MGT_YEAR} Yield_Table_Vol[g,i,j,k] * XForestLand[g,i,j]) ~ H_Area;
176 table tab2 IN "xBASE" "HarvestArea1.dbf": S <- [Period, H_Area];
183 printf 'Constraint\n';
184 printf 'Harvest Period\n';
185 printf 'Type AgeClass PrescMgt Period Value\n';
186 printf{g in G_STAND_TYPE, i in I_CULTURAL_PRES, j in J_MGT_YEAR, k in 1..K_PERIOD}:'%5s %11s %11s %5s %10.2f\n', g,i,j, k, (Yield_Table_Vol[g,i,j,k] * XForestLand[g,i,j]);
189 printf 'Even_Flow_Constaint_Alpha (1-Alpha)\n';
190 printf 'Period Sign \n';
191 for {k in 6..K_PERIOD-1} {
192 printf "%s %10.2f <= %s\n", k, ((1 - Alpha) * sum {g in G_STAND_TYPE, i in I_CULTURAL_PRES, j in J_MGT_YEAR} Yield_Table_Vol[g,i,j,k] * XForestLand[g,i,j] - sum {g in G_STAND_TYPE,i in I_CULTURAL_PRES, j in J_MGT_YEAR} Yield_Table_Vol[g,i,j,k+1] * XForestLand[g,i,j]),0;
197 # Forest / Land Constraints
199 printf 'Total Area Constraint\n';
200 printf 'Type AgeClass PrescMgt Value Sign Total_Area \n';
201 printf '%5s <= %.3f\n',sum {g in G_STAND_TYPE, i in I_CULTURAL_PRES, j in J_MGT_YEAR} XForestLand[g,i,j], Total_Area;
204 printf 'Area Value Sign Areas_Stand\n';
205 for {g in G_STAND_TYPE} {
206 printf '%5s %10.2f <= %.3f\n', g, sum {i in I_CULTURAL_PRES,j in J_MGT_YEAR} XForestLand[g,i,j], Area_Stand_Type[g];
214 # Most of the data has been moved to dbf format
223 param Harvest_Min_Vol_Period:= 12000;