Orbiter 2022
Combinatorial Objects
diophant_activity_description.cpp
Go to the documentation of this file.
1/*
2 * diophant_activity_description.cpp
3 *
4 * Created on: May 29, 2020
5 * Author: betten
6 */
7
8
9#include "foundations.h"
10
11
12using namespace std;
13
14namespace orbiter {
15namespace layer1_foundations {
16namespace solvers {
17
18
19
21{
23 //input_file = NULL;
24 f_print = FALSE;
28
30 box_width = 1;
31 bit_depth = 8;
32 f_draw = FALSE;
34
36 eqn_idx = 0;
38
40 eqn1_idx = 0;
41 eqn2_idx = 0;
44
47
48}
49
51{
52}
53
55 int argc, std::string *argv,
56 int verbose_level)
57{
58 int f_v = (verbose_level >= 1);
59 int i;
61
62 if (f_v) {
63 cout << "diophant_activity_description::read_arguments" << endl;
64 }
65 for (i = 0; i < argc; i++) {
66
67 if (ST.stringcmp(argv[i], "-input_file") == 0) {
69 input_file.assign(argv[++i]);
70 if (f_v) {
71 cout << "-input_file " << input_file << endl;
72 }
73 }
74 else if (ST.stringcmp(argv[i], "-print") == 0) {
75 f_print = TRUE;
76 if (f_v) {
77 cout << "-print " << endl;
78 }
79 }
80 else if (ST.stringcmp(argv[i], "-solve_mckay") == 0) {
82 if (f_v) {
83 cout << "-solve_mckay " << endl;
84 }
85 }
86 else if (ST.stringcmp(argv[i], "-solve_standard") == 0) {
88 if (f_v) {
89 cout << "-solve_standard " << endl;
90 }
91 }
92 else if (ST.stringcmp(argv[i], "-solve_DLX") == 0) {
94 if (f_v) {
95 cout << "-solve_DLX " << endl;
96 }
97 }
98 else if (ST.stringcmp(argv[i], "-draw_as_bitmap") == 0) {
100 box_width = ST.strtoi(argv[++i]);
101 bit_depth = ST.strtoi(argv[++i]);
102 if (f_v) {
103 cout << "-draw_as_bitmap " << box_width << " " << bit_depth << endl;
104 }
105 }
106 else if (ST.stringcmp(argv[i], "-draw") == 0) {
107 f_draw = TRUE;
108 if (f_v) {
109 cout << "-draw " << endl;
110 }
111 }
112 else if (ST.stringcmp(argv[i], "-perform_column_reductions") == 0) {
114 if (f_v) {
115 cout << "-perform_column_reductions " << endl;
116 }
117 }
118 else if (ST.stringcmp(argv[i], "-test_single_equation") == 0) {
120 max_number_of_coefficients = ST.strtoi(argv[++i]);
121 if (f_v) {
122 cout << "-test_single_equation " << max_number_of_coefficients << endl;
123 }
124 }
125 else if (ST.stringcmp(argv[i], "-project_to_single_equation_and_solve") == 0) {
127 eqn_idx = ST.strtoi(argv[++i]);
128 solve_case_idx = ST.strtoi(argv[++i]);
129 if (f_v) {
130 cout << "-project_to_single_equation_and_solve " << eqn_idx << " " << solve_case_idx << endl;
131 }
132 }
133 else if (ST.stringcmp(argv[i], "-project_to_two_equations_and_solve") == 0) {
135 eqn1_idx = ST.strtoi(argv[++i]);
136 eqn2_idx = ST.strtoi(argv[++i]);
137 solve_case_idx_r = ST.strtoi(argv[++i]);
138 solve_case_idx_m = ST.strtoi(argv[++i]);
139 if (f_v) {
140 cout << "-project_to_single_equation_and_solve " << eqn1_idx << " " << eqn2_idx
141 << " " << solve_case_idx_r
142 << " " << solve_case_idx_m
143 << endl;
144 }
145 }
146 else if (ST.stringcmp(argv[i], "-end") == 0) {
147 break;
148 }
149 else {
150 cout << "diophant_activity_description::read_arguments "
151 "unrecognized option " << argv[i] << endl;
152 exit(1);
153 }
154 } // next i
155 if (f_v) {
156 cout << "diophant_activity_description::read_arguments done" << endl;
157 }
158 return i + 1;
159}
160
162{
163 if (f_input_file) {
164 cout << "-input_file " << input_file << endl;
165 }
166 if (f_print) {
167 cout << "-print " << endl;
168 }
169 if (f_solve_mckay) {
170 cout << "-solve_mckay " << endl;
171 }
172 if (f_solve_standard) {
173 cout << "-solve_standard " << endl;
174 }
175 if (f_solve_DLX) {
176 cout << "-solve_DLX " << endl;
177 }
178 if (f_draw_as_bitmap) {
179 cout << "-draw_as_bitmap " << box_width << " " << bit_depth << endl;
180 }
181 if (f_draw) {
182 cout << "-draw " << endl;
183 }
185 cout << "-perform_column_reductions " << endl;
186 }
188 cout << "-test_single_equation " << max_number_of_coefficients << endl;
189 }
191 cout << "-project_to_single_equation_and_solve " << eqn_idx << " " << solve_case_idx << endl;
192 }
194 cout << "-project_to_single_equation_and_solve " << eqn1_idx << " " << eqn2_idx
195 << " " << solve_case_idx_r
196 << " " << solve_case_idx_m
197 << endl;
198 }
199}
200
201
202}}}
203
204
functions related to strings and character arrays
#define TRUE
Definition: foundations.h:231
#define FALSE
Definition: foundations.h:234
the orbiter library for the classification of combinatorial objects