| 158 | } |
| 159 | |
| 160 | int main(int argc, char** argv) { |
| 161 | bool console = false; |
| 162 | const int n = 32; |
| 163 | const int nSamples = 16; |
| 164 | if (argc > 2 || (argc == 2 && strcmp(argv[1], "-"))) { |
| 165 | printf("usage: %s [-]\n", argv[0]); |
| 166 | return -1; |
| 167 | } else if (argc == 2 && argv[1][0] == '-') { |
| 168 | console = true; |
| 169 | } |
| 170 | |
| 171 | try { |
| 172 | af::info(); |
| 173 | printf( |
| 174 | "** ArrayFire Genetic Algorithm Search Demo **\n\n" |
| 175 | "Search for trueMax in a search space where the objective " |
| 176 | "function is defined as :\n\n" |
| 177 | "SS(x ,y) = min(x, n - (x + 1)) + min(y, n - (y + 1))\n\n" |
| 178 | "(x, y) belongs to RxR; R = [0, n); n = %d\n\n", |
| 179 | n); |
| 180 | if (!console) { |
| 181 | printf( |
| 182 | "The left figure shows the objective function.\n" |
| 183 | "The right figure shows current generation's " |
| 184 | "parameters and function values.\n\n"); |
| 185 | } |
| 186 | geneticSearch(console, nSamples, n); |
| 187 | } catch (af::exception& e) { fprintf(stderr, "%s\n", e.what()); } |
| 188 | |
| 189 | return 0; |
| 190 | } |
nothing calls this directly
no test coverage detected