Commit 1dd7a8b3f4b76754c4dbd333cc42692b8dfdcd6e

Authored by Eduardo Eloy
1 parent 3e058fbe
Exists in Standardized

readme

Showing 1 changed file with 117 additions and 22 deletions   Show diff stats
MODFIRE-Prototype/README.md
1 # Forest Management 1 # Forest Management
2 2
3 The purpose of this implementation is to use Constraint Programming to find valid solutions for problems of forest management. 3 The purpose of this implementation is to use Constraint Programming to find valid solutions for problems of forest management.
  4 +
4 Here, Management Units (MUs) are associated with possible prescriptions which define which years the MUs are to be harvested. 5 Here, Management Units (MUs) are associated with possible prescriptions which define which years the MUs are to be harvested.
  6 +
5 But in any given year only 50ha of contiguous forest area can be harvested at once. 7 But in any given year only 50ha of contiguous forest area can be harvested at once.
6 8
7 9
8 Therefore the implementation needs input defining: 10 Therefore the implementation needs input defining:
9 11
10 1-The existing MUs in the forest 12 1-The existing MUs in the forest
  13 +
11 2-The area of each MU 14 2-The area of each MU
  15 +
12 3-The MUs adjacent to each MU 16 3-The MUs adjacent to each MU
  17 +
13 4-The border lenght of each adjacency between MUs 18 4-The border lenght of each adjacency between MUs
  19 +
14 5-The IDs of the Prescriptions of each MU 20 5-The IDs of the Prescriptions of each MU
  21 +
15 6-Relative to each Prescription, the years where the Prescription defines that the MU should be harvested. 22 6-Relative to each Prescription, the years where the Prescription defines that the MU should be harvested.
  23 +
16 7-Relative to each Prescription, the rewards each Prescription gives for being applied. 24 7-Relative to each Prescription, the rewards each Prescription gives for being applied.
17 25
18 -# Step 1: Necessary Setup Files 26 +# Step 1: Necessary Setup Files.
19 27
20 In general for every line in one of the files we assume a new Management Unit, a file with 4 lines would imply that there are 4 MUs, and since this has to be consistent then that means all input files should have 4 lines. 28 In general for every line in one of the files we assume a new Management Unit, a file with 4 lines would imply that there are 4 MUs, and since this has to be consistent then that means all input files should have 4 lines.
21 29
@@ -23,102 +31,168 @@ In general for every line in one of the files we assume a new Management Unit, a @@ -23,102 +31,168 @@ In general for every line in one of the files we assume a new Management Unit, a
23 31
24 32
25 ## external_init.txt 33 ## external_init.txt
26 -###- This file serves to indicate how many Management Units exist in the forest, so each line should have a number to serve as an External identifier of each MU. There should be as many lines as there are MUs in the forest 34 +### This file serves to indicate how many Management Units exist in the forest, so each line should have a number to serve as an External identifier of each MU. There should be as many lines as there are MUs in the forest.
27 35
28 Each of these External IDs have an Internal ID which corresponds to the index of their row starting from 0 36 Each of these External IDs have an Internal ID which corresponds to the index of their row starting from 0
29 ------------------EXAMPLE: 37 +
  38 +........................EXAMPLE:
  39 +
30 30 40 30
  41 +
31 201 42 201
  43 +
32 333 44 333
  45 +
33 335 46 335
34 -------------------------- 47 +
  48 +.........................
35 49
36 So they have the following Internal IDs 50 So they have the following Internal IDs
37 ----------------- 51 +
  52 +.........................
  53 +
38 0 54 0
  55 +
39 1 56 1
  57 +
40 2 58 2
  59 +
41 3 60 3
42 ----------------- 61 +
  62 +.........................
43 63
44 64
45 ## area_init.txt 65 ## area_init.txt
46 -###- This file sets up the area of each MU. 66 +### This file sets up the area of each MU.
47 67
48 -----------------Example: 68 -----------------Example:
  69 +
49 42.60178 70 42.60178
  71 +
50 8.26 72 8.26
  73 +
51 6.0315 74 6.0315
  75 +
52 26.94 76 26.94
  77 +
53 ------------------------ 78 ------------------------
54 79
55 ## adj_init.txt 80 ## adj_init.txt
56 -###- This file sets up the adjacencies of each MU each line should list the Internal IDs of the MUs adjacent to the respective MU separated by a comma. If the MU has no adjacent MUs the line should just have a -1 81 +### This file sets up the adjacencies of each MU each line should list the Internal IDs of the MUs adjacent to the respective MU separated by a comma. If the MU has no adjacent MUs the line should just have a -1
57 82
58 -----------------Example: 83 -----------------Example:
  84 +
59 1,2 85 1,2
  86 +
60 0 87 0
  88 +
61 0 89 0
  90 +
62 -1 91 -1
  92 +
