Orbiter 2022
Combinatorial Objects
exact_cover_arguments.cpp
Go to the documentation of this file.
1// exact_cover_arguments.cpp
2//
3// Anton Betten
4// January 12, 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{
29 f_lift = FALSE;
31 //base_fname = "";
33 //input_prefix = "";
35 //output_prefix = "";
37 //solution_prefix = "";
38 f_lift = FALSE;
40 starter_size = 0;
41 f_lex = FALSE;
42 f_split = FALSE;
43 split_r = 0;
44 split_m = 1;
45 f_solve = FALSE;
46 f_save = FALSE;
47 f_read = FALSE;
49 //fname_system = NULL;
51 //fname_tree = NULL;
57 solution_test_func = NULL;
61 //random_permutation_fname = NULL;
62}
63
65{
66 null();
67}
68
69int exact_cover_arguments::read_arguments(int argc, std::string *argv,
70 int verbose_level)
71{
72 int i;
74
75 for (i = 1; i < argc; i++) {
76 if (ST.stringcmp(argv[i], "-starter_size") == 0) {
78 starter_size = ST.strtoi(argv[++i]);
79 cout << "-starter_size " << starter_size << endl;
80 }
81 else if (ST.stringcmp(argv[i], "-lift") == 0) {
82 f_lift = TRUE;
83 //lift_prefix = argv[++i];
84 cout << "-lift " << endl;
85 }
86 else if (ST.stringcmp(argv[i], "-lex") == 0) {
87 f_lex = TRUE;
88 cout << "-lex" << endl;
89 }
90 else if (ST.stringcmp(argv[i], "-solve") == 0) {
91 f_solve = TRUE;
92 cout << "-solve" << endl;
93 }
94 else if (ST.stringcmp(argv[i], "-save") == 0) {
95 f_save = TRUE;
96 cout << "-save" << endl;
97 }
98 else if (ST.stringcmp(argv[i], "-read") == 0) {
99 f_read = TRUE;
100 cout << "-read" << endl;
101 }
102 else if (ST.stringcmp(argv[i], "-split") == 0) {
103 f_split = TRUE;
104 split_r = ST.strtoi(argv[++i]);
105 split_m = ST.strtoi(argv[++i]);
106 cout << "-split " << split_r << " " << split_m << endl;
107 }
108 else if (ST.stringcmp(argv[i], "-draw_system") == 0) {
110 fname_system.assign(argv[++i]);
111 cout << "-draw_system " << fname_system << endl;
112 }
113 else if (ST.stringcmp(argv[i], "-write_tree") == 0) {
115 fname_tree.assign(argv[++i]);
116 cout << "-write_tree " << fname_tree << endl;
117 }
118 else if (ST.stringcmp(argv[i], "-base_fname") == 0) {
120 base_fname = argv[++i];
121 cout << "-base_fname " << base_fname << endl;
122 }
123 else if (ST.stringcmp(argv[i], "-input_prefix") == 0) {
125 input_prefix.assign(argv[++i]);
126 cout << "-input_prefix " << input_prefix << endl;
127 }
128 else if (ST.stringcmp(argv[i], "-output_prefix") == 0) {
130 output_prefix.assign(argv[++i]);
131 cout << "-output_prefix " << output_prefix << endl;
132 }
133 else if (ST.stringcmp(argv[i], "-solution_prefix") == 0) {
135 solution_prefix.assign(argv[++i]);
136 cout << "-solution_prefix " << solution_prefix << endl;
137 }
138 else if (ST.stringcmp(argv[i], "-randomized") == 0) {
140 random_permutation_fname.assign(argv[++i]);
141 cout << "-randomized " << random_permutation_fname << endl;
142 }
143 else if (ST.stringcmp(argv[i], "-end") == 0) {
144 cout << "-end" << endl;
145 break;
146 }
147 else {
148 cout << "exact_cover_arguments::read_arguments "
149 "unrecognized option " << argv[i] << endl;
150 }
151 } // next i
152 cout << "exact_cover_arguments::read_arguments done" << endl;
153 return i + 1;
154}
155
157{
158 int f_v = (verbose_level >= 1);
159
160 if (f_v) {
161 cout << "exact_cover_arguments::compute_lifts" << endl;
162 cout << "exact_cover_arguments::compute_lifts verbose_level=" << verbose_level << endl;
163 cout << "exact_cover_arguments::compute_lifts base_fname=" << base_fname << endl;
164 cout << "exact_cover_arguments::compute_lifts input_prefix=" << input_prefix << endl;
165 cout << "exact_cover_arguments::compute_lifts output_prefix=" << output_prefix << endl;
166 cout << "exact_cover_arguments::compute_lifts solution_prefix=" << solution_prefix << endl;
167 }
168
169 if (!f_has_base_fname) {
170 cout << "exact_cover_arguments::compute_lifts no base_fname" << endl;
171 exit(1);
172 }
173 if (!f_has_input_prefix) {
174 cout << "exact_cover_arguments::compute_lifts no input_prefix" << endl;
175 exit(1);
176 }
177 if (!f_has_output_prefix) {
178 cout << "exact_cover_arguments::compute_lifts no output_prefix" << endl;
179 exit(1);
180 }
182 cout << "exact_cover_arguments::compute_lifts no solution_prefix" << endl;
183 exit(1);
184 }
185 if (!f_starter_size) {
186 cout << "exact_cover_arguments::compute_lifts no starter_size" << endl;
187 exit(1);
188 }
189
190 if (target_size == 0) {
191 cout << "exact_cover_arguments::compute_lifts target_size == 0" << endl;
192 exit(1);
193 }
194
195 exact_cover *E;
196
198
199
201 A, A2,
204 f_lex,
205 verbose_level - 1);
206
209 verbose_level);
210
213 verbose_level);
214
215 if (f_split) {
216 E->set_split(split_r, split_m, verbose_level - 1);
217 }
218
223 verbose_level - 1);
224 }
225
228 }
229
230 if (f_randomized) {
231 E->randomize(random_permutation_fname, verbose_level);
232 }
233
234 if (f_v) {
235 cout << "exact_cover_arguments::compute_lifts "
236 "before compute_liftings_new" << endl;
237 }
238
242 verbose_level);
243
244 FREE_OBJECT(E);
245
246 if (f_v) {
247 cout << "exact_cover_arguments::compute_lifts done" << endl;
248 }
249
250}
251
252}}
253
254
functions related to strings and character arrays
void(* prepare_function_new)(exact_cover *E, int starter_case, long int *candidates, int nb_candidates, groups::strong_generators *Strong_gens, solvers::diophant *&Dio, long int *&col_label, int &f_ruled_out, int verbose_level)
Definition: solver.h:183
void(* late_cleanup_function)(exact_cover *EC, int starter_case, int verbose_level)
Definition: solver.h:199
void(* early_test_function)(long int *S, int len, long int *candidates, int nb_candidates, long int *good_candidates, int &nb_good_candidates, void *data, int verbose_level)
Definition: solver.h:189
int read_arguments(int argc, std::string *argv, int verbose_level)
int(* solution_test_func)(exact_cover *EC, long int *S, int len, void *data, int verbose_level)
Definition: solver.h:195
exact cover problems arising with the lifting of combinatorial objects
Definition: solver.h:27
void set_split(int split_r, int split_m, int verbose_level)
void add_solution_test_function(int(*solution_test_func)(exact_cover *EC, long int *S, int len, void *data, int verbose_level), void *solution_test_func_data, int verbose_level)
void init_basic(void *user_data, actions::action *A_base, actions::action *A_on_blocks, int target_size, int starter_size, std::string &input_prefix, std::string &output_prefix, std::string &solution_prefix, std::string &base_fname, int f_lex, int verbose_level)
Definition: exact_cover.cpp:58
void add_late_cleanup_function(void(*late_cleanup_function)(exact_cover *E, int starter_case, int verbose_level))
void compute_liftings_new(int f_solve, int f_save, int f_read_instead, int f_draw_system, std::string &fname_system, int f_write_tree, std::string &fname_tree, int verbose_level)
void init_early_test_func(void(*early_test_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 *early_test_func_data, int verbose_level)
void init_prepare_function_new(void(*prepare_function_new)(exact_cover *E, int starter_case, long int *candidates, int nb_candidates, groups::strong_generators *Strong_gens, solvers::diophant *&Dio, long int *&col_label, int &f_ruled_out, int verbose_level), int verbose_level)
void randomize(std::string &random_permutation_fname, int verbose_level)
#define NEW_OBJECT(type)
Definition: foundations.h:638
#define FREE_OBJECT(p)
Definition: foundations.h:651
#define TRUE
Definition: foundations.h:231
#define FALSE
Definition: foundations.h:234
the orbiter library for the classification of combinatorial objects