17namespace layer1_foundations {
18namespace combinatorics {
21static void print_distribution(std::ostream &ost,
22 int *types,
int nb_types,
int type_len,
23 int *distributions,
int nb_distributions);
24static int compare_func_int_vec(
void *a,
void *b,
void *data);
25static int compare_func_int_vec_inverse(
void *a,
void *b,
void *data);
26static void distribution_reverse_sorting(
int f_increasing,
27 int *types,
int nb_types,
int type_len,
28 int *distributions,
int nb_distributions);
59 int f_v = (verbose_level >= 1);
63 cout <<
"tdo_refinement::init" << endl;
76 cout <<
"tdo_refinement::init done" << endl;
83 int f_v = (verbose_level >= 1);
84 int f_vv = (verbose_level >= 2);
88 cout <<
"tdo_refinement::main_loop" << endl;
92 cout <<
"please use option -input_file <fanme>" << endl;
97 cout <<
"tdo_refinement::main_loop "
126 cout <<
"tdo_parameter_calculation::main_loop "
127 "opening file " <<
fname_out <<
" for writing" << endl;
134 cout <<
"tdo_parameter_calculation::main_loop "
135 "cnt=" <<
cnt << endl;
139 cout <<
"eof reached" << endl;
144 if (
cnt && (
cnt % 1000) == 0) {
156 cout <<
"tdo_refinement::main_loop "
157 "cnt=" <<
cnt <<
" read input TDO" << endl;
173 cout <<
"tdo_refinement::main_loop "
174 "read decomposition " <<
cnt << endl;
180 cout <<
"after print_schemes" << endl;
182 do_it(g, verbose_level - 1);
191 cout <<
"tdo_refinement::main_loop " <<
nb_written
195 cout <<
"tdo_refinement::main_loop done" << endl;
201 int f_v = (verbose_level >= 1);
202 int f_vv = (verbose_level >= 2);
203 int f_vvv = (verbose_level >= 3);
209 cout <<
"tdo_refinement::do_it "
210 "read TDO " <<
cnt <<
" " <<
GP.
label << endl;
215 cout <<
"tdo_refinement::do_it "
216 "after init_tdo_scheme" << endl;
222 cout <<
"tdo_refinement::do_it "
223 "calling init_partition_stack" << endl;
227 cout <<
"tdo_refinement::do_it "
229 cout <<
"tdo_parameter_calculation::do_it "
235 cout <<
"tdo_refinement::do_it "
236 "calling do_row_refinement" << endl;
240 cout <<
"tdo_refinement::do_it "
241 "after do_row_refinement" << endl;
246 cout <<
"tdo_refinement::do_it "
247 "calling do_col_refinement" << endl;
251 cout <<
"tdo_refinement::do_it "
252 "after do_col_refinement" << endl;
263 cout <<
"tdo_refinement::do_it "
264 <<
GP.
label <<
" written" << endl;
271 cout <<
"tdo_refinement::do_it done" << endl;
281 int f_v = (verbose_level >= 1);
286 cout <<
"tdo_refinement::do_row_refinement "
287 "col_level > row_level" << endl;
289 int *point_types, nb_point_types, point_type_len;
290 int *distributions, nb_distributions;
295 cout <<
"tdo_refinement::do_row_refinement "
296 "before G.td3_refine_rows" << endl;
300 point_types, nb_point_types, point_type_len,
301 distributions, nb_distributions);
303 cout <<
"tdo_refinement::do_row_refinement "
304 "after G.td3_refine_rows" << endl;
309 cout <<
"tdo_refinement::do_row_refinement "
310 "before G.refine_rows" << endl;
314 point_types, nb_point_types, point_type_len,
315 distributions, nb_distributions,
322 cout <<
"tdo_refinement::do_row_refinement "
323 "after G.refine_rows" << endl;
330 point_types, nb_point_types, point_type_len,
331 distributions, nb_distributions);
333 if (verbose_level >= 5) {
334 print_distribution(cout,
335 point_types, nb_point_types, point_type_len,
336 distributions, nb_distributions);
340 cout <<
"tdo_refinement::do_row_refinement "
341 "before do_all_row_refinements" << endl;
344 point_types, nb_point_types, point_type_len,
348 cout <<
"tdo_refinement::do_row_refinement "
349 "after do_all_row_refinements, found "
350 << nb_distributions <<
" refinements" << endl;
360 cout <<
"tdo_refinement::do_row_refinement "
361 "Case " <<
GP.
label <<
", found " << 0
362 <<
" row refinements, out of which "
363 << 0 <<
" are tactical" << endl;
367 cout <<
"tdo_refinement::do_row_refinement done" << endl;
375 int f_v = (verbose_level >= 1);
379 int *line_types, nb_line_types, line_type_len;
380 int *distributions, nb_distributions;
384 cout <<
"tdo_refinement::do_col_refinement "
385 "col_level < row_level" << endl;
389 cout <<
"tdo_refinement::do_col_refinement "
390 "before G.td3_refine_columns" << endl;
397 line_types, nb_line_types, line_type_len,
398 distributions, nb_distributions);
401 cout <<
"tdo_refinement::do_col_refinement "
402 "after G.td3_refine_columns" << endl;
407 cout <<
"tdo_refinement::do_col_refinement "
408 "before G.refine_columns" << endl;
412 line_types, nb_line_types, line_type_len,
413 distributions, nb_distributions,
420 cout <<
"tdo_refinement::do_col_refinement "
421 "after G.refine_columns" << endl;
427 cout <<
"tdo_refinement::do_col_refinement "
428 "before G.distribution_reverse_sorting" << endl;
431 line_types, nb_line_types, line_type_len,
432 distributions, nb_distributions);
434 cout <<
"tdo_refinement::do_col_refinement "
435 "after G.distribution_reverse_sorting" << endl;
438 if (verbose_level >= 5) {
439 print_distribution(cout,
440 line_types, nb_line_types, line_type_len,
441 distributions, nb_distributions);
445 cout <<
"tdo_refinement::do_col_refinement "
446 "before do_all_column_refinements" << endl;
449 line_types, nb_line_types, line_type_len,
453 cout <<
"tdo_refinement::do_col_refinement "
454 "after do_all_column_refinements" << endl;
463 cout <<
"tdo_refinement::do_col_refinement "
464 "Case " <<
GP.
label <<
", found " << 0
465 <<
" col refinements, out of which "
466 << 0 <<
" are tactical" << endl;
470 cout <<
"tdo_refinement::do_col_refinement done" << endl;
476 int *point_types,
int nb_point_types,
int point_type_len,
477 int *distributions,
int nb_distributions,
int &nb_tactical,
480 int f_v = (verbose_level >= 1);
484 cout <<
"tdo_refinement::do_all_row_refinements" << endl;
494 for (t = 0; t < nb_distributions; t++) {
497 point_type_len, distributions, nb_distributions,
498 verbose_level - 5)) {
504 cout <<
"Case " << label_in <<
", found " << nb_distributions
505 <<
" row refinements, out of which "
509 cout <<
"tdo_refinement::do_all_row_refinements done" << endl;
516 int *line_types,
int nb_line_types,
int line_type_len,
517 int *distributions,
int nb_distributions,
int &nb_tactical,
520 int f_v = (verbose_level >= 1);
525 cout <<
"tdo_refinement::do_all_column_refinements" << endl;
535 for (t = 0; t < nb_distributions; t++) {
539 line_type_len, distributions, nb_distributions,
540 verbose_level - 5)) {
546 cout <<
"Case " << label_in <<
", found " << nb_distributions
547 <<
" column refinements, out of which "
551 cout <<
"tdo_refinement::do_all_column_refinements done" << endl;
558 int *point_types,
int nb_point_types,
int point_type_len,
559 int *distributions,
int nb_distributions,
564 int r, i, j, h, a, l, R, c1, c2, S, s, idx, new_nb_parts, new_nb_entries;
567 int f_v = (verbose_level >= 1);
568 int f_vv = (verbose_level >= 6);
569 int f_vvv = (verbose_level >= 7);
573 cout <<
"tdo_refinement::do_row_refinement t=" << t << endl;
576 type_index =
NEW_int(nb_point_types);
577 for (i = 0; i < nb_point_types; i++) {
591 for (r = 0; r < R; r++) {
601 cout <<
"r=" << r <<
" l=" << l << endl;
603 while (i < nb_point_types) {
604 a = distributions[t * nb_point_types + i];
610 cout <<
"h=" << h <<
" i=" << i <<
" a=" << a <<
" s=" << s <<
" S=" << S << endl;
616 GP2.
part[new_nb_parts++] = S + s;
624 cout <<
"tdo_refinement::do_row_refinement: s > l" << endl;
631 cout <<
"tdo_refinement::do_row_refinement: S != G.m" << endl;
639 cout <<
"new_part:" << endl;
640 for (i = 0; i < new_nb_parts; i++)
643 cout <<
"type_index:" << endl;
644 for (i = 0; i < h; i++)
645 cout << type_index[i] <<
" ";
652 tdo_scheme_synthetic G2;
656 G2.row_level = new_nb_parts;
667 G2.init_partition_stack(verbose_level - 2);
670 cout <<
"found a " << G2.nb_row_classes[
ROW_SCHEME] <<
" x " << G2.nb_col_classes[
ROW_SCHEME] <<
" scheme" << endl;
672 for (i = 0; i < G2.nb_row_classes[
ROW_SCHEME]; i++) {
674 for (j = 0; j < point_type_len ; j++) {
680 a = point_types[idx * point_type_len + j];
682 cout <<
"i=" << i <<
" j=" << j <<
" idx=" << idx <<
" a=" << a << endl;
684 GP2.
entries[new_nb_entries * 4 + 0] = new_nb_parts;
693 for (i = 0; i < new_nb_entries; i++) {
694 for (j = 0; j < 4; j++) {
695 cout << setw(2) <<
GP2.
entries[i * 4 + j] <<
" ";
704 sprintf(str,
".%d", t + 1);
726 cout <<
GP2.
label <<
" written" << endl;
738 cout <<
"tdo_refinement::do_row_refinement t=" << t <<
" done" << endl;
744 int t, std::string &label_in,
746 int *line_types,
int nb_line_types,
int line_type_len,
747 int *distributions,
int nb_distributions,
752 int r, i, j, h, a, l, R, c1, c2, S, s, idx, new_nb_parts, new_nb_entries;
755 int f_v = (verbose_level >= 1);
756 int f_vv = (verbose_level >= 6);
757 int f_vvv = (verbose_level >= 7);
761 cout <<
"tdo_refinement::do_column_refinement t=" << t << endl;
764 type_index =
NEW_int(nb_line_types);
766 for (i = 0; i < nb_line_types; i++) {
774 for (r = 0; r < R; r++) {
778 cout <<
"r=" << r <<
" l=" << l << endl;
780 while (i < nb_line_types) {
781 a = distributions[t * nb_line_types + i];
787 cout <<
"h=" << h <<
" i=" << i <<
" a=" << a <<
" s=" << s <<
" S=" << S << endl;
793 GP2.
part[new_nb_parts++] = S + s;
801 cout <<
"tdo_refinement::do_column_refinement: s > l" << endl;
802 cout <<
"r=" << r << endl;
803 cout <<
"s=" << s << endl;
804 cout <<
"l=" << l << endl;
805 cout <<
"a=" << a << endl;
806 Int_vec_print(cout, distributions + t * nb_line_types, nb_line_types);
813 if (S != G.
m + G.
n) {
814 cout <<
"tdo_refinement::do_column_refinement: S != G.m + G.n" << endl;
822 cout <<
"new_part:" << endl;
823 for (i = 0; i < new_nb_parts; i++) {
827 cout <<
"type_index:" << endl;
828 for (i = 0; i < h; i++) {
829 cout << type_index[i] <<
" ";
865 a = line_types[idx * line_type_len + i];
867 cout <<
"i=" << i <<
" j=" << j <<
" idx=" << idx <<
" a=" << a << endl;
869 GP2.
entries[new_nb_entries * 4 + 0] = new_nb_parts;
878 for (i = 0; i < new_nb_entries; i++) {
879 for (j = 0; j < 4; j++) {
880 cout << setw(2) <<
GP2.
entries[i * 4 + j] <<
" ";
889 sprintf(str,
".%d", t + 1);
911 cout <<
GP2.
label <<
" written" << endl;
924 cout <<
"tdo_refinement::do_column_refinement t=" << t <<
" done" << endl;
932static void print_distribution(ostream &ost,
933 int *types,
int nb_types,
int type_len,
934 int *distributions,
int nb_distributions)
939 ost <<
"types:" << endl;
940 for (i = 0; i < nb_types; i++) {
941 ost << setw(3) << i + 1 <<
" : ";
942 for (j = 0; j < type_len; j++) {
943 ost << setw(3) << types[i * type_len + j];
950 for (j = 0; j < type_len; j++) {
951 ost << setw(3) << j + 1 <<
" & ";
952 for (i = 0; i < nb_types; i++) {
953 ost << setw(2) << types[i * type_len + j];
954 if (i < nb_types - 1) {
958 ost <<
"\\\\" << endl;
962 ost <<
"distributions:" << endl;
963 for (i = 0; i < nb_distributions; i++) {
964 ost << setw(3) << i + 1 <<
" : ";
965 for (j = 0; j < nb_types; j++) {
966 ost << setw(3) << distributions[i * nb_types + j];
971 for (i = 0; i < nb_distributions; i++) {
972 ost << setw(3) << i + 1 <<
" & ";
973 for (j = 0; j < nb_types; j++) {
974 ost << setw(2) << distributions[i * nb_types + j];
975 if (j < nb_types - 1) {
979 ost <<
"\\\\" << endl;
983 ost <<
"distributions (in compact format):" << endl;
985 for (i = 0; i < nb_distributions; i++) {
986 ost << setw(3) << i + 1 <<
" & ";
988 for (j = 0; j < nb_types; j++) {
989 a = distributions[i * nb_types + j];
996 ost << nb_types - 1 - j <<
"^{" << a <<
"}";
999 ost <<
"\\\\" << endl;
1005int static compare_func_int_vec(
void *a,
void *b,
void *data)
1009 int *d = (
int *) data;
1013 for (i = 0; i < size; i++) {
1024int static compare_func_int_vec_inverse(
void *a,
void *b,
void *data)
1028 int *d = (
int *) data;
1032 for (i = 0; i < size; i++) {
1043static void distribution_reverse_sorting(
int f_increasing,
1044 int *types,
int nb_types,
int type_len,
1045 int *distributions,
int nb_distributions)
1050 data_structures::sorting Sorting;
1052 D =
NEW_int(nb_distributions * nb_types);
1055 for (i = 0; i < nb_distributions; i++) {
1056 P[i] = D + i * nb_types;
1057 for (j = 0; j < nb_types; j++) {
1058 D[i * nb_types + nb_types - 1 - j] = distributions[i * nb_types + j];
1067 Sorting.quicksort_array(nb_distributions, (
void **) P,
1068 compare_func_int_vec_inverse, (
void *)p);
1071 Sorting.quicksort_array(nb_distributions, (
void **) P,
1072 compare_func_int_vec, (
void *)p);
1075 for (i = 0; i < nb_distributions; i++) {
1076 for (j = 0; j < nb_types; j++) {
1077 distributions[i * nb_types + j] = P[i][nb_types - 1 - j];
void write_mode_stack(std::ofstream &aStream, std::string &label)
void print_schemes(tdo_scheme_synthetic &G)
int input_mode_stack(std::ifstream &aStream, int verbose_level)
void init_tdo_scheme(tdo_scheme_synthetic &G, int verbose_level)
refinement of the parameters of a linear space
int f_do_the_geometric_test
int f_dual_is_linear_space
int f_use_packing_numbers
void init(tdo_refinement_description *Descr, int verbose_level)
void do_all_column_refinements(std::string &label_in, std::ofstream &g, tdo_scheme_synthetic &G, int *line_types, int nb_line_types, int line_type_len, int *distributions, int nb_distributions, int &nb_tactical, int verbose_level)
void do_all_row_refinements(std::string &label_in, std::ofstream &g, tdo_scheme_synthetic &G, int *point_types, int nb_point_types, int point_type_len, int *distributions, int nb_distributions, int &nb_tactical, int verbose_level)
int do_column_refinement(int t, std::string &label_in, std::ofstream &g, tdo_scheme_synthetic &G, int *line_types, int nb_line_types, int line_type_len, int *distributions, int nb_distributions, int verbose_level)
void do_col_refinement(std::ofstream &g, tdo_scheme_synthetic &G, data_structures::partitionstack &P, int verbose_level)
void do_row_refinement(std::ofstream &g, tdo_scheme_synthetic &G, data_structures::partitionstack &P, int verbose_level)
void main_loop(int verbose_level)
tdo_refinement_description * Descr
void do_it(std::ofstream &g, int verbose_level)
canonical tactical decomposition of an incidence structure
int * row_classes[NUMBER_OF_SCHEMES]
int td3_refine_rows(int verbose_level, int f_once, int lambda3, int block_size, int *&point_types, int &nb_point_types, int &point_type_len, int *&distributions, int &nb_distributions)
int td3_refine_columns(int verbose_level, int f_once, int lambda3, int block_size, int f_scale, int scaling, int *&line_types, int &nb_line_types, int &line_type_len, int *&distributions, int &nb_distributions)
int refine_columns(int verbose_level, int f_once, data_structures::partitionstack &P, int *&line_types, int &nb_line_types, int &line_type_len, int *&distributions, int &nb_distributions, int &cnt_second_system, solution_file_data *Sol, int f_omit1, int omit1, int f_omit, int omit, int f_D1_upper_bound_x0, int D1_upper_bound_x0, int f_use_mckay_solver, int f_use_packing_numbers)
int nb_col_classes[NUMBER_OF_SCHEMES]
int * col_classes_len[NUMBER_OF_SCHEMES]
data_structures::partitionstack * P
int * col_classes[NUMBER_OF_SCHEMES]
int nb_row_classes[NUMBER_OF_SCHEMES]
void init_part_and_entries_int(int *part, int *entries, int verbose_level)
int level[NUMBER_OF_SCHEMES]
int * row_classes_len[NUMBER_OF_SCHEMES]
void init_partition_stack(int verbose_level)
int refine_rows(int verbose_level, int f_use_mckay, int f_once, data_structures::partitionstack &P, int *&point_types, int &nb_point_types, int &point_type_len, int *&distributions, int &nb_distributions, int &cnt_second_system, solution_file_data *Sol, int f_omit1, int omit1, int f_omit2, int omit2, int f_use_packing_numbers, int f_dual_is_linear_space, int f_do_the_geometric_test)
data structure for set partitions following Jeffrey Leon
interface to system functions
#define Int_vec_print(A, B, C)
the orbiter library for the classification of combinatorial objects