63 ------------------------ 93 ------------------------
  94 +
64 So this forest might look like this: 95 So this forest might look like this:
65 -Internal Ids: External Ids:  
66 -|2| |2|  
67 -|0| |3| |0| |3|  
68 -|1| |1|  
69 96
  97 +Internal Ids:
  98 +
  99 +|2|
  100 +
  101 + |
70 102
71 -##border_init.txt  
72 -###- This file sets up the lenght of the border of each adjacent MU, each line should list the lenght of the borders of each adjacency separated by a comma. If the MU has no adjacent MUs the should just have a -1 103 +|0| |3|
  104 +
  105 + |
  106 +
  107 +|1|
  108 +
  109 +External Ids:
  110 +
  111 +|333|
  112 +
  113 + |
  114 +
  115 +|30| |335|
  116 +
  117 + |
  118 +
  119 +|201|
  120 +
  121 +
  122 +## border_init.txt
  123 +### This file sets up the lenght of the border of each adjacent MU, each line should list the lenght of the borders of each adjacency separated by a comma. If the MU has no adjacent MUs the should just have a -1
73 124
74 -----------------Example: 125 -----------------Example:
  126 +
75 259,151 127 259,151
  128 +
76 490 129 490
  130 +
77 102,653 131 102,653
  132 +
78 -1 133 -1
  134 +
79 ------------------------ 135 ------------------------
80 136
81 If borders aren't a factor is your data just put use 0s in place of real border values 137 If borders aren't a factor is your data just put use 0s in place of real border values
82 138
83 139
84 -##ugs_init.txt  
85 -###- This file sets up the Prescriptions associated with each MU, each line should list the IDs of the Prescriptions associated with each MU 140 +## ugs_init.txt
  141 +### This file sets up the Prescriptions associated with each MU, each line should list the IDs of the Prescriptions associated with each MU
86 142
87 -----------------Example: 143 -----------------Example:
  144 +
88 1,2,3 145 1,2,3
  146 +
89 19 147 19
  148 +
90 19,20,21 149 19,20,21
  150 +
91 500,501,502,503,500600,500601 151 500,501,502,503,500600,500601
  152 +
92 ------------------------ 153 ------------------------
93 154
94 -##years_init.txt  
95 -###- This file sets up the relation between Prescriptions and the years where those Prescriptions have Harvest actions. 155 +## years_init.txt
  156 +### This file sets up the relation between Prescriptions and the years where those Prescriptions have Harvest actions.
  157 +
96 ### Each line lists the years where the corresponding Prescription has Harvest actions separated by commas, if the MU has more than one Prescription then a "/" is followed by the next Prescription's harvest years. If a Prescription has no years of Harvest there should be a -1 158 ### Each line lists the years where the corresponding Prescription has Harvest actions separated by commas, if the MU has more than one Prescription then a "/" is followed by the next Prescription's harvest years. If a Prescription has no years of Harvest there should be a -1
97 159
98 Before listing the years the line should have the Internal ID of the MU followed by a "|" 160 Before listing the years the line should have the Internal ID of the MU followed by a "|"
99 161
100 -----------------Example: 162 -----------------Example:
  163 +
101 0|2026,2056,2066/2027,2049,2060/2028,2040,2052,2064 164 0|2026,2056,2066/2027,2049,2060/2028,2040,2052,2064
  165 +
102 1|2022,2032,2042 166 1|2022,2032,2042
  167 +
103 2|2026,2046/2060/-1 168 2|2026,2046/2060/-1
  169 +
104 3|2052/2057/-1/2067/2052/2052 170 3|2052/2057/-1/2067/2052/2052
  171 +
105 ------------------------ 172 ------------------------
106 173
107 -#Step 2: Criteria Files 174 +# Step 2: Criteria Files
108 175
109 There can be a maximum of 10 optimizable criteria in the program represented by these files, these files are crit_file0-10.txt and their format is the same. 176 There can be a maximum of 10 optimizable criteria in the program represented by these files, these files are crit_file0-10.txt and their format is the same.
110 177
111 Each line corresponds to an MU similarly to previous files and the contents are separated by commas, the contents are the values of the objective criteria associated with each Prescription of the respective MU 178 Each line corresponds to an MU similarly to previous files and the contents are separated by commas, the contents are the values of the objective criteria associated with each Prescription of the respective MU
  179 +
112 -----------------Example: 180 -----------------Example:
  181 +
113 34,30.99,3.363 182 34,30.99,3.363
  183 +
114 1568.630 184 1568.630
  185 +
115 565.79,146,1692 186 565.79,146,1692
  187 +
116 4966,6310,7,87,49,496 188 4966,6310,7,87,49,496
  189 +
