32 case schedule_step::all_definitional:
33 return string(
"--all-definitional");
35 case schedule_step::no_definitional:
36 return string(
"--no-definitional");
38 case schedule_step::reorder:
39 return string(
"--reorder");
41 case schedule_step::rand_reorder:
42 return string(
"--random-reorder");
44 case schedule_step::rand_lits:
45 return string(
"--random-reorder-literals");
47 case schedule_step::all_start:
48 return string(
"--all-start");
50 case schedule_step::pos_neg_start:
51 return string(
"--pos-neg-start");
53 case schedule_step::conjecture_start:
54 return string(
"--conjecture-start");
56 case schedule_step::restrict_start:
57 return string(
"--restrict-start");
59 case schedule_step::no_regularity:
60 return string(
"--no-regularity");
62 case schedule_step::all_lemmata:
63 return string(
"--all-lemmata");
65 case schedule_step::all_reductions:
66 return string(
"--all-reductions");
68 case schedule_step::all_extensions:
69 return string(
"--all-extensions");
71 case schedule_step::no_lemmata:
72 return string(
"--no-lemmata");
74 case schedule_step::all_backtrack:
75 return string(
"--all-backtrack");
77 case schedule_step::lemmata_backtrack:
78 return string(
"--lemmata-backtrack");
80 case schedule_step::reduction_backtrack:
81 return string(
"--reduction-backtrack");
83 case schedule_step::extension_backtrack:
84 return string(
"--extension-backtrack");
86 case schedule_step::explore_left_trees:
87 return string(
"--explore-left-trees");
89 case schedule_step::complete:
90 return string(
"--complete");
92 case schedule_step::start_depth:
93 return string(
"--start-depth");
95 case schedule_step::depth_inc:
96 return string(
"--depth-increment");
98 case schedule_step::limit_by_tree_depth:
99 return string(
"--limit-by-tree-depth");
109unsigned int value = 0;
110unsigned int current_time = 0;
112vector<pair<schedule_step, unsigned int>> current_settings;
113vector<vector<pair<schedule_step, unsigned int>>> new_schedule;
114vector<unsigned int> new_times;
118void add_time::operator()(
unsigned int t, qi::unused_type,
119 qi::unused_type)
const {
122void set_value::operator()(
unsigned int v, qi::unused_type,
123 qi::unused_type)
const {
126void set_step::operator()(
string s, qi::unused_type,
127 qi::unused_type)
const {
130void add_step::operator()(qi::unused_type, qi::unused_type)
const {
132 if (step ==
"--all-definitional") step2 = schedule_step::all_definitional;
133 if (step ==
"--no-definitional") step2 = schedule_step::no_definitional;
134 if (step ==
"--reorder") step2 = schedule_step::reorder;
136 if (step ==
"--random-reorder ") step2 = schedule_step::rand_reorder;
137 if (step ==
"--random-reorder-literals") step2 = schedule_step::rand_lits;
138 if (step ==
"--all-start") step2 = schedule_step::all_start;
139 if (step ==
"--pos-neg-start") step2 = schedule_step::pos_neg_start;
140 if (step ==
"--conjecture-start") step2 = schedule_step::conjecture_start;
141 if (step ==
"--restrict-start") step2 = schedule_step::restrict_start;
142 if (step ==
"--no-regularity") step2 = schedule_step::no_regularity;
143 if (step ==
"--all-lemmata") step2 = schedule_step::all_lemmata;
144 if (step ==
"--all-reductions") step2 = schedule_step::all_reductions;
145 if (step ==
"--all-extensions") step2 = schedule_step::all_extensions;
146 if (step ==
"--no-lemmata") step2 = schedule_step::no_lemmata;
147 if (step ==
"--all-backtrack") step2 = schedule_step::all_backtrack;
148 if (step ==
"--lemmata-backtrack") step2 = schedule_step::lemmata_backtrack;
149 if (step ==
"--reduction-backtrack") step2 = schedule_step::reduction_backtrack;
150 if (step ==
"--extension-backtrack") step2 = schedule_step::extension_backtrack;
151 if (step ==
"--explore-left-trees") step2 = schedule_step::explore_left_trees;
152 if (step ==
"--complete") step2 = schedule_step::complete;
153 if (step ==
"--start-depth") step2 = schedule_step::start_depth;
154 if (step ==
"--depth-increment") step2 = schedule_step::depth_inc;
155 if (step ==
"--limit-by-tree-depth") step2 = schedule_step::limit_by_tree_depth;
156 current_settings.push_back(pair<schedule_step, unsigned int>(step2, value));
160void next_settings::operator()(qi::unused_type, qi::unused_type)
const {
161 new_schedule.push_back(current_settings);
162 new_times.push_back(current_time);
164 current_settings.clear();
169qi::rule<Iter, string()> schedule_word =
170 ascii::string(
"--all-definitional")
171 | ascii::string(
"--no-definitional")
174 | ascii::string(
"--random-reorder ")
175 | ascii::string(
"--random-reorder-literals")
176 | ascii::string(
"--all-start")
177 | ascii::string(
"--pos-neg-start")
178 | ascii::string(
"--conjecture-start")
179 | ascii::string(
"--restrict-start")
180 | ascii::string(
"--no-regularity")
181 | ascii::string(
"--all-lemmata")
182 | ascii::string(
"--all-reductions")
183 | ascii::string(
"--all-extensions")
184 | ascii::string(
"--no-lemmata")
185 | ascii::string(
"--all-backtrack")
186 | ascii::string(
"--lemmata-backtrack")
187 | ascii::string(
"--reduction-backtrack")
188 | ascii::string(
"--extension-backtrack")
189 | ascii::string(
"--explore-left-trees")
190 | ascii::string(
"--limit-by-tree-depth");
192qi::rule<Iter, string()> schedule_word_param =
193 ascii::string(
"--complete")
194 | ascii::string(
"--reorder")
195 | ascii::string(
"--start-depth")
196 | ascii::string(
"--depth-increment");
202 : qi::grammar<It, ascii::space_type>
205 : schedule_grammar::base_type(
schedule) {
209 | ((schedule_word_param [
set_step()])
219 qi::rule<Iter, ascii::space_type> schedule_item;
220 qi::rule<Iter, ascii::space_type> schedule_line;
221 qi::rule<Iter, ascii::space_type>
schedule;
227 string file_contents;
228 if (path ==
"default") {
229 params::set_default_schedule();
230 file_contents = params::default_schedule;
239 std::getline(file, current_line);
240 file_contents += current_line;
241 while (file.good()) {
242 std::getline(file, current_line);
243 file_contents += current_line;
248 Iter start = file_contents.begin();
249 Iter end = file_contents.end();
252 bool result = qi::phrase_parse(start, end, g, ascii::space);
254 if (start != end || !result) {
255 std::cerr <<
"Failed to parse schedule file." << endl;
256 new_schedule.clear();
261 if (
times.back() != 0)
262 std::cerr <<
"Warning: the last time entry in the schedule should be 0" << endl;
263 unsigned int total = 0;
264 for (
unsigned int t :
times)
267 std::cerr <<
"Warning: your time percentages add up to more than 100" << endl;
272 unsigned int value = item.second;
274 case schedule_step::all_definitional:
275 if (params::no_definitional) {
276 params::no_definitional =
false;
277 cerr <<
"Warning: --all-definitional cancels --no-definitional." << endl;
279 params::all_definitional =
true;
281 case schedule_step::no_definitional:
282 if (params::all_definitional) {
283 params::all_definitional =
false;
284 cerr <<
"Warning: --no-definitional cancels --all-definitional." << endl;
286 params::no_definitional =
true;
288 case schedule_step::reorder:
289 params::deterministic_reorder =
true;
290 params::number_of_reorders = value;
292 case schedule_step::rand_reorder:
293 params::random_reorder =
true;
295 case schedule_step::rand_lits:
296 params::random_reorder_literals =
true;
298 case schedule_step::all_start:
301 case schedule_step::pos_neg_start:
302 if (params::all_start) {
303 cerr <<
"Warning: are you sure you want to mix --all-start with --pos-neg-start?" << endl;
305 params::all_pos_neg_start =
true;
307 case schedule_step::conjecture_start:
308 if (params::all_start) {
309 cerr <<
"Warning: are you sure you want to mix --all-start with --conjecture-start?" << endl;
311 params::conjecture_start =
true;
313 case schedule_step::restrict_start:
314 if (params::all_start) {
315 cerr <<
"Warning: are you sure you want to mix --all-start with --restrict-start?" << endl;
317 params::restrict_start =
true;
319 case schedule_step::no_regularity:
320 params::use_regularity_test =
false;
322 case schedule_step::all_lemmata:
323 params::limit_lemmata =
false;
325 case schedule_step::all_reductions:
326 params::limit_reductions =
false;
328 case schedule_step::all_extensions:
329 params::limit_extensions =
false;
331 case schedule_step::no_lemmata:
332 params::use_lemmata =
false;
334 case schedule_step::all_backtrack:
337 case schedule_step::lemmata_backtrack:
338 params::limit_bt_lemmas =
false;
340 case schedule_step::reduction_backtrack:
341 params::limit_bt_reductions =
false;
343 case schedule_step::extension_backtrack:
344 params::limit_bt_extensions =
false;
346 case schedule_step::explore_left_trees:
347 params::limit_bt_extensions_left_tree =
false;
349 case schedule_step::complete:
350 params::switch_to_complete = value;
352 case schedule_step::start_depth:
353 params::start_depth = value;
355 case schedule_step::depth_inc:
356 params::depth_increment = value;
358 case schedule_step::limit_by_tree_depth:
359 params::limit_by_tree_depth =
true;
368 pair<bool,unsigned int> result(
false,0);
387 string result(
"Time: ");
389 result += std::to_string(
times[n]);
390 for (
size_t j = 0; j <
schedule[n].size(); j++) {
392 result += to_string((
schedule[n])[j].first);
394 result += std::to_string((
schedule[n])[j].second);
401 ostream& operator<<(ostream& out,
const Schedule& s) {
402 for (
size_t i = 0; i < s.
schedule.size(); i++) {