openModeller  Version 1.5.0
DgGarpBestSubsets.cpp
Go to the documentation of this file.
1 
29 #ifdef WIN32
30 // avoid warnings caused by problems in VC headers
31 #define _SCL_SECURE_NO_DEPRECATE
32 #endif
33 
34 #include "DgGarpBestSubsets.hh"
35 
36 #include <openmodeller/om.hh>
37 #include <openmodeller/Random.hh>
38 #include <openmodeller/Sampler.hh>
39 
40 #include <stdlib.h>
41 #include <stdio.h>
42 #include <math.h>
43 
44 #define NUM_PARAM 11
45 
46 /************************************/
47 /*** Algorithm parameter metadata ***/
48 
50 {
51  // Best Subsets Parameters
52  {
53  "TrainingProportion", // Id.
54  "Training Proportion", // Name.
55  Real, // Type.
56 
57  // Overview.
58  "Percentage of occurrence data to be used to train models.",
59 
60  // Description.
61  "Percentage of occurrence data to be used to train models.",
62 
63  1, // Not zero if the parameter has lower limit.
64  0, // Parameter's lower limit.
65  1, // Not zero if the parameter has upper limit.
66  100, // Parameter's upper limit.
67  "50" // Parameter's typical (default) value.
68  },
69 
70  {
71  "TotalRuns", // Id.
72  "Total Runs", // Name.
73  Integer, // Type.
74 
75  // Overview.
76  "Maximum number of GARP runs to be performed.",
77 
78  // Description.
79  "Maximum number of GARP runs to be performed.",
80 
81  1, // Not zero if the parameter has lower limit.
82  0, // Parameter's lower limit.
83  1, // Not zero if the parameter has upper limit.
84  10000, // Parameter's upper limit.
85  "20" // Parameter's typical (default) value.
86  },
87 
88  {
89  "HardOmissionThreshold", // Id.
90  "Hard Omission Threshold", // Name.
91  Real, // Type.
92 
93  // Overview.
94  "Maximum acceptable omission error. Set to 100% to use only soft omission.",
95 
96  // Description.
97  "Maximum acceptable omission error. Set to 100% to use only soft omission.",
98 
99  1, // Not zero if the parameter has lower limit.
100  0, // Parameter's lower limit.
101  1, // Not zero if the parameter has upper limit.
102  100, // Parameter's upper limit.
103  "100" // Parameter's typical (default) value.
104  },
105 
106  {
107  "ModelsUnderOmissionThreshold", // Id.
108  "Models Under Omission Threshold", // Name.
109  Integer, // Type.
110 
111  // Overview.
112  "Minimum number of models below omission threshold.",
113 
114  // Description.
115  "Minimum number of models below omission threshold.",
116 
117  1, // Not zero if the parameter has lower limit.
118  0, // Parameter's lower limit.
119  1, // Not zero if the parameter has upper limit.
120  10000, // Parameter's upper limit.
121  "20" // Parameter's typical (default) value.
122  },
123 
124  {
125  "CommissionThreshold", // Id.
126  "Commission Threshold", // Name.
127  Real, // Type.
128 
129  // Overview.
130  "Percentage of distribution models to be taken regarding commission error.",
131 
132  // Description.
133  "Percentage of distribution models to be taken regarding commission error.",
134 
135  1, // Not zero if the parameter has lower limit.
136  0, // Parameter's lower limit.
137  1, // Not zero if the parameter has upper limit.
138  100, // Parameter's upper limit.
139  "50" // Parameter's typical (default) value.
140  },
141 
142  {
143  "CommissionSampleSize", // Id.
144  "Commission Sample Size", // Name.
145  Real, // Type.
146 
147  // Overview.
148  "Number of samples used to calculate commission error.",
149 
150  // Description.
151  "Number of samples used to calculate commission error.",
152 
153  1, // Not zero if the parameter has lower limit.
154  1, // Parameter's lower limit.
155  0, // Not zero if the parameter has upper limit.
156  0, // Parameter's upper limit.
157  "10000" // Parameter's typical (default) value.
158  },
159 
160  {
161  "MaxThreads", // Id.
162  "Maximum Number of Threads", // Name.
163  Integer, // Type.
164 
165  // Overview.
166  "Maximum number of threads of executions to run simultaneously.",
167 
168  // Description.
169  "Maximum number of threads of executions to run simultaneously.",
170 
171  1, // Not zero if the parameter has lower limit.
172  1, // Parameter's lower limit.
173  1, // Not zero if the parameter has upper limit.
174  1024, // Parameter's upper limit.
175  "1" // Parameter's typical (default) value.
176  },
177 
178  // GARP parameters
179  {
180  "MaxGenerations", // Id.
181  "Max generations", // Name.
182  Integer, // Type.
183 
184  // Overview.
185  "Maximum number of iterations run by the Genetic Algorithm.",
186 
187  // Description.
188  "Maximum number of iterations (generations) run by the Genetic Algorithm.",
189 
190  1, // Not zero if the parameter has lower limit.
191  1, // Parameter's lower limit.
192  0, // Not zero if the parameter has upper limit.
193  0, // Parameter's upper limit.
194  "400" // Parameter's typical (default) value.
195  },
196 
197  {
198  "ConvergenceLimit", // Id.
199  "Convergence limit", // Name.
200  Real, // Type.
201 
202  // Overview.
203  "Defines the convergence value that makes the algorithm stop (before reaching MaxGenerations).",
204 
205  // Description.
206  "Defines the convergence value that makes the algorithm stop (before reaching MaxGenerations).",
207 
208  1, // Not zero if the parameter has lower limit.
209  0.0, // Parameter's lower limit.
210  1, // Not zero if the parameter has upper limit.
211  1.0, // Parameter's upper limit.
212  "0.01" // Parameter's typical (default) value.
213  },
214 
215  {
216  "PopulationSize", // Id.
217  "Population size", // Name.
218  Integer, // Type.
219 
220  "Maximum number of rules to be kept in solution.", // Overview.
221  "Maximum number of rules to be kept in solution.", // Description
222 
223  1, // Not zero if the parameter has lower limit.
224  1, // Parameter's lower limit.
225  1, // Not zero if the parameter has upper limit.
226  500, // Parameter's upper limit.
227  "50" // Parameter's typical (default) value.
228  },
229 
230  {
231  "Resamples", // Id.
232  "Resamples", // Name.
233  Integer, // Type.
234 
235  // Overview.
236  "Number of points sampled (with replacement) used to test rules.",
237 
238  // Description.
239  "Number of points sampled (with replacement) used to test rules.",
240 
241  1, // Not zero if the parameter has lower limit.
242  1, // Parameter's lower limit.
243  1, // Not zero if the parameter has upper limit.
244  100000, // Parameter's upper limit.
245  "2500" // Parameter's typical (default) value.
246  }
247 };
248 
249 /************************************/
250 /*** Algorithm's general metadata ***/
251 
253 
254  "DG_GARP_BS", // Id.
255  "GARP with best subsets - DesktopGARP implementation", // Name.
256  "3.0.2", // Version.
257 
258  // Overview.
259  "GARP is a genetic algorithm that creates ecological niche \
260 models for species. The models describe environmental conditions \
261 under which the species should be able to maintain populations. \
262 For input, GARP uses a set of point localities where the species \
263 is known to occur and a set of geographic layers representing \
264 the environmental parameters that might limit the species' \
265 capabilities to survive.",
266 
267  // Description.
268  "GARP is a genetic algorithm that creates ecological niche \
269 models for species. The models describe environmental conditions \
270 under which the species should be able to maintain populations. \
271 For input, GARP uses a set of point localities where the species \
272 is known to occur and a set of geographic layers representing \
273 the environmental parameters that might limit the species' \
274 capabilities to survive.",
275 
276  // Author
277  "Anderson, R. P., D. Lew, D. and A. T. Peterson.",
278 
279  // Bibliography.
280  "Anderson, R. P., D. Lew, and A. T. Peterson. 2003. \
281 Evaluating predictive models of species' distributions: criteria \
282 for selecting optimal models.Ecological Modelling, v. 162, p. 211 232.",
283 
284  "Ricardo Scachetti Pereira", // Code author.
285  "rpereira [at] ku.edu", // Code author's contact.
286 
287  0, // Does not accept categorical data.
288  1, // Does not need (pseudo)absence points.
289 
290  NUM_PARAM, // Algorithm's parameters.
291  parameters_bs
292 };
293 
294 
295 /****************************************************************/
296 /****************** Algorithm's factory function ****************/
297 
298 OM_ALG_DLL_EXPORT
299 AlgorithmImpl *
301 {
302  return new DgGarpBestSubsets();
303 }
304 
305 OM_ALG_DLL_EXPORT
306 AlgMetadata const *
308 {
309  return &metadata_bs;
310 }
311 
312 /****************************************************************/
313 /****************** Garp class **********************************/
314 
316  : AbstractBestSubsets(& metadata_bs)
317 {
318  _subAlgorithm = "DG_GARP";
319 }
320 
321 // ****************************************************************
323 {
324 }
325 
OM_ALG_DLL_EXPORT AlgMetadata const * algorithmMetadata()
AlgMetadata metadata_bs
AlgParamMetadata parameters_bs[NUM_PARAM]
OM_ALG_DLL_EXPORT AlgorithmImpl * algorithmFactory()
#define NUM_PARAM