22 template<
typename Module>
27 return new Module(_formula, _conditionals, _manager);
30 return Module::SettingsType::moduleName;
34 template<
typename Module>
80 return carl::PROP_TRUE <= c;
84 std::vector<std::unique_ptr<AbstractModuleFactory>>
mVertices;
85 std::vector<std::vector<BackendLink>>
mEdges;
91 std::size_t
newVertex(std::unique_ptr<AbstractModuleFactory> factory,
const std::initializer_list<BackendLink>& backends) {
96 mEdges.emplace_back(backends);
97 if (backends.size() > 1) {
109 void printAsTree(std::ostream& os, std::size_t vertex, std::set<std::size_t>& history,
const std::string& indent =
"")
const {
110 std::string moduleName =
"Module";
112 if (history.count(vertex) > 0) {
113 os << indent << moduleName <<
" (" << vertex <<
") Backlink"<< std::endl;
115 os << indent << moduleName <<
" (" << vertex <<
")"<< std::endl;
116 history.insert(vertex);
117 for (
const auto& backend:
mEdges[vertex]) {
118 printAsTree(os, backend.getTarget(), history, indent +
" ");
128 template<
typename Module>
131 for (
auto& backend:
mEdges[
id]) {
132 backend.priority(
getPriority(backend.getPriority()));
139 assert(from <
mEdges.size());
142 return mEdges[from].back();
145 std::size_t
addRoot(
const std::initializer_list<BackendLink>& backends) {
161 std::set<std::pair<thread_priority,AbstractModuleFactory*>>
getBackends(std::size_t vertex,
const carl::Condition& condition)
const {
162 std::set<std::pair<thread_priority,AbstractModuleFactory*>> res;
163 SMTRAT_LOG_DEBUG(
"smtrat.strategygraph",
"Getting backends for vertex " << vertex);
164 assert(vertex <
mEdges.size());
165 for (
const auto& it:
mEdges[vertex]) {
166 if (it.checkCondition(condition)) {
168 assert(
mVertices[it.getTarget()] !=
nullptr);
176 std::set<std::size_t> history;
bool checkCondition(const carl::Condition &c) const
BackendLink & condition(const T &f)
BackendLink(std::size_t target, std::size_t priority, const ConditionFunction &cf)
bool operator<(const BackendLink &rhs) const
std::size_t getTarget() const
std::size_t getPriority() const
ConditionFunction mCondition
BackendLink & priority(std::size_t p)
BackendLink & id(std::size_t &id)
A base class for all kind of theory solving methods.
std::set< std::pair< thread_priority, AbstractModuleFactory * > > getBackends(std::size_t vertex, const carl::Condition &condition) const
std::vector< std::unique_ptr< AbstractModuleFactory > > mVertices
friend std::ostream & operator<<(std::ostream &os, const StrategyGraph &sg)
std::size_t newVertex(std::unique_ptr< AbstractModuleFactory > factory, const std::initializer_list< BackendLink > &backends)
std::size_t numberOfBranches() const
std::size_t mNumberOfBranches
std::size_t addRoot(const std::initializer_list< BackendLink > &backends)
void printAsTree(std::ostream &os, std::size_t vertex, std::set< std::size_t > &history, const std::string &indent="") const
std::size_t getPriority(std::size_t priority)
std::vector< std::vector< BackendLink > > mEdges
BackendLink & addEdge(std::size_t from, std::size_t to)
static bool TrueCondition(const carl::Condition &c)
std::size_t getRoot() const
BackendLink addBackend(const std::initializer_list< BackendLink > &backends)
Class to create the formulas for axioms.
std::function< bool(carl::Condition)> ConditionFunction
bool(* ConditionEvaluation)(carl::Condition)
std::vector< std::atomic_bool * > Conditionals
A vector of atomic bool pointers.
std::ostream & operator<<(std::ostream &os, CMakeOptionPrinter cmop)
bool isCondition(carl::Condition _condition)
std::pair< std::size_t, std::size_t > thread_priority
#define SMTRAT_LOG_DEBUG(channel, msg)
virtual std::string moduleName() const =0
virtual Module * create(const ModuleInput *_formula, Conditionals &_conditionals, Manager *const _manager)=0
virtual ~AbstractModuleFactory()=default
Module * create(const ModuleInput *_formula, Conditionals &_conditionals, Manager *const _manager)
std::string moduleName() const