Orbiter 2022
Combinatorial Objects
poset_classification_control.cpp
Go to the documentation of this file.
1/*
2 * poset_classification_control.cpp
3 *
4 * Created on: May 6, 2020
5 * Author: betten
6 */
7
8
9
10
12#include "discreta/discreta.h"
15
16using namespace std;
17
18namespace orbiter {
19namespace layer4_classification {
20namespace poset_classification {
21
22
23
24static void poset_classification_control_early_test_function_cliques(long int *S, int len,
25 long int *candidates, int nb_candidates,
26 long int *good_candidates, int &nb_good_candidates,
27 void *data, int verbose_level);
28
29
30
32{
33
35 //problem_label = NULL;
36
37 f_path = FALSE;
38 //path = NULL;
39
40 f_depth = FALSE;
41 depth = 0;
42
45
46 verbose_level = 0;
48
50 //recover_fname = NULL;
51
53 extend_from = 0;
54 extend_to = 0;
55 extend_r = 0;
56 extend_m = 1;
57
58 f_lex = FALSE;
59
60 f_w = FALSE;
61 f_W = FALSE;
63 f_t = FALSE;
64 f_T = FALSE;
65
67
70
71
76 f_list = FALSE;
80
84
87
89 report_options = NULL;
90
93
98
99 //nb_recognize = 0;
100
103 //schreier_tree_prefix[0] = 0;
104
105
107
109 //preferred_choice
110
112 //std::string clique_test_graph;
113 clique_test_CG = NULL;
114
115
116}
117
119{
120
121}
122
123
124
126 int argc, std::string *argv,
127 int verbose_level)
128{
129 int i;
130 int f_v = (verbose_level >= 1);
132
133 if (f_v) {
134 cout << "poset_classification_control::read_arguments" << endl;
135 }
136 for (i = 0; i < argc; i++) {
137
138 if (ST.stringcmp(argv[i], "-problem_label") == 0) {
140 problem_label.assign(argv[++i]);
141 if (f_v) {
142 cout << "-problem_label " << problem_label << endl;
143 }
144 }
145 else if (ST.stringcmp(argv[i], "-path") == 0) {
146 f_path = TRUE;
147 path.assign(argv[++i]);
148 if (f_v) {
149 cout << "-path " << path << endl;
150 }
151 }
152 else if (ST.stringcmp(argv[i], "-depth") == 0) {
153 f_depth = TRUE;
154 depth = ST.strtoi(argv[++i]);
155 if (f_v) {
156 cout << "-depth " << depth << endl;
157 }
158 }
159 else if (ST.stringcmp(argv[i], "-draw_options") == 0) {
161
163 if (f_v) {
164 cout << "-draw_options " << endl;
165 }
166 i += draw_options->read_arguments(argc - (i + 1),
167 argv + i + 1, verbose_level);
168
169 if (f_v) {
170 cout << "done reading -draw_options " << endl;
171 cout << "i = " << i << endl;
172 cout << "argc = " << argc << endl;
173 if (i < argc) {
174 cout << "next argument is " << argv[i] << endl;
175 }
176 }
177 //cout << "-f_draw_options " << endl;
178 }
179 else if (ST.stringcmp(argv[i], "-v") == 0) {
180 i++;
182 if (f_v) {
183 cout << "-v " << poset_classification_control::verbose_level << endl;
184 }
185 }
186 else if (ST.stringcmp(argv[i], "-gv") == 0) {
187 i++;
189 if (f_v) {
190 cout << "-gv " << verbose_level_group_theory << endl;
191 }
192 }
193 else if (ST.stringcmp(argv[i], "-recover") == 0) {
194 f_recover = TRUE;
195 recover_fname.assign(argv[++i]);
196 if (f_v) {
197 cout << "-recover " << recover_fname << endl;
198 }
199 }
200 else if (ST.stringcmp(argv[i], "-extend") == 0) {
201 f_extend = TRUE;
202 extend_from = ST.strtoi(argv[++i]);
203 extend_to = ST.strtoi(argv[++i]);
204 extend_r = ST.strtoi(argv[++i]);
205 extend_m = ST.strtoi(argv[++i]);
206 extend_fname.assign(argv[++i]);
207 if (f_v) {
208 cout << "-extend from level " << extend_from
209 << " to level " << extend_to
210 << " cases congruent " << extend_r
211 << " mod " << extend_m
212 << " from file " << extend_fname << endl;
213 }
214 }
215 else if (ST.stringcmp(argv[i], "-lex") == 0) {
216 f_lex = TRUE;
217 if (f_v) {
218 cout << "-lex" << endl;
219 }
220 }
221 else if (ST.stringcmp(argv[i], "-w") == 0) {
222 f_w = TRUE;
223 if (f_v) {
224 cout << "-w" << endl;
225 }
226 }
227 else if (ST.stringcmp(argv[i], "-W") == 0) {
228 f_W = TRUE;
229 if (f_v) {
230 cout << "-W" << endl;
231 }
232 }
233
234 else if (ST.stringcmp(argv[i], "-write_data_files") == 0) {
236 if (f_v) {
237 cout << "-write_data_files" << endl;
238 }
239 }
240 else if (ST.stringcmp(argv[i], "-t") == 0) {
241 f_t = TRUE;
242 if (f_v) {
243 cout << "-t" << endl;
244 }
245 }
246 else if (ST.stringcmp(argv[i], "-T") == 0) {
247 f_T = TRUE;
248 if (f_v) {
249 cout << "-T" << endl;
250 }
251 }
252 else if (ST.stringcmp(argv[i], "-write_tree") == 0) {
254 if (f_v) {
255 cout << "-write_tree" << endl;
256 }
257 }
258 else if (ST.stringcmp(argv[i], "-find_node_by_stabilizer_order") == 0) {
261 if (f_v) {
262 cout << "-find_node_by_stabilizer_order " << find_node_by_stabilizer_order << endl;
263 }
264 }
265 else if (ST.stringcmp(argv[i], "-draw_poset") == 0) {
267 if (f_v) {
268 cout << "-draw_poset " << endl;
269 }
270 }
271 else if (ST.stringcmp(argv[i], "-draw_full_poset") == 0) {
273 if (f_v) {
274 cout << "-draw_full_poset " << endl;
275 }
276 }
277 else if (ST.stringcmp(argv[i], "-plesken") == 0) {
278 f_plesken = TRUE;
279 if (f_v) {
280 cout << "-plesken " << endl;
281 }
282 }
283 else if (ST.stringcmp(argv[i], "-print_data_structure") == 0) {
285 if (f_v) {
286 cout << "-print_data_structure " << endl;
287 }
288 }
289 else if (ST.stringcmp(argv[i], "-list") == 0) {
290 f_list = TRUE;
291 if (f_v) {
292 cout << "-list" << endl;
293 }
294 }
295 else if (ST.stringcmp(argv[i], "-list_all") == 0) {
297 if (f_v) {
298 cout << "-list_all" << endl;
299 }
300 }
301 else if (ST.stringcmp(argv[i], "-table_of_nodes") == 0) {
303 if (f_v) {
304 cout << "-table_of_nodes" << endl;
305 }
306 }
307 else if (ST.stringcmp(argv[i], "-make_relations_with_flag_orbits") == 0) {
309 if (f_v) {
310 cout << "-make_relation_with_flag_orbits" << endl;
311 }
312 }
313 else if (ST.stringcmp(argv[i], "-Kramer_Mesner_matrix") == 0) {
315 Kramer_Mesner_t = ST.strtoi(argv[++i]);
316 Kramer_Mesner_k = ST.strtoi(argv[++i]);
317 if (f_v) {
318 cout << "-Kramer_Mesner_matrix " << Kramer_Mesner_t << " " << Kramer_Mesner_k << endl;
319 }
320 }
321 else if (ST.stringcmp(argv[i], "-level_summary_csv") == 0) {
323 if (f_v) {
324 cout << "-level_summary_csv" << endl;
325 }
326 }
327 else if (ST.stringcmp(argv[i], "-orbit_reps_csv") == 0) {
329 if (f_v) {
330 cout << "-orbit_reps_csv" << endl;
331 }
332 }
333 else if (ST.stringcmp(argv[i], "-report") == 0) {
334 f_report = TRUE;
335
337 if (f_v) {
338 cout << "-report " << endl;
339 }
340 i += report_options->read_arguments(argc - (i + 1),
341 argv + i + 1, verbose_level);
342
343 if (f_v) {
344 cout << "done reading -report " << endl;
345 cout << "i = " << i << endl;
346 cout << "argc = " << argc << endl;
347 if (i < argc) {
348 cout << "next argument is " << argv[i] << endl;
349 }
350 }
351
352 if (f_v) {
353 cout << "-report" << endl;
354 }
355 }
356 else if (ST.stringcmp(argv[i], "-node_label_is_group_order") == 0) {
358 if (f_v) {
359 cout << "-node_label_is_group_order" << endl;
360 }
361 }
362 else if (ST.stringcmp(argv[i], "-node_label_is_element") == 0) {
364 if (f_v) {
365 cout << "-node_label_is_element" << endl;
366 }
367 }
368 else if (ST.stringcmp(argv[i], "-show_orbit_decomposition") == 0) {
370 if (f_v) {
371 cout << "-show_orbit_decomposition" << endl;
372 }
373 }
374 else if (ST.stringcmp(argv[i], "-show_stab") == 0) {
376 if (f_v) {
377 cout << "-show_stab" << endl;
378 }
379 }
380 else if (ST.stringcmp(argv[i], "-save_stab") == 0) {
382 if (f_v) {
383 cout << "-save_stab" << endl;
384 }
385 }
386 else if (ST.stringcmp(argv[i], "-show_whole_orbits") == 0) {
388 if (f_v) {
389 cout << "-show_whole_orbit" << endl;
390 }
391 }
392
393 else if (ST.stringcmp(argv[i], "-recognize") == 0) {
394
395 string s;
396
397 s.assign(argv[++i]);
398 recognize.push_back(s);
399 if (f_v) {
400 cout << "-recognize " << recognize[recognize.size() - 1] << endl;
401 }
402 }
403 else if (ST.stringcmp(argv[i], "-export_schreier_trees") == 0) {
405 if (f_v) {
406 cout << "-export_schreier_trees" << endl;
407 }
408 }
409 else if (ST.stringcmp(argv[i], "-draw_schreier_trees") == 0) {
411 schreier_tree_prefix.assign(argv[++i]);
412 if (f_v) {
413 cout << "-draw_schreier_trees " << schreier_tree_prefix << endl;
414 }
415 }
416 else if (ST.stringcmp(argv[i], "-test_multi_edge_in_decomposition_matrix") == 0) {
418 if (f_v) {
419 cout << "-test_multi_edge_in_decomposition_matrix " << endl;
420 }
421 }
422 else if (ST.stringcmp(argv[i], "-preferred_choice") == 0) {
423
425
426 int node, pt, pt_pref;
427 vector<int> v;
428
429 node = ST.strtoi(argv[++i]);
430 pt = ST.strtoi(argv[++i]);
431 pt_pref = ST.strtoi(argv[++i]);
432 v.push_back(node);
433 v.push_back(pt);
434 v.push_back(pt_pref);
435 preferred_choice.push_back(v);
436
437 if (f_v) {
438 cout << "-preferred_choice " << node << " " << pt << " " << pt_pref << endl;
439 }
440 }
441 else if (ST.stringcmp(argv[i], "-clique_test") == 0) {
443 clique_test_graph.assign(argv[++i]);
444 if (f_v) {
445 cout << "-clique_test " << clique_test_graph << endl;
446 }
447 }
448
449 else if (ST.stringcmp(argv[i], "-end") == 0) {
450 if (f_v) {
451 cout << "-end" << endl;
452 }
453 break;
454 }
455 else {
456 cout << "poset_classification_control::read_arguments "
457 "unrecognized option '" << argv[i] << "'" << endl;
458 exit(1);
459 }
460
461 } // next i
462 if (f_v) {
463 cout << "poset_classification_control::read_arguments done" << endl;
464 }
465 return i + 1;
466}
467
469{
470 //cout << "poset_classification_control::print:" << endl;
471
472
473
474 if (f_problem_label) {
475 cout << "-problem_label " << problem_label << endl;
476 }
477 if (f_depth) {
478 cout << "-depth " << depth << endl;
479 }
480 if (f_path) {
481 cout << "-path" << path << endl;
482 }
483 if (f_draw_options) {
484 cout << "-draw_options" << endl;
486 }
487 cout << "v=" << verbose_level << endl;
488 cout << "gv=" << verbose_level_group_theory << endl;
489
490 if (f_recover) {
491 cout << "-recover " << recover_fname << endl;
492 }
493 if (f_extend) {
494 cout << "-extend from=" << extend_from << " to=" << extend_to
495 << " r=" << extend_r << " m=" << extend_m << " fname=" << extend_fname << endl;
496 }
497
498 if (f_lex) {
499 cout << "-lex" << endl;
500 }
501 if (f_w) {
502 cout << "-w" << endl;
503 }
504 if (f_W) {
505 cout << "-W" << endl;
506 }
507 if (f_write_data_files) {
508 cout << "-write_data_files" << endl;
509 }
510 if (f_T) {
511 cout << "-T" << endl;
512 }
513 if (f_t) {
514 cout << "-t" << endl;
515 }
516 if (f_write_tree) {
517 cout << "-write_tree" << endl;
518 }
520 cout << "-find_node_by_stabilizer_order " << find_node_by_stabilizer_order << endl;
521 }
522 if (f_draw_poset) {
523 cout << "-draw_poset" << endl;
524 }
525 if (f_draw_full_poset) {
526 cout << "-draw_full_poset" << endl;
527 }
528 if (f_plesken) {
529 cout << "-plesken" << endl;
530 }
532 cout << "-print_data_structure" << endl;
533 }
534 if (f_list) {
535 cout << "-list" << endl;
536 }
537 if (f_list_all) {
538 cout << "-list_all" << endl;
539 }
540 if (f_table_of_nodes) {
541 cout << "-table_of_nodes" << endl;
542 }
544 cout << "-make_relations_with_flag_orbits" << endl;
545 }
547 cout << "-Kramer_Mesner_matrix t=" << Kramer_Mesner_t << " k=" << Kramer_Mesner_k << endl;
548 }
550 cout << "-level_summary_csv" << endl;
551 }
552 if (f_orbit_reps_csv) {
553 cout << "-orbit_reps_csv" << endl;
554 }
555 if (f_report) {
556 cout << "-report ";
558 }
560 cout << "-node_label_is_group_order" << endl;
561 }
563 cout << "-node_label_is_element" << endl;
564 }
566 cout << "-show_orbit_decomposition" << endl;
567 }
568 if (f_show_stab) {
569 cout << "-show_stab" << endl;
570 }
571 if (f_save_stab) {
572 cout << "-save_stab" << endl;
573 }
575 cout << "-show_whole_orbits" << endl;
576 }
577
578 if (recognize.size()) {
579 cout << "-recognize recognizing " << recognize.size() << " many sets" << endl;
580 }
581
583 cout << "-export_schreier_trees" << endl;
584 }
586 cout << "-node_label_is_group_order" << endl;
587 }
589 cout << "-test_multi_edge_in_decomposition_matrix" << endl;
590 }
591 if (f_preferred_choice) {
592 for (int i = 0; i < preferred_choice.size(); i++) {
593 cout << "-preferred_choice "
594 << preferred_choice[i][0]
595 << " " << preferred_choice[i][1]
596 << " " << preferred_choice[i][2] << endl;
597 }
598 }
599 if (f_clique_test) {
600 cout << "-clique_test " << clique_test_graph << endl;
601 }
602}
603
604
606{
607 int f_v = TRUE; //(verbose_level >= 1);
608
609 if (f_v) {
610 cout << "poset_classification_control::prepare" << endl;
611 }
612 if (f_clique_test) {
613 if (f_v) {
614 cout << "poset_classification_control::prepare -clique_test " << clique_test_graph << endl;
615 }
616
617 int idx;
618
620
621 if (idx == -1) {
622 cout << "poset_classification_control::prepare -clique_test cannot find symbol " << clique_test_graph << endl;
623 exit(1);
624 }
625
627 if (f_v) {
628 cout << "poset_classification_control::prepare -clique_test "
629 "found a graph with " << clique_test_CG->nb_points << " vertices" << endl;
630 cout << "poset_classification_control::prepare -clique_test "
631 "PC->get_A2()->degree = " << PC->get_A2()->degree << endl;
632 }
633
634 if (PC->get_A2()->degree != clique_test_CG->nb_points) {
635 cout << "poset_classification_control::prepare -clique_test "
636 "found a graph with " << clique_test_CG->nb_points << " vertices" << endl;
637 cout << "poset_classification_control::prepare -clique_test "
638 "PC->get_A2()->degree = " << PC->get_A2()->degree << endl;
639 cout << "poset_classification_control::prepare -clique_test degree of group does not match size of graph" << endl;
640 exit(1);
641 }
642
643 PC->get_poset()->add_testing_without_group(
644 poset_classification_control_early_test_function_cliques,
645 this /* void *data */,
647
648 }
649
650 if (f_v) {
651 cout << "poset_classification_control::prepare done" << endl;
652 }
653}
654
655
657 long int *S, int len,
658 long int *candidates, int nb_candidates,
659 long int *good_candidates, int &nb_good_candidates,
660 int verbose_level)
661{
662 int f_v = (verbose_level >= 1);
663
664 if (f_v) {
665 cout << "poset_classification_control::early_test_func_for_clique_search" << endl;
666 }
667
668 if (!f_clique_test) {
669 cout << "poset_classification_control::early_test_func_for_clique_search !f_clique_test" << endl;
670 exit(1);
671 }
672 if (clique_test_CG == NULL) {
673 cout << "poset_classification_control::early_test_func_for_clique_search clique_test_CG == NULL" << endl;
674 exit(1);
675 }
676
678 S, len,
679 candidates, nb_candidates,
680 good_candidates, nb_good_candidates,
682
683 if (f_v) {
684 cout << "poset_classification_control::early_test_func_for_clique_search done" << endl;
685 }
686}
687
688
689
690
691
692
694 groups::schreier *Sch, void *data, int data2,
695 int verbose_level)
696{
697 int f_v = (verbose_level >= 1);
699
700 if (f_v) {
701 cout << "poset_classification_control_preferred_choice_function data2=" << data2 << endl;
702 }
703 int i, l;
704 int node1, pt1, pt_prev1;
705
706 pt_pref = pt;
707
708 l = PC->get_control()->preferred_choice.size();
709 for (i = 0; i < l; i++) {
710 node1 = PC->get_control()->preferred_choice[i][0];
711 pt1 = PC->get_control()->preferred_choice[i][1];
712 pt_prev1 = PC->get_control()->preferred_choice[i][2];
713 if (node1 == data2 && pt == pt1) {
714 if (f_v) {
715 cout << "poset_classification_control_preferred_choice_function "
716 "node=" << data2 << " pt=" << pt << " pt_pref=" << pt_pref << endl;
717 }
718 pt_pref = pt_prev1;
719 break;
720 }
721 }
722
723}
724
725
726static void poset_classification_control_early_test_function_cliques(long int *S, int len,
727 long int *candidates, int nb_candidates,
728 long int *good_candidates, int &nb_good_candidates,
729 void *data, int verbose_level)
730{
731 poset_classification_control *Control = (poset_classification_control *) data;
732 int f_v = (verbose_level >= 1);
733
734 if (f_v) {
735 cout << "poset_classification_control_early_test_function_cliques for set ";
736 Lint_vec_print(cout, S, len);
737 cout << endl;
738 }
739
740 Control->early_test_func_for_clique_search(S, len,
741 candidates, nb_candidates,
742 good_candidates, nb_good_candidates,
743 verbose_level - 2);
744
745
746 if (f_v) {
747 cout << "poset_classification_control_early_test_function_cliques done" << endl;
748 }
749}
750
751
752
753}}}
754
functions related to strings and character arrays
void early_test_func_for_clique_search(long int *S, int len, long int *candidates, int nb_candidates, long int *good_candidates, int &nb_good_candidates, int verbose_level)
options for drawing an object of type layered_graph
Definition: graphics.h:457
int read_arguments(int argc, std::string *argv, int verbose_level)
Schreier trees for orbits of groups on points.
Definition: groups.h:839
void early_test_func_for_clique_search(long int *S, int len, long int *candidates, int nb_candidates, long int *good_candidates, int &nb_good_candidates, int verbose_level)
to control the behavior of the poset classification report function
#define NEW_OBJECT(type)
Definition: foundations.h:638
#define Lint_vec_print(A, B, C)
Definition: foundations.h:686
#define TRUE
Definition: foundations.h:231
#define FALSE
Definition: foundations.h:234
orbiter_kernel_system::orbiter_session * Orbiter
global Orbiter session
void poset_classification_control_preferred_choice_function(int pt, int &pt_pref, groups::schreier *Sch, void *data, int data2, int verbose_level)
the orbiter library for the classification of combinatorial objects