A grouping genetic algorithm for joint stratification and sample allocation designs
Section 4. An improved Bethel implementation
Our GGA was proposed and developed so that it would work with the rest of the functions in SamplingStrata. Therefore the rest of the functions in the package remained unchanged. This includes the bethel.r function which evaluates the fitness of chromosomes in every iteration and is computationally expensive. For instance, for the PUMS dataset the experiment took approximately 30 days for either GA or GGA with 100 iterations.
We searched for performance bottlenecks in bethel.r using the R lineprof package. Our analysis of results suggested that the function within bethel.r called chromy appears to take the bulk of computational time. A further examination reveals that chromy contains a while loop with a default setting of 200 iterations. Furthermore bethel.r itself can be run on each chromosome in any chromosome population on a dataset of any functional size (which we have the computation power to process) for any number of iterations. Bigger datasets will take longer to process. We expected that performance would be improved by converting the bethel.r algorithm into C++ then integrating that into R using the Rcpp package (Eddelbuettel, 2013).
| Dataset | Records | Domains | Atomic Strata | Bethel s | BethelRcpp s | Speed-up Factor |
|---|---|---|---|---|---|---|
| iris | 150 | 1 | 8 | 2,684.77 | 143.13 | 18.76 |
| swissmunicipalities | 2,896 | 7 | 641 | 99,916 | 10,749.51 | 9.29 |
| American Community Survey 2015 | 619,747 | 51 | 123,007 | 565,278,500 | 47,858,200 | 11.81 |
| Kiva Loans Data | 614,361 | 73 | 84,897 | 826,297,710 | 82,894,480 | 9.97 |
| UN Commodity Trade Data 2011 | 351,057 | 171 | 350,895 | 139,749,810 | 87,555,870 | 1.6 |
| US Census Data 2000 | 627,611 | 9 | 517,632 | 2,686,771 | 1,303,667 | 2.06 |
Table 4.1 shows the median time taken to run the Bethel algorithm one hundred times for the datasets we used to conduct our analysis. Our results confirm that the C++ version of Bethel is faster than the R version. The speed up could make a practical difference in the number of iterations that can be run in SamplingStrata due to the processing times required for bethel.r. However, performance will vary according to the size and complexity of the problem. The speed up is achieved because C++ enables communication at a lower level with the computer than R. However, it is also due to the complexity of the analysis conducted in each for loop as well as the fact that larger data will restrict the available memory. It should also be noted that the C++ version of Bethel was compared with the R version as two stand alone functions. The performance of the C++ version of Bethel within the GGA is not compared with that of the R version in the GA. This would be part of a larger project to create a C++ version of the SamplingStrata package and integrating it into R.
- Date modified: