Connect++ 0.6.0
A fast, readable connection prover for first-order logic.
Loading...
Searching...
No Matches
Schedule.hpp
1/*
2
3Copyright © 2023-24 Sean Holden. All rights reserved.
4
5*/
6/*
7
8This file is part of Connect++.
9
10Connect++ is free software: you can redistribute it and/or modify it
11under the terms of the GNU General Public License as published by the
12Free Software Foundation, either version 3 of the License, or (at your
13option) any later version.
14
15Connect++ is distributed in the hope that it will be useful, but WITHOUT
16ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
18more details.
19
20You should have received a copy of the GNU General Public License along
21with Connect++. If not, see <https://www.gnu.org/licenses/>.
22
23*/
24
25#ifndef SCHEDULE_HPP
26#define SCHEDULE_HPP
27
28#include<iostream>
29#include<string>
30#include<filesystem>
31#include <fstream>
32
33#include <boost/spirit/include/qi.hpp>
34
35#include "Parameters.hpp"
36#include "Exceptions.hpp"
37
38using std::string;
39using std::vector;
40using std::ifstream;
41using std::ostream;
42using std::cout;
43using std::cerr;
44using std::endl;
45using std::pair;
46using namespace boost::spirit;
47using Iter = string::const_iterator;
48
49namespace fs = std::filesystem;
50
59namespace schedule {
63enum class schedule_step {
64 all_definitional,
65 no_definitional,
66 reorder,
67 rand_reorder,
68 rand_lits,
69 all_start,
70 pos_neg_start,
71 conjecture_start,
72 restrict_start,
73 no_regularity,
74 all_lemmata,
75 all_reductions,
76 all_extensions,
77 no_lemmata,
78 all_backtrack,
79 lemmata_backtrack,
80 reduction_backtrack,
81 extension_backtrack,
82 explore_left_trees,
83 complete,
84 start_depth,
85 depth_inc,
86 limit_by_tree_depth
87};
88string to_string(const schedule_step&);
107class Schedule {
108private:
115 vector<vector<pair<schedule_step,unsigned int>>> schedule;
119 vector<unsigned int> times;
127 void apply_item(const pair<schedule_step,unsigned int>&);
128public:
145 string step_to_string(size_t) const;
153 void read_schedule_from_file(fs::path);
160 pair<bool,unsigned int> set_next_schedule();
161
162 friend ostream& operator<<(ostream&, const Schedule&);
163};
167struct add_time {
168 void operator()(unsigned int, qi::unused_type, qi::unused_type) const;
169};
173struct set_value {
174 void operator()(unsigned int, qi::unused_type, qi::unused_type) const;
175};
179struct set_step {
180 void operator()(string, qi::unused_type, qi::unused_type) const;
181};
185struct add_step {
186 void operator()(qi::unused_type, qi::unused_type) const;
187};
192 void operator()(qi::unused_type, qi::unused_type) const;
193};
194
195}
196
197#endif
Wrap up the parsing process and the operation of a schedule in a single class.
Definition Schedule.hpp:107
vector< vector< pair< schedule_step, unsigned int > > > schedule
Representation of a schedule.
Definition Schedule.hpp:115
void read_schedule_from_file(fs::path)
Self-explanatory.
Definition Schedule.cpp:226
vector< unsigned int > times
Times for each member of a schedule.
Definition Schedule.hpp:119
size_t schedule_step_number
Keep track of which step in the schedule we're on.
Definition Schedule.hpp:123
void apply_item(const pair< schedule_step, unsigned int > &)
Apply the settings for a single step in a schedule.
Definition Schedule.cpp:270
Schedule()
You only need this constructor because everything will be filled in by the parser.
Definition Schedule.hpp:133
void reset_schedule()
Go back to the beginning of the schedule but leave everything else intact.
Definition Schedule.hpp:138
string step_to_string(size_t) const
Make a string representation of a line in the schedule.
Definition Schedule.cpp:386
pair< bool, unsigned int > set_next_schedule()
Apply the settings for the next step in the schedule.
Definition Schedule.cpp:366
Hide all the global stuff in this namespace.
Definition Schedule.cpp:27
schedule_step
Possible kinds of schedule step.
Definition Schedule.hpp:63
Semantic action for parser.
Definition Schedule.hpp:185
Semantic action for parser.
Definition Schedule.hpp:167
Semantic action for parser.
Definition Schedule.hpp:191
Semantic action for parser.
Definition Schedule.hpp:179
Semantic action for parser.
Definition Schedule.hpp:173