15namespace layer5_applications {
16namespace apps_combinatorics {
19static void large_set_early_test_function(
long int *S,
int len,
20 long int *candidates,
int nb_candidates,
21 long int *good_candidates,
int &nb_good_candidates,
22 void *data,
int verbose_level);
63 Design_table_reduced = NULL;
64 Design_table_reduced_idx = NULL;
66 nb_remaining_colors = 0;
67 reduced_design_color_table = NULL;
70 Orbits_on_reduced = NULL;
71 color_of_reduced_orbits = NULL;
74 selected_type_idx = 0;
101 if (Design_table_reduced) {
104 if (Design_table_reduced_idx) {
118 int f_v = (verbose_level >= 1);
121 cout <<
"large_set_classify::init" << endl;
133 cout <<
"large_set_classify::init nb_points=" <<
nb_points << endl;
134 cout <<
"large_set_classify::init nb_lines=" <<
nb_lines << endl;
135 cout <<
"large_set_classify::init design_size=" <<
design_size << endl;
136 cout <<
"large_set_classify::init size_of_large_set=" <<
size_of_large_set << endl;
146 cout <<
"large_set_classify::init before compute_colors" << endl;
151 cout <<
"large_set_classify::init after compute_colors" << endl;
156 cout <<
"large_set_classify::init we are not computing colors" << endl;
162 cout <<
"large_set_classify::init_designs "
163 "creating graph" << endl;
168 cout <<
"large_set_classify::init before create_action_and_poset" << endl;
172 cout <<
"large_set_classify::init after create_action_and_poset" << endl;
178 cout <<
"large_set_classify::init done" << endl;
184 int f_v = (verbose_level >= 1);
187 cout <<
"large_set_classify::create_action_and_poset" << endl;
194 cout <<
"large_set_classify::create_action_and_poset "
195 "creating action A_on_designs" << endl;
203 cout <<
"large_set_classify::create_action_and_poset "
213 cout <<
"large_set_classify::create_action_and_poset before "
214 "Poset->add_testing_without_group" << endl;
217 large_set_early_test_function,
236 Control->print_function = print_set;
237 Control->print_function_data =
this;
240 cout <<
"large_set_classify::create_action_and_poset "
241 "calling gen->initialize" << endl;
254 cout <<
"large_set_classify::create_action_and_poset done" << endl;
260 int f_v = (verbose_level >= 1);
262 int f_use_invariant_subset_if_available =
TRUE;
271 f_use_invariant_subset_if_available,
278 cout <<
"large_set_classify::compute done with generator_main" << endl;
282 cout <<
"large_set_classify::compute We found "
283 << length <<
" orbits on "
291 int level,
int verbose_level)
293 int f_v = (verbose_level >= 1);
294 string fname_classification_at_level;
297 cout <<
"large_set_classify::read_classification" << endl;
304 cout <<
"reading all orbit representatives from "
305 "file " << fname_classification_at_level << endl;
311 fname_classification_at_level, verbose_level - 1);
314 cout <<
"large_set_classify::read_classification "
315 "We read all orbit representatives. "
316 "There are " << T->
nb_orbits <<
" orbits" << endl;
322 int level,
int case_nr,
int verbose_level)
324 int f_v = (verbose_level >= 1);
325 string fname_classification_at_level;
328 cout <<
"large_set_classify::read_classification_single_case" << endl;
335 cout <<
"reading all orbit representatives from "
336 "file " << fname_classification_at_level << endl;
345 fname_classification_at_level, case_nr, verbose_level - 1);
348 cout <<
"large_set_classify::read_classification_single_case before copy" << endl;
350 *Rep = T->
Reps[case_nr];
352 cout <<
"large_set_classify::read_classification_single_case before null" << endl;
357 cout <<
"large_set_classify::read_classification_single_case before FREE_OBJECT(T)" << endl;
361 cout <<
"large_set_classify::read_classification_single_case after FREE_OBJECT(T)" << endl;
365 cout <<
"large_set_classify::read_classification_single_case done" << endl;
373 int f_v = (verbose_level >= 1);
377 cout <<
"large_set_classify::compute_colors" << endl;
389 cout <<
"large_set_classify::compute_colors done" << endl;
394void large_set_classify::compute_reduced_colors(
395 long int *chosen_set,
int chosen_set_sz,
398 int f_v = (verbose_level >= 1);
400 int *chosen_set_color;
403 cout <<
"large_set_classify::compute_reduced_colors" << endl;
405 chosen_set_color =
NEW_int(chosen_set_sz);
406 for (i = 0; i < chosen_set_sz; i++) {
411 cout <<
"large_set_classify::compute_reduced_colors DC->k != 4" << endl;
414 nb_remaining_colors =
nb_colors - chosen_set_sz;
416 cout <<
"large_set_classify::compute_reduced_colors "
417 "nb_remaining_colors=" << nb_remaining_colors << endl;
419 reduced_design_color_table =
NEW_int(nb_reduced);
420 for (i = 0; i < nb_reduced; i++) {
421 idx = Design_table_reduced_idx[i];
424 for (j = 0; j < chosen_set_sz; j++) {
425 if (c > chosen_set_color[j]) {
429 reduced_design_color_table[i] = c - s;
433 cout <<
"large_set_classify::compute_reduced_colors done" << endl;
442void large_set_classify::process_starter_case(
443 long int *starter_set,
int starter_set_sz,
444 strong_generators *SG, std::string &prefix,
445 std::string &group_label,
int orbit_length,
446 int f_read_solution_file, std::string &solution_file_name,
447 long int *&Large_sets,
int &nb_large_sets,
448 int f_compute_normalizer_orbits, strong_generators *N_gens,
451 int f_v = (verbose_level >= 1);
454 cout <<
"large_set_classify::process_starter_case" << endl;
457 cout <<
"large_set_classify::process_starter_case "
458 "before make_reduced_design_table" << endl;
460 make_reduced_design_table(
461 starter_set, starter_set_sz,
462 Design_table_reduced, Design_table_reduced_idx, nb_reduced,
465 cout <<
"large_set_classify::process_starter_case "
466 "after make_reduced_design_table" << endl;
469 cout <<
"large_set_classify::process_starter_case "
470 "The reduced design table has length " << nb_reduced << endl;
474 cout <<
"large_set_classify::process_starter_case "
475 "before compute_reduced_colors" << endl;
477 compute_reduced_colors(starter_set, starter_set_sz, verbose_level);
479 cout <<
"large_set_classify::process_starter_case "
480 "after compute_reduced_colors" << endl;
485 cout <<
"large_set_classify::process_starter_case "
486 "creating A_reduced:" << endl;
489 Design_table_reduced_idx, nb_reduced,
494 cout <<
"large_set_classify::process_starter_case "
495 "computing orbits on reduced set of designs:" << endl;
512 cout <<
"large_set_classify::process_starter_case "
513 "orbits on the reduced set of designs are:" << endl;
514 OoS->report_classified_orbit_lengths(cout);
521 int f_has_user_data =
FALSE;
523 fname.assign(prefix);
524 fname.append(group_label);
527 cout <<
"large_set_classify::process_starter_case "
528 "before OoS->test_orbits_of_a_certain_length" << endl;
532 OoS->test_orbits_of_a_certain_length(
536 large_set_design_test_orbit,
541 cout <<
"large_set_classify::process_starter_case "
542 "after OoS->test_orbits_of_a_certain_length "
543 "prev_nb=" << prev_nb <<
" cur_nb="
544 << OoS->Orbits_classified->Set_size[selected_type_idx] << endl;
551 if (f_read_solution_file) {
553 cout <<
"large_set_classify::process_starter_case "
554 "trying to read solution file " << solution_file_name << endl;
556 int i, j, a, b, l, h;
563 Fio.read_solutions_from_file_and_get_solution_size(solution_file_name,
564 nb_solutions, Solutions, solution_size,
566 cout <<
"Read the following solutions from file:" << endl;
568 cout <<
"Number of solutions = " << nb_solutions << endl;
569 cout <<
"solution_size = " << solution_size << endl;
571 int sz = starter_set_sz + solution_size * orbit_length;
574 cout <<
"large_set_classify::process_starter_case sz != size_of_large_set" << endl;
579 nb_large_sets = nb_solutions;
580 Large_sets =
NEW_lint(nb_solutions * sz);
581 for (i = 0; i < nb_solutions; i++) {
583 for (j = 0; j < solution_size; j++) {
585 a = Solutions[i * solution_size + j];
586 b = OoS->Orbits_classified->Sets[selected_type_idx][a];
588 b = Solutions[i * solution_size + j];
593 OoS->Sch->get_orbit(b,
594 Large_sets + i * sz + starter_set_sz + j * orbit_length,
596 if (l != orbit_length) {
597 cout <<
"large_set_classify::process_starter_case l != orbit_length" << endl;
601 for (j = 0; j < solution_size * orbit_length; j++) {
602 a = Large_sets[i * sz + starter_set_sz + j];
603 b = Design_table_reduced_idx[a];
604 Large_sets[i * sz + starter_set_sz + j] = b;
612 fname_out.assign(solution_file_name);
613 ST.replace_extension_with(fname_out,
"_packings.csv");
615 ST.replace_extension_with(fname_out,
"_packings.csv");
617 Fio.lint_matrix_write_csv(fname_out, Large_sets, nb_solutions, sz);
619 long int *Packings_explicit;
622 Packings_explicit =
NEW_lint(nb_solutions * Sz);
623 for (i = 0; i < nb_solutions; i++) {
624 for (j = 0; j < sz; j++) {
625 a = Large_sets[i * sz + j];
628 Packings_explicit[i * Sz + j *
design_size + h] = b;
637 fname_out.assign(solution_file_name);
638 ST.replace_extension_with(fname_out,
"_packings_explicit.csv");
640 Fio.lint_matrix_write_csv(fname_out, Packings_explicit, nb_solutions, Sz);
648 cout <<
"large_set_classify::process_starter_case "
649 "before OoS->create_graph_on_orbits_of_a_certain_length" << endl;
653 OoS->create_graph_on_orbits_of_a_certain_length(
658 f_has_user_data, NULL , 0 ,
659 TRUE , nb_remaining_colors, reduced_design_color_table,
660 large_set_design_test_pair_of_orbits,
665 cout <<
"large_set_classify::process_starter_case "
666 "after OoS->create_graph_on_orbits_of_a_certain_length" << endl;
669 cout <<
"large_set_classify::process_starter_case "
670 "before CG->save" << endl;
673 CG->save(fname, verbose_level);
683 cout <<
"large_set_classify::process_starter_case "
684 "The orbits on the reduced set of designs are:" << endl;
691 cout <<
"large_set_classify::process_starter_case "
692 "Distribution of orbit lengths:" << endl;
693 Orbits_on_reduced->print_orbit_length_distribution(cout);
698 int *reduced_design_color;
700 reduced_design_color =
NEW_int(nb_reduced);
701 for (i = 0; i < nb_reduced; i++) {
708 C.init(reduced_design_color, nb_reduced,
FALSE, 0);
709 cout <<
"color distribution of reduced designs:" << endl;
710 C.print_naked_tex(cout,
FALSE );
719 cout <<
"large_set_classify::process_starter_case done" << endl;
737int large_set_design_test_orbit(
long int *orbit,
int orbit_length,
743 ret = LS->test_orbit(orbit, orbit_length);
749int large_set_design_compare_func_for_invariants(
void *data,
int i,
int j,
void *extra_data)
752 int **Invariant = (
int **) data;
755 ret = int_vec_compare(Invariant[i], Invariant[j], 3);
759void large_set_swap_func_for_invariants(
void *data,
int i,
int j,
void *extra_data)
762 int **Invariant = (
int **) data;
766 Invariant[i] = Invariant[j];
773int large_set_design_compare_func(
void *data,
int i,
int j,
void *extra_data)
775 large_set_classify *LS = (large_set_classify *) extra_data;
776 int **Sets = (
int **) data;
779 ret = int_vec_compare(Sets[i], Sets[j], LS->design_size);
783void large_set_swap_func(
void *data,
int i,
int j,
void *extra_data)
786 int **Sets = (
int **) data;
794int large_set_compute_color_of_reduced_orbits_callback(schreier *Sch,
795 int orbit_idx,
void *data,
int verbose_level)
797 int f_v = (verbose_level >= 1);
798 large_set_classify *LS = (large_set_classify *) data;
803 cout <<
"large_set_compute_color_of_reduced_orbits_callback" << endl;
805 a = Sch->orbit[Sch->orbit_first[orbit_idx]];
807 LS->Design_table_reduced + a * LS->design_size, 0 );
809 cout <<
"large_set_compute_color_of_reduced_orbits_callback done" << endl;
816static void large_set_early_test_function(
long int *S,
int len,
817 long int *candidates,
int nb_candidates,
818 long int *good_candidates,
int &nb_good_candidates,
819 void *data,
int verbose_level)
821 large_set_classify *LS = (large_set_classify *) data;
822 int f_v = (verbose_level >= 1);
827 cout <<
"large_set_early_test_function for set ";
833 nb_good_candidates = nb_candidates;
837 nb_good_candidates = 0;
838 for (i = 0; i < nb_candidates; i++) {
845 k = Combi.
ij2k(a, b, LS->Design_table->nb_designs);
846 if (LS->Bitvec->s_i(k)) {
847 good_candidates[nb_good_candidates++] = b;
853 if (LS->test_if_designs_are_disjoint(a, b)) {
854 good_candidates[nb_good_candidates++] = b;
860 cout <<
"large_set_early_test_function done" << endl;
a collection of combinatorial functions
int ij2k(int i, int j, int n)
void matrix_print(int *p, int m, int n)
void copy(long int *from, long int *to, long int len)
data_structures::lint_vec * Lint_vec
data_structures::int_vec * Int_vec
interface to system functions
action * restricted_action(long int *points, int nb_points, int verbose_level)
action * create_induced_action_on_sets(int nb_sets, int set_size, long int *sets, int verbose_level)
groups::strong_generators * Strong_gens
a set of orbits using a vector of orbit representatives and stabilizers
void read_from_file_one_case_only(actions::action *A, actions::action *A2, std::string &fname, int case_nr, int verbose_level)
set_and_stabilizer * Reps
void read_from_file(actions::action *A, actions::action *A2, std::string &fname, int verbose_level)
a set and its known set stabilizer
to control the behavior of the poset classification algorithm
std::string problem_label
the poset classification algorithm
void initialize_and_allocate_root_node(poset_classification_control *PC_control, poset_with_group_action *Poset, int depth, int verbose_level)
actions::action * get_A2()
actions::action * get_A()
int main(int t0, int schreier_depth, int f_use_invariant_subset_if_available, int f_debug, int verbose_level)
void make_fname_lvl_file(std::string &fname, std::string &fname_base, int lvl)
int nb_orbits_at_level(int level)
std::string & get_problem_label_with_path()
a poset with a group action on it
void init_subset_lattice(actions::action *A, actions::action *A2, groups::strong_generators *Strong_gens, int verbose_level)
void add_testing_without_group(void(*func)(long int *S, int len, long int *candidates, int nb_candidates, long int *good_candidates, int &nb_good_candidates, void *data, int verbose_level), void *data, int verbose_level)
to create a known design using a description from class design_create_description
int get_color_as_two_design_assume_sorted(long int *design, int verbose_level)
int get_nb_colors_as_two_design(int verbose_level)
a set of designs to be used for a large set
int test_if_designs_are_disjoint(int i, int j)
classification of large sets of designs
void read_classification_single_case(data_structures_groups::set_and_stabilizer *&Rep, int level, int case_nr, int verbose_level)
void init(design_create *DC, design_tables *T, int verbose_level)
actions::action * A_on_designs
poset_classification::poset_classification_control * Control
poset_classification::poset_with_group_action * Poset
void read_classification(data_structures_groups::orbit_transversal *&T, int level, int verbose_level)
void compute_colors(design_tables *Design_table, int *&design_color_table, int verbose_level)
std::string problem_label
data_structures::bitvector * Bitvec
int test_if_designs_are_disjoint(int i, int j)
design_tables * Design_table
void compute(int verbose_level)
poset_classification::poset_classification * gen
void create_action_and_poset(int verbose_level)
#define Lint_vec_copy(A, B, C)
#define Lint_vec_print(A, B, C)
orbiter_kernel_system::orbiter_session * Orbiter
global Orbiter session
the orbiter library for the classification of combinatorial objects