117 ------------------------ 190 ------------------------
118 191
119 -#Step 3: Running the software 192 +# Step 3: Running the software
120 193
121 The program is run through the make file and requires Java 11. 194 The program is run through the make file and requires Java 11.
  195 +
122 Open up the Makefile in this folder and modify the parameters of the "make" label, then run the "make" command in the terminal. 196 Open up the Makefile in this folder and modify the parameters of the "make" label, then run the "make" command in the terminal.
123 197
124 ## MainWithSpecific 198 ## MainWithSpecific
@@ -128,25 +202,41 @@ The examples shown are related to the Vale de Sousa forest which was used in the @@ -128,25 +202,41 @@ The examples shown are related to the Vale de Sousa forest which was used in the
128 202
129 ## MainWithSpecific parameters: 203 ## MainWithSpecific parameters:
130 1st- Maximum Area Limit (50) 204 1st- Maximum Area Limit (50)
  205 +
131 2nd- Directory with data about forest (res) 206 2nd- Directory with data about forest (res)
  207 +
132 3rd- Minimum Border Lenght (50) 208 3rd- Minimum Border Lenght (50)
  209 +
133 4th- Single or Multi Criteria 210 4th- Single or Multi Criteria
  211 +
134 5th- Name of file with the UGs to be considered (in subregions folder) 212 5th- Name of file with the UGs to be considered (in subregions folder)
  213 +
135 6th and onward- Choose the criterias to be optimized, if the 4th parameter is Single only the first criteria will be optimized 214 6th and onward- Choose the criterias to be optimized, if the 4th parameter is Single only the first criteria will be optimized
136 215
  216 +
137 0-Criteria0 (Wood Yield) 217 0-Criteria0 (Wood Yield)
  218 +
138 1-Criteria1 (Soil Loss) 219 1-Criteria1 (Soil Loss)
  220 +
139 2-Criteria2 (Perc_r) 221 2-Criteria2 (Perc_r)
  222 +
140 3-Criteria3 (Biodiversity) 223 3-Criteria3 (Biodiversity)
  224 +
141 4-Criteria4 (Cashflow) 225 4-Criteria4 (Cashflow)
  226 +
142 5-Criteria5 (Carbon Stock) 227 5-Criteria5 (Carbon Stock)
  228 +
143 6-Criteria6 (NPV) 229 6-Criteria6 (NPV)
  230 +
144 7-Criteria7 (Perc_rait) 231 7-Criteria7 (Perc_rait)
  232 +
145 8-Criteria8 (R) 233 8-Criteria8 (R)
  234 +
146 9-Criteria9 (Rait) 235 9-Criteria9 (Rait)
  236 +
147 10-Criteria10(Sbiom) 237 10-Criteria10(Sbiom)
148 238
149 -## Example to optimize Wood Yield and Soil Loss in Paredes-> MainWithSpecific 50 res 50 Multi Paredes 0 1 239 +#### Example to optimize Wood Yield and Soil Loss in Paredes-> MainWithSpecific 50 res 50 Multi Paredes 0 1
150 240
151 The program will try to find valid solutions for 8 hours (28800000 miliseconds) or until there's a memory error. 241 The program will try to find valid solutions for 8 hours (28800000 miliseconds) or until there's a memory error.
152 242
@@ -156,15 +246,20 @@ Same as MainWithSpecific but the 4th parameter sets the time limit for finding s @@ -156,15 +246,20 @@ Same as MainWithSpecific but the 4th parameter sets the time limit for finding s
156 Example: MainTime 50 res 50 28800000 Paredes 0 1 246 Example: MainTime 50 res 50 28800000 Paredes 0 1
157 247
158 248
159 -#Step 4: Output files 249 +# Step 4: Output files
160 In Multi Criteria optimization the following files are written to the Results folder: 250 In Multi Criteria optimization the following files are written to the Results folder:
  251 +
161 Output files Multi-Criteria: 252 Output files Multi-Criteria:
162 253
163 254
164 allSolutionPairs.csv:- MU/Presc pairs for every valid solution found 255 allSolutionPairs.csv:- MU/Presc pairs for every valid solution found
  256 +
165 outputPairsMulti.csv:- MU/Presc pairs for every pareto solution (determined by choco solver) 257 outputPairsMulti.csv:- MU/Presc pairs for every pareto solution (determined by choco solver)
  258 +
166 nonPareto.csv:- Values of the optimizable criteria for every valid solution found 259 nonPareto.csv:- Values of the optimizable criteria for every valid solution found
  260 +
167 pareto.csv:- Values of the optimizable criteria for every pareto solution found 261 pareto.csv:- Values of the optimizable criteria for every pareto solution found
  262 +
168 pairCriteria.csv:- MU/Presc pairs for every pareto solution along with associated values of objective criteria. 263 pairCriteria.csv:- MU/Presc pairs for every pareto solution along with associated values of objective criteria.
169 264
170 265