Orbiter 2022
Combinatorial Objects
isomorph_arguments.cpp
Go to the documentation of this file.
1// isomorph_arguments.cpp
2//
3// Anton Betten
4// January 27, 2016
5
7#include "discreta/discreta.h"
10
11using namespace std;
12
13namespace orbiter {
14namespace layer4_classification {
15
16
18{
19 null();
20}
21
23{
24 freeself();
25}
26
28{
30
31 ECA = NULL;
33
37 //fname_list_of_cases = NULL;
40
42 //read_statistics_split_m = 0;
43
47 f_event_file = FALSE; // -e <event file> option
48 //event_file_name;
49 print_mod = 500;
54
56 //prefix_iso = "./ISO/";
57
60 final_test_data = NULL;
61
63
64}
65
67{
68 null();
69}
70
71int isomorph_arguments::read_arguments(int argc, std::string *argv,
72 int verbose_level)
73{
74 int i;
76
77 for (i = 0; i < argc; i++) {
78 if (ST.stringcmp(argv[i], "-build_db") == 0) {
80 cout << "-build_db " << endl;
81 }
82 else if (ST.stringcmp(argv[i], "-read_solutions") == 0) {
84 cout << "-read_solutions " << endl;
85 }
86 else if (ST.stringcmp(argv[i], "-read_solutions_from_clique_finder") == 0) {
88 cout << "-read_solutions_from_clique_finder " << endl;
89 }
90 else if (ST.stringcmp(argv[i], "-read_solutions_from_clique_finder_list_of_cases") == 0) {
92 fname_list_of_cases.assign(argv[++i]);
93 cout << "-read_solutions_from_clique_finder_list_of_cases " << fname_list_of_cases << endl;
94 }
95 else if (ST.stringcmp(argv[i], "-read_solutions_after_split") == 0) {
97 read_solutions_split_m = ST.strtoi(argv[++i]);
98 cout << "-read_solutions_after_split " << read_solutions_split_m << endl;
99 }
100 else if (ST.stringcmp(argv[i], "-read_statistics_after_split") == 0) {
102 read_solutions_split_m = ST.strtoi(argv[++i]);
103 cout << "-read_statistics_after_split " << read_solutions_split_m << endl;
104 }
105
106 else if (ST.stringcmp(argv[i], "-compute_orbits") == 0) {
108 cout << "-compute_orbits " << endl;
109 }
110 else if (ST.stringcmp(argv[i], "-isomorph_testing") == 0) {
112 cout << "-isomorph_testing " << endl;
113 }
114 else if (ST.stringcmp(argv[i], "-classification_graph") == 0) {
116 cout << "-make_classification_graph " << endl;
117 }
118 else if (ST.stringcmp(argv[i], "-e") == 0) {
119 i++;
121 event_file_name.assign(argv[i]);
122 cout << "-e " << event_file_name << endl;
123 }
124 else if (ST.stringcmp(argv[i], "-print_interval") == 0) {
125 print_mod = ST.strtoi(argv[++i]);
126 cout << "-print_interval " << print_mod << endl;
127 }
128 else if (ST.stringcmp(argv[i], "-isomorph_report") == 0) {
130 cout << "-report " << endl;
131 }
132 else if (ST.stringcmp(argv[i], "-subset_orbits") == 0) {
134 cout << "-subset_orbits " << endl;
135 }
136 else if (ST.stringcmp(argv[i], "-subset_orbits_file") == 0) {
138 subset_orbits_fname.assign(argv[++i]);
139 cout << "-subset_orbits_fname " << endl;
140 }
141 else if (ST.stringcmp(argv[i], "-down_orbits") == 0) {
143 cout << "-down_orbits " << endl;
144 }
145 else if (ST.stringcmp(argv[i], "-prefix_iso") == 0) {
147 prefix_iso.assign(argv[++i]);
148 cout << "-prefix_iso " << prefix_iso << endl;
149 }
150 else if (ST.stringcmp(argv[i], "-prefix_with_directory") == 0) {
152 prefix_with_directory.assign(argv[++i]);
153 cout << "-prefix_with_directory " << prefix_with_directory << endl;
154 }
155 else if (ST.stringcmp(argv[i], "-end") == 0) {
156 cout << "-end" << endl;
157 break;
158 }
159 else {
160 cout << "isomorph_arguments::read_arguments "
161 "unrecognized option " << argv[i] << endl;
162 }
163 } // next i
164 cout << "isomorph_arguments::read_arguments done" << endl;
165 return i + 1;
166}
167
168
172 int target_size,
175 void (*callback_report)(isomorph *Iso, void *data, int verbose_level),
176 void (*callback_subset_orbits)(isomorph *Iso, void *data, int verbose_level),
177 void *callback_data,
178 int verbose_level)
179{
180 int f_v = (verbose_level >= 1);
181
182 if (f_v) {
183 cout << "isomorph_arguments::init" << endl;
184 }
190 //sprintf(prefix_with_directory, "%s%s", Control->path, Control->problem_label);
191 //isomorph_arguments::prefix_with_directory = prefix_with_directory;
196
198 cout << "isomorph_arguments::init please "
199 "use -solution_prefix <solution_prefix>" << endl;
200 exit(1);
201 }
202 if (!ECA->f_has_base_fname) {
203 cout << "isomorph_arguments::init please "
204 "use -base_fname <base_fname>" << endl;
205 exit(1);
206 }
207
209
210 if (f_v) {
211 cout << "isomorph_arguments::init done" << endl;
212 }
213}
214
215#if 0
216void isomorph_arguments::execute(int verbose_level)
217{
218 int f_v = (verbose_level >= 1);
219 file_io Fio;
220
221 if (f_v) {
222 cout << "isomorph_arguments::execute" << endl;
223 }
224
226 cout << "isomorph_arguments::execute please "
227 "call init before execute" << endl;
228 exit(1);
229 }
230
231 if (f_build_db) {
232
233 if (f_v) {
234 cout << "isomorph_arguments::execute build_db" << endl;
235 cout << "isomorph_arguments::execute before isomorph_build_db" << endl;
236 }
237 isomorph_build_db(A, A, gen,
239 ECA->starter_size, verbose_level);
240 if (f_v) {
241 cout << "isomorph_arguments::execute after isomorph_build_db" << endl;
242 }
243 }
244 else if (f_read_solutions) {
245
246 string fname;
247 int nb_files = 1;
248 char str[1000];
249
250 fname.assign(ECA->solution_prefix);
251 fname.append(ECA->base_fname);
252 sprintf(str, "_depth_%d_solutions.txt", ECA->starter_size);
253
254
255 if (f_v) {
256 cout << "isomorph_arguments::execute before isomorph_read_solution_files" << endl;
257 }
258 isomorph_read_solution_files(A, A2, gen,
261 &fname, nb_files,
264 verbose_level);
265 if (f_v) {
266 cout << "isomorph_arguments::execute after isomorph_read_solution_files" << endl;
267 }
268
269 }
271
272 string fname1;
273 char str[1000];
274
275 fname1.assign(ECA->solution_prefix);
276 fname1.append(ECA->base_fname);
277 sprintf(str, "_solutions_%d_0_1.txt", ECA->starter_size);
278 fname1.append(str);
279
280
281 if (f_v) {
282 cout << "isomorph_arguments::execute before isomorph_read_solution_files_from_clique_finder" << endl;
283 }
284 isomorph_read_solution_files_from_clique_finder(
285 A, A2, gen,
288 &fname1, 1 /*nb_files*/, verbose_level);
289 if (f_v) {
290 cout << "isomorph_arguments::execute after isomorph_read_solution_files_from_clique_finder" << endl;
291 }
292 }
294
295
296 if (f_v) {
297 cout << "f_read_solutions_from_clique_finder_list_of_cases" << endl;
298 }
299 long int *list_of_cases;
300 int nb_cases;
301
302 if (f_v) {
303 cout << "isomorph_arguments::execute before Fio.read_set_from_file" << endl;
304 }
305 Fio.read_set_from_file(fname_list_of_cases,
306 list_of_cases, nb_cases, verbose_level);
307 if (f_v) {
308 cout << "nb_cases=" << nb_cases << endl;
309 }
310
311 string *fname;
312 int i, c;
313
314 fname = new string[nb_cases];
315 for (i = 0; i < nb_cases; i++) {
316 c = list_of_cases[i];
317
318 char str[1000];
319 sprintf(str, "_solutions_%d.txt", c);
320
321 fname[i].assign(ECA->solution_prefix);
322 fname[i].append(ECA->base_fname);
323 fname[i].append(str);
324 }
325
326 if (f_v) {
327 cout << "isomorph_arguments::execute before "
328 "isomorph_read_solution_files_from_clique_finder_case_by_case" << endl;
329 }
330 isomorph_read_solution_files_from_clique_finder_case_by_case(A, A2, gen,
332 fname, list_of_cases, nb_cases, verbose_level);
333
334 delete [] fname;
335 FREE_lint(list_of_cases);
336 }
337
338
340
341
342 string *fname;
343 int nb_files = 0;
344 int i;
345
346 nb_files = read_solutions_split_m;
347
348 fname = new string[read_solutions_split_m];
349
350 for (i = 0; i < read_solutions_split_m; i++) {
351
352
353 char str[1000];
354 sprintf(str, "_solutions_%d_%d_%d.txt", ECA->starter_size, i, read_solutions_split_m);
355
356 fname[i].assign(ECA->solution_prefix);
357 fname[i].append(ECA->base_fname);
358 fname[i].append(str);
359
360 }
361 if (f_v) {
362 cout << "Reading the following " << nb_files << " files:" << endl;
363 for (i = 0; i < nb_files; i++) {
364 cout << i << " : " << fname[i] << endl;
365 }
366 }
367
368
369
370 if (f_v) {
371 cout << "isomorph_arguments::execute before "
372 "isomorph_read_solution_files_from_clique_finder" << endl;
373 }
374
375
376 isomorph_read_solution_files_from_clique_finder(A, A2, gen,
378 fname, nb_files, verbose_level);
379
380 delete [] fname;
381 }
382
383
385
386
387 if (f_v) {
388 cout << "f_read_statistics_after_split" << endl;
389 }
390
391
392 string *fname;
393 int nb_files = 0;
394 int i;
395
396 nb_files = read_solutions_split_m;
397
398 fname = new string[read_solutions_split_m];
399
400
401 for (i = 0; i < read_solutions_split_m; i++) {
402
403
404 char str[1000];
405 sprintf(str, "_solutions_%d_%d_%d_stats.txt", ECA->starter_size, i, read_solutions_split_m);
406
407 fname[i].assign(ECA->solution_prefix);
408 fname[i].append(ECA->base_fname);
409 fname[i].append(str);
410
411 }
412 if (f_v) {
413 cout << "Reading the following " << nb_files << " files:" << endl;
414 for (i = 0; i < nb_files; i++) {
415 cout << i << " : " << fname[i] << endl;
416 }
417 }
418
419
420 if (f_v) {
421 cout << "isomorph_arguments::execute before "
422 "isomorph_read_statistic_files" << endl;
423 }
424 isomorph_read_statistic_files(A, A2, gen,
427 fname, nb_files, verbose_level);
428
429 delete [] fname;
430
431 }
432
433 else if (f_compute_orbits) {
434
435
436 if (f_v) {
437 cout << "isomorph_arguments::execute before "
438 "isomorph_compute_orbits" << endl;
439 }
440 isomorph_compute_orbits(A, A2, gen,
442 ECA->starter_size, verbose_level);
443 if (f_v) {
444 cout << "isomorph_arguments::execute after "
445 "isomorph_compute_orbits" << endl;
446 }
447 }
448 else if (f_isomorph_testing) {
449
450
451 if (f_v) {
452 cout << "isomorph_arguments::execute before isomorph_testing" << endl;
453 }
454 isomorph_testing(A, A2, gen,
458 verbose_level);
459 if (f_v) {
460 cout << "isomorph_arguments::execute after isomorph_testing" << endl;
461 }
462 }
463 else if (f_classification_graph) {
464
465 if (f_v) {
466 cout << "isomorph_arguments::execute before "
467 "isomorph_classification_graph" << endl;
468 }
469 isomorph_classification_graph(A, A2, gen,
473 verbose_level);
474 if (f_v) {
475 cout << "isomorph_arguments::execute after "
476 "isomorph_classification_graph" << endl;
477 }
478 }
479 else if (f_isomorph_report) {
480
481 if (callback_report == NULL) {
482 cout << "isomorph_arguments::execute "
483 "callback_report == NULL" << endl;
484 exit(1);
485 }
486 if (f_v) {
487 cout << "isomorph_arguments::execute before isomorph_worker" << endl;
488 }
489 isomorph_worker(A, A2, gen,
492 ECA->starter_size, verbose_level);
493 if (f_v) {
494 cout << "isomorph_arguments::execute after isomorph_worker" << endl;
495 }
496 }
497 else if (f_subset_orbits) {
498
499 isomorph_worker_data WD;
500
501 WD.the_set = NULL;
502 WD.set_size = 0;
503 WD.callback_data = callback_data;
504
506 Fio.read_set_from_file(subset_orbits_fname,
507 WD.the_set, WD.set_size, verbose_level);
508 }
509 if (f_v) {
510 cout << "isomorph_arguments::execute before isomorph_worker" << endl;
511 }
512 isomorph_worker(A, A2, gen,
515 ECA->starter_size, verbose_level);
516 if (f_v) {
517 cout << "isomorph_arguments::execute after isomorph_worker" << endl;
518 }
519
520 if (WD.the_set) {
521 FREE_lint(WD.the_set);
522 }
523 }
524 else if (f_down_orbits) {
525
526 if (f_v) {
527 cout << "isomorph_arguments::execute before isomorph_compute_down_orbits" << endl;
528 }
529 isomorph_compute_down_orbits(A, A2, gen,
533 ECA->starter_size, verbose_level);
534 if (f_v) {
535 cout << "isomorph_arguments::execute after isomorph_compute_down_orbits" << endl;
536 }
537 }
538
539
540 if (f_v) {
541 cout << "isomorph_arguments::execute done" << endl;
542 }
543}
544#endif
545
546}}
547
functions related to strings and character arrays
a permutation group in a fixed action.
Definition: actions.h:99
command line arguments to control the lifting via exact cover
Definition: solver.h:155
int read_arguments(int argc, std::string *argv, int verbose_level)
int(* final_test_function)(long int *data, int sz, void *final_test_data, int verbose_level)
Definition: isomorph.h:745
poset_classification::poset_classification_control * Control
Definition: isomorph.h:731
poset_classification::poset_classification * gen
Definition: isomorph.h:729
void init(actions::action *A, actions::action *A2, poset_classification::poset_classification *gen, int target_size, poset_classification::poset_classification_control *Control, exact_cover_arguments *ECA, void(*callback_report)(isomorph *Iso, void *data, int verbose_level), void(*callback_subset_orbits)(isomorph *Iso, void *data, int verbose_level), void *callback_data, int verbose_level)
void(* callback_subset_orbits)(isomorph *Iso, void *data, int verbose_level)
Definition: isomorph.h:740
void(* callback_report)(isomorph *Iso, void *data, int verbose_level)
Definition: isomorph.h:738
classification of combinatorial objects using subobjects
Definition: isomorph.h:30
to control the behavior of the poset classification algorithm
#define TRUE
Definition: foundations.h:231
#define FALSE
Definition: foundations.h:234
#define FREE_lint(p)
Definition: foundations.h:642
the orbiter library for the classification of combinatorial objects